    :root{
      color-scheme: light;
      --bg: #f1f1f0;
      --panel: #f7f7f6;
      --panel-2: rgba(255,255,255,0.82);
      --text: #0f0f0f;
      --muted: rgba(0,0,0,0.55);
      --line: rgba(0,0,0,0.10);
      --hairline: rgba(0, 0, 0, 0.08);
      --metric-k: rgba(0, 0, 0, 0.52);
      --metric-v: rgba(0, 0, 0, 0.88);
      --shadow: 0 10px 28px rgba(0,0,0,0.08);
      --shadow-2: 0 18px 54px rgba(0,0,0,0.12);
      --orange: #ff6a00;
      --orange-2: #ff4d00;
      /* Highlights panel — shifted toward red-orange */
      --highlights-red: #e53512;
      --highlights-red-deep: #c42a0e;
      /* Translucent layers so backdrop-filter can frost the map */
      --highlights-glass-sheen: rgba(255, 255, 255, 0.07);
      --highlights-glass-mix-top: 74%;
      --highlights-glass-mix-bot: 80%;
      /* Glass panels — translucent so backdrop-filter blurs the globe */
      --term-glass-stroke: rgba(255, 255, 255, 0.62);
      --term-glass-stroke-outer: rgba(0, 0, 0, 0.12);
      --term-glass-fill: rgba(255, 255, 255, 0.22);
      --term-glass-deep: rgba(255, 255, 255, 0.14);
      --term-glass-inset: rgba(255, 255, 255, 0.45);
      --term-glass-key: rgba(0, 0, 0, 0.06);
      --term-glass-shade: rgba(0, 0, 0, 0.12);
      --term-glass-blur: 44px;
      --term-glass-blur-tight: 28px;
      /* Surfaces & chrome (theme-aware; overridden in dark) */
      --term-float-0: rgba(255, 255, 255, 0.65);
      --term-float-1: rgba(255, 255, 255, 0.82);
      --term-float-border-0: rgba(0, 0, 0, 0.08);
      --term-float-border-1: rgba(0, 0, 0, 0.12);
      --term-float-shadow: rgba(0, 0, 0, 0.08);
      --term-fg-secondary: rgba(0, 0, 0, 0.72);
      --term-fg-tertiary: rgba(0, 0, 0, 0.55);
      --term-fg-strong: rgba(0, 0, 0, 0.86);
      --term-menu-bg: rgba(255, 255, 255, 0.96);
      --term-menu-shadow: rgba(0, 0, 0, 0.10);
      --term-row-hover: rgba(0, 0, 0, 0.035);
      --term-row-hover-2: rgba(0, 0, 0, 0.04);
      --term-zoom-chrome: rgba(0, 0, 0, 0.035);
      --term-tooltip-bg: rgba(255, 255, 255, 0.97);
      --term-tooltip-border: rgba(0, 0, 0, 0.10);
      --term-tooltip-shadow: rgba(0, 0, 0, 0.12);
      --term-tooltip-fg: rgba(0, 0, 0, 0.9);
      --term-tooltip-muted: rgba(0, 0, 0, 0.55);
      --term-ghost-bg: rgba(255, 255, 255, 0.70);
      --term-ghost-bg-hover: rgba(255, 255, 255, 0.86);
      --term-ghost-bg-active: rgba(255, 255, 255, 0.92);
      --term-ghost-border: rgba(0, 0, 0, 0.10);
      --term-ghost-fg: rgba(0, 0, 0, 0.62);
      --term-ghost-fg-hover: rgba(0, 0, 0, 0.74);
      --term-tag-bg: rgba(255, 255, 255, 0.7);
      --term-tag-border: rgba(0, 0, 0, 0.10);
      --term-tag-fg: rgba(0, 0, 0, 0.7);
      --term-dot-muted: rgba(0, 0, 0, 0.25);
      --term-info-fg: #111;
      --term-legend-ring: rgba(0, 0, 0, 0.06);
      --term-chart-small: rgba(0, 0, 0, 0.55);
      --term-chart-stat-k: rgba(0, 0, 0, 0.5);
      --term-mini-bar: rgba(0, 0, 0, 0.08);
      --term-divider-soft: rgba(0, 0, 0, 0.08);
      --term-gutter-idle: rgba(0, 0, 0, 0.10);
      --term-map-svg-shadow: rgba(0, 0, 0, 0.06);
      --term-chart-tick: rgba(0, 0, 0, 0.45);
      --term-chart-grid: rgba(0, 0, 0, 0.06);
      --term-chart-tooltip-bg: rgba(255, 255, 255, 0.96);
      --term-chart-tooltip-border: rgba(0, 0, 0, 0.12);
      --term-chart-tooltip-title: rgba(0, 0, 0, 0.9);
      --term-chart-tooltip-body: rgba(0, 0, 0, 0.75);
      --term-chart-line-muted: #111827;

      /* Resizable layout; JS resizer overrides these vars. */
      --leftW: clamp(240px, 26vw, 360px);
      --rightW: clamp(320px, 36vw, 520px);
      --leftScale: 1;
      --rightScale: 1;
      /* Hover strip at left edge — must match .sidebar-hover-panel width for push layout */
      --sidebar-hover-width: 60px;
    }

    @media (prefers-color-scheme: dark) {
      :root {
        color-scheme: dark;
        --bg: #0f0f0f;
        --panel: rgba(28, 28, 28, 0.94);
        --panel-2: rgba(32, 32, 32, 0.88);
        --text: #f0f0f0;
        --muted: rgba(255, 255, 255, 0.55);
        --line: rgba(255, 255, 255, 0.12);
        --hairline: rgba(255, 255, 255, 0.1);
        --metric-k: rgba(255, 255, 255, 0.52);
        --metric-v: rgba(255, 255, 255, 0.92);
        --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
        --shadow-2: 0 20px 56px rgba(0, 0, 0, 0.55);
        --highlights-glass-sheen: rgba(255, 255, 255, 0.06);
        --term-glass-stroke: rgba(255, 255, 255, 0.18);
        --term-glass-stroke-outer: rgba(0, 0, 0, 0.55);
        --term-glass-fill: rgba(32, 32, 32, 0.48);
        --term-glass-deep: rgba(24, 24, 24, 0.55);
        --term-glass-inset: rgba(255, 255, 255, 0.08);
        --term-glass-key: rgba(255, 255, 255, 0.08);
        --term-glass-shade: rgba(0, 0, 0, 0.45);
        --term-float-0: rgba(40, 40, 40, 0.88);
        --term-float-1: rgba(52, 52, 52, 0.92);
        --term-float-border-0: rgba(255, 255, 255, 0.14);
        --term-float-border-1: rgba(255, 255, 255, 0.22);
        --term-float-shadow: rgba(0, 0, 0, 0.4);
        --term-fg-secondary: rgba(255, 255, 255, 0.78);
        --term-fg-tertiary: rgba(255, 255, 255, 0.52);
        --term-fg-strong: rgba(255, 255, 255, 0.92);
        --term-menu-bg: rgba(28, 28, 28, 0.94);
        --term-menu-shadow: rgba(0, 0, 0, 0.5);
        --term-row-hover: rgba(255, 255, 255, 0.06);
        --term-row-hover-2: rgba(255, 255, 255, 0.07);
        --term-zoom-chrome: rgba(255, 255, 255, 0.08);
        --term-tooltip-bg: rgba(28, 28, 28, 0.96);
        --term-tooltip-border: rgba(255, 255, 255, 0.14);
        --term-tooltip-shadow: rgba(0, 0, 0, 0.5);
        --term-tooltip-fg: rgba(255, 255, 255, 0.95);
        --term-tooltip-muted: rgba(255, 255, 255, 0.55);
        --term-ghost-bg: rgba(40, 40, 40, 0.85);
        --term-ghost-bg-hover: rgba(50, 50, 50, 0.9);
        --term-ghost-bg-active: rgba(56, 56, 56, 0.95);
        --term-ghost-border: rgba(255, 255, 255, 0.12);
        --term-ghost-fg: rgba(255, 255, 255, 0.72);
        --term-ghost-fg-hover: rgba(255, 255, 255, 0.88);
        --term-tag-bg: rgba(40, 40, 40, 0.75);
        --term-tag-border: rgba(255, 255, 255, 0.12);
        --term-tag-fg: rgba(255, 255, 255, 0.78);
        --term-dot-muted: rgba(255, 255, 255, 0.35);
        --term-info-fg: rgba(255, 255, 255, 0.95);
        --term-legend-ring: rgba(255, 255, 255, 0.12);
        --term-chart-small: rgba(255, 255, 255, 0.55);
        --term-chart-stat-k: rgba(255, 255, 255, 0.5);
        --term-mini-bar: rgba(255, 255, 255, 0.12);
        --term-divider-soft: rgba(255, 255, 255, 0.1);
        --term-gutter-idle: rgba(255, 255, 255, 0.14);
        --term-map-svg-shadow: rgba(0, 0, 0, 0.35);
        --term-chart-tick: rgba(255, 255, 255, 0.45);
        --term-chart-grid: rgba(255, 255, 255, 0.08);
        --term-chart-tooltip-bg: rgba(28, 28, 28, 0.96);
        --term-chart-tooltip-border: rgba(255, 255, 255, 0.16);
        --term-chart-tooltip-title: rgba(255, 255, 255, 0.95);
        --term-chart-tooltip-body: rgba(255, 255, 255, 0.72);
        --term-chart-line-muted: #a8a8a8;
      }
    }

    * { box-sizing: border-box; }
    html, body { height: 100%; }
    body {
      margin: 0;
      font-family: var(--font);
      color: var(--text);
      background: var(--bg);
      overflow: hidden;
    }

    .app {
      height: 100%;
      height: 100dvh;
      width: 100%;
      margin-left: 0;
      box-sizing: border-box;
      display: grid;
      grid-template-columns: var(--leftW) 1fr var(--rightW);
      grid-template-rows: 1fr;
      grid-template-areas: "left main right";
      position: relative;
      isolation: isolate;
      transition:
        margin-left 0.24s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* Full-viewport globe behind chrome so glass panels actually frost the map */
    .app-map-backdrop {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: auto;
      background: var(--bg);
    }
    .terminal-map-stack {
      position: absolute;
      inset: 0;
    }

    /* Fades map opacity at the top so the top bar / search read clearly; clicks pass through. */
    .terminal-map-top-fade {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      height: min(260px, 44vh);
      z-index: 2;
      pointer-events: none;
      background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--bg) 92%, transparent) 0%,
        color-mix(in srgb, var(--bg) 55%, transparent) 38%,
        color-mix(in srgb, var(--bg) 18%, transparent) 72%,
        transparent 100%
      );
    }

    .left,
    .main,
    .right {
      position: relative;
      z-index: 1;
    }

    /* Resizer gutters */
    .gutter {
      grid-row: 1;
      z-index: 20;
      width: 14px;
      margin-left: -7px;
      cursor: col-resize;
      position: relative;
      touch-action: none;
    }
    .gutter::before {
      content: '';
      position: absolute;
      top: 10px;
      bottom: 10px;
      left: 50%;
      transform: translateX(-50%);
      width: 2px;
      border-radius: 999px;
      background: var(--term-gutter-idle);
      opacity: 0;
      transition: opacity 0.12s ease, background 0.12s ease;
    }
    .gutter:hover::before,
    .gutter.dragging::before {
      opacity: 1;
      background: rgba(255,106,0,0.55);
    }
    .gutter-left { grid-column: 2; }  /* boundary between left and map */
    .gutter-right { grid-column: 3; } /* boundary between map and right */

    body.resizing {
      cursor: col-resize;
      user-select: none;
    }
    body.resizing * {
      pointer-events: none;
    }
    body.resizing .gutter {
      pointer-events: auto;
    }

    /* Left edge hover sidebar — empty shell for future menu links */
    .sidebar-hover {
      position: fixed;
      left: 0;
      top: 0;
      bottom: 0;
      width: min(calc(var(--sidebar-hover-width) + 18px), 40vw);
      z-index: 35;
      pointer-events: none;
    }
    .sidebar-hover-trigger {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 8px;
      pointer-events: auto;
      cursor: default;
    }
    .sidebar-hover-panel {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: var(--sidebar-hover-width);
      max-width: min(var(--sidebar-hover-width), calc(100vw - 16px));
      padding: max(6px, env(safe-area-inset-top, 0px)) 4px 8px max(4px, env(safe-area-inset-left, 0px));
      box-sizing: border-box;
      transform: translateX(-100%);
      transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
      pointer-events: none;
      background: var(--term-glass-fill);
      backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      border-right: 1px solid var(--term-glass-stroke);
      box-shadow: none;
    }
    @media (hover: hover) and (pointer: fine) {
      .sidebar-hover:has(.sidebar-hover-trigger:hover) .sidebar-hover-panel,
      .sidebar-hover:has(.sidebar-hover-panel:hover) .sidebar-hover-panel {
        transform: translateX(0);
        pointer-events: auto;
      }
      /* Sidebar is a sibling of .app so it stays at the viewport edge while chrome narrows + shifts right */
      body:has(.sidebar-hover .sidebar-hover-trigger:hover) .app,
      body:has(.sidebar-hover .sidebar-hover-panel:hover) .app {
        margin-left: var(--sidebar-hover-width);
        width: calc(100% - var(--sidebar-hover-width));
      }
      body:has(.sidebar-hover .sidebar-hover-trigger:hover) .map-topbar,
      body:has(.sidebar-hover .sidebar-hover-panel:hover) .map-topbar {
        left: calc(max(8px, env(safe-area-inset-left, 0px)) + var(--sidebar-hover-width) + var(--leftW));
      }
      body:has(.sidebar-hover .sidebar-hover-trigger:hover) .map-topbar-wordmark.site-wordmark,
      body:has(.sidebar-hover .sidebar-hover-panel:hover) .map-topbar-wordmark.site-wordmark {
        left: calc(max(14px, env(safe-area-inset-left, 0px)) + var(--sidebar-hover-width));
      }
    }
    @media (prefers-reduced-motion: reduce) {
      .sidebar-hover-panel {
        transition-duration: 0.01ms;
      }
      .app {
        transition-duration: 0.01ms;
      }
    }

    /* Map top bar — inset from left/right panel edges (aligned with map column) */
    .map-topbar {
      position: fixed;
      top: max(14px, env(safe-area-inset-top, 0px));
      left: calc(max(8px, env(safe-area-inset-left, 0px)) + var(--leftW));
      right: max(14px, env(safe-area-inset-right, 0px));
      z-index: 25;
      display: flex;
      align-items: center;
      gap: 10px;
      height: 36px;
      user-select: none;
      pointer-events: none;
    }
    .map-topbar > * {
      pointer-events: auto;
    }
    /* Wordmark: true viewport top-left (out of flex flow); shifts when hover-sidebar is open */
    .map-topbar-wordmark.site-wordmark {
      position: fixed;
      top: max(14px, env(safe-area-inset-top, 0px));
      left: max(14px, env(safe-area-inset-left, 0px));
      z-index: 36;
      height: 36px;
      font-size: 0.875rem;
      color: var(--term-fg-strong);
      line-height: 1;
      margin: 0;
    }
    .map-topbar-wordmark.site-wordmark .site-wordmark-logo {
      height: 26px;
    }
    .map-topbar-center {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      height: 36px;
    }
    .map-topbar-center .search {
      width: 100%;
      max-width: min(520px, 100%);
      min-width: min(240px, 100%);
    }

    /* Zoom — top-right of map column only (not full viewport) */
    .main .map-controls {
      position: absolute;
      top: max(14px, env(safe-area-inset-top, 0px));
      right: max(14px, env(safe-area-inset-right, 0px));
      z-index: 25;
    }
    .main .map-controls .zoom {
      display: inline-flex;
      border: 1px solid var(--term-float-border-0);
      border-radius: 0;
      overflow: hidden;
      background: var(--term-float-0);
      box-shadow: 0 10px 24px var(--term-float-shadow);
    }
    .main .map-controls .zoom button {
      width: 44px;
      height: 36px;
      font-size: 1.15rem;
      border: none;
      background: transparent;
      line-height: 1;
      cursor: pointer;
      color: var(--term-fg-secondary);
      transition: background 0.12s ease, color 0.12s ease;
    }
    .main .map-controls .zoom button + button {
      border-left: 1px solid var(--term-float-border-0);
    }
    .main .map-controls .zoom button:hover {
      background: var(--term-row-hover-2);
      color: var(--text);
    }
    .main .map-controls .zoom button:active {
      background: var(--term-row-hover);
    }

    .search {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      height: 100%;
      padding: 0 8px 0 2px;
      border-radius: 0;
      border: none;
      background: transparent;
      color: var(--term-fg-secondary);
      font-size: 1rem;
    }
    .search svg { opacity: 0.7; width: 16px; height: 16px; }
    .search input {
      border: none;
      outline: none;
      background: transparent;
      font: inherit;
      color: inherit;
      width: min(260px, 42vw);
      height: 100%;
    }
    .search input::placeholder { color: var(--term-fg-tertiary); }
    .search-menu{
      position: fixed;
      left: 0;
      transform: none;
      top: calc(max(14px, env(safe-area-inset-top, 0px)) + 36px + 8px);
      z-index: 26;
      width: min(520px, calc(100vw - 28px));
      min-width: 260px;
      max-width: min(520px, calc(100vw - 28px));
      max-height: min(320px, calc(100vh - 120px));
      overflow: auto;
      border: 1px solid var(--term-float-border-0);
      background: var(--term-menu-bg);
      border-radius: 0;
      box-shadow: 0 10px 26px var(--term-menu-shadow);
      padding: 4px;
      display: none;
    }
    .search-menu.open{ display: block; }
    .search-item{
      display: flex;
      flex-direction: column;
      gap: 1px;
      padding: 9px 10px;
      border-radius: 0;
      cursor: pointer;
      user-select: none;
      color: var(--term-fg-strong);
    }
    .search-item:hover,
    .search-item.active{
      background: var(--term-row-hover);
    }
    .search-item .label{
      font-weight: 700;
      letter-spacing: 0.01em;
    }
    .search-item .sub{
      font-size: 0.83rem;
      color: var(--term-fg-tertiary);
    }
    .search-empty{
      padding: 12px 10px;
      color: var(--term-fg-tertiary);
      font-size: 0.9rem;
    }
    #info-title {
      text-decoration: underline;
      text-underline-offset: 3px;
      text-decoration-thickness: 1px;
    }
    #info-title.switchable {
      cursor: pointer;
    }
    .city-menu{
      position: fixed;
      z-index: 50;
      min-width: 220px;
      max-width: min(320px, calc(100vw - 24px));
      max-height: min(320px, calc(100vh - 24px));
      overflow: auto;
      border: 1px solid var(--term-tooltip-border);
      background: var(--term-tooltip-bg);
      box-shadow: 0 16px 48px var(--term-tooltip-shadow);
      padding: 6px;
      display: none;
    }
    .city-menu.open{ display: block; }
    .city-item{
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 9px 10px;
      cursor: pointer;
      user-select: none;
      color: var(--term-fg-strong);
    }
    .city-item:hover{ background: var(--term-row-hover-2); }
    .city-item.active{ background: rgba(255,106,0,0.10); }
    .city-item .label{ font-weight: 700; letter-spacing: 0.01em; }
    .city-item .sub{ font-size: 0.82rem; color: var(--term-fg-tertiary); }
    .spacer { flex: 1; }
    .zoom {
      display: inline-flex;
      border: 1px solid var(--term-float-border-0);
      border-radius: 0;
      overflow: hidden;
      background: var(--term-zoom-chrome);
    }
    .zoom button {
      width: 42px; height: 34px;
      border: none;
      background: transparent;
      font-size: 1.05rem;
      line-height: 1;
      cursor: pointer;
      color: var(--term-fg-secondary);
      transition: background 0.12s ease, color 0.12s ease;
    }
    .zoom button + button { border-left: 1px solid var(--line); }
    .zoom button:hover { background: var(--term-row-hover-2); color: var(--text); }
    .zoom button:active { background: var(--term-row-hover); }
    .top-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .icon-btn {
      width: 34px; height: 34px;
      display: grid;
      place-items: center;
      border: 1px solid var(--line);
      background: var(--term-float-0);
      border-radius: 10px;
      cursor: not-allowed;
      opacity: 0.85;
    }
    .icon-btn svg { width: 16px; height: 16px; opacity: 0.8; }
    .icon-action{
      width: 34px; height: 34px;
      display: grid;
      place-items: center;
      border: 1px solid var(--line);
      background: var(--term-float-0);
      border-radius: 10px;
      cursor: pointer;
      opacity: 0.9;
      transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
    }
    .icon-action:hover{
      background: var(--term-float-1);
      border-color: var(--term-float-border-1);
      opacity: 1;
    }
    .icon-action:active{
      background: var(--term-float-1);
    }
    .icon-action svg { width: 16px; height: 16px; opacity: 0.8; }

    /* Left overview panel — height follows content (capped); bottom-aligned in grid */
    .left {
      grid-area: left;
      align-self: end;
      width: 100%;
      height: auto;
      max-height: min(80dvh, 100%);
      min-height: 0;
      min-width: 0;
      display: flex;
      flex-direction: column;
      background: var(--term-glass-fill);
      backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      border-right: 1px solid var(--term-glass-stroke);
      border-top: 1px solid var(--term-glass-stroke);
      box-shadow: none;
      padding: 0;
      overflow: hidden;
      position: relative;
    }

    .left-inner {
      flex: 1 1 auto;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 22px 18px 14px;
      display: flex;
      flex-direction: column;
      -webkit-overflow-scrolling: touch;
    }

    .left-inner-stack {
      min-width: 0;
    }

    .left-head {
      margin-top: 0;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }
    .title {
      margin: 0;
      font-size: calc(1.75rem * var(--leftScale));
      font-weight: 800;
      letter-spacing: -0.02em;
      line-height: 1.02;
      color: var(--text);
    }
    .left-actions {
      display: flex;
      gap: 8px;
      opacity: 0.9;
    }
    .mini-btn {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid var(--term-ghost-border);
      background: var(--term-float-0);
      display: grid;
      place-items: center;
      cursor: not-allowed;
    }
    .mini-btn svg { width: 16px; height: 16px; opacity: 0.75; }
    .ghost-btn{
      border: 1px solid var(--term-ghost-border);
      background: var(--term-ghost-bg);
      border-radius: 12px;
      padding: 9px 10px;
      font-family: var(--font);
      font-weight: 800;
      font-size: 0.66rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--term-ghost-fg);
      cursor: pointer;
      transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
      user-select: none;
    }
    .ghost-btn:hover{
      background: var(--term-ghost-bg-hover);
      border-color: rgba(255,106,0,0.35);
      color: var(--term-ghost-fg-hover);
    }
    .ghost-btn:active{
      background: var(--term-ghost-bg-active);
    }
    .ghost-btn[aria-pressed="true"]{
      border-color: rgba(255,106,0,0.40);
    }

    .left-stack {
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding-top: 0;
    }
    .card {
      border: 1px solid var(--term-glass-stroke);
      background: var(--term-glass-deep);
      backdrop-filter: blur(var(--term-glass-blur-tight)) saturate(160%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur-tight)) saturate(160%);
      border-radius: 16px;
      box-shadow:
        0 1px 0 var(--term-glass-inset) inset,
        0 0 0 0.5px var(--term-glass-key);
      overflow: hidden;
    }
    /* Country overview — flat on the left panel (no inset card chrome) */
    .country-card {
      align-self: stretch;
      padding: 0;
      border: none;
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      border-radius: 0;
      box-shadow: none;
      overflow: visible;
    }
    .country-card .mini-bars { display: none; }
    .oil-context{
      margin-top: 4px;
      padding-top: 8px;
      border-top: 1px solid var(--term-divider-soft);
      color: var(--term-fg-secondary);
      font-size: 0.9rem;
      line-height: 1.35;
    }
    .oil-context .k{
      font-size: 0.62rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      opacity: 0.72;
      margin-bottom: 6px;
    }
    .oil-context .v{
      font-weight: 600;
      color: var(--text);
    }
    .card-topline {
      font-size: 0.7rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .card-topline-row{
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .card-topline-row .ghost-btn{
      padding: 7px 9px;
      border-radius: 999px;
      font-size: 0.6rem;
      letter-spacing: 0.14em;
    }
    .card-title {
      margin-top: 10px;
      font-size: 1.05rem;
      font-weight: 800;
      letter-spacing: -0.01em;
      line-height: 1.12;
      color: var(--text);
    }
    .pill-row {
      margin-top: 10px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .tag {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 8px;
      border: 1px solid var(--term-tag-border);
      background: var(--term-tag-bg);
      border-radius: 999px;
      font-family: var(--font);
      font-size: 0.68rem;
      letter-spacing: 0.06em;
      color: var(--term-tag-fg);
    }
    .dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: var(--term-dot-muted);
    }
    .dot.orange { background: var(--orange); }
    .dot.green { background: #16a34a; }

    /* Overview numbers — match app.html #card-overview metrics */
    .overview-metrics{
      display: flex;
      flex-direction: column;
      gap: 0;
      margin-top: 14px;
    }
    .overview-row{
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      border-top: 1px solid var(--hairline);
      padding-top: 10px;
      padding-bottom: 14px;
    }
    .overview-metric-empty{
      min-width: 0;
      pointer-events: none;
    }
    .overview-metrics .metric{
      min-width: 0;
    }
    .overview-metrics .metric .k{
      font-family: var(--font);
      font-size: 0.66rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--metric-k);
    }
    .overview-metrics .metric .v{
      margin-top: 6px;
      font-family: var(--font);
      font-size: 0.95rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      font-variant-numeric: tabular-nums;
      color: var(--metric-v);
      line-height: 1.25;
    }

    .mini-bars {
      height: 76px;
      border-top: 1px solid var(--term-divider-soft);
      margin-top: 12px;
      padding-top: 12px;
      display: grid;
      grid-template-columns: repeat(16, 1fr);
      gap: 5px;
      align-items: end;
      opacity: 0.72;
    }
    .mini-bars span{
      display: block;
      height: 40%;
      border-radius: 6px;
      background: var(--term-mini-bar);
    }
    .mini-bars span:nth-child(3n){ height: 65%; }
    .mini-bars span:nth-child(4n){ height: 25%; }
    .mini-bars span:nth-child(5n){ height: 85%; }

    /* Map chrome only: globe lives in .app-map-backdrop; pass clicks through to globe */
    .main {
      grid-area: main;
      position: relative;
      background: transparent;
      overflow: visible;
      pointer-events: none;
    }
    .main > * {
      pointer-events: auto;
    }

    /* ── Map (reuse homepage style) ─────────────────────────────── */
    .terminal-map-wrap {
      position: absolute;
      inset: 0;
      overflow: hidden;
      z-index: 1;
    }
    #terminal-map.terminal-mapkit-root,
    #terminal-map.terminal-map-openfreemap-root {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      min-height: 200px;
      filter: none;
    }

    .terminal-map-wrap .maplibregl-map,
    .terminal-map-wrap .maplibregl-canvas-container {
      position: absolute !important;
      inset: 0;
    }
    .terminal-map-wrap svg{
      filter: drop-shadow(0 20px 40px var(--term-map-svg-shadow));
    }
    .terminal-map-wrap svg {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
      touch-action: none;
    }
    /* Slightly bluer ocean so the globe reads on mobile */
    .sphere { fill: #e7eef7; }
    .graticule { fill: none; stroke: rgba(48,48,48,0.05); stroke-width: 0.3; }
    .country {
      fill: none;
      stroke: rgba(48, 48, 48, 0.22);
      stroke-width: 0.5;
      vector-effect: non-scaling-stroke;
      paint-order: stroke fill;
      cursor: default;
      transition: stroke 0.12s ease;
    }
    .country:hover {
      fill: none;
      stroke: rgba(48, 48, 48, 0.36);
    }
    .country.live {
      fill: rgba(17, 24, 39, 0.28); /* dark grey for non-selected live */
      stroke: none;
      cursor: pointer;
    }
    .country.live:hover { fill: rgba(17, 24, 39, 0.38); }
    .country.live.selected {
      fill: rgba(254,94,14,0.26); /* orange for selected */
    }
    .country.live.selected:hover { fill: rgba(254,94,14,0.34); }
    /* Singapore overlay (countries-110m may merge SG into MY) — matches app.html */
    .country.live.country-sg{
      stroke: rgba(32, 32, 32, 0.58);
      stroke-width: 1.15px;
      vector-effect: non-scaling-stroke;
      paint-order: stroke fill;
    }
    .country.live.country-sg.selected{
      stroke: rgba(255, 106, 0, 0.9);
      stroke-width: 1.85px;
    }
    .border-mesh {
      fill: none;
      stroke: rgba(48,48,48,0.14);
      stroke-width: 0.5;
      pointer-events: none;
    }
    .border-live {
      fill: none;
      stroke: rgba(17, 24, 39, 0.45); /* dark grey for non-selected live */
      stroke-width: 1;
      pointer-events: none;
    }
    .border-live.selected {
      stroke: rgba(254,94,14,0.75); /* orange for selected only */
    }

    /* Dark globe — after light rules; #terminal-map raises specificity so this wins over .sphere/.country */
    @media (prefers-color-scheme: dark) {
      #terminal-map svg {
        filter: drop-shadow(0 20px 40px var(--term-map-svg-shadow));
      }
      #terminal-map .sphere { fill: #1a1a1a; }
      #terminal-map .graticule {
        fill: none;
        stroke: rgba(255, 255, 255, 0.08);
        stroke-width: 0.3;
      }
      #terminal-map .country {
        fill: none;
        stroke: rgba(255, 255, 255, 0.2);
        stroke-width: 0.5;
        vector-effect: non-scaling-stroke;
        paint-order: stroke fill;
      }
      #terminal-map .country:hover {
        fill: none;
        stroke: rgba(255, 255, 255, 0.34);
      }
      #terminal-map .country.live {
        fill: rgba(255, 255, 255, 0.2);
        stroke: none;
      }
      #terminal-map .country.live:hover { fill: rgba(255, 255, 255, 0.3); }
      #terminal-map .country.live.selected {
        fill: rgba(255, 106, 0, 0.32);
      }
      #terminal-map .country.live.selected:hover { fill: rgba(255, 106, 0, 0.42); }
      #terminal-map .country.live.country-sg {
        stroke: rgba(255, 255, 255, 0.4);
        stroke-width: 1.15px;
        vector-effect: non-scaling-stroke;
        paint-order: stroke fill;
      }
      #terminal-map .country.live.country-sg.selected {
        stroke: rgba(255, 200, 140, 0.95);
        stroke-width: 1.85px;
      }
      #terminal-map .border-mesh {
        fill: none;
        stroke: rgba(255, 255, 255, 0.12);
        stroke-width: 0.5;
      }
      #terminal-map .border-live {
        fill: none;
        stroke: rgba(255, 255, 255, 0.28);
        stroke-width: 1;
      }
      #terminal-map .border-live.selected {
        stroke: rgba(255, 106, 0, 0.85);
      }
    }

    /* Tooltip (reuse homepage) */
    #tooltip {
      position: fixed;
      z-index: 500;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.12s ease;
      background: var(--term-tooltip-bg);
      border: 1px solid var(--term-tooltip-border);
      border-radius: 10px;
      padding: 9px 14px 8px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      box-shadow: 0 10px 28px var(--term-tooltip-shadow);
      min-width: 148px;
    }
    #tooltip.show { opacity: 1; }
    .tt-country {
      display: block;
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--term-tooltip-fg);
      letter-spacing: 0.02em;
      margin-bottom: 3px;
    }
    .tt-status {
      display: block;
      font-size: 0.7rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-family: var(--font);
      color: var(--term-tooltip-muted);
    }
    .tt-status.live { color: rgba(255,106,0,0.95); }

    /* Right panel — single hairline frame (no stacked box-shadow borders) */
    .right {
      grid-area: right;
      background: transparent;
      border-left: 1px solid var(--term-glass-stroke);
      border-top: 1px solid var(--term-glass-stroke);
      border-right: 1px solid var(--term-glass-stroke);
      display: grid;
      grid-template-rows: 1fr 1fr;
      min-height: 0;
    }

    /* Desktop layout: chart (history) on top, highlights below */
    .chart {
      padding: 28px 26px;
      border-bottom: 1px solid var(--term-glass-stroke);
      background: var(--term-glass-fill);
      backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
      box-shadow: none;
      display: flex;
      flex-direction: column;
      gap: 14px;
      min-height: 0;
      overflow: auto;
    }
    .chart h2 {
      margin: 0;
      font-size: calc(3.1rem * var(--rightScale));
      font-weight: 800;
      letter-spacing: -0.04em;
      line-height: 0.95;
      color: var(--text);
    }
    /* Hide the large country title in the white panel */
    #right-title { display: none; }
    .chart .small {
      color: var(--term-chart-small);
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }
    .chart .statgrid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px 18px;
      margin-top: 4px;
    }
    .chart .stat .k {
      font-size: 0.66rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--term-chart-stat-k);
    }
    .chart .stat .v {
      margin-top: 6px;
      font-family: var(--font);
      font-weight: 800;
      letter-spacing: 0.02em;
      color: var(--text);
    }
    .chart .toolbar {
      margin-top: auto;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 12px;
      flex-wrap: wrap;
    }
    /* Inline legend (replaces "Gov API" tag) */
    #right-subtag{
      display: inline-flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      color: var(--term-chart-small);
      font-family: var(--font);
      font-weight: 700;
      letter-spacing: 0.02em;
    }
    .legend-item{
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.72rem;
      white-space: nowrap;
    }
    .legend-dot{
      width: 8px;
      height: 8px;
      border-radius: 999px;
      box-shadow: 0 0 0 2px var(--term-legend-ring);
      flex: 0 0 auto;
    }
    /* export buttons now use .icon-action */

    .chart-canvas-wrap {
      position: relative;
      flex: 1;
      min-height: 220px;
      border: 1px solid var(--term-glass-stroke);
      border-radius: 16px;
      background: var(--term-glass-deep);
      backdrop-filter: blur(var(--term-glass-blur-tight)) saturate(155%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur-tight)) saturate(155%);
      box-shadow: none;
      padding: 12px 12px 10px;
    }
    .chart-canvas-wrap canvas {
      width: 100% !important;
      height: 100% !important;
      display: block;
    }
    .info {
      background-color: transparent;
      background-image:
        linear-gradient(180deg, var(--highlights-glass-sheen) 0%, transparent 40%),
        linear-gradient(
          165deg,
          color-mix(in srgb, var(--highlights-red) var(--highlights-glass-mix-top), transparent) 0%,
          color-mix(in srgb, var(--highlights-red-deep) var(--highlights-glass-mix-bot), transparent) 100%
        );
      backdrop-filter: blur(var(--term-glass-blur)) saturate(185%);
      -webkit-backdrop-filter: blur(var(--term-glass-blur)) saturate(185%);
      color: var(--term-info-fg);
      padding: 28px 26px;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      gap: 10px;
      min-height: 0;
      overflow: auto;
      border-top: none;
      box-shadow: none;
    }
    .info h3 {
      margin: 0;
      font-size: 2.1rem;
      font-weight: 800;
      letter-spacing: -0.02em;
      line-height: 1.05;
    }
    .info .hint {
      font-family: var(--font);
      font-size: 0.78rem;
      letter-spacing: 0.06em;
      opacity: 0.8;
    }
    /* Parent grid + subgrid on each row so price/delta columns share one width across all
       rows (avoids “MYR 1.99/L” shifting when delta is “-” vs “+MYR 0.40”). */
    .info .lines {
      margin-top: 10px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) max-content max-content;
      column-gap: 10px;
      row-gap: 10px;
      font-family: var(--font);
      font-size: 0.78rem;
      letter-spacing: 0.02em;
      opacity: 0.95;
    }
    .info .kv {
      display: grid;
      grid-template-columns: subgrid;
      grid-column: 1 / -1;
      align-items: baseline;
      padding-top: 10px;
      border-top: 1px solid color-mix(in srgb, var(--highlights-red-deep) 45%, rgba(0, 0, 0, 0.2));
    }
    .kv .k {
      opacity: 0.72;
      grid-column: 1;
      min-width: 0;
      line-height: 1.3;
      hyphens: none;
    }
    .kv .v {
      font-weight: 800;
      min-width: 0;
    }
    .kv .v-wrap {
      display: contents;
    }
    .kv .v-wrap .v {
      grid-column: 2;
      text-align: left;
      margin-top: 0;
    }
    .kv .v-wrap .v:only-child {
      grid-column: 2 / span 2;
    }
    .kv > .v {
      grid-column: 2 / span 2;
      margin-top: 0;
      text-align: left;
    }
    .kv .v-wrap .v-delta {
      grid-column: 3;
      font-size: 0.85em;
      font-weight: 400;
      font-variant-numeric: tabular-nums;
      opacity: 0.72;
      white-space: nowrap;
      text-align: left;
    }

    @supports not (grid-template-columns: subgrid) {
      .info .lines {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
      }
      .info .kv {
        grid-column: auto;
        grid-template-columns: minmax(0, 1fr) minmax(12.5ch, max-content) minmax(10.5ch, max-content);
        column-gap: 10px;
      }
    }

    @media (prefers-color-scheme: dark) {
      .info {
        background-color: var(--term-glass-fill);
        background-image: linear-gradient(
          180deg,
          rgba(255, 255, 255, 0.1) 0%,
          transparent 42%
        );
        background-repeat: no-repeat;
        backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
        -webkit-backdrop-filter: blur(var(--term-glass-blur)) saturate(175%);
        color: var(--term-info-fg);
        border-top: none;
        box-shadow: none;
      }
      .info .kv {
        border-top: 1px solid var(--hairline);
      }
    }

    .pager {
      position: absolute;
      right: 20px;
      bottom: 18px;
      display: inline-flex;
      gap: 0;
      border-radius: 0;
      border: 1px solid #3a3a3a;
      background: #2f2f2f;
      box-shadow: 0 14px 34px rgba(0,0,0,0.28);
      overflow: hidden;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .pager button {
      width: 38px;
      height: 38px;
      border-radius: 0;
      border: none;
      background: transparent;
      color: #bdbdbd;
      cursor: pointer;
      font-size: 0.95rem;
      font-weight: 400;
      line-height: 1;
      display: grid;
      place-items: center;
      transition: background 0.12s ease, color 0.12s ease;
    }
    .pager button + button { border-left: 1px solid #3a3a3a; }
    .pager button:hover { background: #3a3a3a; color: #d6d6d6; }
    .pager button:active { background: #444444; }
    .pager button:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }


