/* ═══════════════════════════════════════════════════
   GAMES — Light Theme Matching Site Palette
   Uses design tokens from variables.css
   ═══════════════════════════════════════════════════ */

/* ── Game Screen Overlay ── */
.game-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--color-bg);
    display: none;
    flex-direction: column;
    overflow-y: auto;
    font-family: var(--font-family);
    color: var(--color-text-primary);
}

.game-screen.active {
    display: flex;
}

/* ── Game Header ── */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.game-header__back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.game-header__back:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
}

.game-header__back svg {
    width: 18px;
    height: 18px;
}

.game-header__title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.game-header__balance {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary-lighter);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary-dark);
}

.game-header__balance-icon {
    width: 18px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
}

/* ── Game Body ── */
.game-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6) var(--space-5);
    gap: var(--space-5);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* ── Bet Controls ── */
.bet-section {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

.bet-section__label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
}

.bet-amount-row {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.bet-chip {
    flex: 1;
    min-width: 60px;
    padding: 10px 6px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.bet-chip:hover {
    border-color: var(--color-primary-light);
    background: var(--color-primary-lighter);
}

.bet-chip.active {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    color: var(--color-primary-dark);
    box-shadow: var(--shadow-glow);
}

/* ── Result Toast ── */
.game-result-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10001;
    padding: var(--space-8) var(--space-12);
    border-radius: var(--radius-2xl);
    text-align: center;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-2xl);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-result-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.game-result-toast.win {
    background: var(--color-surface);
    box-shadow: 0 20px 60px rgba(61, 187, 125, 0.3);
    color: var(--color-success);
    border: 2px solid var(--color-success);
}

.game-result-toast.lose {
    background: var(--color-surface);
    box-shadow: 0 20px 60px rgba(229, 77, 94, 0.3);
    color: var(--color-error);
    border: 2px solid var(--color-error);
}

.game-result-toast__amount {
    font-size: var(--font-size-4xl);
    margin-top: var(--space-2);
}

/* ═══════════════════════════════════════
   AVIATOR GAME - REDESIGNED
   ═══════════════════════════════════════ */

.aviator-history-bar {
    display: flex;
    align-items: center;
    background: var(--color-surface);
    padding: 6px 12px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--color-border-light);
    z-index: 10;
    width: 100%;
}

.aviator-history-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    padding: 4px 0;
    scrollbar-width: none;
}

.aviator-history-scroll::-webkit-scrollbar {
    display: none;
}

