/* Aviator-Style Theme */
:root {
    --bg-dark: #0e121b;
    --bg-darker: #090c13;
    --bg-card: #161c28;
    --bg-card-light: #1a202f;
    --bg-input: #1a202f;
    
    --accent-red: #e53935;
    --accent-red-dark: #c62828;
    --accent-green: #2962ff; /* changed to blue theme */
    --accent-green-light: #3b74ff;
    --accent-orange: #ff9800;
    --accent-purple: #9c27b0;
    --accent-blue: #2962ff;

    
    --text-white: #ffffff;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dim: rgba(255, 255, 255, 0.3);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-darker);
    color: var(--text-white);
}

.hidden { display: none !important; }

/* ========== LAYOUT ========== */
.aviator-game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
}

/* ========== TOP BAR ========== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.top-bar__left,
.top-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.icon-btn.active {
    color: var(--accent-green);
}

.icon-btn__text {
    font-weight: 500;
}

.balance-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 20px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.balance-pill__label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-pill__value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-green-light);
}

/* ========== MAIN LAYOUT ========== */
.game-main {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 12px;
    padding: 12px;
    overflow: hidden;
}

/* ========== LEFT PANEL ========== */
.left-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-tabs {
    display: flex;
    background: var(--bg-darker);
    padding: 4px;
    gap: 4px;
}

.panel-tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.panel-tab:hover {
    color: var(--text-light);
}

.panel-tab.active {
    background: var(--bg-card-light);
    color: var(--text-white);
}

.live-bets {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.live-bets__header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.8fr 1fr;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.live-bets__body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-card-light) transparent;
}

.bet-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.8fr 1fr;
    padding: 8px 12px;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.2s;
}

.bet-row:hover {
    background: rgba(255,255,255,0.02);
}

