/* ─── CSS Variables ─── */
:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --accent: #7c5cff;
    --accent-gradient: linear-gradient(135deg, #7c5cff 0%, #a855f7 100%);
    --accent-glow: rgba(124, 92, 255, 0.3);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.06);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    touch-action: manipulation;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ─── Glassmorphism ─── */
.glass {
    background: rgba(18, 18, 31, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

/* ─── Header ─── */
.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    padding-top: max(12px, env(safe-area-inset-top));
    z-index: 100;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 20px var(--accent-glow);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 30px rgba(124, 92, 255, 0.5); }
}

.header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(124, 92, 255, 0.15);
    border: 1px solid rgba(124, 92, 255, 0.2);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    width: fit-content;
    transition: var(--transition);
}

.balance-pill.updated {
    animation: balance-pop 0.4s ease;
}

@keyframes balance-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ─── Main Content ─── */
#main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: 100px;
    scroll-behavior: smooth;
}

#main-content::-webkit-scrollbar {
    width: 0;
}

/* ─── Screen transitions ─── */
.screen {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Game Cards Grid ─── */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.game-card:hover,
.game-card:active {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.game-card:hover::before,
.game-card:active::before {
    opacity: 1;
}

.game-card .icon {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.game-card:hover .icon {
    transform: scale(1.1) rotate(-5deg);
}

.game-card .title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.game-card .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 30px rgba(124, 92, 255, 0.5);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: var(--radius-lg);
    width: 100%;
}

/* ─── Bet Selector ─── */
.bet-selector {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.bet-chip {
    flex-shrink: 0;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.bet-chip.active {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.1);
    color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.bet-chip:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════
   CRASH — полностью переработанный
   ═══════════════════════════════════════ */

/* ─── Crash History (пилюли коэффициентов) ─── */
.crash-history {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 80px;
    overflow-y: auto;
}

.crash-hist-item {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-card);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.crash-hist-red {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.crash-hist-yellow {
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.crash-hist-green {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

/* ─── Crash Canvas Container ─── */
.crash-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

.crash-canvas-container {
    position: relative;
    height: 280px;
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%);
}

#crash-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ─── Crash Multiplier (большая цифра по центру) ─── */
.crash-multiplier {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 56px;
    font-weight: 800;
    color: var(--success);
    text-shadow: 0 0 40px rgba(34, 197, 94, 0.6);
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 10;
    display: block;
}

.crash-multiplier.danger {
    color: var(--danger);
    text-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
}

/* ─── Crash Countdown (большая цифра между раундами) ─── */
.crash-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 60px rgba(124, 92, 255, 0.6), 0 0 120px rgba(124, 92, 255, 0.3);
    pointer-events: none;
    display: none;
    z-index: 10;
    line-height: 1;
    animation: countdown-pulse 0.5s ease-in-out;
}

@keyframes countdown-pulse {
    0% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ─── Crash Status (верхний левый угол) ─── */
.crash-status {
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
    background: rgba(0,0,0,0.4);
    padding: 4px 10px;
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

/* ─── Crash Controls (ставка + кнопки) ─── */
.crash-controls {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crash-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.crash-input {
    width: 100%;
    padding: 16px 48px 16px 16px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary) !important;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.crash-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.crash-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.crash-input::placeholder {
    color: var(--text-muted);
}

/* Убираем стрелки у number input */
.crash-input::-webkit-outer-spin-button,
.crash-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.crash-input[type=number] {
    -moz-appearance: textfield;
}

.crash-input-coin {
    position: absolute;
    right: 16px;
    font-size: 20px;
    pointer-events: none;
}

/* ─── Crash Players List ─── */
.crash-players {
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.crash-players-title {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.crash-players-list {
    max-height: 200px;
    overflow-y: auto;
}

.crash-player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.crash-player-item:last-child {
    border-bottom: none;
}

.crash-player-item:hover {
    background: var(--bg-hover);
}

.crash-player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 10px var(--accent-glow);
}

.crash-player-info {
    flex: 1;
    min-width: 0;
}

.crash-player-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crash-player-bet {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.crash-player-status {
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   Остальные игры (Mines, Coin, Dice, Slots)
   ═══════════════════════════════════════ */

/* ─── Mines Game ─── */
.mines-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.mines-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.mines-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.mines-cell:hover:not(.revealed) {
    transform: scale(1.05);
    border-color: var(--accent);
}

.mines-cell.revealed {
    cursor: default;
}

.mines-cell.safe {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.mines-cell.safe::before {
    opacity: 0.1;
}

.mines-cell.mine {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    animation: shake 0.5s ease;
}

.mines-cell.mine::before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    opacity: 0.15;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.mines-cell.hidden {
    font-size: 18px;
    color: var(--text-muted);
}

.mines-info {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.mines-info-item {
    text-align: center;
}

.mines-info-item .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mines-info-item .value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

/* ─── Coin Flip ─── */
.coin-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px 0;
}

.coin {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    box-shadow: 0 8px 32px rgba(255, 170, 0, 0.3);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.coin.flipping {
    animation: coin-flip 1s ease-in-out;
}

@keyframes coin-flip {
    0% { transform: rotateY(0) scale(1); }
    50% { transform: rotateY(900deg) scale(1.1); }
    100% { transform: rotateY(1800deg) scale(1); }
}

.coin-choice-group {
    display: flex;
    gap: 12px;
    width: 100%;
}

.coin-choice-btn {
    flex: 1;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.coin-choice-btn .emoji {
    font-size: 32px;
}

.coin-choice-btn.active {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ─── Dice & Slots ─── */
.dice-display, .slots-display {
    font-size: 80px;
    text-align: center;
    padding: 40px 0;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
    transition: transform 0.3s ease;
}

.dice-display.rolling, .slots-display.rolling {
    animation: dice-bounce 0.5s ease infinite;
}

@keyframes dice-bounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(-5px) rotate(-5deg); }
}

/* ─── Profile Screen ─── */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 16px;
    box-shadow: 0 0 30px var(--accent-glow);
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.history-item:hover {
    background: var(--bg-hover);
}

.history-item .game-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-item .game-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.history-item .game-details {
    display: flex;
    flex-direction: column;
}

.history-item .game-name {
    font-size: 14px;
    font-weight: 600;
}

.history-item .game-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.history-item .game-result {
    font-size: 14px;
    font-weight: 700;
}

.history-item .game-result.win {
    color: var(--success);
}

.history-item .game-result.lose {
    color: var(--danger);
}

/* ─── Leaderboard ─── */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.leaderboard-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.leaderboard-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.3);
}

.leaderboard-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #000;
}

.leaderboard-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: #fff;
}

.leaderboard-rank.default {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.leaderboard-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.leaderboard-balance {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

/* ─── Bottom Nav ─── */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid var(--border);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
    transition: var(--transition);
}

.nav-btn.active {
    color: var(--accent);
}

.nav-btn.active svg {
    stroke: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ─── Toast ─── */
#toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.toast.info {
    background: rgba(124, 92, 255, 0.15);
    border: 1px solid rgba(124, 92, 255, 0.3);
    color: var(--accent);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ─── Result Overlay ─── */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.3s ease;
}

.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

.result-card .emoji {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
}

.result-card .title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
}

.result-card .amount {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
}

.result-card .amount.win {
    color: var(--success);
}

.result-card .amount.lose {
    color: var(--danger);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ─── Scrollbar hide ─── */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* ─── Withdraw / Deposit ─── */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ─── Responsive ─── */
@media (min-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* ═══════════════════════════════════════
   CRASH HISTORY — горизонтальная шкала
   Новые слева, старые справа
   ═══════════════════════════════════════ */

.crash-history-wrapper {
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.crash-history-track {
    display: flex;
    flex-direction: row; /* нормальное направление, но reverse в JS */
    gap: 8px;
    justify-content: flex-start;
}

.crash-hist-item {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-card);
    border: 1px solid var(--border);
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* Цвета коэффициентов */
.crash-hist-red {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.crash-hist-yellow {
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.crash-hist-green {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

/* Анимация только для НОВОГО элемента */
.hist-new {
    animation: hist-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hist-pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5) translateX(-20px);
    }
    70% {
        transform: scale(1.1) translateX(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}
.crash-history-wrapper {
    overflow: hidden;
    margin-bottom: 12px;
}

.crash-history-track {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.crash-hist-item {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-card);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.crash-hist-red {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.crash-hist-yellow {
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.crash-hist-green {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

.hist-new {
    animation: hist-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hist-pop-in {
    0% { opacity: 0; transform: scale(0.5) translateX(-20px); }
    70% { transform: scale(1.1) translateX(0); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}