:root {
            /* Apple dark mode palette */
            --apple-bg: #000000;
            --apple-surface-1: #272729;
            --apple-surface-2: #262628;
            --apple-surface-3: #28282a;
            --apple-text-primary: #ffffff;
            --apple-text-secondary: rgba(255, 255, 255, 0.6);
            --apple-text-tertiary: rgba(255, 255, 255, 0.45);
            --apple-blue: #0071e3;
            --apple-blue-soft: rgba(0, 113, 227, 0.08);
            --apple-accent-warm: #ff9f0a;
            --apple-accent-teal: #5ac8fa;
            --apple-divider: rgba(255, 255, 255, 0.12);
            --apple-card-shadow: rgba(0, 0, 0, 0.22) 3px 5px 30px 0px;
            --apple-sticky-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
            /* Functional data colors */
            --data-bitget: #2997ff;
            --data-binance: #e8a43e;
            --data-positive: #30d158;
            --data-negative: #ff453a;
            --data-positive-alpha-08: rgba(48, 209, 88, 0.08);
            --data-positive-alpha-10: rgba(48, 209, 88, 0.10);
            --data-positive-alpha-12: rgba(48, 209, 88, 0.12);
            --data-positive-alpha-15: rgba(48, 209, 88, 0.15);
            --data-positive-alpha-18: rgba(48, 209, 88, 0.18);
            --data-positive-alpha-22: rgba(48, 209, 88, 0.22);
            --data-positive-alpha-25: rgba(48, 209, 88, 0.25);
            --data-positive-alpha-28: rgba(48, 209, 88, 0.28);
            --data-positive-alpha-30: rgba(48, 209, 88, 0.30);
            --data-positive-alpha-88: rgba(48, 209, 88, 0.88);
            --data-positive-alpha-95: rgba(48, 209, 88, 0.95);
            --data-negative-alpha-07: rgba(255, 69, 58, 0.07);
            --data-negative-alpha-10: rgba(255, 69, 58, 0.10);
            --data-negative-alpha-12: rgba(255, 69, 58, 0.12);
            --data-negative-alpha-14: rgba(255, 69, 58, 0.14);
            --data-negative-alpha-15: rgba(255, 69, 58, 0.15);
            --data-negative-alpha-18: rgba(255, 69, 58, 0.18);
            --data-negative-alpha-20: rgba(255, 69, 58, 0.20);
            --data-negative-alpha-30: rgba(255, 69, 58, 0.30);
            --data-positive-bright: #00d85a;
            --data-positive-bright-alpha-28: rgba(0, 255, 106, 0.28);
            --data-positive-bright-shadow: rgba(0, 255, 106, 0.14);
            --data-total: #5ac8fa;
            /* Structural overlay colors (dark default) */
            --apple-header-bg: rgba(0, 0, 0, 0.8);
            --apple-overlay-subtle: rgba(255, 255, 255, 0.03);
            --apple-overlay-light: rgba(255, 255, 255, 0.04);
            --apple-overlay: rgba(255, 255, 255, 0.06);
            --apple-overlay-medium: rgba(255, 255, 255, 0.08);
            --apple-overlay-strong: rgba(255, 255, 255, 0.12);
            --apple-hover-border: rgba(255, 255, 255, 0.24);
            /* Chart SVG colors (dark default) */
            --apple-chart-invested: rgba(255, 255, 255, 0.55);
            --apple-chart-guide: rgba(255, 255, 255, 0.18);
            --apple-tooltip-bg: rgba(24, 24, 26, 0.96);
            --apple-tooltip-border: rgba(255, 255, 255, 0.12);
            --apple-tooltip-text: #ffffff;
            /* Elevation shadows (theme-aware) */
            --apple-shadow-popover: 0 8px 32px rgba(0, 0, 0, 0.45);
            --apple-shadow-tooltip: 0 4px 16px rgba(0, 0, 0, 0.4);
            --apple-chart-grid: rgba(255, 255, 255, 0.10);
            --apple-chart-text: rgba(255, 255, 255, 0.75);
            --apple-chart-text-dim: rgba(255, 255, 255, 0.50);
            --apple-chart-crosshair: rgba(255, 255, 255, 0.32);
            --apple-chart-color: rgba(255, 255, 255, 0.80);
            /* Type scale */
            --text-xs: 12px;
            --text-sm: 13px;
            --text-base: 14px;
            --text-lg: 16px;
            --text-xl: 22px;
            --text-2xl: 32px;
            /* Spacing scale */
            --space-xs: 4px;
            --space-sm: 8px;
            --space-md: 12px;
            --space-lg: 16px;
            --space-xl: 24px;
            --space-2xl: 32px;
            /* Transition tokens */
            --transition-fast: 0.15s ease;
            --transition-normal: 0.25s ease;
            --transition-slow: 0.4s ease;
            /* Border-radius scale */
            --radius-sm: 6px;
            --radius-md: 8px;
            --radius-lg: 12px;
            --radius-full: 999px;
        }
