
        :root {
            --bg-dark: #0f111a;
            --sidebar-bg: rgba(21, 26, 38, 0.95);
            --nav-bg: rgba(21, 26, 38, 0.9);
            --primary: #ffd700;       /* Gold */
            --accent: #00ff88;        /* Green */
            --accent-hover: #00cc6a;
            --danger: #ff4757;        /* Red */
            --text-main: #ffffff;
            --text-dim: #8b9bb4;
            --border: rgba(255,255,255,0.08);
            --glass: blur(12px);
            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
        }

        * { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

        body {
            margin: 0; padding: 0;
            overflow: hidden;
            background: #0f111a;
            font-family: 'Inter', sans-serif;
            color: var(--text-main);
            height: 100vh;
            width: 100vw;
            display: flex;
        }

        /* --- SPLASH SCREEN --- */
        #splash-screen {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: radial-gradient(circle at center, #1a1e2e 0%, #090a0f 100%);
            z-index: 9999;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: opacity 0.8s ease-out;
        }
        
        #splash-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .splash-logo {
            font-family: 'Rajdhani', sans-serif;
            font-size: 4rem;
            font-weight: 800;
            color: #fff;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            margin-bottom: 40px;
            animation: pulseLogo 2s infinite ease-in-out;
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        
        .splash-logo i {
            font-size: 5rem;
            color: var(--primary);
            filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.4));
        }

        .loader-container {
            width: 200px;
            height: 4px;
            background: rgba(255,255,255,0.1);
            border-radius: 4px;
            overflow: hidden;
            position: relative;
        }

        .loader-bar {
            width: 0%;
            height: 100%;
            background: var(--primary);
            box-shadow: 0 0 10px var(--primary);
            animation: loadProgress 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        }

        .loading-text {
            margin-top: 15px;
            font-size: 0.8rem;
            color: var(--text-dim);
            font-family: 'Rajdhani', sans-serif;
            letter-spacing: 1px;
        }

        @keyframes pulseLogo {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }

        @keyframes loadProgress {
            0% { width: 0%; }
            50% { width: 60%; }
            100% { width: 100%; }
        }

        /* 3D Canvas Background */
        #game-container {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            z-index: 0;
        }

        /* --- NAVBAR --- */
        .navbar {
            position: absolute;
            top: 0; left: 0; width: 100%;
            height: 60px; /* Reduced height */
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            background: var(--nav-bg);
            border-bottom: 1px solid var(--border);
            backdrop-filter: var(--glass);
            z-index: 10;
        }

        .logo {
            display: flex; align-items: center; gap: 8px;
            font-family: 'Rajdhani', sans-serif;
            font-size: 1.4rem;
            font-weight: 800;
            letter-spacing: 1px;
            color: #fff;
        }
        .logo i { color: var(--primary); font-size: 1.6rem; }

        .nav-actions { display: flex; align-items: center; gap: 10px; }

        .nav-btn {
            background: rgba(255,255,255,0.05);
            border: 1px solid var(--border);
            color: var(--text-dim);
            padding: 6px 12px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
            display: flex; align-items: center; gap: 6px;
            transition: all 0.2s;
        }
        .nav-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
        .nav-btn.ad-btn { background: rgba(255, 215, 0, 0.1); color: var(--primary); border-color: rgba(255, 215, 0, 0.2); }
        .nav-btn.ad-btn:hover { background: rgba(255, 215, 0, 0.2); }

        .wallet-display {
            background: rgba(0,0,0,0.3);
            padding: 6px 12px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--accent);
            color: var(--accent);
            font-family: 'Rajdhani', sans-serif;
            font-weight: 700;
            font-size: 1rem;
            display: flex; align-items: center; gap: 6px;
            box-shadow: 0 0 15px rgba(0, 255, 136, 0.1);
        }

        /* --- RIGHT SIDEBAR --- */
        .sidebar {
            position: absolute;
            right: 0; top: 60px; bottom: 0;
            width: 320px;
            background: var(--sidebar-bg);
            border-left: 1px solid var(--border);
            backdrop-filter: var(--glass);
            padding: 15px; /* Compact padding */
            display: flex;
            flex-direction: column;
            gap: 12px; /* Compact gap */
            z-index: 10;
            transform: translateX(0);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .panel-section { display: flex; flex-direction: column; gap: 6px; }
        .label { font-size: 0.7rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

        /* Bet Input */
        .input-wrapper {
            position: relative;
            background: rgba(0,0,0,0.4);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            display: flex; align-items: center;
            padding: 2px;
            transition: border-color 0.2s;
        }
        .input-wrapper:focus-within { border-color: var(--primary); }
        
        .coin-icon { color: var(--primary); padding-left: 8px; font-size: 1.1rem; }
        
        input[type="number"] {
            width: 100%;
            background: transparent;
            border: none;
            color: #fff;
            font-family: 'Rajdhani', sans-serif;
            font-size: 1.1rem; /* Slightly smaller */
            font-weight: 700;
            padding: 8px; /* Compact */
            outline: none;
        }

        .multipliers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
        .mult-btn {
            background: rgba(255,255,255,0.05);
            border: none;
            color: var(--text-dim);
            padding: 6px; /* Compact */
            border-radius: 4px;
            font-size: 0.7rem;
            font-weight: 600;
            cursor: pointer;
            transition: 0.2s;
        }
        .mult-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

        /* Side Selection */
        .side-toggle {
            display: flex;
            background: rgba(0,0,0,0.4);
            padding: 3px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
        }
        .side-option {
            flex: 1;
            padding: 8px; /* Compact */
            text-align: center;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.3s;
            font-weight: 700;
            color: var(--text-dim);
            display: flex; flex-direction: column; align-items: center; gap: 3px;
        }
        .side-option i { font-size: 1.3rem; }
        .side-option span { font-size: 0.75rem; text-transform: uppercase; }

        /* Active States */
        .side-option.active-heads { background: var(--primary); color: #000; box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3); }
        .side-option.active-tails { background: #e0e0e0; color: #000; box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2); }

        /* Main Button */
        .action-btn {
            background: var(--accent);
            color: #000;
            border: none;
            padding: 12px; /* Compact */
            border-radius: var(--radius-md);
            font-family: 'Rajdhani', sans-serif;
            font-size: 1.1rem;
            font-weight: 800;
            letter-spacing: 1px;
            cursor: pointer;
            text-transform: uppercase;
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
            transition: all 0.2s;
            margin-top: 5px;
        }
        .action-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
        .action-btn:active { transform: scale(0.98); }
        .action-btn:disabled { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; transform: none; }

        /* History List (Vertical) */
        .history-section {
            margin-top: auto;
            border-top: 1px solid var(--border);
            padding-top: 10px;
            flex: 1; /* Takes remaining height */
            display: flex;
            flex-direction: column;
            overflow: hidden; 
            min-height: 0; /* Crucial for nested scroll */
        }
        
        .history-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 8px;
            overflow-y: auto; /* Enable vertical scroll */
            padding-right: 5px;
            flex: 1;
            /* Smooth scrolling for touch */
            -webkit-overflow-scrolling: touch; 
        }
        
        /* Custom Scrollbar */
        .history-list::-webkit-scrollbar { width: 4px; }
        .history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

        .hist-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0,0,0,0.3);
            padding: 8px 10px; /* Compact */
            border-radius: 6px;
            border-left: 3px solid transparent;
            animation: slideIn 0.3s ease-out;
            flex-shrink: 0; /* Prevent shrinking */
        }
        
        @keyframes slideIn {
            from { opacity: 0; transform: translateX(20px); }
            to { opacity: 1; transform: translateX(0); }
        }

        .hist-item.win { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(0,255,136,0.05), transparent); }
        .hist-item.lose { border-left-color: var(--danger); }

        .hist-side {
            font-weight: 700;
            font-size: 0.75rem;
            display: flex; align-items: center; gap: 6px;
            text-transform: uppercase;
        }
        .hist-amt {
            font-family: 'Rajdhani', sans-serif;
            font-weight: 700;
            font-size: 0.95rem;
        }
        .hist-amt.plus { color: var(--accent); }
        .hist-amt.minus { color: var(--text-dim); }

        /* --- POPUPS / MODALS --- */
        .modal-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(5px);
            z-index: 100;
            display: flex; align-items: center; justify-content: center;
            opacity: 0; pointer-events: none;
            transition: opacity 0.3s;
        }
        .modal-overlay.open { opacity: 1; pointer-events: auto; }

        .modal-card {
            background: #1a1f2e;
            width: 90%; max-width: 450px;
            border-radius: 20px;
            border: 1px solid var(--border);
            padding: 30px;
            text-align: center;
            transform: scale(0.9);
            transition: transform 0.3s;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
        }
        .modal-overlay.open .modal-card { transform: scale(1); }

        .modal-icon {
            font-size: 3rem; color: var(--primary);
            margin-bottom: 15px;
        }
        .modal-title {
            font-family: 'Rajdhani', sans-serif;
            font-size: 2rem; margin: 0 0 10px 0;
            color: #fff;
        }
        .modal-text {
            color: var(--text-dim);
            line-height: 1.6;
            margin-bottom: 25px;
            font-size: 0.95rem;
        }
        .btn-close, .btn-claim {
            background: rgba(255,255,255,0.1);
            border: none; color: #fff;
            padding: 12px 24px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: 0.2s;
            width: 100%;
        }
        .btn-close:hover { background: rgba(255,255,255,0.2); }
        .btn-claim { background: var(--accent); color: #000; display: none; } /* Hidden initially */
        
        /* Result Center Display */
        #result-display {
            position: absolute;
            top: 50%; 
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            pointer-events: none;
            z-index: 5;
            opacity: 0;
            transition: opacity 0.3s, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        
        #result-display.active { opacity: 1; transform: translate(-50%, -60%); }
        .res-main { font-family: 'Rajdhani'; font-size: 5rem; font-weight: 800; line-height: 1; text-transform: uppercase; -webkit-text-stroke: 2px rgba(0,0,0,0.5); }
        .res-sub { background: rgba(0,0,0,0.6); padding: 5px 20px; border-radius: 20px; font-weight: 600; display: inline-block; margin-top: 10px; font-size: 1.5rem; }
        .win-text { color: var(--accent); text-shadow: 0 0 30px var(--accent); }
        .lose-text { color: var(--danger); text-shadow: 0 0 30px var(--danger); }

        /* Confetti */
        .confetti { position: absolute; width: 8px; height: 8px; background: var(--primary); animation: fall linear forwards; z-index: 50; }
        @keyframes fall { to { transform: translateY(100vh) rotate(720deg); } }

        /* Desktop specific layout adjustment */
        @media (min-width: 769px) {
            #result-display {
                /* Increased offset even more to move play area left */
                left: calc(50% - 350px); 
            }
        }

        /* Mobile Responsive */
        @media (max-width: 768px) {
            .navbar { padding: 0 15px; }
            .logo span { display: none; } /* Hide text logo on small mobile */
            .sidebar {
                width: 100%;
                height: 55vh; /* Slightly increased to fit history */
                top: auto; bottom: 0;
                border-left: none;
                border-top: 1px solid var(--border);
                border-radius: 20px 20px 0 0;
                overflow: hidden; /* Prevent body scroll, let history list scroll */
                padding-bottom: 20px;
            }
            #result-display { left: 50%; top: 25%; } /* Move result up */
            
            /* Enable history on mobile */
            .history-section { 
                display: flex; 
            } 
        }
    