/* ==========================================================================
   1xBet Crash Game Demo - Stylesheet
   Modern, responsive, dark casino aesthetic with high-energy neon accents.
   ========================================================================== */

:root {
    --bg-darkest: #050912;
    --bg-dark: #08111f;
    --bg-card: rgba(10, 17, 29, 0.92);
    --bg-card-hover: rgba(17, 27, 43, 0.96);
    --bg-input: #0a1322;
    --border-color: rgba(212, 175, 55, 0.24);
    --border-glow: rgba(245, 197, 66, 0.3);

    --primary-gold: #d4af37;
    --primary-gold-strong: #f5c542;
    --primary-gold-soft: rgba(212, 175, 55, 0.18);
    --primary-blue: #81a7ff;
    --primary-blue-hover: #9abaff;
    --win-green: #2ecf7d;
    --win-green-hover: #67f0a7;
    --cashout-gold: #ffbf3d;
    --cashout-gold-hover: #ffd76a;
    --crash-red: #ff4d4d;
    --crash-red-hover: #ff6a6a;

    --text-primary: #f8f5ef;
    --text-secondary: #d9d8d8;
    --text-muted: #9ea9ba;

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.15s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-darkest);
    background-image:
        linear-gradient(rgba(212, 175, 55, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, 0.028) 1px, transparent 1px),
        radial-gradient(circle at 18% 0%, rgba(212, 175, 55, 0.18), transparent 34%),
        radial-gradient(circle at 88% 72%, rgba(129, 167, 255, 0.12), transparent 30%),
        linear-gradient(135deg, #050912 0%, #08111f 52%, #0a1629 100%);
    background-size: 44px 44px, 44px 44px, auto, auto, auto;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background: linear-gradient(180deg, #0e1a2d 0%, #0c1524 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 6px;
}

.logo-badge {
    background: linear-gradient(135deg, #0084ff, #0056b3);
    color: #ffffff;
    font-weight: 900;
    font-size: 17px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(0, 132, 255, 0.4);
}

.logo-title {
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    color: var(--text-primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.logo-title span {
    color: var(--primary-gold-strong);
    text-shadow: 0 0 18px rgba(245, 197, 66, 0.6);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.live-dot {
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.balance-pill {
    background: #08101a;
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.balance-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.balance-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-gold-strong);
    font-variant-numeric: tabular-nums;
}

.btn-deposit {
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-strong) 100%);
    color: #181200;
    font-weight: 800;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-deposit:hover {
    background: linear-gradient(135deg, #ecd27f 0%, var(--primary-gold) 100%);
    transform: scale(1.02);
    box-shadow: 0 0 12px rgba(245, 197, 66, 0.28);
}

.btn-withdraw {
    background: linear-gradient(135deg, #f0b429 0%, #e6910a 100%);
    color: #1a0f00;
    font-weight: 800;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.btn-withdraw:hover {
    background: linear-gradient(135deg, #f5c84a 0%, #f0a820 100%);
    transform: scale(1.03);
    box-shadow: 0 0 12px rgba(240, 180, 41, 0.35);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* ==========================================================================
   History Bar (Top Multipliers Ribbon)
   ========================================================================== */
.history-bar-container {
    background: linear-gradient(90deg, #091220 0%, #101c2e 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.history-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.history-ribbon {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;
    padding: 2px 0;
}

.history-ribbon::-webkit-scrollbar {
    display: none;
}

.mult-pill {
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--transition-fast);
}

.mult-pill:hover {
    transform: translateY(-2px);
}

.mult-pill.low {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.mult-pill.medium {
    background: rgba(147, 51, 234, 0.15);
    color: #c084fc;
    border: 1px solid rgba(147, 51, 234, 0.35);
}

.mult-pill.high {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.4);
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.2);
}

.mult-pill.jackpot {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.5);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.3);
}

/* ==========================================================================
   Main Game Layout
   ========================================================================== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    padding: 16px 20px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.arena-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==========================================================================
   Flight Canvas Container
   ========================================================================== */
.canvas-wrapper {
    position: relative;
    background: #08101a;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    height: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#flightCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-badge-overlay {
    position: absolute;
    top: 14px;
    left: 16px;
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.round-tag {
    background: rgba(10, 20, 35, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ==========================================================================
   Dual Betting Control Panels
   ========================================================================== */
.betting-panels-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

#panel_1 {
    display: none !important;
}

@media (max-width: 640px) {
    .betting-panels-grid {
        grid-template-columns: 1fr;
    }
}

.bet-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    position: relative;
}

.card-header-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.tab-group {
    display: flex;
    background: var(--bg-input);
    border-radius: 20px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-strong) 100%);
    color: #181200;
}

.auto-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #27374d;
    transition: 0.2s;
    border-radius: 18px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--win-green);
}

input:checked + .slider:before {
    transform: translateX(14px);
}

/* Bet Panel Controls Body */
.panel-controls {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    align-items: center;
}

@media (max-width: 480px) {
    .panel-controls {
        grid-template-columns: 1fr;
    }
}

.inputs-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.stepper-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.stepper-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 800;
    width: 32px;
    height: 34px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.stepper-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.stepper-val {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    outline: none;
}

.quick-chips-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.chip-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Big Action Button */
.action-btn-col {
    display: flex;
    height: 100%;
    min-height: 80px;
}

.btn-action {
    width: 100%;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 900;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.08s ease, filter var(--transition-fast);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

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

.btn-action.btn-bet {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.btn-action.btn-bet:hover {
    background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
}

.btn-action.btn-cancel {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

.btn-action.btn-cashout {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    color: #111827;
    animation: pulseCashout 1s infinite alternate;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

@keyframes pulseCashout {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.02); filter: brightness(1.1); }
}

.btn-action.btn-disabled {
    background: #1f2d42;
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-main-label {
    font-size: 16px;
    letter-spacing: 0.5px;
}

.btn-sub-label {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 800;
}

/* Auto Cashout Row in Panel */
.auto-cashout-row {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.auto-cashout-row.visible {
    display: flex;
}

/* ==========================================================================
   Sidebar: Live Bets & Multi-Player Table
   ========================================================================== */
.sidebar-column {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 600px;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #0e1929;
}

.sidebar-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    padding: 12px 6px;
    cursor: pointer;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.sidebar-tab.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
    background: rgba(0, 132, 255, 0.05);
}

.sidebar-stats-bar {
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.sidebar-stats-bar span {
    color: #ffffff;
}

.table-container {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.table-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
    width: 0;
    height: 0;
}

.bets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.bets-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.bets-table td {
    padding: 7px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-variant-numeric: tabular-nums;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #e2e8f0;
}

.user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #ffffff;
}

.row-cashed-out {
    background: rgba(0, 200, 83, 0.08);
}

.row-cashed-out td {
    color: #4ade80;
}

.row-crashed {
    opacity: 0.45;
}

.mult-badge-mini {
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-block;
}

.mult-badge-mini.won {
    background: rgba(0, 200, 83, 0.2);
    color: #4ade80;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

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

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-backdrop.open .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-code-box {
    background: #090f18;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-family: monospace;
    font-size: 11px;
    color: #38bdf8;
    word-break: break-all;
    user-select: all;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: #0e1929;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
}

.signup-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.signup-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
}

.signup-input:focus {
    border-color: var(--primary-gold-strong);
    box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.14);
}

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

.signup-win-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 14px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(10, 23, 38, 0.9));
    border: 1px solid rgba(212, 175, 55, 0.28);
    box-shadow: inset 0 0 18px rgba(212, 175, 55, 0.08);
}

.signup-win-label {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-gold-strong);
    font-weight: 800;
}

.signup-win-amount {
    font-size: clamp(2.3rem, 6vw, 4rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    color: #fff7d7;
    text-shadow: 0 0 18px rgba(245, 197, 66, 0.32);
    margin-top: 8px;
}

.signup-win-sub {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.signup-hint {
    color: var(--text-muted);
    font-size: 11px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 13px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

.toast.win {
    border-left: 4px solid var(--win-green);
    color: #ffffff;
}

.toast.win .toast-val {
    color: var(--win-green);
    font-weight: 800;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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