[data-theme="light"] {
            /* Apple light mode palette — bg gray, surfaces white */
            --apple-bg: #f2f2f7;
            --apple-surface-1: #ffffff;
            --apple-surface-2: #f5f5f7;
            --apple-surface-3: #fafafa;
            --apple-text-primary: #1d1d1f;
            --apple-text-secondary: rgba(0, 0, 0, 0.55);
            --apple-text-tertiary: rgba(0, 0, 0, 0.4);
            --apple-blue-soft: rgba(0, 113, 227, 0.06);
            --apple-divider: rgba(0, 0, 0, 0.10);
            --apple-card-shadow: rgba(0, 0, 0, 0.04) 0 1px 8px 0px;
            --apple-sticky-shadow: 2px 0 6px rgba(0, 0, 0, 0.08);
            /* Structural overlay colors (light) */
            --apple-header-bg: rgba(255, 255, 255, 0.72);
            --apple-overlay-subtle: rgba(0, 0, 0, 0.02);
            --apple-overlay-light: rgba(0, 0, 0, 0.03);
            --apple-overlay: rgba(0, 0, 0, 0.04);
            --apple-overlay-medium: rgba(0, 0, 0, 0.05);
            --apple-overlay-strong: rgba(0, 0, 0, 0.10);
            --apple-hover-border: rgba(0, 0, 0, 0.20);
            /* Chart SVG colors (light) */
            --apple-chart-invested: rgba(0, 0, 0, 0.50);
            --apple-chart-guide: rgba(0, 0, 0, 0.14);
            --apple-tooltip-bg: rgba(255, 255, 255, 0.96);
            --apple-tooltip-border: rgba(0, 0, 0, 0.10);
            --apple-tooltip-text: #1d1d1f;
            /* Elevation shadows (theme-aware) */
            --apple-shadow-popover: 0 8px 32px rgba(0, 0, 0, 0.12);
            --apple-shadow-tooltip: 0 4px 16px rgba(0, 0, 0, 0.10);
            --apple-chart-grid: rgba(0, 0, 0, 0.06);
            --apple-chart-text: rgba(0, 0, 0, 0.50);
            --apple-chart-text-dim: rgba(0, 0, 0, 0.28);
            --apple-chart-crosshair: rgba(0, 0, 0, 0.18);
            --apple-chart-color: rgba(0, 0, 0, 0.65);
        }
/* Red-up / green-down color scheme (A-share convention).
           Swaps the semantic meaning of --data-positive and --data-negative. */
html[data-color-scheme="red_up"] {
            --data-positive: #ff453a;
            --data-positive-alpha-08: rgba(255, 69, 58, 0.08);
            --data-positive-alpha-10: rgba(255, 69, 58, 0.10);
            --data-positive-alpha-12: rgba(255, 69, 58, 0.12);
            --data-positive-alpha-15: rgba(255, 69, 58, 0.15);
            --data-positive-alpha-18: rgba(255, 69, 58, 0.18);
            --data-positive-alpha-22: rgba(255, 69, 58, 0.22);
            --data-positive-alpha-25: rgba(255, 69, 58, 0.25);
            --data-positive-alpha-28: rgba(255, 69, 58, 0.28);
            --data-positive-alpha-30: rgba(255, 69, 58, 0.30);
            --data-positive-alpha-88: rgba(255, 69, 58, 0.88);
            --data-positive-alpha-95: rgba(255, 69, 58, 0.95);
            --data-negative: #30d158;
            --data-negative-alpha-07: rgba(48, 209, 88, 0.07);
            --data-negative-alpha-10: rgba(48, 209, 88, 0.10);
            --data-negative-alpha-12: rgba(48, 209, 88, 0.12);
            --data-negative-alpha-14: rgba(48, 209, 88, 0.14);
            --data-negative-alpha-15: rgba(48, 209, 88, 0.15);
            --data-negative-alpha-18: rgba(48, 209, 88, 0.18);
            --data-negative-alpha-20: rgba(48, 209, 88, 0.20);
            --data-negative-alpha-30: rgba(48, 209, 88, 0.30);
            --data-positive-bright: #ff453a;
            --data-positive-bright-alpha-28: rgba(255, 69, 58, 0.28);
            --data-positive-bright-shadow: rgba(255, 69, 58, 0.14);
        }
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
            font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            background: var(--apple-bg);
            color: var(--apple-text-primary);
            letter-spacing: -0.01em;
            min-height: 100vh;
            font-size: var(--text-sm);
            line-height: 1.5;
        }
