/* Fonts are requested from index.html via <link> rather than @import.
   An @import cannot start downloading until this stylesheet has been
   fetched and parsed, which serialises two round trips on first paint.
   Both families fall back to system faces, so the game is fully
   playable offline. */

/* ==================================================================
   CASINO ROCK PAPER SCISSORS — STYLESHEET

   01  Tokens
   02  Reset & base
   03  App shell + scroll architecture
   04  Boot loader
   05  Top HUD
   06  Arena — hand selection
   07  Arena — battle reveal
   08  Arena — hint & streak readout
   09  Control dock — ladder
   10  Control dock — mode toggle
   11  Control dock — betting panel
   12  Toast
   13  Rules modal
   14  Utilities & keyboard badges
   15  Responsive — larger screens
   16  Responsive — short & landscape screens
   17  Accessibility preferences
   ================================================================== */


/* ==================================================================
   01  TOKENS
   ================================================================== */
:root {
    --app-bg: #070b14;
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-light: rgba(255, 255, 255, 0.28);

    --gold: #f59e0b;
    --gold-light: #fbbf24;
    --gold-glow: rgba(245, 158, 11, 0.45);

    --green: #10b981;
    --green-bright: #34d399;
    --green-glow: rgba(16, 185, 129, 0.5);

    --cyan: #38bdf8;
    --cyan-glow: rgba(56, 189, 248, 0.45);

    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.45);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Claymorphism: dual shadow + inset highlight */
    --clay-btn-shadow:
        6px 8px 16px rgba(0, 0, 0, 0.5),
        inset 2px 2px 4px rgba(255, 255, 255, 0.22),
        inset -2px -3px 6px rgba(0, 0, 0, 0.4);

    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Safe areas (notches, home indicators) */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* Fluid scale — everything below derives from these */
    --pad-x: clamp(14px, 4.2vw, 22px);
    --hand-size: clamp(58px, min(21vw, 13.5vh), 96px);
    --battle-hand-size: clamp(64px, min(24vw, 15vh), 112px);
    --gap-hands: clamp(10px, 4vw, 22px);
    --radius-lg: 18px;
    --radius-md: 14px;
}


/* ==================================================================
   02  RESET & BASE
   ================================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #030712;
    background-image:
        radial-gradient(at 20% 20%, rgba(56, 189, 248, 0.12) 0, transparent 50%),
        radial-gradient(at 80% 80%, rgba(245, 158, 11, 0.12) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    display: flex;
    justify-content: center;
    align-items: flex-start;

    /* The page itself scrolls when the shell cannot fit the viewport. */
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

input {
    font: inherit;
}

/* Text is selectable nowhere except the stake field — this is a game,
   and drag-selecting sprites mid-round is noise. */
body {
    user-select: none;
}

.bet-input-field {
    user-select: text;
}

/* Visible, consistent keyboard focus everywhere. */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 6px;
}


/* ==================================================================
   03  APP SHELL + SCROLL ARCHITECTURE
   ==================================================================
   .app-container   flex column, fills the viewport
     .top-hud       fixed height
     .app-scroll    flexible + scrollable  <- absorbs size changes
     .control-dock  fixed height, always reachable
   ================================================================== */
.app-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 0%,
        rgba(30, 41, 59, 0.9) 0%, rgba(7, 11, 20, 0.98) 100%);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(56, 189, 248, 0.08),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.app-scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: clamp(150px, 26vh, 280px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.app-scroll::-webkit-scrollbar {
    width: 5px;
}

.app-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.main-arena {
    flex: 1 0 auto; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vh, 20px) var(--pad-x);
}

.stage-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vh, 16px);
}

.control-dock {
    flex: 0 0 auto;
    position: relative;
    z-index: 20;
}


/* ==================================================================
   04  BOOT LOADER
   ================================================================== */
.boot-loader {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px;
    background: radial-gradient(circle at 50% 40%,
        rgba(30, 41, 59, 0.98) 0%, rgba(3, 7, 18, 1) 100%);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.boot-loader.is-done {
    opacity: 0;
    visibility: hidden;
}

.boot-mark {
    text-align: center;
}

.boot-mark-line {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    color: var(--cyan);
    text-shadow: 0 0 14px var(--cyan-glow);
}

.boot-mark-title {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.15rem, 5.5vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.boot-progress {
    width: min(230px, 70%);
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.boot-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cyan), var(--gold-light));
    box-shadow: 0 0 14px var(--cyan-glow);
    transition: width 0.25s ease;
}

