
        :root {
            --bg-dark: #0f172a;
            --bg-panel: #1e293b;
            --bg-panel-lighter: #334155;
            --accent-gold: #f59e0b;
            --accent-gold-hover: #d97706;
            --accent-blue: #3b82f6;
            --accent-green: #10b981;
            --accent-red: #ef4444;
            --text-light: #f8fafc;
            --text-dim: #94a3b8;
            --font-main: 'Montserrat', sans-serif;
            --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
            --glass-border: 1px solid rgba(255, 255, 255, 0.1);
        }

        * {
            box-sizing: border-box;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            margin: 0;
            overflow: hidden;
            height: 100vh;
            width: 100vw;
            font-family: var(--font-main);
            background-color: var(--bg-dark);
            color: var(--text-light);
        }

        /* --- SPLASH SCREEN --- */
        #splash-screen {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: opacity 0.6s ease-out;
        }
        
        .splash-content {
            text-align: center;
            position: relative;
        }

        .splash-logo {
            font-size: 3.5rem;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 3px;
            margin-bottom: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            background: linear-gradient(135deg, #fceabb 0%, #f8b500 50%, #fceabb 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            filter: drop-shadow(0 0 20px rgba(248, 181, 0, 0.4));
            animation: shimmer 3s infinite linear;
            background-size: 200% auto;
        }
        
        .splash-logo i {
            font-size: 3rem;
            background: linear-gradient(135deg, #fceabb, #f8b500);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        @keyframes shimmer {
            to { background-position: 200% center; }
        }

        .loader-track {
            width: 240px;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            margin: 0 auto 15px;
            overflow: hidden;
            position: relative;
        }

        .loader-bar {
            position: absolute;
            top: 0; left: 0; height: 100%; width: 0%;
            background: var(--accent-gold);
            box-shadow: 0 0 15px var(--accent-gold);
            border-radius: 4px;
            animation: load 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        }

        @keyframes load {
            0% { width: 0%; }
            40% { width: 60%; }
            100% { width: 100%; }
        }

        .loading-text {
            color: var(--text-dim);
            font-size: 0.75rem;
            letter-spacing: 2px;
            text-transform: uppercase;
            font-weight: 600;
            opacity: 0.7;
        }

        #splash-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }

        /* --- LAYOUT --- */
        #app {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        /* --- NAVBAR --- */
        #navbar {
            height: 50px;
            background: rgba(15, 23, 42, 0.95);
            border-bottom: var(--glass-border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 15px;
            z-index: 200;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
            flex-shrink: 0; /* Prevent navbar from shrinking */
        }

        .logo {
            font-weight: 800;
            font-size: 1.1rem;
            color: var(--text-light);
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .logo i { color: var(--accent-gold); }

        .nav-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .wallet-pill {
            background: var(--bg-panel-lighter);
            padding: 4px 12px;
            border-radius: 15px;
            font-weight: 700;
            color: var(--accent-green);
            display: flex;
            align-items: center;
            gap: 6px;
            border: var(--glass-border);
            font-size: 0.9rem;
        }

        .nav-btn {
            background: transparent;
            border: none;
            color: var(--text-dim);
            cursor: pointer;
            font-size: 1rem;
            transition: color 0.2s;
            position: relative;
        }
        .nav-btn:hover { color: var(--text-light); }
        
        .btn-ad {
            background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
            color: #000;
            font-weight: 700;
            font-size: 0.75rem;
            padding: 5px 10px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            gap: 5px;
            box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
        }
        .btn-ad:active { transform: scale(0.95); }

        /* --- MAIN CONTENT --- */
        #main-content {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        /* --- GAME CANVAS --- */
        #game-area {
            flex: 1;
            position: relative;
            background: linear-gradient(to bottom, #1a1a2e, #16213e); 
        }
        
        #game-canvas {
            width: 100%;
            height: 100%;
            display: block;
        }

        /* --- SIDEBAR --- */
        #sidebar {
            width: 280px; /* More compact */
            background: var(--bg-panel);
            border-left: var(--glass-border);
            display: flex;
            flex-direction: column;
            z-index: 100;
            padding: 12px;
            gap: 12px;
        }

        /* Sidebar Header Stats - Compact */
        .game-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }
        .stat-card {
            background: var(--bg-panel-lighter);
            padding: 8px;
            border-radius: 6px;
            text-align: center;
            border: var(--glass-border);
        }
        .stat-label { 
            font-size: 0.65rem; 
            color: var(--text-dim); 
            text-transform: uppercase; 
            margin-bottom: 2px;
        }
        .stat-val { 
            font-size: 1rem; 
            font-weight: 700; 
            color: var(--accent-gold); 
            line-height: 1.2;
        }
        .stat-val.win { color: var(--accent-green); }

        /* Controls */
        .control-section {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        
        .section-label {
            font-size: 0.7rem;
            color: var(--text-dim);
            font-weight: 600;
            text-transform: uppercase;
        }

        .input-group {
            position: relative;
            display: flex;
            align-items: center;
        }
        .input-icon {
            position: absolute;
            left: 10px;
            color: var(--text-dim);
            font-size: 0.8rem;
        }
        input[type="number"] {
            width: 100%;
            background: var(--bg-dark);
            border: 1px solid var(--bg-panel-lighter);
            padding: 8px 8px 8px 30px;
            border-radius: 5px;
            color: white;
            font-family: var(--font-main);
            font-weight: 600;
            font-size: 0.9rem;
        }
        input:focus { outline: 1px solid var(--accent-blue); }

        /* Risk Buttons - Compact Grid */
        .risk-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
        }
        .risk-btn {
            background: var(--bg-panel-lighter);
            border: 1px solid transparent;
            padding: 8px 4px;
            border-radius: 5px;
            color: var(--text-dim);
            font-family: var(--font-main);
            font-size: 0.7rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1px;
        }
        .risk-btn span { font-size: 0.55rem; opacity: 0.7; font-weight: 400; }
        
        .risk-btn.active {
            background: rgba(59, 130, 246, 0.15);
            border-color: var(--accent-blue);
            color: white;
        }
        .risk-btn.low.active { border-color: var(--accent-green); background: rgba(16, 185, 129, 0.15); }
        .risk-btn.med.active { border-color: var(--accent-gold); background: rgba(245, 158, 11, 0.15); }
        .risk-btn.high.active { border-color: #f97316; background: rgba(249, 115, 22, 0.15); }
        .risk-btn.ext.active { border-color: var(--accent-red); background: rgba(239, 68, 68, 0.15); }

        /* Main Action Buttons */
        .btn-main {
            width: 100%;
            padding: 12px;
            border: none;
            border-radius: 6px;
            font-family: var(--font-main);
            font-weight: 800;
            font-size: 0.9rem;
            text-transform: uppercase;
            cursor: pointer;
            transition: transform 0.1s, filter 0.2s;
            box-shadow: 0 3px 5px rgba(0,0,0,0.2);
        }
        .btn-main:active { transform: translateY(1px); }
        .btn-main:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

        .btn-bet { background: var(--accent-green); color: #000; }
        .btn-bet:hover { background: #34d399; }

        .game-controls { display: flex; gap: 8px; }
        .btn-stack { flex: 1; background: var(--accent-blue); color: white; }
        .btn-cashout { flex: 1; background: var(--accent-gold); color: #000; }

        /* History */
        .history-section {
            margin-top: auto;
            border-top: var(--glass-border);
            padding-top: 10px;
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-height: 80px;
        }
        .history-list {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding-right: 2px;
        }
        /* Custom Scrollbar */
        .history-list::-webkit-scrollbar { width: 3px; }
        .history-list::-webkit-scrollbar-thumb { background: var(--bg-panel-lighter); border-radius: 2px; }

        .history-item {
            display: flex;
            justify-content: space-between;
            background: rgba(255,255,255,0.03);
            padding: 6px 8px;
            border-radius: 3px;
            font-size: 0.75rem;
        }
        .h-mult { font-weight: 700; }
        .h-profit { font-family: monospace; }
        .history-item.win { border-left: 2px solid var(--accent-green); }
        .history-item.win .h-mult, .history-item.win .h-profit { color: var(--accent-green); }
        .history-item.loss { border-left: 2px solid var(--accent-red); opacity: 0.7; }
        .history-item.loss .h-mult, .history-item.loss .h-profit { color: var(--text-dim); }

        /* Overlays */
        #floating-msg {
            position: absolute;
            top: 25%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            pointer-events: none;
            z-index: 50;
        }
        .float-txt {
            font-size: 3.5rem;
            font-weight: 900;
            text-shadow: 0 4px 10px rgba(0,0,0,0.5);
            opacity: 0;
            transform: scale(0.5);
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        .float-txt.show { opacity: 1; transform: scale(1); }
        .float-txt.crash { color: var(--accent-red); font-family: 'Courier New', monospace; }
        .float-txt.win { color: var(--accent-green); }

        /* --- 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: 1000;
            display: none;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s;
        }
        .modal-overlay.open { display: flex; opacity: 1; }
        
        .modal-card {
            background: var(--bg-panel);
            width: 90%;
            max-width: 400px;
            border-radius: 12px;
            border: var(--glass-border);
            padding: 25px;
            position: relative;
            transform: translateY(20px);
            transition: transform 0.3s;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
        }
        .modal-overlay.open .modal-card { transform: translateY(0); }

        .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
        .modal-header h3 { margin: 0; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }
        .close-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.5rem; }
        
        .modal-body { color: var(--text-dim); font-size: 0.9rem; line-height: 1.6; }
        .modal-body ul { padding-left: 20px; margin-bottom: 0; }
        .modal-body li { margin-bottom: 8px; }

        .ad-timer-container {
            text-align: center;
            margin-top: 20px;
        }
        .ad-circle {
            width: 80px; height: 80px;
            border-radius: 50%;
            border: 4px solid var(--bg-panel-lighter);
            margin: 0 auto 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--accent-gold);
            position: relative;
        }
        .ad-circle svg {
            position: absolute;
            top: -4px; left: -4px;
            width: 80px; height: 80px;
            transform: rotate(-90deg);
        }
        .ad-circle circle {
            fill: none;
            stroke: var(--accent-gold);
            stroke-width: 4;
            stroke-dasharray: 240;
            stroke-dashoffset: 240;
            transition: stroke-dashoffset 1s linear;
        }
        .ad-msg { font-size: 0.9rem; margin-bottom: 20px; }

        /* Responsive */
        @media (max-width: 768px) {
            #main-content { flex-direction: column; } 
            #sidebar { 
                width: 100%; 
                height: 50%; 
                padding: 10px; 
                border-left: none; 
                border-top: var(--glass-border);
                overflow-y: auto; /* Enable Scroll */
                -webkit-overflow-scrolling: touch;
            }
            #game-area { height: 50%; }
            .history-section { display: flex; min-height: 120px; } /* Visible and sized */
            .game-stats { margin-bottom: 8px; }
            .control-section { gap: 4px; }
        }
    
/* Casino: narrow embedded viewport */
@media (max-width: 600px) {

#navbar { flex-wrap: wrap; height: auto; min-height: 60px; padding: 8px; gap: 6px; }
.nav-right { flex-wrap: wrap; max-width: 100%; gap: 6px; }
#btn-watch-ad { display: none; }
}