/* Header — compact brand area */
.header {
            position: relative;
            z-index: 10;
            min-height: 64px;
            padding: 14px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 24px;
            background:
                radial-gradient(circle at 18% 0%, var(--vix-header-glow-a, rgba(0, 113, 227, 0.24)), transparent 34%),
                radial-gradient(circle at 82% 18%, var(--vix-header-glow-b, rgba(90, 200, 250, 0.16)), transparent 32%),
                linear-gradient(180deg, var(--vix-header-tint, var(--apple-surface-1)), var(--apple-bg));
            border-bottom: 1px solid var(--apple-divider);
            transition: background var(--transition-slow);
        }
.header.vix-bg-extreme-low {
            --vix-header-glow-a: rgba(255, 69, 58, 0.16);
            --vix-header-glow-b: rgba(255, 159, 10, 0.08);
            --vix-header-tint: rgba(255, 69, 58, 0.045);
        }
.header.vix-bg-low {
            --vix-header-glow-a: rgba(255, 69, 58, 0.10);
            --vix-header-glow-b: rgba(255, 159, 10, 0.055);
            --vix-header-tint: rgba(255, 69, 58, 0.03);
        }
.header.vix-bg-normal {
            --vix-header-glow-a: rgba(0, 113, 227, 0.06);
            --vix-header-glow-b: rgba(90, 200, 250, 0.04);
            --vix-header-tint: var(--apple-surface-1);
        }
.header.vix-bg-elevated {
            --vix-header-glow-a: rgba(48, 209, 88, 0.16);
            --vix-header-glow-b: rgba(48, 209, 88, 0.10);
            --vix-header-tint: rgba(48, 209, 88, 0.055);
        }
.header.vix-bg-high {
            --vix-header-glow-a: rgba(48, 209, 88, 0.22);
            --vix-header-glow-b: rgba(48, 209, 88, 0.14);
            --vix-header-tint: rgba(48, 209, 88, 0.075);
        }
.header.vix-bg-extreme {
            --vix-header-glow-a: rgba(0, 255, 106, 0.40);
            --vix-header-glow-b: rgba(48, 209, 88, 0.28);
            --vix-header-tint: rgba(0, 255, 106, 0.14);
        }
.logo { display: flex; align-items: center; gap: 12px; }
/* Header background trend: faint QQQ area chart behind the title text.
   Layered above the header's gradient background but below the text/buttons.
   overflow:hidden lives here (not on .header) so the settings dropdown can
   still spill outside the header. */
.header-trend {
            position: absolute;
            inset: 0;
            z-index: 0;
            overflow: hidden;
            pointer-events: none;
        }
