:root {
            --bg-color: #121212;
            --text-color: #ffffff;
            --accent-color: #FFD700; /* Gold */
            --danger-color: #FF4757;
            --success-color: #2ED573;
            --ui-bg: rgba(30, 30, 30, 0.95);
            --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }

        * { box-sizing: border-box; touch-action: none; user-select: none; -webkit-user-select: none; }
        
        body {
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text-color);
            font-family: var(--font-family);
            overflow: hidden; /* Prevent scroll on mobile */
            height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* --- SPLASH SCREEN --- */
        #splash-screen {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: #000;
            z-index: 1000;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            transition: opacity 0.5s ease-out;
        }
        
        .splash-content { text-align: center; animation: zoomIn 0.5s ease-out; }
        .splash-logo { font-size: 5rem; margin-bottom: 20px; animation: bounce 2s infinite; }
        .splash-title { font-family: 'Segoe UI Black', Impact, sans-serif; font-size: 2.5rem; color: #fff; text-transform: uppercase; letter-spacing: 2px; margin: 0; line-height: 1; }
        .splash-subtitle { color: var(--accent-color); font-size: 1.5rem; margin-bottom: 40px; font-weight: bold; }
        .loading-container { width: 200px; height: 6px; background: #333; border-radius: 3px; margin: 0 auto; overflow: hidden; position: relative; }
        .loading-bar-fill { width: 0%; height: 100%; background: var(--success-color); box-shadow: 0 0 10px var(--success-color); animation: loadProgress 2s ease-in-out forwards; }

        @keyframes zoomIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
        @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
        @keyframes loadProgress { 0% { width: 0%; } 100% { width: 100%; } }

        /* HEADER */
        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            background: linear-gradient(180deg, #1e1e1e, #000000);
            border-bottom: 2px solid #333;
            height: 60px;
            z-index: 10;
            box-shadow: 0 4px 10px rgba(0,0,0,0.5);
            flex-wrap: nowrap;
        }

        .logo { font-size: 1.2rem; font-weight: 900; color: var(--accent-color); text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 2px 0 #000; white-space: nowrap; margin-right: 10px; }
        .balance-group { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
        .balance-display { font-size: 1.2rem; font-weight: 800; color: var(--success-color); text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
        
        .btn-free-money {
            background: linear-gradient(to bottom, #3498db, #2980b9);
            color: white; border: none; padding: 6px 14px; font-size: 0.85rem; font-weight: bold; border-radius: 20px; cursor: pointer; box-shadow: 0 3px 0 #1a5276; transition: transform 0.1s; white-space: nowrap;
        }
        .btn-free-money:active { transform: translateY(3px); box-shadow: 0 0 0 #1a5276; }

        .header-icons { display: flex; align-items: center; flex-shrink: 0; }
        .header-icons button { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #aaa; margin-left: 10px; transition: color 0.2s; padding: 0; display: flex; }
        .header-icons button:hover { color: #fff; }

        /* MAIN GAME AREA */
        #game-container { flex: 1; position: relative; background: #2c3e50; overflow: hidden; display: flex; justify-content: center; align-items: center; }
        canvas { box-shadow: 0 0 30px rgba(0,0,0,0.6); max-width: 100%; max-height: 100%; }

        /* UI OVERLAYS */
        .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); z-index: 20; transition: opacity 0.3s; }
        .hidden { display: none !important; opacity: 0; pointer-events: none; }

        .panel {
            background: var(--ui-bg); border: 1px solid rgba(255,255,255,0.1); padding: 30px; border-radius: 20px; text-align: center; max-width: 90%; width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,0.8); transform: scale(1); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        @keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

        h2 { margin-top: 0; color: var(--accent-color); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
        p { margin: 15px 0; line-height: 1.6; color: #ddd; }

        /* --- GOOGLE AD SLOT CONTAINER --- */
        #google-ad-slot {
            width: 300px; 
            height: 250px; 
            background: #fff; /* White bg for visibility if ad fails */
            margin: 15px auto;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #333;
            font-size: 0.8rem;
            border: 2px dashed #555;
        }

        /* --- CUSTOM MODAL STYLES --- */
        #custom-modal { z-index: 2000; }
        .modal-icon { font-size: 3rem; margin-bottom: 10px; display: block; }
        .modal-buttons { display: flex; gap: 15px; justify-content: center; margin-top: 25px; width: 100%; }
        .modal-buttons button { flex: 1; margin-top: 0; }

        /* CONTROLS AREA */
        #controls-area { height: 200px; background: linear-gradient(180deg, #222, #111); display: flex; flex-direction: column; padding: 15px; border-top: 1px solid #333; z-index: 30; box-shadow: 0 -5px 20px rgba(0,0,0,0.5); position: relative; }
        .bet-row { display: flex; justify-content: center; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
        .game-controls { display: flex; justify-content: space-between; align-items: center; flex: 1; padding: 0 10px; width: 100%; }
        .cashout-container { flex: 1; padding: 0 20px; }

        /* 3D BUTTONS */
        .btn-3d { border: none; border-radius: 12px; cursor: pointer; font-weight: 800; font-family: var(--font-family); transition: all 0.1s; position: relative; top: 0; text-transform: uppercase; letter-spacing: 0.5px; outline: none; -webkit-tap-highlight-color: transparent; }
        .btn-3d:active { top: 4px; }

        .btn-bet { background: #3a3a3a; color: #ccc; padding: 10px 16px; box-shadow: 0 4px 0 #222; }
        .btn-bet:active { box-shadow: 0 0 0 #222; }
        .btn-bet.active { background: var(--accent-color); color: #000; box-shadow: 0 4px 0 #b39700; }
        .btn-bet.active:active { box-shadow: 0 0 0 #b39700; }
        
        .btn-primary { background: var(--success-color); color: #fff; padding: 14px 24px; font-size: 1.1rem; width: 100%; margin-top: 15px; box-shadow: 0 5px 0 #1e8e4c; }
        .btn-primary:active { box-shadow: 0 0 0 #1e8e4c; }

        .btn-danger { background: var(--danger-color); color: #fff; padding: 12px 20px; width: 100%; margin-top: 8px; box-shadow: 0 4px 0 #c0392b; }
        .btn-danger:active { box-shadow: 0 0 0 #c0392b; }

        .btn-secondary { background: #3498db; color: #fff; padding: 12px 20px; margin-top: 12px; width: 100%; box-shadow: 0 4px 0 #2980b9; }
        .btn-secondary:active { box-shadow: 0 0 0 #2980b9; }
        
        .cashout-btn { background: linear-gradient(to bottom, #FFD700, #FFA500); color: #000; padding: 5px; font-size: 1.3rem; width: 100%; height: 80px; border-radius: 15px; box-shadow: 0 6px 0 #b87802, 0 10px 10px rgba(0,0,0,0.3); text-shadow: 0 1px 0 rgba(255,255,255,0.4); display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1.2; }
        .cashout-btn:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 0 0 #b87802; }
        .cashout-btn:disabled { background: #444; color: #888; box-shadow: 0 6px 0 #222; cursor: not-allowed; transform: none; }

        input[type="number"] { padding: 10px; border-radius: 8px; border: 2px solid #444; background: #222; color: #fff; width: 70px; text-align: center; font-weight: bold; font-size: 1rem; }

        .d-pad { display: flex; gap: 18px; }
        .d-btn { width: 65px; height: 65px; background: linear-gradient(to bottom, #555, #444); color: #fff; font-size: 1.8rem; border-radius: 50%; display: flex; justify-content: center; align-items: center; border: none; box-shadow: 0 6px 0 #222, 0 5px 5px rgba(0,0,0,0.3); cursor: pointer; transition: all 0.1s; }
        .d-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #222; }
        
        .jump-btn { width: 85px; height: 85px; background: radial-gradient(circle at 30% 30%, #2ecc71, #27ae60); border-radius: 50%; font-size: 2.5rem; color: #fff; border: 4px solid rgba(255,255,255,0.2); display: flex; justify-content: center; align-items: center; box-shadow: 0 8px 0 #1e8449, 0 10px 10px rgba(0,0,0,0.3); cursor: pointer; transition: all 0.1s; }
        .jump-btn:active { transform: translateY(8px); box-shadow: 0 0 0 #1e8449; }

        /* AD SIMULATION */
        #ad-progress-bar { width: 100%; height: 12px; background: #333; margin: 10px 0; border-radius: 10px; overflow: hidden; border: 1px solid #444; }
        #ad-progress-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #f1c40f, #e67e22); transition: width 0.1s linear; }

        /* HUD */
        #hud { position: absolute; top: 20px; left: 0; width: 100%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
        .hud-multiplier { font-size: 3.5rem; font-weight: 900; color: #fff; text-shadow: 0 4px 0 #000, 0 0 20px rgba(255, 215, 0, 0.5); font-family: 'Segoe UI Black', Impact, sans-serif; margin-bottom: 10px; }
        .hud-msg { font-size: 1.1rem; color: #fff; opacity: 0; font-weight: 800; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); padding: 8px 20px; border-radius: 30px; border: 1px solid rgba(255,255,255,0.2); text-transform: uppercase; letter-spacing: 1px; transform: translateY(10px); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
        .hud-msg.show { opacity: 1; transform: translateY(0); }

        /* THEMES */
        .theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 15px 0; }
        .theme-item { width: 40px; height: 40px; border-radius: 10px; border: 2px solid #555; cursor: pointer; position: relative; transition: transform 0.2s; box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
        .theme-item:hover { transform: translateY(-2px); }
        .theme-item.locked::after { content: '🔒'; font-size: 14px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-shadow: 0 1px 2px #000; }
        .theme-item.active { border-color: #fff; transform: scale(1.1); box-shadow: 0 0 15px var(--accent-color); z-index: 2; }

        .disclaimer { font-size: 0.75rem; color: #666; margin-top: 15px; font-style: italic; }

        /* MOBILE RESPONSIVE */
        @media (max-width: 600px) {
            header { padding: 5px 10px; }
            .logo { font-size: 0.9rem; margin-right: 5px; }
            .balance-group { gap: 8px; }
            .balance-display { font-size: 0.9rem; }
            .btn-free-money { padding: 4px 8px; font-size: 0.7rem; }
            .header-icons button { font-size: 1.2rem; margin-left: 5px; }
            #controls-area { height: auto; min-height: 180px; padding: 10px 5px; }
            .bet-row { gap: 6px; margin-bottom: 10px; }
            .btn-3d { font-size: 0.8rem; padding: 8px 10px; }
            .game-controls { padding: 0; }
            .d-pad { gap: 8px; }
            .d-btn { width: 50px; height: 50px; font-size: 1.4rem; box-shadow: 0 4px 0 #222, 0 3px 3px rgba(0,0,0,0.3); }
            .d-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #222; }
            .jump-btn { width: 70px; height: 70px; font-size: 2rem; box-shadow: 0 6px 0 #1e8449, 0 6px 6px rgba(0,0,0,0.3); }
            .jump-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #1e8449; }
            .cashout-container { padding: 0 8px; }
            .cashout-btn { height: 65px; }
            .cashout-btn span:first-child { font-size: 0.75rem; }
            #cashout-val { font-size: 1.1rem !important; }
        }