* { margin: 0; padding: 0; box-sizing: border-box; }

        :root {
            --bg-main: #050505;
            --bg-sidebar: #0a0a0a;
            --bg-header: #080808;
            --bg-input: #111111;
            --border: #1a1a1a;
            --text: #999999;
            --text-dim: #666666;
            --text-bright: #eeeeee;
            --green: #00c851;
            --red: #ff4444;
            --cyan: #00d4aa;
            --yellow: #ffbb33;
            --orange: #ff8800;
            --purple: #aa66cc;
        }

        body {
            font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
            font-variant-numeric: tabular-nums;
            -webkit-font-smoothing: antialiased;
            background: var(--bg-main);
            color: var(--text);
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            --nav-zoom: .8475;
            zoom: 1.18;  /* global font bump (+~2px across all sizes) */
        }

        /* Shared site navigation in /assets/app.css */

        /* ===== MAIN LAYOUT ===== */
        .main-layout {
            flex: 1;
            display: flex;
            overflow: hidden;
        }

        /* ===== CHART AREA ===== */
        .chart-area {
            flex: 1;
            position: relative;
            overflow: hidden;
            /* Cap visible height: body has zoom:1.18 + height:100vh which makes
               total layout 118vh visually → bottom edge falls below viewport.
               66vh logical × 1.18 ≈ 78vh visual — fits comfortably with header
               above + leaves the time-axis row inside the visible window. */
            max-height: calc(100vh / 1.18 - 56px);
        }

        #mainCanvas {
            display: block;
            width: 100%;
            height: 100%;
        }
        .ch-pill {
            position: absolute;
            font: 11px Inter, sans-serif;
            line-height: 18px;
            height: 18px;
            padding: 0 6px;
            border-radius: 3px;
            white-space: nowrap;
            transform: translate(-50%, -50%);
            font-variant-numeric: tabular-nums;
        }
        #ch-ypill {
            font-size: 10px;
            line-height: 14px;
            height: 14px;
            padding: 0 4px;
            opacity: 0.65;
        }

        .watermark {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            opacity: 0.02;
            font-size: 48px;
            font-weight: 700;
            color: #fff;
            letter-spacing: 4px;
            text-align: center;
        }

        /* Price labels */
        .price-label-left, .price-label-right {
            position: absolute;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 10px;
            font-weight: 600;
            color: #fff;
            white-space: nowrap;
            pointer-events: none;
            z-index: 100;
        }
        .price-label-left {
            /* MARGIN.left=60；pill 占 0-58 区域，盖住 y-axis 数字（数字仍在底层 canvas 渲染但 pill 覆盖在上） */
            left: 0;
            width: 58px;
            text-align: right;
            padding: 2px 6px 2px 4px;
            box-sizing: border-box;
        }
        .price-label-right {
            right: 10px;
        }
        .price-label-left.green  { background: #089981; color: #fff; }
        .price-label-left.red    { background: #f23645; color: #fff; }
        .price-label-left.orange { background: var(--orange); color: #fff; }
        .price-label-left.blue   { background: #5eb8ff; color: #fff; }
        .price-label-left.yellow { background: var(--yellow); color: #000; }
        .price-label-left.cyan   { background: var(--cyan); }

        /* right-side classes kept for backwards-compat (其他页面仍用) */
        .price-label-right.yellow { background: var(--yellow); }
        .price-label-right.orange { background: var(--orange); color: #fff; }
        .price-label-right.blue   { background: #5eb8ff; color: #fff; }

        /* Timeframe selector pills */
        .tf-btn {
            background:#1a2030; color:#a5b3c9; border:1px solid #2a3445;
            padding:2px 7px; border-radius:3px; cursor:pointer;
            font:inherit; line-height:1.4; pointer-events:auto;
        }
        .tf-btn:hover { background:#243044; color:#e6ecf6; }
        .tf-btn.active { background:#2b6cb0; color:#fff; border-color:#4d8ed1; }

        /* ===== RIGHT SIDEBAR ===== */
        .right-sidebar {
            width: 220px;
            background: var(--bg-sidebar);
            border-left: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            flex-shrink: 0;
        }

        .sidebar-header {
            padding: 8px 12px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .sidebar-title { font-size: 13px; font-weight: 600; color: var(--text-bright); }
        /* Mode dropdown — visually matches .ticker-* below */
        .mode-dropdown { position: relative; }
        .mode-trigger {
            padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border);
            border-radius: 4px; color: var(--text-bright); font-size: 12px; font-weight: 600;
            font-family: inherit; cursor: pointer; display: flex; align-items: center;
            gap: 8px; min-width: 110px; justify-content: space-between;
        }
        .mode-trigger:hover { border-color: #3a3a45; }
        .mode-trigger svg { width: 12px; height: 8px; color: var(--text-dim); flex-shrink: 0; }
        .mode-menu {
            position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
            background: var(--bg-input); border: 1px solid var(--border);
            border-radius: 6px; z-index: 100; display: none; overflow: hidden;
        }
        .mode-menu.open { display: block; }
        .mode-item {
            display: block;
            padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
            color: var(--text-bright);
            text-decoration: none;
        }
        .mode-item:hover { background: #252530; }
        .mode-item.active { background: #1e3a4f; color: var(--text-bright); }
        .sidebar-icons {
            display: flex;
            gap: 12px;
            position: relative;
        }
        .sidebar-icon {
            width: 24px; height: 24px;
            display: flex; align-items: center; justify-content: center;
            background: none; border: none; color: var(--text-dim);
            cursor: pointer; border-radius: 4px;
        }
        .sidebar-icon:hover { color: var(--text); }
        .settings-menu {
            position: absolute;
            top: 28px; right: 0;
            min-width: 180px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 6px 4px;
            z-index: 200;
            display: none;
            box-shadow: 0 4px 16px rgba(0,0,0,0.4);
        }
        .settings-menu.open { display: block; }
        .settings-menu-header {
            font-size: 10px; color: var(--text-dim);
            padding: 4px 10px 6px; text-transform: lowercase; letter-spacing: 0.3px;
            border-bottom: 1px solid var(--border); margin-bottom: 4px;
        }
        .settings-item {
            display: flex; align-items: center; gap: 8px;
            padding: 5px 10px; font-size: 12px; color: var(--text);
            cursor: pointer; border-radius: 3px;
        }
        .settings-item:hover { background: rgba(255,255,255,0.04); }
        .settings-item input[type=checkbox] {
            margin: 0; accent-color: #60a5fa; cursor: pointer;
        }

        .sb-section { padding: 8px 12px; border-bottom: 1px solid var(--border); }
        .sb-section:last-child { border-bottom: none; }

        .sb-label {
            font-size: 9px;
            font-weight: 500;
            text-transform: lowercase;
            color: var(--text-dim);
            margin-bottom: 6px;
            letter-spacing: 0.3px;
        }

        .ticker-dropdown { position: relative; }
        .ticker-trigger {
            width: 100%;
            padding: 6px 10px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text-bright);
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .ticker-trigger:hover { border-color: #3a3a45; }
        .ticker-trigger svg { width: 14px; height: 14px; color: var(--text-dim); }
        .ticker-menu {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            margin-top: 4px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: 6px;
            max-height: 300px;
            overflow-y: auto;
            z-index: 100;
            display: none;
        }
        .ticker-menu.open { display: block; }
        .ticker-search {
            padding: 8px 10px;
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 0;
            background: var(--bg-input);
            z-index: 1;
        }
        .ticker-search input {
            width: 100%;
            padding: 6px 10px;
            background: var(--bg-main);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text-bright);
            font-size: 12px;
            font-family: inherit;
            outline: none;
        }
        .ticker-search input:focus { border-color: var(--cyan); }
        .ticker-search input::placeholder { color: var(--text-dim); }
        .ticker-item {
            padding: 8px 14px;
            cursor: pointer;
            font-size: 13px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .ticker-item:hover { background: #252530; }
        .ticker-item.active { background: #1e3a4f; color: var(--text-bright); }
        .ticker-item-symbol { font-weight: 600; }
        .ticker-item-price { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
        .ticker-item.active .ticker-item-price { color: #6ab3d9; }

        /* Date selector buttons */
        .date-selector {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .date-btn {
            padding: 6px 10px;
            background: #1e3a5f;
            border: 1px solid #2a4a7f;
            border-radius: 4px;
            color: #6ab3d9;
            font-size: 10px;
            font-family: inherit;
            cursor: pointer;
            text-align: center;
        }
        .date-btn {
            transition: background 0.15s, color 0.15s, border-color 0.15s;
        }
        .date-btn:hover {
            background: #1e3a5f;
            border-color: #60a5fa;
            color: #60a5fa;
        }
        .date-btn.active {
            background: #1e3a5f;
            border-color: #2a4a7f;
            color: #6ab3d9;
        }
        .date-btn.active:hover {
            background: #25476f;
            border-color: #60a5fa;
            color: #93c5fd;
        }
        .pb-btn {
            background: #1a1a1a; color: #bbb;
            border: 1px solid #333; border-radius: 3px;
            padding: 2px 6px; font-size: 11px; font-family: inherit;
            cursor: pointer; line-height: 1;
        }
        .pb-btn:hover { background: #2a2a2a; border-color: #555; color: #fff; }
        .pb-btn.active { background: #1e3a5f; border-color: #2a4a7f; color: #6ab3d9; }
        #speedSel {
            background: #1a1a1a; color: #bbb;
            border: 1px solid #333; border-radius: 3px;
            padding: 2px 3px; font-size: 10px; font-family: inherit;
            cursor: pointer;
        }

        /* ── Gexbot-style playback panel ─────────────────── */
        .pb-panel { padding: 0; }
        .pb-pill {
            display: flex; align-items: center; gap: 8px;
            padding: 6px 10px;
            background: #141414;
            border-radius: 4px;
            margin-bottom: 8px;
            font-size: 11px;
        }
        .pb-pill-btn {
            background: none; border: none; color: #bbb;
            font-size: 13px; line-height: 1; padding: 0;
            cursor: pointer;
        }
        .pb-pill-btn:hover { color: #fff; }
        .pb-pill-speed {
            color: #9ca3af; cursor: pointer;
            font-weight: 500; user-select: none;
            min-width: 28px;
        }
        .pb-pill-speed:hover { color: #60a5fa; }
        .pb-pill-time {
            color: #9ca3af; flex: 1;
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        .pb-slider {
            -webkit-appearance: none;
            appearance: none;
            width: 100%;
            height: 2px;
            background: #2a2a2a;
            border-radius: 1px;
            outline: none;
            margin: 8px 0 10px;
            cursor: pointer;
        }
        .pb-slider::-webkit-slider-runnable-track {
            height: 2px; background: #2a2a2a; border-radius: 1px;
        }
        .pb-slider::-moz-range-track {
            height: 2px; background: #2a2a2a; border-radius: 1px;
        }
        .pb-slider::-webkit-slider-thumb {
            -webkit-appearance: none; appearance: none;
            width: 10px; height: 10px;
            border-radius: 50%;
            background: #60a5fa;
            cursor: pointer;
            margin-top: -4px;
        }
        .pb-slider::-moz-range-thumb {
            width: 10px; height: 10px;
            border-radius: 50%;
            background: #60a5fa;
            cursor: pointer;
            border: none;
        }
        .pb-ctrl-row {
            display: flex; align-items: center;
            justify-content: center; gap: 22px;
            margin-top: 4px;
        }
        .pb-ctrl {
            background: none; border: none;
            color: #bbb; font-size: 16px;
            cursor: pointer; padding: 6px 10px;
            line-height: 1; border-radius: 4px;
            transition: color 0.15s, background 0.15s;
        }
        .pb-ctrl:hover {
            color: #60a5fa;
            background: #1e2a3d;
        }
        .pb-ctrl-main {
            font-size: 22px;
            color: #fff;
            padding: 6px 12px;
        }
        .pb-ctrl-main:hover {
            color: #60a5fa;
            background: #1e3a5f;
        }

        /* Max change gex table */
        .max-change-table {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .max-change-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 11px;
            padding: 1px 0;
        }
        .max-change-time {
            color: #3b82f6;
            width: 45px;
            font-variant-numeric: tabular-nums;
        }
        .max-change-strike {
            color: #ef4444;
            width: 30px;
            text-align: center;
            font-variant-numeric: tabular-nums;
        }
        .max-change-value {
            color: #ef4444;
            text-align: right;
            font-variant-numeric: tabular-nums;
        }

        .d-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 2px 0;
            line-height: 1.4;
        }
        .d-lbl {
            font-size: 10px;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .d-lbl.green { color: var(--green); }
        .d-lbl.red { color: var(--red); }
        .d-val {
            font-size: 10px;
            font-weight: 500;
            font-variant-numeric: tabular-nums;
            text-align: right;
            color: var(--text-bright);
        }
        .d-val.green { color: var(--green); }
        .d-val.red { color: var(--red); }
        .d-val.cyan { color: var(--cyan); }
        .d-val.yellow { color: var(--yellow); }
        .d-val.orange { color: var(--orange); }
        .d-val.white { color: var(--text-bright); }
        .d-val.purple { color: var(--purple); }

        .cdot {
            display: inline-block;
            width: 6px; height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        /* GEX bars */
        .gex-bar-row {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 1px 0;
            font-size: 9px;
        }
        .gex-bar-strike {
            width: 24px;
            text-align: right;
            font-variant-numeric: tabular-nums;
            color: var(--text);
            font-weight: 500;
            font-size: 9px;
        }
        .gex-bar-container {
            flex: 1;
            height: 6px;
            background: var(--bg-input);
            border-radius: 1px;
            overflow: hidden;
        }
        .gex-bar-fill { height: 100%; border-radius: 1px; }
        .gex-bar-value {
            width: 32px;
            text-align: right;
            font-variant-numeric: tabular-nums;
            font-weight: 500;
            font-size: 9px;
            color: var(--text-bright);
        }

        /* Playback controls */
        .playback-controls {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 16px;
            border-top: 1px solid var(--border);
        }
        .playback-btn {
            width: 32px; height: 32px;
            display: flex; align-items: center; justify-content: center;
            background: var(--bg-input);
            border: 1px solid var(--border);
            color: var(--text);
            cursor: pointer;
            border-radius: 4px;
        }
        .playback-btn:hover { border-color: #3a3a45; }
        .playback-speed {
            padding: 4px 10px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            font-size: 12px;
            cursor: pointer;
        }
        .playback-time {
            flex: 1;
            text-align: center;
            font-size: 13px;
            font-weight: 600;
            color: var(--text-bright);
            font-variant-numeric: tabular-nums;
        }

        /* Progress bar */
        .progress-bar {
            height: 4px;
            background: var(--bg-input);
            border-radius: 2px;
            margin: 0 16px 12px;
            position: relative;
            cursor: pointer;
        }
        .progress-fill {
            height: 100%;
            background: var(--cyan);
            border-radius: 2px;
            width: 100%;
        }

        /* Tooltip */
        .chart-tooltip {
            position: absolute;
            background: rgba(20, 20, 25, 0.95);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 10px 14px;
            font-size: 12px;
            color: var(--text-bright);
            pointer-events: none;
            z-index: 1000;
            display: none;
            min-width: 180px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        }
        .tooltip-row {
            display: flex;
            justify-content: space-between;
            gap: 20px;
            padding: 2px 0;
        }
        .tooltip-label { color: var(--text-dim); }
        .tooltip-value { font-weight: 600; font-variant-numeric: tabular-nums; }
        .tooltip-value.green { color: var(--green); }
        .tooltip-value.red { color: var(--red); }
        .tooltip-value.cyan { color: var(--cyan); }
        .tooltip-value.yellow { color: var(--yellow); }

        /* Zoom hint */
        .zoom-hint {
            position: absolute;
            bottom: 10px;
            left: 10px;
            font-size: 11px;
            color: var(--text-dim);
            background: rgba(0,0,0,0.5);
            padding: 4px 8px;
            border-radius: 4px;
            pointer-events: none;
        }

        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-track { background: var(--bg-sidebar); }
        ::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 2px; }