.boot-progress-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.1em;
}


/* ==================================================================
   05  TOP HUD
   ================================================================== */
.top-hud {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding:
        calc(12px + var(--safe-top))
        calc(var(--pad-x) + var(--safe-right))
        12px
        calc(var(--pad-x) + var(--safe-left));
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 30;
}

.wallet-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 5px 6px 5px 14px;
    background: rgba(9, 13, 22, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 22px;
    box-shadow:
        0 0 20px rgba(56, 189, 248, 0.15),
        inset 0 2px 6px rgba(0, 0, 0, 0.7);
}

.wallet-label {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.wallet-amount {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(0.9rem, 3.6vw, 1.05rem);
    color: var(--cyan);
    text-shadow: 0 0 12px var(--cyan-glow);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.refill-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 14px var(--green-glow), var(--clay-btn-shadow);
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}

.refill-btn:hover {
    transform: scale(1.1);
}

.refill-btn:active {
    transform: scale(0.92);
}

.hud-actions {
    display: flex;
    gap: 8px;
}

.hud-icon-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border-light);
    box-shadow: var(--clay-btn-shadow);
    transition: transform 0.25s var(--ease-spring),
                background-color 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
}

.hud-icon-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--cyan);
    color: #fff;
    transform: translateY(-2px);
}

.hud-icon-btn:active {
    transform: scale(0.94);
}

.hud-icon-btn.is-muted {
    color: var(--text-dark);
}


/* ==================================================================
   06  ARENA — HAND SELECTION
   ================================================================== */
.hands-stage {
    width: 100%;
}

.pure-hands-selection-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--gap-hands);
    width: 100%;
}

.pure-hand-item {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px;
    transition: transform 0.25s var(--ease-spring), opacity 0.25s ease;
}

.pure-hand-art {
    display: block;
    width: var(--hand-size);
    height: var(--hand-size);
}

.pure-hand-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.7));
    transition: filter 0.25s ease;
}

.pure-hand-label {
    font-size: clamp(0.64rem, 2.8vw, 0.78rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    transition: color 0.2s ease, text-shadow 0.2s ease;
    white-space: nowrap;
}

.pure-hand-item:not(.disabled):hover,
.pure-hand-item:not(.disabled):focus-visible {
    transform: scale(1.1) translateY(-6px);
}

.pure-hand-item:not(.disabled):hover img,
.pure-hand-item:not(.disabled):focus-visible img {
    filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.85));
}

.pure-hand-item:not(.disabled):active {
    transform: scale(1.04) translateY(-2px);
}

.pure-hand-item.disabled {
    pointer-events: none;
    opacity: 0.35;
    filter: grayscale(0.8);
}

.pure-hand-item.is-chosen img {
    filter: drop-shadow(0 0 26px var(--gold)) drop-shadow(0 0 10px #fff);
}

.pure-hand-item.is-chosen .pure-hand-label {
    color: var(--gold-light);
    text-shadow: 0 0 12px var(--gold);
}


/* ==================================================================
   07  ARENA — BATTLE REVEAL
   ================================================================== */
.battle-arena-view {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: clamp(6px, 3vw, 18px);
}

.battle-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.battle-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 14px;
    font-size: clamp(0.6rem, 2.6vw, 0.72rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: var(--clay-btn-shadow);
}

.robot-tag {
    color: var(--red);
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px var(--red-glow), var(--clay-btn-shadow);
}

.player-tag {
    color: var(--cyan);
    background: rgba(56, 189, 248, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 15px var(--cyan-glow), var(--clay-btn-shadow);
}

.hand-raw-wrapper {
    width: var(--battle-hand-size);
    height: var(--battle-hand-size);
    display: grid;
    place-items: center;
    transition: transform 0.3s var(--ease-spring), opacity 0.3s ease;
}

.hand-slot,
.hand-slot img {
    width: 100%;
    height: 100%;
}

.hand-slot img {
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.8));
    transition: filter 0.3s ease;
}

.hand-raw-wrapper.is-winner {
    transform: scale(1.08);
}

.hand-raw-wrapper.is-winner .hand-slot img {
    filter: drop-shadow(0 0 26px var(--gold-glow)) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.8));
}

.hand-raw-wrapper.is-loser {
    opacity: 0.55;
    transform: scale(0.94);
}