.header-trend svg { display: block; width: 100%; height: 100%; }
.header-trend .ht-area   { fill: url(#htGrad); }
.header-trend .ht-stroke {
            fill: none;
            stroke: var(--header-trend-color, rgba(0, 113, 227, 0.10));
            stroke-width: 1.5;
            vector-effect: non-scaling-stroke;
            stroke-linejoin: round;
            stroke-linecap: round;
        }
/* Lift header content above the trend layer. */
.header-left, .status { position: relative; z-index: 1; }
.header-left {
            display: flex;
            align-items: center;
            align-self: center;
            gap: 16px;
            min-width: 0;
        }
.nav-links a.active { color: var(--apple-blue); }
.logo-text h1 {
            font-size: 22px;
            font-weight: 700;
            color: var(--apple-text-primary);
            letter-spacing: -0.5px;
            line-height: 1.15;
        }
.logo-text h1 a {
            display: block;
            width: fit-content;
            margin-top: 4px;
            font-size: var(--text-xs);
            font-weight: 500;
            letter-spacing: -0.01em;
            color: var(--apple-blue) !important;
            opacity: 0.9;
        }
.logo-text p {
            font-size: var(--text-xs);
            color: var(--apple-text-secondary);
            margin-top: 4px;
        }
.logo-text p a {
            color: var(--apple-blue);
            text-decoration: none;
            transition: opacity var(--transition-fast);
        }
.logo-text p a:hover { opacity: 0.8; text-decoration: underline; }
/* Status — simplified, no pill */
.status {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 8px;
            padding: 0;
            margin-top: 2px;
        }
.status-row {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 14px;
            flex-wrap: wrap;
        }
.site-url {
            color: #30d158;
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
            letter-spacing: -0.01em;
        }
.site-url:hover {
            color: #30d158;
            text-decoration: none;
            opacity: 0.82;
        }
.status-dot {
            width: 7px; height: 7px;
            flex-shrink: 0;
            background: var(--apple-text-tertiary);
            border-radius: 50%;
            transition: background var(--transition-normal);
        }
.status-dot.connected {
            background: #30d158; /* Apple green — allowed functional color */
        }
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
            width: 20px; height: 20px;
            border: 2px solid var(--apple-divider);
            border-top-color: var(--apple-text-secondary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto 10px;
        }
.main {
            padding: 32px 24px;
            max-width: 1200px;
            margin: 0 auto;
        }
/* Controls — no card chrome, sit directly on black */
.controls-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 32px;
            padding: 0;
            background: transparent;
            border: none;
            border-radius: 0;
            flex-wrap: wrap;
            gap: 12px;
        }
.control-group {
            display: flex;
            align-items: center;
            gap: 12px;
        }
.control-label {
            font-size: 12px;
            color: var(--apple-text-tertiary);
        }
/* Toggle buttons — segmented control */
.toggle-btn.active { background: var(--apple-blue); color: #fff; }
/* Select inputs */
.token-key-btn.primary {
            background: var(--apple-blue);
            border-color: var(--apple-blue);
            color: #fff;
        }
/* Custom date range */
/* Exchange grid — 1:1 horizontal */
/* Info chips in controls bar */
#dataPoints,  #lastUpdate {
            color: var(--apple-text-primary);
            font-weight: 600;
        }
/* Hero: Total Assets card */
/* Stat cards — no borders, no hover chrome */
/* Change chips row */
/* Charts section */
/* Transfer Records Section */
.transfer-tabs {
            display: flex;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            background: var(--apple-surface-2);
            border-radius: var(--radius-md);
            padding: 3px;
            gap: 3px;
            flex-shrink: 0;
        }
.transfer-tabs::-webkit-scrollbar { display: none; }
.transfer-tab {
            padding: 6px 14px;
            border: none;
            background: transparent;
            color: var(--apple-text-secondary);
            font-size: 12px;
            font-weight: 500;
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: all var(--transition-fast);
            white-space: nowrap;
            flex-shrink: 0;
        }
.transfer-tab:hover { color: var(--apple-text-primary); }
.transfer-tab.active { background: var(--apple-blue); color: #fff; }
.transfer-table-wrap {
            overflow-x: auto;
            padding: 0 24px 16px;
        }
.transfer-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }
.transfer-table th {
            text-align: left;
            padding: 10px 12px;
            color: var(--apple-text-secondary);
            font-size: 12px;
            font-weight: 600;
            border-bottom: 1px solid var(--apple-overlay-medium);
            white-space: nowrap;
        }
.transfer-table td {
            padding: 10px 12px;
            color: var(--apple-text-primary);
            border-bottom: 1px solid var(--apple-overlay-light);
            white-space: nowrap;
        }
.transfer-table tbody tr:hover {
            background: var(--apple-overlay-subtle);
        }
.transfer-table .amount {
            text-align: right;
        }
/* Exchange badges — unified, no brand colors */
.transfer-table .exchange-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: var(--radius-sm);
            font-size: var(--text-xs);
            font-weight: 600;
        }
