/* ========================================
   WHOLE PAGE LAYOUT
   ======================================== */

/* Whole page */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #2d6a3f;
    font-family: Arial, sans-serif;
    overflow: auto;
}

/* Win effect layer */
.money-rain-layer {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 9999;
}

.money-bill {
    position: fixed;
    top: -40px;
    width: 45px;
    height: 25px;
    box-sizing: border-box;
    border: 2px solid #74b86b;
    border-radius: 4px;
    background: linear-gradient(180deg, #2f7f44 0%, #1e5a30 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    opacity: 0;
    will-change: transform, opacity;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation-name: money-bill-fall;
    animation-duration: var(--fall-duration, 3s);
    animation-timing-function: linear;
    animation-delay: var(--fall-delay, 0s);
    animation-fill-mode: both;
}

@keyframes money-bill-fall {
    0% {
        transform: translate3d(0, -10vh, 0) rotate(var(--rotation-start, 0deg));
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    75% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift-end, 0px), 112vh, 0) rotate(var(--rotation-end, 0deg));
        opacity: 0;
    }
}

header,
.middler,
footer,
.stats-main,
.help-btn {
    position: relative;
    z-index: 1;
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

/* Header / Nav */
header {
    background-color: #1f4b2f;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    padding: 26px 24px;
    border-bottom: 2px solid black;
    gap: 8px;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-size: 24px;
    outline: none;
    flex-shrink: 0;
    min-width: fit-content;
    position: relative;
}

.nav-links a:focus {
    outline: 3px solid #ffed4e;
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-links a:hover {
    opacity: 0.7;
}

/* ========================================
   KEYBOARD NAVIGATION & FOCUS STYLES
   ======================================== */

/* Visible focus styles for keyboard navigation */
button:focus,
input:focus,
a:focus {
    outline: 3px solid #ffed4e;
    outline-offset: 2px;
}

button:focus,
.help-btn:focus,
.bet-modal-controls button:focus,
.help-modal .help-close-btn:focus {
    outline: 3px solid #ffed4e;
    outline-offset: 2px;
    border-radius: 4px;
}

input:focus {
    outline: 3px solid #ffed4e;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Focus visible for better keyboard navigation support */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid #ffed4e;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================================
   MIDDLE CONTAINER & SIDEBARS
   ======================================== */

/* Middle container */
.middler {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
}

.lefter {
    flex-basis: 200px;
    flex-shrink: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.righter {
    flex-basis: 200px;
    flex-shrink: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

/* Main content */
main {
    flex-grow: 1;
    flex-basis: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========================================
   FOOTER
   ======================================== */

/* Footer */
footer {
    padding: 10px;
    text-align: center;
    color: white;
}

/* ========================================
   HOME PAGE / WELCOME SECTION
   ======================================== */

/* Welcome chip section */
.welcome-chip {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

.welcome-chip img {
    max-width: 850px;
    min-width: 625px;
    height: auto;
    width: 100%;
}

.welcome-text {
    position: absolute;
    top: 32%;
    width: 100%;
    text-align: center;
}

.welcome-text h1 {
    color: white;
    font-size: clamp(28px, 4vw, 56px);
    margin: 0 0 12px 0;
}

.username-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 46px;
}

.username-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.username-form input {
    padding: 6px 14px;
    font-size: clamp(12px, 1.5vw, 16px);
    border-radius: 8px;
    border: 2px solid #000000;
    background-color: rgba(114, 114, 114, 0.545);
    color: white;
    outline: none;
    text-align: center;
    width: clamp(140px, 20vw, 200px);
}

.username-form button {
    padding: 6px 0;
    font-size: clamp(12px, 1.5vw, 16px);
    font-family: Arial, sans-serif;
    background-color: rgba(114, 114, 114, 0.545);
    color: white;
    border: 2px solid #000000;
    border-radius: 8px;
    cursor: pointer;
    width: clamp(100px, 20vw, 200px);
}

/* ========================================
   SIDEBAR CONTENT
   ======================================== */

/* Sidebar content */
#username-display, #balance-display {
    color: white;
    font-size: 28px;
    text-align: center;
}

.bet-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.bet-area input {
    width: 90%;
    min-width: 100px;
    padding: 12px 10px;
    min-height: 50px;
    font-size: 22px;
    border-radius: 6px;
    border: 2px solid #5fa876;
    background-color: rgba(0,0,0,0.3);
    color: white;
    text-align: center;
    outline: none;
    box-sizing: border-box;
}

.bet-area label {
    color: white;
    font-size: 22px;
}

.game-controls button {
    width: 90%;
    min-width: 100px;
    padding: 16px 0;
    min-height: 50px;
    font-size: 22px;
    font-family: Arial, sans-serif;
    background-color: rgba(0,0,0,0.3);
    color: white;
    border: 2px solid #5fa876;
    border-radius: 8px;
    cursor: pointer;
}

.game-controls {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.game-controls button:hover {
    background-color: #5fa876;
}

/* ========================================
   BLACKJACK GAME SECTIONS
   ======================================== */

/* Hand sections */
.hand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.hand p {
    color: white;
    font-size: 32px;
    margin: 0;
    min-width: 80px;
    text-align: center;
}

.hand h3 {
    color: white;
    margin: 0;
    font-size: 18px;
}

/* ========================================
   CARD DISPLAY
   ======================================== */

/* Cards */
.cards {
    display: flex;
    flex-direction: row;
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    height: 420px;
    min-width: 120px;
    width: 500px;
    max-width: 100%;
    perspective: 1000px;
    box-sizing: border-box;
}

.cards li {
    position: absolute;
    list-style: none;
}

.cards li img {
    height: 400px;
    border-radius: 6px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    transform-origin: center;
    backface-visibility: hidden;
}

.cards li.card-flip img {
    animation: card-flip 420ms ease-out both;
    animation-delay: var(--flip-delay, 0ms);
}

@keyframes card-flip {
    from {
        transform: rotateY(90deg);
        opacity: 0.35;
    }
    to {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cards li.card-flip img {
        animation: none;
    }
}

output {
    color: white;
    font-size: 32px;
    text-align: center;
}

/* ========================================
   LOADER SPINNER
   ======================================== */

.spinner {
    width: 44px;
    height: 44px;
    border: 5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    margin: 6px auto;
}

@keyframes spinner-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.reels {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    flex-grow: 1;
    box-sizing: border-box;
}

/* ========================================
   GAME AREA
   ======================================== */

.game-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    flex-grow: 1;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.reel {
    flex: 1;
    max-width: 30%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #5fa876;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* ========================================
   STATS PAGE LAYOUT
   ======================================== */

/* Stats page */
.stats-main {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stats-hero {
    text-align: center;
    color: white;
    padding: 24px 16px 8px;
}

.stats-hero .eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.8rem;
    opacity: 0.85;
}

.stats-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.stats-hero p {
    margin: 12px auto 0;
    max-width: 70ch;
    font-size: 1rem;
    line-height: 1.6;
}

/* ========================================
   STATS GRID & PANEL LAYOUT
   ======================================== */

.stats-grid,
.stats-panels {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-panels {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ========================================
   STAT CARDS & PANELS
   ======================================== */

.stat-card,
.panel-card,
.history-section {
    background: rgba(0, 0, 0, 0.28);
    border: 2px solid rgba(95, 168, 118, 0.85);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    color: white;
}

.stat-card {
    padding: 18px;
    text-align: center;
}

.stat-card h2,
.panel-card h2,
.history-section h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #eaf8ec;
}

.stat-value {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
}

.panel-card {
    padding: 18px;
}

.chart-card {
    min-height: 320px;
}

.chart-card canvas {
    width: 100% !important;
    height: 260px !important;
}

.chart-container {
    width: 300px;
    height: 300px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* ========================================
   BREAKDOWN LISTS
   ======================================== */

.breakdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.breakdown-list strong {
    font-size: 1rem;
}

.history-section {
    padding: 18px;
}

.table-wrap {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.history-table th,
.history-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.history-table thead th {
    color: #d9f0dc;
    font-size: 0.95rem;
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ========================================
   OUTCOME STATUS STYLING
   ======================================== */

.outcome-win {
    color: #9be3a7;
    text-transform: capitalize;
}

.outcome-lose {
    color: #ff8c8c;
    text-transform: capitalize;
}

.outcome-push {
    color: #f4cf80;
    text-transform: capitalize;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    padding: 14px 16px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.stats-main {
    width: 100%;
    height: 100%;
    padding: 16px;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.stats-hero {
    grid-column: 1 / -1;
}

.stats-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stats-panels {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
}

.history-section {
    grid-column: 1 / -1;
}

.stats-page footer {
    margin-top: auto;
}

/* ========================================
   STORE PAGE / DICE ROLLER
   ======================================== */

/* Store page */
.store-page .dice-wrapper {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.store-page .game-area {
    gap: 20px;
    justify-content: center;
    align-items: center;
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 28px 22px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.store-page .game-controls {
    width: auto;
    align-items: center;
    justify-content: center;
}

.store-page .game-controls button,
.store-page #roll-btn {
    width: auto;
    min-width: 170px;
    padding: 14px 28px;
    text-align: center;
}

.store-page #cooldown-message {
    text-align: center;
    min-height: 1.5em;
    color: #f7f1b2;
    font-size: 18px;
}

.store-page .timer-warning {
    margin: 0;
    text-align: center;
    color: #f7f1b2;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(247, 241, 178, 0.65);
    border-radius: 10px;
    padding: 10px 14px;
    width: min(520px, 100%);
}

.store-page #dice-face {
    width: 300px;
    height: 300px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    place-items: center;
    background: #ffffff;
    border: 3px solid #d8d8d8;
    border-radius: 24px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.store-page .store-pip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111111;
    visibility: hidden;
}

.store-page .store-pip.is-visible {
    visibility: visible;
}

.store-page #dice-face.rolling {
    animation: store-die-roll 150ms linear infinite;
}

#dice-result {
    color: white;
    font-size: 28px;
    margin: 0;
}



@keyframes store-die-roll {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-7deg) scale(0.97);
    }
    50% {
        transform: rotate(0deg) scale(1.03);
    }
    75% {
        transform: rotate(7deg) scale(0.98);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .store-page #dice-face.rolling {
        animation: none;
    }

    .money-drop {
        animation: none;
    }
}

/* ========================================
   Baccarat MODAL
   ======================================== */

.bet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.bet-overlay.active {
    display: flex;
}

.bet-modal {
    background: #1f4b2f;
    border: 2px solid #5fa876;
    border-radius: 16px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 400px;
    width: 90%;
}

.bet-modal h2 {
    color: white;
    font-size: 32px;
    margin: 0;
}

.bet-modal p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    margin: 0;
}

.bet-modal-controls {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.bet-modal-controls button {
    width: 100%;
    padding: 20px 0;
    font-size: 24px;
    font-family: Arial, sans-serif;
    background-color: rgba(0,0,0,0.3);
    color: white;
    border: 2px solid #5fa876;
    border-radius: 8px;
    cursor: pointer;
}

.bet-modal-controls button:hover {
    background-color: #5fa876;
}

/* ========================================
   HELP MODAL & BUTTON
   ======================================== */

/* Help button */
.help-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #5fa876;
    border: 2px solid #3f8a52;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: background-color 0.2s ease, transform 0.2s ease;
    font-family: Arial, sans-serif;
    padding: 0;
    box-sizing: border-box;
}

.help-btn:hover {
    background-color: #3f8a52;
    transform: scale(1.1);
}

.help-btn:active {
    transform: scale(0.95);
}

/* Help modal overlay */
.help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.help-overlay.active {
    display: flex;
}

/* Help modal dialog */
.help-modal {
    background: #1f4b2f;
    border: 2px solid #5fa876;
    border-radius: 16px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.help-modal h2 {
    color: white;
    font-size: 32px;
    margin: 0;
    text-align: center;
}

.help-modal h3 {
    color: #5fa876;
    font-size: 18px;
    margin: 16px 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #5fa876;
}

.help-modal p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.help-modal ul {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin: 0 0 8px 20px;
    padding: 0;
    line-height: 1.5;
}

.help-modal ul li {
    margin-bottom: 6px;
}

.help-modal .help-close-btn {
    align-self: center;
    padding: 12px 32px;
    font-size: 18px;
    font-family: Arial, sans-serif;
    background-color: rgba(0,0,0,0.3);
    color: white;
    border: 2px solid #5fa876;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.help-modal .help-close-btn:hover {
    background-color: #5fa876;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
   ======================================== */

/* Responsive — mobile */
@media (max-width: 868px) {
    .help-btn {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 28px;
    }

    .help-modal {
        padding: 32px 24px;
        max-width: 90vw;
    }

    .help-modal h2 {
        font-size: 28px;
    }

    .help-modal h3 {
        font-size: 16px;
    }

    .help-modal p,
    .help-modal ul {
        font-size: 15px;
    }

    .nav-links a {
        font-size: 18px;
    }

    .middler {
        flex-direction: column;
        overflow: visible;
    }

    .lefter {
        flex-basis: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        width: 100%;
        max-width: 100%;
        padding: 12px 8px;
        order: 1;
        gap: 12px;
        box-sizing: border-box;
    }

    main {
        order: 2;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .righter {
        flex-basis: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        width: 100%;
        max-width: 100%;
        padding: 12px 8px;
        order: 1;
        gap: 12px;
        box-sizing: border-box;
    }

    #username-display, #balance-display {
        font-size: 32px;
        margin: 0;
    }

    .bet-area {
        flex-direction: row;
        gap: 10px;
        width: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .bet-area label {
        font-size: 20px;
        order: 0;
    }

    .bet-area input {
        width: auto;
        min-width: 130px;
        flex: 1;
        max-width: 220px;
        font-size: 18px;
        padding: 12px 10px;
        min-height: 48px;
    }

    .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .game-controls button {
        width: auto;
        min-width: 120px;
        flex: 0 1 auto;
        font-size: 20px;
        padding: 14px 22px;
        min-height: 48px;
    }

    .reels {
        gap: 8px;
        padding: 0 8px;
    }

    .reel {
        flex: 1;
        min-width: 0;
        max-width: 32%;
        min-height: 120px;
    }

    .cards {
        width: 100%;
        max-width: 280px;
        height: 240px;
        padding: 0 8px;
    }

    .cards li img {
        height: 220px;
    }

    .hand {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding: 0 8px;
    }

    .hand p {
        font-size: 24px;
    }

    output {
        font-size: 20px;
        padding: 0 8px;
        word-wrap: break-word;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-panels {
        grid-template-columns: 1fr;
    }

    .stats-main {
        padding: 16px 12px 24px;
    }

    .chart-card {
        min-height: 300px;
    }

    .chart-card canvas {
        width: 100% !important;
        height: 240px !important;
    }

    .history-table {
        font-size: 14px;
    }

    .history-table th,
    .history-table td {
        padding: 10px 8px;
    }

    /* Blackjack-specific mobile layout: reorder to balance → cards → bet/buttons */
    .middler:has(.hand) > .righter {
        order: 1;
    }

    .middler:has(.hand) > main {
        order: 2;
    }

    .middler:has(.hand) > .lefter {
        order: 3;
    }
}

/* ========================================
   RESPONSIVE DESIGN - TINY SCREENS (393px)
   ======================================== */

/* Responsive — tiny (393px) */
@media (max-width: 393px) {
    .nav-links {
        padding: 16px 12px;
        gap: 4px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .lefter,
    .righter {
        padding: 10px 6px;
        gap: 8px;
    }

    #username-display, #balance-display {
        font-size: 18px;
    }

    .bet-area label {
        font-size: 16px;
    }

    .bet-area input {
        min-width: 90px;
        max-width: 160px;
        font-size: 16px;
        padding: 10px 8px;
        min-height: 44px;
    }

    .game-controls button {
        font-size: 16px;
        min-width: 90px;
        padding: 12px 18px;
        min-height: 44px;
    }

    output {
        font-size: 16px;
    }

    .reels {
        gap: 6px;
        padding: 0 4px;
    }

    .reel {
        max-width: 30%;
        min-height: 80px;
    }

    .cards {
        width: 100%;
        max-width: 240px;
        height: 180px;
        padding: 0 4px;
    }

    .cards li img {
        height: 160px;
    }

    .hand {
        gap: 8px;
        padding: 0 4px;
    }

    .hand p {
        font-size: 18px;
        min-width: 60px;
    }

    .stats-main {
        padding: 12px 10px 20px;
        gap: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card h2 {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .stat-value {
        font-size: clamp(1.2rem, 3vw, 1.8rem);
    }

    .panel-card {
        padding: 12px;
    }

    .panel-card h2 {
        font-size: 14px;
    }

    .chart-card {
        min-height: 240px;
    }

    .chart-card canvas {
        width: 100% !important;
        height: 180px !important;
    }

    .breakdown-list li {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 10px;
        gap: 4px;
    }

    .breakdown-list strong {
        font-size: 0.95rem;
    }

    .history-table {
        font-size: 12px;
        min-width: auto;
    }

    .history-table th,
    .history-table td {
        padding: 8px 6px;
    }

    .help-btn {
        bottom: 12px;
        right: 12px;
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .help-modal {
        padding: 24px 16px;
    }

    .help-modal h2 {
        font-size: 24px;
    }

    .help-modal h3 {
        font-size: 14px;
        margin: 12px 0 6px 0;
    }

    .help-modal p,
    .help-modal ul {
        font-size: 14px;
    }
}