.vs-text {
    font-family: var(--font-mono);
    font-size: clamp(1.15rem, 5.5vw, 1.7rem);
    font-weight: 800;
    font-style: italic;
    color: var(--gold-light);
    text-shadow: 0 0 18px var(--gold-glow), 0 0 30px var(--gold);
}

/* Shake — duration must stay in sync with CONFIG.timing.shakeDuration */
.shake-left {
    animation: shakeSyncLeft 1.5s ease-in-out;
}

.shake-right {
    animation: shakeSyncRight 1.5s ease-in-out;
}

@keyframes shakeSyncLeft {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    20% { transform: translateY(-22px) rotate(-8deg); }
    40% { transform: translateY(22px) rotate(8deg); }
    60% { transform: translateY(-22px) rotate(-8deg); }
    80% { transform: translateY(22px) rotate(8deg); }
}

@keyframes shakeSyncRight {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    20% { transform: translateY(-22px) rotate(8deg); }
    40% { transform: translateY(22px) rotate(-8deg); }
    60% { transform: translateY(-22px) rotate(8deg); }
    80% { transform: translateY(22px) rotate(-8deg); }
}


/* ==================================================================
   08  ARENA — HINT & STREAK READOUT
   ================================================================== */
.stage-footer {
    width: 100%;
    min-height: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.stage-hint {
    font-size: clamp(0.72rem, 3vw, 0.84rem);
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stage-hint.is-visible {
    opacity: 1;
}

.streak-readout {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 16px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.32);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.16);
}

.streak-readout.is-visible {
    display: flex;
}

.streak-banked {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 3.6vw, 1rem);
    font-weight: 800;
    color: var(--gold-light);
    text-shadow: 0 0 12px var(--gold-glow);
}

.streak-next {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dark);
}


/* ==================================================================
   09  CONTROL DOCK — VICTORY LADDER
   ================================================================== */
.victory-multipliers-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px var(--pad-x);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.victory-multipliers-row::-webkit-scrollbar {
    display: none;
}

.multiplier-pill {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    font-family: var(--font-mono);
    font-size: clamp(0.68rem, 2.8vw, 0.78rem);
    font-weight: 800;
    color: var(--text-muted);
    white-space: nowrap;
    box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.4),
                inset 1px 1px 2px rgba(255, 255, 255, 0.2);
    transition: transform 0.25s var(--ease-spring),
                background-color 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
}

.multiplier-pill.is-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.28));
    border-color: var(--gold-light);
    color: var(--gold-light);
    box-shadow: 0 0 14px var(--gold-glow), 2px 4px 10px rgba(0, 0, 0, 0.4);
    transform: scale(1.06);
}

.multiplier-pill.is-complete {
    background: rgba(16, 185, 129, 0.25);
    border-color: var(--green-bright);
    color: var(--green-bright);
    box-shadow: 0 0 10px var(--green-glow);
}


/* ==================================================================
   10  CONTROL DOCK — MODE TOGGLE
   ================================================================== */
.mode-toggle-bar {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 0 var(--pad-x) 10px;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(19, 27, 42, 0.7);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: clamp(0.72rem, 3vw, 0.82rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: var(--clay-btn-shadow);
    transition: transform 0.25s var(--ease-spring),
                background-color 0.25s ease,
                border-color 0.25s ease,
                color 0.25s ease;
}

.mode-btn:hover:not(:disabled) {
    color: var(--text-main);
    border-color: var(--glass-border-light);
}

.mode-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.15));
    border-color: var(--gold-light);
    color: var(--gold-light);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35), var(--clay-btn-shadow);
}

.mode-btn:disabled {
    opacity: 0.45;
}


/* ==================================================================
   11  CONTROL DOCK — BETTING PANEL
   ================================================================== */
.betting-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding:
        14px
        calc(var(--pad-x) + var(--safe-right))
        calc(16px + var(--safe-bottom))
        calc(var(--pad-x) + var(--safe-left));
    background: rgba(13, 21, 38, 0.85);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border-top: 1px solid var(--glass-border-light);
    border-top-left-radius: 26px;
    border-top-right-radius: 26px;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.7),
                inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.bet-adjuster-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    background: rgba(5, 8, 15, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.75);
}

.adjust-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    box-shadow: var(--clay-btn-shadow);
    transition: transform 0.2s var(--ease-spring),
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease;
}

.adjust-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--cyan);
    color: var(--cyan);
}

.adjust-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.adjust-btn:disabled {
    opacity: 0.4;
}

.bet-amount-displayer {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bet-label-mini {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dark);
    cursor: default;
}