.transfer-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 32px;
            color: var(--apple-text-secondary);
            font-size: 13px;
        }
/* Pagination buttons */
.page-btn.active {
            background: var(--apple-blue);
            color: #fff;
            border-color: var(--apple-blue);
        }
/* Responsive breakpoints */
@media (max-width: 768px) {
    .header,  .main { padding: 14px; }
    .header {
                min-height: 0;
                align-items: flex-start;
                flex-direction: column;
                gap: 14px;
            }
    .header-left { width: 100%; flex-direction: column; align-items: flex-start; gap: 8px; }
    .status {
                width: 100%;
                align-items: flex-start;
                gap: 8px;
            }
    .status-row {
                justify-content: flex-start;
                gap: 10px;
            }
    .site-url { align-self: flex-start; }
    .controls-bar { flex-direction: column; align-items: stretch; }
    .control-group { justify-content: space-between; }
    /* Transfer section responsive */
    .transfer-tabs { width: 100%; }
    .transfer-table-wrap { padding: 0 16px 16px; }
    /* Info chips stack on mobile */
}
@media (max-width: 480px) {
    .logo-text h1 { font-size: 18px; }
    .logo-text p { display: none; }
}
/* ─── VIX Fear Index ─── */
/* Header secondary line for VIX badge */
.vix-header-line {
            color: var(--apple-text-secondary);
            margin-top: 0;
            margin-bottom: 0;
            line-height: 1;
        }
/* Header badge */
.vix-header-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 2px 10px;
            border-radius: var(--radius-full);
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
            vertical-align: middle;
            cursor: help;
            text-decoration: none;
        }
.vix-header-badge.has-tip {
            text-decoration-line: underline;
            text-decoration-style: dashed;
            text-decoration-thickness: 1px;
            text-underline-offset: 3px;
        }
.vix-header-badge.zone-loading {
            background: var(--apple-overlay);
            color: var(--apple-text-secondary);
        }
.vix-header-badge.zone-error {
            background: var(--data-negative-alpha-14);
            color: var(--data-negative);
        }
.vix-header-badge.zone-extreme-low {
            background: var(--data-negative-alpha-14);
            color: var(--data-negative);
        }
.vix-header-badge.zone-low {
            background: var(--data-negative-alpha-10);
            color: var(--data-negative);
        }
.vix-header-badge.zone-normal {
            background: var(--apple-overlay);
            color: var(--apple-text-primary);
        }
.vix-header-badge.zone-elevated {
            background: var(--data-positive-alpha-22);
            color: var(--data-positive);
        }
.vix-header-badge.zone-high {
            background: var(--data-positive-alpha-30);
            color: var(--data-positive);
        }
.vix-header-badge.zone-extreme {
            background: var(--data-positive-bright-alpha-28);
            color: var(--data-positive-bright);
            box-shadow: 0 0 0 1px var(--data-positive-bright-shadow) inset;
        }
/* VIX advice card */
.vix-advice-card {
            margin-bottom: 16px;
            padding: 14px 18px;
            background: var(--apple-surface-2);
            border-radius: var(--radius-md);
            border: 1px solid var(--apple-divider);
        }
.vix-advice-grid {
            display: flex;
            gap: 20px;
            align-items: center;
            flex-wrap: wrap;
        }
