        /* ============================================================================
           1. APPLE LIQUID GLASS & СТИЛИСТИЧЕСКИЕ ТЕМЫ (НЕ ПРОСТО РЕКОЛОР, А ГЕОМЕТРИЯ И FX)
           ============================================================================ */
        :root {
            --glass-bg: rgba(255, 255, 255, 0.08);
            --glass-bg-elevated: rgba(255, 255, 255, 0.13);
            --glass-border: rgba(255, 255, 255, 0.22);
            --glass-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.45), inset 0 -1px 2px rgba(0, 0, 0, 0.25);
            --glass-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
            --radius-main: 28px;
            --radius-inner: 20px;
            --accent-primary: #38bdf8;
            --accent-secondary: #818cf8;
            --font-active: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
        }

        body {
            font-family: var(--font-active);
            background-color: #050811;
            overflow-x: hidden;
            transition: background-color 0.5s ease;
        }

        /* Базовый контейнер Liquid Glass */
        .liquid-panel {
            background: var(--glass-bg);
            backdrop-filter: blur(28px) saturate(180%);
            -webkit-backdrop-filter: blur(28px) saturate(180%);
            border: 1px solid var(--glass-border);
            box-shadow: var(--glass-highlight), var(--glass-shadow);
            border-radius: var(--radius-main);
            transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        }

        .liquid-card {
            background: var(--glass-bg-elevated);
            backdrop-filter: blur(18px) saturate(160%);
            -webkit-backdrop-filter: blur(18px) saturate(160%);
            border: 1px solid var(--glass-border);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
            border-radius: var(--radius-inner);
            transition: all 0.35s ease;
        }

        /* --- СТИЛЬ 1: APPLE LIQUID GLASS (По умолчанию — сферические блики и плавные капсулы) --- */
        body.style-liquid {
            --glass-bg: rgba(255, 255, 255, 0.07);
            --glass-bg-elevated: rgba(255, 255, 255, 0.12);
            --glass-border: rgba(255, 255, 255, 0.24);
            --radius-main: 30px;
            --radius-inner: 20px;
            --accent-primary: #38bdf8;
            --accent-secondary: #a855f7;
            --font-active: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
        }

        /* --- СТИЛЬ 2: CYBERPUNK OVERDRIVE (Скошенные углы clip-path, неон, сканлайны, моноширинный HUD) --- */
        body.style-cyberpunk {
            --glass-bg: rgba(16, 6, 32, 0.78);
            --glass-bg-elevated: rgba(32, 10, 58, 0.85);
            --glass-border: #f43f5e;
            --glass-highlight: inset 0 0 18px rgba(244, 63, 94, 0.35);
            --radius-main: 4px;
            --radius-inner: 2px;
            --accent-primary: #00f0ff;
            --accent-secondary: #f43f5e;
            --font-active: 'SF Mono', ui-monospace, Menlo, monospace;
        }
        body.style-cyberpunk .liquid-panel {
            clip-path: polygon(0 14px, 14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
            border-width: 1.5px;
        }
        body.style-cyberpunk::after {
            content: "";
            position: fixed;
            inset: 0;
            background: repeating-linear-gradient(0deg, rgba(0, 240, 255, 0.03) 0px, rgba(0, 240, 255, 0.03) 1px, transparent 1px, transparent 3px);
            pointer-events: none;
            z-index: 40;
        }

        /* --- СТИЛЬ 3: ROYAL MONACO GOLD (Арт-деко двойные рамки, антиква, золотое тиснение) --- */
        body.style-monaco {
            --glass-bg: rgba(24, 18, 10, 0.82);
            --glass-bg-elevated: rgba(42, 31, 14, 0.88);
            --glass-border: #fbbf24;
            --glass-highlight: inset 0 0 0 3px rgba(251, 191, 36, 0.18), 0 12px 35px rgba(180, 83, 9, 0.35);
            --radius-main: 18px;
            --radius-inner: 12px;
            --accent-primary: #fbbf24;
            --accent-secondary: #d97706;
            --font-active: Georgia, 'Times New Roman', serif;
        }
        body.style-monaco .liquid-panel {
            border-style: double;
            border-width: 3px;
        }

        /* --- СТИЛЬ 4: RETRO WINDOWS 95 / ARCADE (Жёсткие пиксельные 3D-фаски, без блюра, системный шрифт) --- */
        body.style-retro95 {
            --glass-bg: #c0c0c0;
            --glass-bg-elevated: #d4d0c8;
            --glass-border: #ffffff;
            --glass-highlight: inset 2px 2px 0px #ffffff, inset -2px -2px 0px #404040, 4px 4px 0px #000000;
            --glass-shadow: 6px 6px 0px rgba(0,0,0,0.85);
            --radius-main: 0px;
            --radius-inner: 0px;
            --accent-primary: #000080;
            --accent-secondary: #008080;
            --font-active: 'Courier New', monospace;
            color: #111111 !important;
        }
        body.style-retro95 .liquid-panel,
        body.style-retro95 .liquid-card {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            color: #111111;
        }
        body.style-retro95 .text-white,
        body.style-retro95 .text-slate-100,
        body.style-retro95 .text-slate-200 {
            color: #111111 !important;
        }
        body.style-retro95 .text-slate-400,
        body.style-retro95 .text-slate-300 {
            color: #333333 !important;
        }

        /* --- СТИЛЬ 5: MATRIX TERMINAL (Зелёный фосфор, CRT-виньетка, моноширинный код) --- */
        body.style-matrix {
            --glass-bg: rgba(2, 16, 6, 0.88);
            --glass-bg-elevated: rgba(5, 28, 10, 0.92);
            --glass-border: #22c55e;
            --glass-highlight: inset 0 0 20px rgba(34, 197, 94, 0.25);
            --radius-main: 8px;
            --radius-inner: 4px;
            --accent-primary: #22c55e;
            --accent-secondary: #15803d;
            --font-active: 'SF Mono', ui-monospace, monospace;
        }
        body.style-matrix * {
            text-shadow: 0 0 6px rgba(34, 197, 94, 0.35);
        }

        /* --- СТИЛЬ 6: FROSTED ARCTIC WHITE (Светлый матовый ледяной хрусталь Apple VisionOS) --- */
        body.style-arctic {
            --glass-bg: rgba(255, 255, 255, 0.68);
            --glass-bg-elevated: rgba(255, 255, 255, 0.84);
            --glass-border: rgba(255, 255, 255, 0.95);
            --glass-highlight: inset 0 2px 3px #ffffff, 0 20px 40px rgba(15, 23, 42, 0.12);
            --radius-main: 34px;
            --radius-inner: 22px;
            --accent-primary: #0284c7;
            --accent-secondary: #6366f1;
            --font-active: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
            color: #0f172a !important;
        }
        body.style-arctic .text-white,
        body.style-arctic .text-slate-100,
        body.style-arctic .text-slate-200 {
            color: #0f172a !important;
        }
        body.style-arctic .text-slate-400,
        body.style-arctic .text-slate-300 {
            color: #475569 !important;
        }

        /* Живые жидкие орбы на фоне (Liquid Mesh) */
        @keyframes floatOrb1 {
            0%, 100% { transform: translate(0, 0) scale(1); }
            33% { transform: translate(60px, -40px) scale(1.15); }
            66% { transform: translate(-40px, 50px) scale(0.92); }
        }
        @keyframes floatOrb2 {
            0%, 100% { transform: translate(0, 0) scale(1); }
            50% { transform: translate(-70px, -50px) scale(1.2); }
        }
        .liquid-orb-1 { animation: floatOrb1 16s ease-in-out infinite; }
        .liquid-orb-2 { animation: floatOrb2 20s ease-in-out infinite; }

        /* Физика барабанов */
        @keyframes reelBlurFast {
            0% { transform: translateY(-12px) scaleY(1.22); filter: blur(2.5px); }
            50% { transform: translateY(12px) scaleY(0.88); filter: blur(3.5px); }
            100% { transform: translateY(-12px) scaleY(1.22); filter: blur(2.5px); }
        }
        .spinning-symbol { animation: reelBlurFast 0.085s infinite linear; }

        @keyframes reelBounceStop {
            0% { transform: translateY(-16px) scaleY(1.1); }
            55% { transform: translateY(7px) scaleY(0.94); }
            80% { transform: translateY(-3px) scaleY(1.02); }
            100% { transform: translateY(0) scaleY(1); }
        }
        .reel-stopped-bounce { animation: reelBounceStop 0.28s cubic-bezier(0.22, 1, 0.36, 1); }

        @keyframes anticipationPulse {
            0%, 100% { box-shadow: inset 0 0 16px rgba(245, 158, 11, 0.45), 0 0 22px rgba(245, 158, 11, 0.7); border-color: #fbbf24; }
            50% { box-shadow: inset 0 0 28px rgba(239, 68, 68, 0.75), 0 0 32px rgba(239, 68, 68, 0.95); border-color: #f87171; }
        }
        .anticipation-glow { animation: anticipationPulse 0.34s infinite ease-in-out !important; }

        @keyframes popWinCell {
            0% { transform: scale(0.9); }
            50% { transform: scale(1.16); }
            100% { transform: scale(1.04); }
        }
        .win-cell-glow {
            animation: popWinCell 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
            background: radial-gradient(circle, rgba(251,191,36,0.34) 0%, rgba(15,23,42,0.85) 85%) !important;
            border-color: #fbbf24 !important;
            box-shadow: 0 0 18px rgba(251, 191, 36, 0.6);
        }

        /* Мягкий стеклянный импульс вместо тряски экрана */
        @keyframes glassPulse {
            0% { box-shadow: var(--glass-highlight), var(--glass-shadow); }
            45% { box-shadow: inset 0 0 26px rgba(255, 255, 255, 0.32), 0 0 34px -4px var(--accent-primary); }
            100% { box-shadow: var(--glass-highlight), var(--glass-shadow); }
        }
        .glass-pulse { animation: glassPulse 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

        @keyframes rainbowNeon {
            0% { border-color: #ff0080; box-shadow: 0 0 22px rgba(255, 0, 128, 0.4); }
            33% { border-color: #00e676; box-shadow: 0 0 22px rgba(0, 230, 118, 0.4); }
            66% { border-color: #38bdf8; box-shadow: 0 0 22px rgba(56, 189, 248, 0.4); }
            100% { border-color: #ff0080; box-shadow: 0 0 22px rgba(255, 0, 128, 0.4); }
        }
        .adhd-rainbow { animation: rainbowNeon 2s linear infinite !important; }

        @keyframes tickerLoop {
            0% { transform: translateX(0); }
            100% { transform: translateX(-50%); }
        }
        .ticker-track { display: flex; width: max-content; animation: tickerLoop 34s linear infinite; }
        .ticker-track:hover { animation-play-state: paused; }

        @keyframes floatUpFade {
            0% { opacity: 1; transform: translate(-50%, 0) scale(0.85); }
            100% { opacity: 0; transform: translate(-50%, -48px) scale(1.25); }
        }
        .floating-gain {
            position: fixed;
            pointer-events: none;
            z-index: 9999;
            font-weight: 900;
            animation: floatUpFade 0.68s cubic-bezier(0.16, 1, 0.3, 1) forwards;
            text-shadow: 0 2px 10px rgba(0,0,0,0.45);
        }

        /* Золотая кнопка в стиле Liquid Glass */
        .liquid-btn-primary {
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
            box-shadow: inset 0 1px 1px rgba(255,255,255,0.55), 0 10px 24px -6px rgba(56, 189, 248, 0.45);
            border: 1px solid rgba(255, 255, 255, 0.35);
            color: #ffffff !important;
        }

        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 9999px; }
    
                /* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */
        html, body { max-width: 100%; overflow-x: hidden; }
        body { min-height: 100vh; min-height: 100dvh; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
        input { -webkit-user-select: text; user-select: text; }

        @media (max-width: 639px) {
            /* шапка в две строки: логотип сверху, кнопки в ряд снизу */
            header.liquid-panel { flex-wrap: wrap; row-gap: 8px; }
            header h1 { font-size: 15px; }
            #headerActions { width: 100%; display: grid; grid-template-columns: 1.5fr 1.2fr 1fr 1fr auto; gap: 6px; }
            #headerActions > button, #headerActions > #soundBox { padding: 7px 4px; font-size: 11px; justify-content: center; text-align: center; white-space: nowrap; }
            #headerActions > button { min-width: 0; }
            #soundBox { padding: 7px 8px !important; }
            /* поля ввода >=16px, иначе iOS приближает экран при фокусе */
            input[type="number"] { font-size: 16px !important; }
            /* крупнее зоны нажатия */
            #betButtons button, .arc-tab { min-height: 38px; }
            #spinBtn { min-height: 52px; }
            .liquid-panel { --radius-main: 24px; }
        }

        /* ===== TELEGRAM MINI APP ===== */
        body {
            padding-top: var(--tg-content-safe-area-inset-top, 0px);
            padding-bottom: var(--tg-safe-area-inset-bottom, 0px);
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
        }
        /* Облегчённый режим для слабых телефонов: меньше блюра */
        body.tg-lite .liquid-panel,
        body.tg-lite .liquid-card {
            backdrop-filter: blur(8px) !important;
            -webkit-backdrop-filter: blur(8px) !important;
        }
        body.tg-lite #liquidBackdrop > div { filter: blur(40px) !important; }

        /* ===== ИНТЕРФЕЙС, ЧИТАЕМОСТЬ И МОБИЛЬНАЯ ОПТИМИЗАЦИЯ ===== */
        main, main > section, main > aside, .liquid-card { min-width: 0; }
        .metric-value {
            font-size: clamp(14px, 2vw, 24px);
            line-height: 1.2;
            letter-spacing: -0.035em;
            white-space: nowrap;
            font-variant-numeric: tabular-nums;
        }
        #balanceCard { transition: border-color 0.2s ease, transform 0.2s ease; }
        #balanceCard:hover, #balanceCard:focus-visible { border-color: var(--accent-primary); outline: none; }
        #balanceCard:active { transform: scale(0.98); }

        .floating-balance {
            position: fixed;
            top: calc(var(--tg-content-safe-area-inset-top, 0px) + 8px);
            left: 50%;
            z-index: 35;
            opacity: 0;
            pointer-events: none;
            transform: translate(-50%, -12px);
            transition: opacity 0.2s ease, transform 0.2s ease;
            white-space: nowrap;
        }
        .floating-balance.visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }

        .app-modal { overscroll-behavior: contain; }
        .meta-modal-panel {
            --modal-bg: rgba(8, 13, 26, 0.96);
            display: grid;
            gap: 14px;
            max-height: calc(100dvh - 24px);
            overflow: hidden;
            background: var(--modal-bg);
        }
        .meta-modal-header { min-width: 0; }
        #metaTabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; min-width: 0; }
        #metaTabs button { min-width: 0; white-space: normal; line-height: 1.2; }
        #metaContent { min-height: 0; max-height: calc(100dvh - 190px); overscroll-behavior: contain; }
        .meta-modal-description { line-height: 1.3; }
        .exact-balance-container { overflow: hidden; }
        .exact-balance-value {
            font-size: 36px;
            line-height: 1.15;
            font-weight: 900;
            letter-spacing: -0.04em;
            white-space: nowrap;
            font-variant-numeric: tabular-nums;
        }
        #toastNotification { max-width: calc(100vw - 32px); text-align: center; }

        .plinko-board {
            flex: 0 0 auto;
            width: min(100%, 380px);
            aspect-ratio: 1;
            margin: 0 auto;
        }
        #plinkoCanvas { aspect-ratio: 1; }
        #winLinesSvg { overflow: visible; }
        .earn-highlight { outline: 2px solid #fbbf24 !important; outline-offset: 4px; }

        body.style-arctic .meta-modal-panel { --modal-bg: rgba(241, 245, 249, 0.98); }
        body.style-retro95 .meta-modal-panel { --modal-bg: #c0c0c0; }
        body.style-arctic h1,
        body.style-retro95 h1 {
            background: none !important;
            color: #0f172a !important;
            -webkit-text-fill-color: #0f172a;
        }
        body.style-arctic .text-sky-200,
        body.style-arctic .text-sky-300,
        body.style-retro95 .text-sky-200,
        body.style-retro95 .text-sky-300 { color: #0369a1 !important; }
        body.style-arctic .text-fuchsia-200,
        body.style-arctic .text-fuchsia-300,
        body.style-retro95 .text-fuchsia-200,
        body.style-retro95 .text-fuchsia-300 { color: #a21caf !important; }
        body.style-arctic .text-emerald-300,
        body.style-arctic .text-emerald-400,
        body.style-retro95 .text-emerald-300,
        body.style-retro95 .text-emerald-400 { color: #047857 !important; }
        body.style-arctic .text-amber-200,
        body.style-arctic .text-amber-300,
        body.style-arctic .text-amber-400,
        body.style-retro95 .text-amber-200,
        body.style-retro95 .text-amber-300,
        body.style-retro95 .text-amber-400 { color: #92400e !important; }
        body.style-arctic .text-rose-300,
        body.style-retro95 .text-rose-300 { color: #be123c !important; }
        body.style-arctic input,
        body.style-retro95 input { background: rgba(255,255,255,0.7) !important; color: #0f172a !important; }
        body.style-arctic #metaTabs button:not(.liquid-btn-primary),
        body.style-retro95 #metaTabs button:not(.liquid-btn-primary) { color: #1e293b !important; }
        body.style-monaco .liquid-btn-primary { color: #211500 !important; text-shadow: none; }

        body.tg-lite .liquid-panel,
        body.tg-lite .liquid-card,
        body.tg-lite .app-modal {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        body.tg-lite:not(.style-arctic):not(.style-retro95) {
            --glass-bg: rgba(8, 13, 26, 0.9);
            --glass-bg-elevated: rgba(17, 24, 39, 0.92);
        }
        body.tg-lite .liquid-orb-1,
        body.tg-lite .liquid-orb-2,
        body.tg-lite .spinning-symbol { animation: none !important; }
        body.tg-lite #orb3 { display: none; }

        @media (max-width: 639px) {
            #headerActions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
            #headerActions > button, #headerActions > #soundBox { min-width: 0; overflow: hidden; }
            .meta-modal-panel { gap: 10px; }
            #metaTabs button { padding: 8px 3px; font-size: 10px; }
            .meta-modal-description { align-items: flex-start; font-size: 10px; }
            #metaContent { max-height: calc(100dvh - 174px); }
            .exact-balance-value { font-size: 28px; }
        }
        @media (max-width: 370px) {
            #headerActions > button, #headerActions > #soundBox { font-size: 10px; }
            #achCountBadge { display: none; }
        }
        @media (prefers-reduced-motion: reduce) {
            .liquid-orb-1, .liquid-orb-2, .ticker-track, .spinning-symbol { animation: none !important; }
        }