.bet-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.bet-currency {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gold);
}

.bet-input-field {
    width: clamp(64px, 22vw, 96px);
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 4.4vw, 1.18rem);
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}

.bet-input-field::-webkit-outer-spin-button,
.bet-input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bet-input-field:disabled {
    opacity: 0.55;
}

.preset-chips-bar {
    display: flex;
    gap: 8px;
    width: 100%;
}

.chip-pill {
    flex: 1;
    padding: 9px 0;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--gold-light);
    font-size: clamp(0.68rem, 2.9vw, 0.76rem);
    font-weight: 800;
    text-align: center;
    box-shadow: var(--clay-btn-shadow);
    transition: transform 0.2s var(--ease-spring),
                background-color 0.2s ease,
                box-shadow 0.2s ease;
}

.chip-pill:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 14px var(--gold-glow), var(--clay-btn-shadow);
    transform: translateY(-2px);
}

.chip-pill:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.chip-pill:disabled {
    opacity: 0.4;
}

.place-bet-btn,
.cashout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #030712;
    font-size: clamp(0.95rem, 4vw, 1.08rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
}

.place-bet-btn {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 0 25px var(--green-glow), var(--clay-btn-shadow);
}

.place-bet-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 35px var(--green-glow), var(--clay-btn-shadow);
}

.place-bet-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.place-bet-btn:disabled {
    background: linear-gradient(135deg, #334155, #1e293b);
    color: var(--text-dark);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.cashout-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 0 25px var(--gold-glow), var(--clay-btn-shadow);
    font-variant-numeric: tabular-nums;
}

.cashout-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 35px var(--gold-glow), var(--clay-btn-shadow);
}

.cashout-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.cashout-btn:disabled {
    opacity: 0.55;
    box-shadow: none;
}


/* ==================================================================
   12  TOAST
   ================================================================== */
.toast-notification-banner {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    min-width: 220px;
    max-width: min(360px, calc(100% - 32px));
    padding: 13px 26px;
    border-radius: 20px;
    background: rgba(13, 21, 38, 0.94);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border: 1px solid var(--glass-border-light);
    text-align: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: top 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.35s ease;
}

.toast-notification-banner.is-visible {
    top: calc(72px + var(--safe-top));
    opacity: 1;
    pointer-events: auto;
}

.toast-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.toast-title {
    font-size: clamp(0.95rem, 4vw, 1.1rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.toast-subtitle {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.toast-subtitle:empty {
    display: none;
}

.toast-notification-banner.win {
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 30px var(--green-glow);
}

.toast-notification-banner.win .toast-title {
    color: var(--green-bright);
    text-shadow: 0 0 12px var(--green-glow);
}

.toast-notification-banner.lose {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 30px var(--red-glow);
}

.toast-notification-banner.lose .toast-title {
    color: var(--red);
    text-shadow: 0 0 12px var(--red-glow);
}

.toast-notification-banner.tie {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 30px var(--gold-glow);
}

.toast-notification-banner.tie .toast-title {
    color: var(--gold-light);
    text-shadow: 0 0 12px var(--gold-glow);
}


/* ==================================================================
   13  RULES MODAL
   ================================================================== */
.modal-overlay {
    position: absolute;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.menu-drawer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 380px;
    max-height: 100%;
    padding: 20px;
    border-radius: 26px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid var(--glass-border-light);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.85),
                0 0 35px rgba(56, 189, 248, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transform: scale(0.92);
    transition: transform 0.25s var(--ease-spring);
}

.modal-overlay.is-open .menu-drawer {
    transform: scale(1);
}

.drawer-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.close-drawer-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    box-shadow: var(--clay-btn-shadow);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.close-drawer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* The rules list scrolls independently so the modal always fits. */
.rules-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    padding-right: 4px;
}

.rules-content::-webkit-scrollbar {
    width: 5px;
}

.rules-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.rule-block {
    padding: 13px 15px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.15),
                inset -1px -1px 4px rgba(0, 0, 0, 0.4);
}

.rule-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-main);
}

.rule-desc {
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.rule-desc + .rule-desc,
.rule-ladder + .rule-desc {
    margin-top: 8px;
}

.rule-ladder {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(245, 158, 11, 0.22);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.7;
    color: var(--gold-light);
    text-align: center;
    word-spacing: 0.05em;
}

.rule-footnote {
    padding-top: 2px;
    font-size: 0.68rem;
    line-height: 1.5;
    text-align: center;
    color: var(--text-dark);
}

.matchup-visual-container {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 8px;
}

.matchup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 11px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.matchup-hand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 800;
}