.bet-row__user {
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bet-row__amount {
    color: var(--text-white);
    font-weight: 500;
}

.bet-row__mult {
    font-weight: 600;
}

.bet-row__mult.pending {
    color: var(--text-muted);
}

.bet-row__mult.won {
    color: var(--accent-purple);
}

.bet-row__profit {
    font-weight: 600;
}

.bet-row__profit.positive {
    color: var(--accent-green-light);
}

.bet-row__profit.negative {
    color: var(--accent-red);
}

/* ========== CENTER - GAME CANVAS ========== */
.game-center {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.history-bar {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow-x: auto;
    scrollbar-width: none;
}

.history-bar::-webkit-scrollbar { display: none; }

.history-pill {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s;
}

.history-pill:hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.history-pill.blue {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: white;
}

.history-pill.purple {
    background: linear-gradient(135deg, #ab47bc, #8e24aa);
    color: white;
}

.history-pill.pink {
    background: linear-gradient(135deg, #ec407a, #d81b60);
    color: white;
}

.canvas-container {
    height: 260px;
    flex: none;
    position: relative;
    background: radial-gradient(ellipse at center bottom, #2a2a4a 0%, #1a1a2e 50%, #0f0f1a 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.multiplier-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

.multiplier-box {
    padding: 16px 40px;
    background: transparent;
    border-radius: 0;
    border: none;
}

.multiplier-box.flying {
    border-color: transparent;
    box-shadow: none;
}

.multiplier-box.crashed {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.multiplier-value {
    font-size: 72px;
    font-weight: 900;
    color: var(--text-white);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: color 0.3s;
}

.multiplier-box.flying .multiplier-value {
    color: var(--accent-green-light);
}

.multiplier-box.crashed .multiplier-value {
    color: var(--accent-red);
}

.phase-text {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 15;
}

.countdown-text {
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.countdown-value {
    font-size: 64px;
    font-weight: 900;
    color: var(--accent-red);
}

/* ========== RIGHT PANEL - BET CARDS ========== */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bet-card {
    background: #161c28; /* BETSPORT card background */
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bet-card__top {
    display: flex;
    justify-content: center;
}

.bet-card__tabs {
    display: flex;
    background: var(--bg-darker);
    border-radius: 20px;
    padding: 3px;
    width: 200px;
}

.bet-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
}

.bet-tab.active {
    background: var(--bg-card-light);
    color: var(--text-white);
}

.bet-card__bottom {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 12px;
}

.bet-card__controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-darker);
    padding: 6px;
    border-radius: var(--radius-lg);
}

.bet-card__amount {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-darker);
    border-radius: var(--radius-lg);
}

.amount-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
}

.amount-btn:hover {
    background: var(--bg-card-light);
    border-color: var(--accent-green);
}

.amount-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.bet-card__presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
}

.bet-card__presets button {
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.bet-card__presets button:hover {
    background: var(--bg-card-light);
    color: var(--text-white);
}

.bet-card__presets button.active {
    background: var(--accent-green);
    color: var(--text-white);
}

.bet-card__action {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    align-items: stretch;
    /* No gap here, handled via margin on animated elements */
}

.bet-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bet-btn__text {
    font-size: 20px;
    letter-spacing: 0px;
    font-weight: 500;
    text-transform: capitalize;
}

.bet-btn__amount {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
}

.bet-btn--bet {
    flex: 1 1 auto;
    background: #2b6bff;
    border: none;
    border-radius: var(--radius-lg);
    color: #ffffff;
    overflow: hidden;
}

.bet-btn--bet:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(43, 107, 255, 0.4);
}

.bet-btn--bet:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bet-btn--bet.waiting {
    background: linear-gradient(135deg, var(--accent-orange), #f57c00);
}

.bet-btn--cashout {
    flex: 1 1 100%;
    background: linear-gradient(135deg, var(--accent-orange), #f57c00);
    color: white;
    border-radius: var(--radius-lg);
    animation: pulse-cashout 0.8s ease-in-out infinite;
}

@keyframes pulse-cashout {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.bet-btn--cashout:hover {
    filter: brightness(1.1);
}

.bet-btn--cancel {
    flex: 0 0 35%;
    height: 35%;
    max-height: 100px;
    min-height: 30px;
    width: 100%;
    margin-top: 8px;
    background: var(--accent-red);
    color: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    white-space: nowrap;
    opacity: 1;
    transform-origin: bottom center;
    transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                flex-basis 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                margin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                max-height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                min-height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                padding 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.2s ease;
}

.bet-btn--cancel.hidden {
    display: flex !important; /* overrides display: none */
    height: 0;
    max-height: 0;
    min-height: 0;
    flex: 0 0 0px;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border: none;
    pointer-events: none;
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 450px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-white);
}

.modal-body {
    padding: 20px;
}

.verify-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.verify-row:last-child {
    border-bottom: none;
}

.verify-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.verify-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-light);
    word-break: break-all;
}

.verify-result {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-purple);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
    .game-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        overflow-y: auto; /* Allow scrolling if it doesn't fit mobile height */
    }
    
    .left-panel {
        display: none;
    }
    
    .right-panel {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap; /* in case of multiple slots */
    }
    
    .bet-card {
        flex: 1;
        min-width: 280px;
        max-width: 400px;
    }
}

@media (max-width: 600px) {
    .game-main {
        padding: 8px; /* give slightly less padding */
        gap: 8px;
    }
    
    .right-panel {
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 8px;
        scrollbar-width: none; /* Hide scrollbar for cleaner look */
    }
    .right-panel::-webkit-scrollbar {
        display: none;
    }
    
    .bet-card {
        flex: 0 0 92%; /* Takes 92% of width so second card peeks out */
        scroll-snap-align: center;
        max-width: none;
        padding: 10px;
    }

    .canvas-container {
        height: 250px;
    }
    
    .multiplier-value {
        font-size: 48px;
    }
    
    .top-bar {
        padding: 6px 10px;
    }
    
    .icon-btn__text {
        display: none;
    }
}