.aviator-history__item {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.aviator-history__item.low {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.aviator-history__item.mid {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.aviator-history__item.high {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.aviator-history-dropdown {
    background: var(--color-surface-muted);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    color: var(--color-text-tertiary);
}

.aviator-history-dropdown svg {
    width: 14px;
    height: 14px;
}

/* Main Display */
.aviator-main-display {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aviator-background-animated {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(232, 131, 107, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 0% 100%, rgba(61, 187, 125, 0.05) 0%, transparent 50%);
    animation: slowPulse 8s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes slowPulse {
    0% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.aviator-game__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.aviator-game__multiplier {
    font-size: 64px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    z-index: 3;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.aviator-game__multiplier.crashed {
    color: var(--color-error);
    text-shadow: 0 4px 20px rgba(229, 77, 94, 0.4);
}

.aviator-game__status {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    z-index: 4;
}

/* Dual Bets */
.aviator-dual-bets {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: #F8F9FA;
    border-top: 2px solid rgba(0, 0, 0, 0.05);
    width: 100%;
}

.aviator-bet-panel {
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.aviator-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border-light);
}

.aviator-panel-tabs button {
    flex: 1;
    padding: 8px;
    background: var(--color-surface-muted);
    border: none;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-tertiary);
}

.aviator-panel-tabs button.active {
    background: var(--color-surface);
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

.aviator-panel-body {
    display: flex;
    padding: 10px;
    gap: 12px;
}

.aviator-panel-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aviator-input-group {
    display: flex;
    align-items: center;
    background: #1A1A1A;
    border-radius: 8px;
    overflow: hidden;
    height: 40px;
}

.aviator-btn-math {
    background: #2D2D2D;
    border: none;
    color: #fff;
    width: 32px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.aviator-btn-math:active {
    background: #444;
}

.aviator-btn-math svg {
    width: 14px;
    height: 14px;
}

.aviator-bet-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    -moz-appearance: textfield;
}

.aviator-bet-input::-webkit-outer-spin-button,
.aviator-bet-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.aviator-bet-input:focus {
    outline: none;
}

.aviator-chips-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.aviator-chip {
    background: var(--color-surface-muted);
    border: none;
    border-radius: 6px;
    padding: 4px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.aviator-chip:active {
    background: var(--color-border-light);
}

.aviator-btn-action {
    width: 130px;
    border-radius: 10px;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: transform 0.1s, filter 0.1s;
    cursor: pointer;
}

.aviator-btn-action.bet {
    background: var(--color-success);
    box-shadow: 0 4px 15px rgba(61, 187, 125, 0.4);
}

.aviator-btn-action.cashout {
    background: #F5A623;
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
}

.aviator-btn-action:disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

.aviator-btn-action:active:not(:disabled) {
    transform: scale(0.97);
}

.action-top {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
}

.action-bottom {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.95;
}

/* Footer */
.aviator-footer-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 0 20px;
    background: #F8F9FA;
    width: 100%;
}

.aviator-footer-tabs button {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--color-text-tertiary);
    font-weight: 600;
    cursor: pointer;
}

.aviator-footer-tabs button.active {
    color: var(--color-text-primary);
    border-bottom: 2px solid var(--color-text-primary);
    padding-bottom: 2px;
}

/* ═══════════════════════════════════════
   WINGO GAME
   ═══════════════════════════════════════ */
.wingo-game__timer {
    width: 100%;
    text-align: center;
    padding: var(--space-5);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

.wingo-game__timer-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}

.wingo-game__timer-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

.wingo-game__round {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin-top: var(--space-2);
}

.wingo-buttons {
    display: flex;
    gap: var(--space-3);
    width: 100%;
}

.wingo-btn {
    flex: 1;
    padding: var(--space-5) var(--space-3);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.wingo-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: inherit;
}

.wingo-btn--red {
    background: #E54D5E;
    box-shadow: 0 6px 20px rgba(229, 77, 94, 0.35);
}

.wingo-btn--green {
    background: #3DBB7D;
    box-shadow: 0 6px 20px rgba(61, 187, 125, 0.35);
}

.wingo-btn--violet {
    background: #8B5CF6;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.wingo-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.wingo-btn:active {
    transform: translateY(0);
}

.wingo-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    filter: none !important;
}

.wingo-btn__multiplier {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    opacity: 0.85;
    margin-top: 4px;
}

/* Result reveal */
.wingo-reveal {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    animation: wingoRevealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 10px auto;
}

@keyframes wingoRevealPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* History dots */
.wingo-history {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    padding: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    width: 100%;
}

.wingo-history__dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

/* ═══════════════════════════════════════
   CHICKENROAD GAME
   ═══════════════════════════════════════ */
.chicken-game__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
    width: 100%;
    max-width: 380px;
}

.chicken-tile {
    aspect-ratio: 1;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow-xs);
    position: relative;
}

.chicken-tile:hover:not(.revealed):not(:disabled) {
    border-color: var(--color-primary-light);
    background: var(--color-primary-lighter);
    transform: scale(1.03);
}

.chicken-tile.safe {
    background: var(--color-success-bg);
    border-color: var(--color-success);
    animation: tileSafe 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chicken-tile.mine {
    background: var(--color-error-bg);
    border-color: var(--color-error);
    animation: tileMine 0.4s ease;
}

.chicken-tile.unrevealed-mine {
    background: var(--color-surface-muted);
    border-color: var(--color-border);
    opacity: 0.6;
}

.chicken-tile:disabled {
    cursor: not-allowed;
}

@keyframes tileSafe {
    0% {
        transform: scale(0.8);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes tileMine {

    0%,
    100% {
        transform: rotate(0);
    }

    25% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(5deg);
    }
}

.chicken-multiplier-bar {
    width: 100%;
    text-align: center;
    padding: var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

.chicken-multiplier-bar__current {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--color-primary);
}

.chicken-multiplier-bar__label {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.chicken-multiplier-bar__potential {
    font-size: var(--font-size-sm);
    color: var(--color-success);
    font-weight: var(--font-weight-semibold);
    margin-top: var(--space-1);
}

.chicken-controls {
    display: flex;
    gap: var(--space-3);
    width: 100%;
}

.chicken-btn {
    flex: 1;
    padding: var(--space-4);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.chicken-btn--start {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.chicken-btn--start:hover {
    transform: translateY(-2px);
}

.chicken-btn--cashout {
    background: var(--color-success);
    color: #fff;
    box-shadow: 0 4px 20px rgba(61, 187, 125, 0.3);
}

.chicken-btn--cashout:hover {
    transform: translateY(-2px);
}

.chicken-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* Mine count selector */
.mine-selector {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    width: 100%;
}

.mine-option {
    flex: 1;
    min-width: 50px;
    padding: 8px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.mine-option:hover {
    border-color: var(--color-primary-light);
}

.mine-option.active {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    color: var(--color-primary-dark);
}

/* ── Confetti ── */
@keyframes confettiDrop {
    0% {
        transform: translateY(-100vh) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti-piece {
    position: fixed;
    z-index: 10002;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiDrop 2s ease-in forwards;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .game-header {
        padding: var(--space-3) var(--space-4);
    }

    .game-header__title {
        font-size: var(--font-size-base);
    }

    .game-header__balance {
        font-size: var(--font-size-xs);
        padding: 6px 10px;
    }

    .game-body {
        padding: var(--space-4) var(--space-4);
        gap: var(--space-4);
    }

    .aviator-game__multiplier {
        font-size: 42px;
    }

    .chicken-game__grid {
        gap: 6px;
    }

    .wingo-btn {
        padding: var(--space-4) var(--space-2);
        font-size: var(--font-size-sm);
    }
}