.vix-advice-item {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
.vix-advice-full {
            flex: 1 1 200px;
        }
.vix-advice-label {
            font-size: var(--text-xs);
            color: var(--apple-text-tertiary);
        }
.vix-advice-label.has-tip, 
        .pc-bt-summary-label.has-tip, 
        .etf-th-sort .has-tip, 
        .etf-ds-label.has-tip {
            cursor: help;
            text-decoration-line: underline;
            text-decoration-style: dashed;
            text-decoration-thickness: 1px;
            text-underline-offset: 3px;
        }
/* ── Custom instant tooltip (replaces slow native title tooltip) ── */
.custom-tip {
    position: fixed;
    z-index: 9999;
    max-width: 360px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: var(--apple-tooltip-bg);
    border: 1px solid var(--apple-tooltip-border);
    color: var(--apple-tooltip-text);
    font-size: var(--text-xs);
    line-height: 1.5;
    box-shadow: var(--apple-shadow-tooltip);
    pointer-events: none;
    word-break: break-word;
}
.vix-advice-value {
            font-size: 24px;
            font-weight: 700;
            font-variant-numeric: tabular-nums;
            color: var(--apple-text-primary);
        }
.vix-advice-stat {
            font-size: 16px;
            font-weight: 700;
            font-variant-numeric: tabular-nums;
            color: var(--apple-text-primary);
        }
.vix-advice-zone {
            font-size: 14px;
            font-weight: 600;
            padding: 2px 10px;
            border-radius: var(--radius-full);
            display: inline-block;
            width: fit-content;
        }
.vix-advice-zone.zone-extreme-low {
            background: var(--data-negative-alpha-14);
            color: var(--data-negative);
        }
.vix-advice-zone.zone-low {
            background: var(--data-negative-alpha-10);
            color: var(--data-negative);
        }
.vix-advice-zone.zone-normal {
            background: var(--apple-overlay);
            color: var(--apple-text-primary);
        }
.vix-advice-zone.zone-elevated {
            background: var(--data-positive-alpha-22);
            color: var(--data-positive);
        }
.vix-advice-zone.zone-high {
            background: var(--data-positive-alpha-30);
            color: var(--data-positive);
        }
.vix-advice-zone.zone-extreme {
            background: var(--data-positive-bright-alpha-28);
            color: var(--data-positive-bright);
            box-shadow: 0 0 0 1px var(--data-positive-bright-shadow) inset;
        }
.vix-advice-tip {
            font-size: 13px;
            color: var(--apple-text-secondary);
            line-height: 1.4;
        }
/* ─── Heatmap (treemap) ─── */
.hm-filter-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 10px;
            margin-bottom: 8px;
            border-radius: var(--radius-md);
            cursor: pointer;
            user-select: none;
            font-size: 12px;
            color: var(--apple-text-tertiary);
            background: var(--apple-overlay-subtle);
            border: 1px solid var(--apple-divider);
            width: fit-content;
            transition: color var(--transition-fast), background var(--transition-fast);
        }
.hm-filter-toggle:hover {
            color: var(--apple-text-secondary);
            background: var(--apple-overlay-light);
        }
.hm-filter-icon {
            font-size: 13px;
        }
.hm-filter-arrow {
            font-size: 10px;
            transition: transform 0.2s ease;
        }
.hm-filter-panel {
            margin-bottom: 12px;
        }
.hm-treemap-wrap {
            width: 100%;
            margin-top: 8px;
            border-radius: 14px;
            overflow: hidden;
            box-shadow: var(--apple-card-shadow);
        }
@keyframes hmWrapEnter {
            0% { opacity: 0; transform: scale(0.965); }
            60% { opacity: 1; }
            100% { opacity: 1; transform: scale(1); }
        }
.hm-treemap-wrap.hm-entering {
            animation: hmWrapEnter 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
            transform-origin: center top;
        }
.hm-treemap-svg {
            display: block;
            width: 100%;
            height: auto;
            max-height: 90vh;
        }
.hm-treemap-svg-inner {
            width: 100%;
            height: 100%;
        }
@keyframes hmCellPop {
            0% { opacity: 0; }
            70% { opacity: 1; }
            100% { opacity: 1; }
        }
@keyframes hmLabelFade {
            from { opacity: 0; }
            to { opacity: 1; }
        }
.hm-treemap-svg g.hm-cell {
            cursor: pointer;
            transform-box: fill-box;
            transform-origin: center;
            animation: hmCellPop 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
            transition: filter 0.18s ease;
        }
.hm-treemap-svg g.hm-cell:hover {
            filter: brightness(1.16) saturate(1.06);
        }
/* Breathing effect: return-ranked pulse after load */
.hm-treemap-svg g.hm-cell.hm-breathing {
            animation: hmBreathing 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        }
@keyframes hmBreathing {
            0%, 100% {
                filter: brightness(1);
            }
            50% {
                filter: brightness(1.4) saturate(1.25);
            }
        }
.hm-treemap-svg text.hm-label {
            pointer-events: none;
            user-select: none;
            font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
            letter-spacing: 0.2px;
            animation: hmLabelFade 0.35s ease-out backwards;
        }