.matchup-hand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}

.matchup-hand.winner span {
    color: var(--green-bright);
    text-shadow: 0 0 8px rgba(52, 211, 153, 0.35);
}

.matchup-hand.loser span {
    color: var(--text-muted);
}

.matchup-arrow {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.beats-tag {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.stat-cell {
    padding: 9px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.stat-cell dt {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.stat-cell dd {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.stat-cell dd.is-positive {
    color: var(--green-bright);
}

.stat-cell dd.is-negative {
    color: var(--red);
}

.icon-gold { color: var(--gold); }
.icon-cyan { color: var(--cyan); }
.icon-green { color: var(--green-bright); }


/* ==================================================================
   14  UTILITIES & KEYBOARD BADGES
   ================================================================== */
.hidden {
    display: none !important;
}

[data-icon] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kbd-badge {
    display: none;
    padding: 2px 6px;
    margin-left: 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--cyan);
    vertical-align: middle;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
                0 2px 4px rgba(0, 0, 0, 0.3);
}

.kbd-badge.btn-kbd {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 3px 8px;
    font-size: 0.68rem;
    margin-left: 6px;
}

/* Keyboard hints only make sense where there is a keyboard. */
@media (hover: hover) and (pointer: fine) and (min-width: 640px) {
    .kbd-badge {
        display: inline-block;
    }
}


/* ==================================================================
   15  RESPONSIVE — LARGER SCREENS
   ================================================================== */
@media (min-width: 640px) {
    :root {
        --pad-x: 24px;
        --hand-size: clamp(84px, min(13vw, 15vh), 115px);
        --battle-hand-size: clamp(90px, min(15vw, 17vh), 125px);
        --gap-hands: 30px;
    }

    body {
        padding: 20px;
        align-items: center;
    }

    .app-container {
        max-width: 640px;
        min-height: 0;
        height: min(940px, calc(100dvh - 40px));
        min-height: 560px;
        border-radius: 30px;
        border: 1px solid var(--glass-border-light);
        box-shadow: 0 35px 90px rgba(0, 0, 0, 0.95),
                    0 0 50px rgba(56, 189, 248, 0.12),
                    inset 0 1px 2px rgba(255, 255, 255, 0.25);
    }

    .victory-multipliers-row {
        justify-content: center;
    }

    .multiplier-pill {
        padding: 7px 14px;
    }
}

@media (min-width: 1024px) {
    :root {
        --hand-size: clamp(96px, min(11vw, 16vh), 130px);
        --battle-hand-size: clamp(100px, min(12vw, 18vh), 140px);
        --gap-hands: 42px;
    }

    .app-container {
        max-width: 720px;
    }
}


/* ==================================================================
   16  RESPONSIVE — SHORT & LANDSCAPE SCREENS
   ==================================================================
   On a landscape phone there is very little vertical room. The dock
   compresses, the arena lays out horizontally, and anything that
   still does not fit scrolls rather than being clipped.
   ================================================================== */
@media (max-height: 620px) {
    :root {
        --hand-size: clamp(48px, 11vh, 72px);
        --battle-hand-size: clamp(52px, 13vh, 82px);
    }

    .stage-footer {
        min-height: 34px;
    }

    .betting-panel {
        gap: 8px;
        padding-top: 10px;
    }

    .adjust-btn {
        width: 38px;
        height: 38px;
    }

    .place-bet-btn,
    .cashout-btn {
        padding: 11px 18px;
    }

    .mode-btn {
        padding: 8px 12px;
    }

    .victory-multipliers-row {
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .app-container {
        max-width: 820px;
    }

    .main-arena {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .stage-view {
        gap: 6px;
    }

    .pure-hand-item {
        gap: 4px;
    }

    .betting-panel {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        grid-template-areas:
            "stake  action"
            "chips  action";
        gap: 8px 12px;
        align-items: center;
    }

    .bet-adjuster-box { grid-area: stake; }
    .preset-chips-bar { grid-area: chips; }

    .place-bet-btn,
    .cashout-btn {
        grid-area: action;
        height: 100%;
    }
}


/* ==================================================================
   17  ACCESSIBILITY PREFERENCES
   ================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .shake-left,
    .shake-right {
        animation: none !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --text-muted: #cbd5e1;
        --text-dark: #94a3b8;
        --glass-border: rgba(255, 255, 255, 0.32);
    }
}
