
        :root {
            --bg: #070B14;
            --hdr: #121822;
            --brd: #1F2937;
            --txt: #D1D5DB;
            --up: #10B981;
            --dn: #EF4444;
            --cyn: #00FFFF;
            --poc: #2962FF;
        }

        * { box-sizing: border-box; }
        body, html {
            margin: 0; padding: 0;
            width: 100vw; height: 100vh;
            background: var(--bg);
            color: var(--txt);
            font-family: 'Inter', sans-serif;
            overflow: hidden;
            display: flex; flex-direction: column;
        }

        header {
            height: 38px;
            background: var(--hdr);
            border-bottom: 2px solid #1A212E;
            display: flex; align-items: center; justify-content: space-between;
            padding: 0 12px; font-size: 11px; user-select: none;
            overflow: visible;
        }
        .toolset {
            display: flex;
            align-items: center;
            gap: 15px;
            color: #9CA3AF;
            flex: 1;
            min-width: 0;
            overflow-x: auto;
            white-space: nowrap;
            scrollbar-width: none; /* Firefox */
        }
        .toolset::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Opera */
        }
        .toolset > div {
            flex-shrink: 0;
            display: flex;
            align-items: center;
        }
        .toolset b { color: #FFF; margin-right: 4px; }

        /* ===== Toolbar Dropdown Groups (new UI wrapper only -- no indicator logic touched) ===== */
        .tb-grp { position: relative; flex-shrink: 0; }
        .tb-grp-trigger {
            display: flex; align-items: center; gap: 6px;
            background: linear-gradient(180deg,#1A2332,#121825);
            border: 1px solid #2A3344;
            color: #C9D3E0;
            font-family: 'Inter', sans-serif;
            font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px;
            padding: 5px 10px; border-radius: 8px;
            cursor: pointer; user-select: none;
            transition: all .18s ease;
            white-space: nowrap;
        }
        .tb-grp-trigger:hover { border-color: #00FFFF; color: #00FFFF; box-shadow: 0 0 10px rgba(0,255,255,0.18); }
        .tb-grp.open .tb-grp-trigger { border-color: #00FFFF; color: #00FFFF; background: linear-gradient(180deg,#132131,#0E1722); box-shadow: 0 0 14px rgba(0,255,255,0.25); }
        .tb-grp-ico { font-size: 11px; }
        .tb-grp-count {
            background: rgba(0,255,255,0.12); color: #00FFFF;
            font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 20px;
            min-width: 14px; text-align: center; display: none;
        }
        .tb-grp-caret { font-size: 9px; color: #64748B; transition: transform .18s ease; }
        .tb-grp.open .tb-grp-caret { transform: rotate(180deg); color: #00FFFF; }
        .tb-grp-menu {
            display: none;
            position: fixed; top: 44px; left: 0;
            background: rgba(13,18,28,0.98);
            backdrop-filter: blur(14px);
            border: 1px solid #263142;
            border-radius: 12px;
            padding: 12px;
            width: 420px; max-width: 86vw;
            max-height: 62vh; overflow-y: auto;
            box-shadow: 0 12px 36px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,255,255,0.05);
            z-index: 5000;
            flex-wrap: wrap;
            gap: 6px;
            align-content: flex-start;
            white-space: normal;
        }
        .tb-grp.open .tb-grp-menu { display: flex; }
        .tb-grp-menu::-webkit-scrollbar { width: 5px; }
        .tb-grp-menu::-webkit-scrollbar-thumb { background: #2A3344; border-radius: 4px; }
        .tb-grp-menu > * { flex-shrink: 0; }

        /* Premium styled indicator pill buttons inside dropdowns */
        .tb-grp-menu .draw-btn {
            height: 28px !important;
            width: auto !important;
            padding: 0 10px !important;
            border-radius: 6px !important;
            font-size: 9.5px !important;
            font-weight: 700 !important;
            letter-spacing: 0.4px !important;
            font-family: 'Roboto Mono', monospace !important;
            background: rgba(15,22,35,0.9) !important;
            border-width: 1px !important;
            transition: all 0.15s ease !important;
            white-space: nowrap !important;
            text-transform: uppercase !important;
        }
        .tb-grp-menu .draw-btn:hover {
            filter: brightness(1.35);
            box-shadow: 0 0 10px currentColor !important;
            transform: translateY(-1px);
        }
        .tb-grp-menu .draw-btn.active {
            filter: brightness(1.2);
            box-shadow: 0 0 10px currentColor, 0 0 20px rgba(255,255,255,0.06) !important;
            opacity: 1 !important;
        }
        /* Section headers inside dropdown */
        .tb-grp-section {
            width: 100%;
            font-size: 9px;
            font-weight: 800;
            color: #3D5068;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            padding: 6px 2px 2px;
            border-bottom: 1px solid #1A2535;
            margin-bottom: 2px;
        }
        /* Dropdown header bar */
        .tb-grp-menu-header {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-bottom: 8px;
            margin-bottom: 4px;
            border-bottom: 1px solid #1E2D40;
        }
        .tb-grp-menu-title {
            font-size: 10px; font-weight: 800;
            color: #00FFFF; letter-spacing: 1px;
            text-transform: uppercase;
        }
        .tb-grp-menu-close {
            width: 20px; height: 20px;
            display: flex; align-items: center; justify-content: center;
            background: #1A2535; border: 1px solid #263142;
            border-radius: 4px; cursor: pointer; color: #64748B;
            font-size: 12px; line-height: 1;
        }
        .tb-grp-menu-close:hover { color: #EF4444; border-color: #EF4444; }

        .atas-input, .atas-select {
            background: #1F2937; border: 1px solid #374151; color: #FFF;
            font-size: 11px; padding: 2px 6px; width: 90px;
            outline: none; font-weight: bold; text-transform: uppercase;
        }
        .atas-select { cursor: pointer; color: #00FFFF; width: auto; font-size: 10px; padding: 1px 4px; border-color: #4B5563; }

        .price-badge-live { font-family: 'Roboto Mono', monospace; font-weight: 700; font-size: 16px; padding-right: 40px; }
        main { flex: 1; display: flex; position: relative; overflow: hidden; }
        #viewport { flex: 1; position: relative; display: flex; flex-direction: column; cursor: crosshair; }
        #scale-right { width: 85px; background: #0A0F17; border-left: 1px solid #1E293B; position: relative; cursor: ns-resize; }
        canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
        #price-badge { position: absolute; right: 0; background: var(--dn); color: #FFF; font-family: 'Roboto Mono', monospace; font-size: 11px; padding: 2px 6px; transform: translateY(-50%); width: 83px; text-align: right; z-index: 200; border-radius: 2px 0 0 2px; pointer-events: none; }
        #price-timer { position: absolute; right: 0; background: #1F2937; color: #9CA3AF; font-family: 'Roboto Mono', monospace; font-size: 10px; padding: 2px 6px; width: 83px; text-align: right; z-index: 199; border-radius: 0 0 0 2px; pointer-events: none; display: none; }
        .status-ohlc { position: absolute; top: 12px; left: 15px; font-family: 'Roboto Mono', monospace; font-size: 10px; color: #94A3B8; pointer-events: none; }
        #bottom-axis { height: 26px; background: #090D14; border-top: 1px solid #1E293B; cursor: ew-resize; }
        #loader { position: absolute; inset: 0; background: #070B14; display: flex; align-items: center; justify-content: center; z-index: 1000; font-weight: bold; }
        
        #drawing-toolbar { position: absolute; left: 10px; top: 100px; max-height: calc(100vh - 130px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; z-index: 500; background: rgba(18, 24, 34, 0.8); padding: 4px; border: 1px solid #1E293B; border-radius: 4px; border-left: 2px solid #00FFFF; user-select: none; scrollbar-width: none; }
        #drawing-toolbar::-webkit-scrollbar { display: none; }
        #drawing-toolbar.hidden { display: none !important; }
        .draw-btn { width: 28px; height: 28px; background: #1F2937; border: 1px solid #374151; color: #FFF; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: 0.2s; border-radius: 2px; }
        .draw-btn:hover, .draw-btn.active { background: #00FFFF; color: #000; border-color: #00FFFF; box-shadow: 0 0 10px rgba(0, 255, 255, 0.3); }

        #abs-btn.active { background: rgba(255, 255, 0, 0.2) !important; color: #FFFF00 !important; border-color: #FFFF00 !important; box-shadow: 0 0 10px rgba(255, 255, 0, 0.3) !important; }
        #abs-btn:hover { background: rgba(255, 255, 0, 0.4) !important; }

        #hvbuy-btn.active { background: rgba(0, 255, 255, 0.2) !important; color: #00FFFF !important; border-color: #00FFFF !important; box-shadow: 0 0 10px rgba(0, 255, 255, 0.3) !important; }
        #hvbuy-btn:hover { background: rgba(0, 255, 255, 0.4) !important; }

        #hvsell-btn.active { background: rgba(255, 0, 255, 0.2) !important; color: #FF00FF !important; border-color: #FF00FF !important; box-shadow: 0 0 10px rgba(255, 0, 255, 0.3) !important; }
        #hvsell-btn:hover { background: rgba(255, 0, 255, 0.4) !important; }

        #acd-btn.active { background: rgba(255, 255, 255, 0.15) !important; color: #FFFFFF !important; border-color: #FFFFFF !important; box-shadow: 0 0 12px rgba(255, 255, 255, 0.5) !important; }
        #acd-btn:hover { background: rgba(255, 255, 255, 0.25) !important; }

        /* Floating REPLAY button */
        #replay-btn:hover {
            background: rgba(255, 165, 0, 0.2) !important;
            box-shadow: 0 0 16px rgba(255,165,0,0.5) !important;
            color: #FFB833 !important;
        }
        #replay-btn.active {
            background: rgba(255, 165, 0, 0.25) !important;
            border-color: #FFB833 !important;
            box-shadow: 0 0 18px rgba(255,165,0,0.6) !important;
            color: #FFD080 !important;
        }

        #oi-resizer {
            height: 4px;
            background: #1E293B;
            cursor: ns-resize;
            flex-shrink: 0;
            z-index: 100;
        }
        #oi-resizer:hover, #oi-resizer.active {
            background: #00FFFF;
        }
        #oi-panel-wrap, #vspd-panel-wrap {
            height: 120px;
            position: relative;
            background: #060A12;
            flex-shrink: 0;
            overflow: hidden;
        }
        #oi-panel-wrap canvas, #vspd-panel-wrap canvas {
            position: absolute; top: 0; left: 0;
            width: 100%; height: 100%;
            image-rendering: pixelated;
        }
        #vspd-panel-wrap { height: 100px; background: #05080E; }
        
        #stats-panel-wrap {
            height: 100px;
            position: relative;
            background: #060A12;
            flex-shrink: 0;
            overflow: hidden;
            display: flex;
            border-top: 1px solid #1E293B;
        }
        #stats-panel-wrap canvas {
            position: absolute; top: 0; left: 0;
            width: 100%; height: 100%;
            image-rendering: pixelated;
        }
        #vspd-resizer {
            height: 4px; background: #1E293B; cursor: ns-resize; flex-shrink: 0; z-index: 100;
        }
        #vspd-resizer:hover, #vspd-resizer.active { background: #FF00FF; }

        /* --- MTF Heatmap HUD --- */
        #tf-heatmap-hud {
            position: absolute;
            top: 60px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 6px;
            padding: 8px;
            background: rgba(12, 18, 28, 0.85);
            backdrop-filter: blur(8px);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 4px;
            z-index: 9999;
            user-select: none;
            transition: 0.3s;
            pointer-events: none;
            box-shadow: 0 4px 15px rgba(0,0,0,0.5);
        }
        .tf-cell {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 50px;
            height: 40px;
            background: rgba(31, 41, 55, 0.5);
            border-radius: 3px;
            border: 1px solid rgba(255,255,255,0.05);
        }
        .tf-cell.bull { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 0 8px rgba(16, 185, 129, 0.1); }
        .tf-cell.bear { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 8px rgba(239, 68, 68, 0.1); }
        .tf-cell.neut { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }
        
        .tf-label { font-size: 8px; font-weight: bold; color: #94A3B8; margin-bottom: 2px; }
        .tf-status { font-size: 10px; font-weight: bold; font-family: 'Roboto Mono', monospace; }
        .tf-status.bull { color: #10B981; }
        .tf-status.bear { color: #EF4444; }
        .tf-status.neut { color: #F59E0B; }

        /* --- News HUD --- */
        #news-hud { position: absolute; top: 60px; right: 90px; display: none; flex-direction: column; gap: 8px; z-index: 900; pointer-events: none; width: 280px; }
        .news-item { background: rgba(12, 18, 28, 0.9); border-left: 3px solid #3B82F6; border-radius: 4px; padding: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); color: #FFF; font-size: 11px; animation: slideIn 0.3s ease-out; }
        .news-header { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 10px; color: #9CA3AF; }
        .news-sentiment { font-weight: bold; }
        .news-sentiment.bull { color: #10B981; }
        .news-sentiment.bear { color: #EF4444; }
        .news-sentiment.neut { color: #F59E0B; }
        @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

        /* ===== MOBILE RESPONSIVE ===== */
        #bottom-nav {
            display: none;
            position: fixed;
            bottom: 0; left: 0; right: 0;
            height: 56px;
            background: rgba(12,18,28,0.97);
            backdrop-filter: blur(16px);
            border-top: 1px solid #1E293B;
            z-index: 2000;
            flex-direction: row;
            align-items: center;
            justify-content: space-around;
            padding: 0 8px;
        }
        .bnav-btn {
            display: flex; flex-direction: column;
            align-items: center; justify-content: center;
            gap: 3px;
            background: none; border: none;
            color: #6B7280; cursor: pointer;
            padding: 6px 16px;
            border-radius: 10px;
            transition: all 0.2s;
            -webkit-tap-highlight-color: transparent;
            min-width: 60px;
        }
        .bnav-btn.active { color: #00FFFF; background: rgba(0,255,255,0.08); }
        .bnav-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
        .bnav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

        #sheet-overlay {
            display: none;
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 2500;
            backdrop-filter: blur(4px);
        }
        #bottom-sheet {
            display: none;
            position: fixed;
            bottom: 0; left: 0; right: 0;
            background: #0D1421;
            border-top: 1px solid #1E293B;
            border-radius: 20px 20px 0 0;
            z-index: 3000;
            padding: 0 0 env(safe-area-inset-bottom);
            transform: translateY(100%);
            transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
        }
        #bottom-sheet.open { transform: translateY(0); }
        .sheet-handle {
            width: 36px; height: 4px;
            background: #374151; border-radius: 2px;
            margin: 12px auto 0;
        }
        .sheet-title {
            text-align: center;
            font-size: 13px; font-weight: 700;
            color: #94A3B8;
            padding: 10px 0 14px;
            border-bottom: 1px solid #1E293B;
            letter-spacing: 1px;
            text-transform: uppercase;
        }
        .sheet-content {
            padding: 14px 16px 20px;
            max-height: 60vh;
            overflow-y: auto;
        }
        .sheet-section-title {
            font-size: 10px; font-weight: 700;
            color: #4B5563; letter-spacing: 1.5px;
            text-transform: uppercase;
            margin: 14px 0 8px;
        }
        .sheet-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }
        .sheet-toggle {
            display: flex; flex-direction: column;
            align-items: center; justify-content: center;
            gap: 4px;
            padding: 10px 6px;
            background: #131C2B;
            border: 1px solid #1E293B;
            border-radius: 10px;
            cursor: pointer;
            color: #6B7280;
            font-size: 10px; font-weight: 700;
            transition: all 0.2s;
            -webkit-tap-highlight-color: transparent;
            letter-spacing: 0.5px;
        }
        .sheet-toggle.on {
            background: rgba(0,255,255,0.08);
            border-color: #00FFFF;
            color: #00FFFF;
        }
        .sheet-toggle .st-icon { font-size: 18px; line-height: 1; }

        .sheet-tf-row {
            display: flex; gap: 8px; flex-wrap: wrap;
            margin-top: 4px;
        }
        .sheet-tf-btn {
            flex: 1; min-width: 60px;
            padding: 10px 4px;
            background: #131C2B;
            border: 1px solid #1E293B;
            border-radius: 10px;
            color: #94A3B8;
            font-size: 13px; font-weight: 700;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        .sheet-tf-btn.active {
            background: rgba(0,255,255,0.1);
            border-color: #00FFFF;
            color: #00FFFF;
        }

        .sheet-sym-row {
            display: flex; gap: 8px; margin-top: 4px;
        }
        .sheet-sym-input {
            flex: 1;
            background: #131C2B;
            border: 1px solid #374151;
            border-radius: 10px;
            color: #FFF;
            font-size: 15px; font-weight: 700;
            padding: 11px 14px;
            text-transform: uppercase;
            outline: none;
        }
        .sheet-sym-go {
            background: #00FFFF;
            color: #000;
            font-weight: 700;
            font-size: 13px;
            border: none;
            border-radius: 10px;
            padding: 0 20px;
            cursor: pointer;
        }

        @media (max-width: 767px) {
            #bottom-nav { display: flex; }
            body { padding-bottom: 56px; }
            body, html { overflow: hidden; }

            header { height: 48px; padding: 0 12px; }
            header .toolset > div:not(:first-child):not(:last-child) { display: none; }
            header .toolset > div:last-child { display: none; }
            #oi-panel-wrap, #oi-resizer, #vspd-panel-wrap, #vspd-resizer { display: none !important; }
            #scale-right { width: 60px; }

            .price-badge-live { font-size: 18px; }
            .atas-input { font-size: 13px; width: 110px; }

            #mobile-menu-btn {
                display: flex !important;
                align-items: center; justify-content: center;
                width: 36px; height: 36px;
                background: #1F2937;
                border: 1px solid #374151;
                border-radius: 8px;
                color: #FFF;
                font-size: 20px;
                cursor: pointer;
                margin-left: 6px;
            }
            #bottom-sheet { display: block; }
            #sheet-overlay { display: block; }
        }
        @media (min-width: 768px) {
            #mobile-menu-btn { display: none !important; }
            #bottom-nav { display: none !important; }
        }

        /* --- FRVP SETTINGS MODAL --- */
        .modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.6);
            display: flex; align-items: center; justify-content: center; z-index: 5000;
        }
        .modal-content {
            background: #1e222d; border-radius: 6px; width: 340px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid #363a45;
            color: #d1d4dc; font-family: 'Inter', sans-serif; overflow: hidden;
        }
        .modal-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 12px 16px; border-bottom: 1px solid #363a45; font-weight: 600;
        }
        .modal-close { cursor: pointer; font-size: 20px; color: #787b86; }
        .modal-tabs {
            display: flex; border-bottom: 1px solid #363a45; padding: 0 16px;
        }
        .modal-tab {
            padding: 10px 0; margin-right: 20px; font-size: 13px; font-weight: 600;
            color: #787b86; cursor: pointer; position: relative;
        }
        .modal-tab.active { color: #d1d4dc; }
        .modal-tab.active::after {
            content: ''; position: absolute; bottom: 0; left: 0; right: 0;
            height: 2px; background: #2962ff;
        }
        .modal-body { padding: 20px 16px; }
        .settings-row {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 16px; font-size: 13px;
        }
        .settings-row label { color: #d1d4dc; }
        .settings-row input[type="number"], .settings-row select {
            background: #2a2e39; border: 1px solid #363a45; color: #d1d4dc;
            padding: 4px 8px; border-radius: 4px; outline: none; width: 120px;
        }
        .settings-row input[type="checkbox"] { accent-color: #2962ff; width: 16px; height: 16px; }
        .modal-footer {
            display: flex; justify-content: space-between; align-items: center;
            padding: 16px; border-top: 1px solid #363a45;
        }
        .template-select {
            background: #2a2e39; border: 1px solid #363a45; color: #d1d4dc;
            padding: 4px 8px; border-radius: 4px; font-size: 12px;
        }
        .modal-btn {
            padding: 6px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; border: none;
        }
        .modal-btn.cancel { background: #363a45; color: #d1d4dc; }
        .modal-btn.ok { background: #2962ff; color: #fff; }

        /* --- RECENT COINS DROPDOWN --- */
        .recent-coins-dropdown {
            position: fixed;
            top: 40px;
            left: 70px;
            background: #1e222d;
            border: 1px solid #363a45;
            border-radius: 4px;
            z-index: 9999;
            max-height: 250px;
            overflow-y: auto;
            width: 140px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
            display: none;
        }
        .recent-coin-item {
            padding: 8px 10px;
            cursor: pointer;
            color: #d1d4dc;
            font-size: 11px;
            font-weight: bold;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .recent-coin-item:hover {
            background: #2962ff;
            color: #fff;
        }
        .recent-coin-remove {
            color: #f6465d;
            opacity: 0.5;
            padding: 0 4px;
        }
        .recent-coin-item:hover .recent-coin-remove {
            opacity: 1;
        }
    