/* ── HTML tooltip overlay ── */
.hm-tooltip {
            position: fixed;
            z-index: 9999;
            pointer-events: none;
            min-width: 168px;
            padding: 10px 14px;
            border-radius: 10px;
            background: var(--apple-tooltip-bg);
            border: 1px solid var(--apple-tooltip-border);
            color: var(--apple-tooltip-text);
            font-size: 12px;
            line-height: 1.5;
            box-shadow: var(--apple-shadow-popover);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
        }
.hm-tooltip .hm-tt-sym {
            font-size: 14px;
            font-weight: 700;
            margin-bottom: 6px;
            color: var(--apple-text-primary);
        }
.hm-tooltip .hm-tt-name {
            font-size: 11px;
            font-weight: 500;
            color: var(--apple-text-tertiary);
        }
.hm-tooltip .hm-tt-row {
            display: flex;
            justify-content: space-between;
            gap: 18px;
            margin-top: 3px;
        }
.hm-tooltip .hm-tt-label { color: var(--apple-text-tertiary); }
.hm-tooltip .hm-tt-val {
            font-variant-numeric: tabular-nums;
            font-weight: 600;
            color: var(--apple-text-primary);
        }
.hm-tooltip .hm-tt-up { color: var(--data-positive); }
.hm-tooltip .hm-tt-down { color: var(--data-negative); }
.hm-legend {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 14px;
            font-size: 11px;
            color: var(--apple-text-tertiary);
            flex-wrap: wrap;
        }
.hm-legend-seg { white-space: nowrap; }
.hm-legend-sep { color: var(--apple-text-tertiary); opacity: 0.5; }
.hm-legend-cell {
            width: 18px;
            height: 18px;
            border-radius: 4px;
            flex-shrink: 0;
            border: 1px solid rgba(0,0,0,0.12);
            box-shadow: 0 1px 2px rgba(0,0,0,0.08);
        }
.hm-legend-label {
            font-variant-numeric: tabular-nums;
            font-size: 10px;
            color: var(--apple-text-secondary);
            white-space: nowrap;
        }
/* ── Overview Stats ── */
.hm-stats {
            display: flex;
            gap: 10px;
            margin-top: 10px;
            margin-bottom: 8px;
            flex-wrap: wrap;
        }
.hm-stat-card {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background: var(--apple-surface-1);
            border: 1px solid var(--apple-divider);
            border-radius: var(--radius-md);
            font-size: 11px;
            color: var(--apple-text-secondary);
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
            /* Entrance animation: fade + slide up */
            animation: hmStatEnter 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
        }
@keyframes hmStatEnter {
            from {
                opacity: 0;
                transform: translateY(8px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
.hm-stat-card:nth-child(1) { animation-delay: 0ms; }
.hm-stat-card:nth-child(2) { animation-delay: 60ms; }
.hm-stat-card:nth-child(3) { animation-delay: 120ms; }
.hm-stat-card:nth-child(4) { animation-delay: 180ms; }
.hm-stat-icon {
            font-size: 16px;
            font-weight: 700;
        }
.hm-stat-label {
            font-size: 11px;
            color: var(--apple-text-tertiary);
        }
.hm-stat-val {
            font-variant-numeric: tabular-nums;
            font-weight: 700;
            font-size: 14px;
        }
.hm-stat-up { color: var(--data-positive); }
.hm-stat-down { color: var(--data-negative); }
@media (max-width: 768px) {
            .hm-treemap-svg { max-height: none; }
            .hm-legend { gap: 6px; font-size: 10px; }
            .hm-legend-cell { width: 14px; height: 14px; }
            .hm-legend-label { font-size: 9px; }
            .hm-stats {
                gap: 8px;
                margin-top: 12px;
                /* 2×2 grid on mobile for compactness */
                display: grid;
                grid-template-columns: 1fr 1fr;
            }
            .hm-stat-card {
                padding: 8px 10px;
                font-size: 11px;
                flex-direction: column;
                align-items: flex-start;
                gap: 3px;
            }
            .hm-stat-icon { font-size: 14px; }
            .hm-stat-val { font-size: 13px; }
            .hm-stat-label { font-size: 10px; }
        }

