/* ===== Design tokens ===== */
:root,
[data-theme="light"] {
  /* Light: warm white + champagne gold (round-5 palette; glass/button alphas from round 6) */
  --bg: #f6f1e8;
  --bg-2: #efe6d6;
  --blob-1: rgba(214, 174, 98, 0.42);
  --blob-2: rgba(255, 228, 182, 0.75);
  --blob-3: rgba(196, 160, 104, 0.28);
  --glass: rgba(255, 252, 246, 0.40);
  --glass-strong: rgba(255, 253, 249, 0.64);
  --data: rgba(255, 254, 251, 0.94);
  --btn: rgba(255, 252, 246, 0.28);
  --btn-hover: rgba(255, 252, 246, 0.52);
  --btn-sel: rgba(196, 150, 70, 0.26);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 62%);
  --edge: rgba(255, 255, 255, 0.95);
  --border: rgba(150, 116, 56, 0.20);
  --border-strong: rgba(150, 116, 56, 0.38);
  --text: #1e1a14;
  --text-2: #554b3c;
  --text-3: #6f6555;
  --accent: #9a6f22;
  --accent-text: #7f5a17;
  --accent-soft: rgba(196, 150, 70, 0.16);
  --accent-glow: rgba(160, 120, 50, 0.26);
  --accent-grad: linear-gradient(135deg, #ecd5a2 0%, #cfa457 55%, #bb8f42 100%);
  --on-accent: #2a1e08;
  --chart-line: #9a6f22;
  --chart-dd: #7a6a58;
  --mk-twd: #1f6fb2;
  --mk-usd: #b5541c;
  --up: #c8262f;
  --down: #0f7a4f;
  --grid: rgba(90, 70, 40, 0.12);
  --shadow: 0 12px 32px rgba(110, 82, 36, 0.12), 0 2px 6px rgba(110, 82, 36, 0.06);
  --shadow-hover: 0 18px 40px rgba(110, 82, 36, 0.18), 0 3px 8px rgba(110, 82, 36, 0.08);
  --banner-bg: rgba(122, 88, 28, 0.10);
  --backdrop: rgba(10, 8, 4, 0.45);
  color-scheme: light;
}

[data-theme="dark"] {
  /* Dark: deep black + gold (round-5 palette; glass/button alphas from round 6) */
  --bg: #0b0a08;
  --bg-2: #14110c;
  --blob-1: rgba(201, 158, 78, 0.24);
  --blob-2: rgba(120, 90, 40, 0.30);
  --blob-3: rgba(232, 196, 122, 0.12);
  --glass: rgba(30, 26, 20, 0.34);
  --glass-strong: rgba(32, 28, 22, 0.60);
  --data: rgba(20, 18, 15, 0.94);
  --btn: rgba(216, 178, 106, 0.10);
  --btn-hover: rgba(216, 178, 106, 0.18);
  --btn-sel: rgba(216, 178, 106, 0.26);
  --sheen: linear-gradient(180deg, rgba(255, 240, 210, 0.13) 0%, rgba(255, 240, 210, 0) 62%);
  --edge: rgba(255, 233, 190, 0.16);
  --border: rgba(214, 177, 108, 0.18);
  --border-strong: rgba(214, 177, 108, 0.40);
  --text: #f4eee3;
  --text-2: #c7bdab;
  --text-3: #a39885;
  --accent: #d8b26a;
  --accent-text: #e3c283;
  --accent-soft: rgba(216, 178, 106, 0.14);
  --accent-glow: rgba(216, 178, 106, 0.30);
  --accent-grad: linear-gradient(135deg, #f3dca6 0%, #d6ad5f 55%, #bf9445 100%);
  --on-accent: #1c1407;
  --chart-line: #d8b26a;
  --chart-dd: #b9a68a;
  --mk-twd: #6fb3ff;
  --mk-usd: #f0955a;
  --up: #ff5c63;
  --down: #2fc489;
  --grid: rgba(240, 220, 180, 0.10);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 22px 50px rgba(0, 0, 0, 0.55), 0 3px 8px rgba(0, 0, 0, 0.4);
  --banner-bg: rgba(216, 178, 106, 0.10);
  --backdrop: rgba(10, 8, 4, 0.55);
  color-scheme: dark;
}

:root {
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --maxw: 1240px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Segoe UI Variable", "Segoe UI",
    "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", system-ui, sans-serif;
  --blur: saturate(160%) blur(18px);
  --blur-btn: saturate(170%) blur(14px);
  --header-h: 68px;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  background-color: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: .01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); transition: background .4s ease; }
.blob-1 { width: 560px; height: 560px; top: -170px; right: -120px; background: var(--blob-1); }
.blob-2 { width: 640px; height: 640px; top: 30%; left: -260px; background: var(--blob-2); }
.blob-3 { width: 500px; height: 500px; bottom: -180px; right: 12%; background: var(--blob-3); }

/* ===== Surfaces ===== */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
}
/* Text and chart areas: stable, nearly opaque base so the glow never competes with numbers */
.data-surface {
  background: var(--data);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
}

/* ===== Glass buttons (shared) ===== */
.chip, .seg, .entry, .main-nav a[aria-current="page"], .modal-close {
  -webkit-backdrop-filter: var(--blur-btn);
  backdrop-filter: var(--blur-btn);
}
.chip, .entry {
  border: 1px solid var(--border);
  background: var(--sheen), var(--btn);
  box-shadow: inset 0 1px 0 var(--edge), 0 1px 3px rgba(0, 0, 0, .06);
  transition: background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.chip:hover, .entry:hover { background: var(--sheen), var(--btn-hover); border-color: var(--border-strong); }
.seg {
  display: flex; padding: 3px; gap: 2px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--sheen), var(--btn);
  box-shadow: inset 0 1px 0 var(--edge);
}
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s, border-color .2s;
}
.seg button:hover { background: var(--btn-hover); color: var(--text); }
/* Selected: translucent tint + accent edge + soft glow (still clearly readable) */
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] {
  color: var(--text); font-weight: 650;
  background: var(--sheen), var(--btn-sel);
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 var(--edge), 0 0 0 3px var(--accent-soft), 0 4px 14px var(--accent-glow);
}

/* ===== Sample banner ===== */
.sample-banner {
  display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; align-items: center;
  padding: 7px 16px; font-size: 13px;
  color: var(--accent-text); background: var(--banner-bg);
  border-bottom: 1px solid var(--border); text-align: center;
}
.sample-banner span { color: var(--text-2); }
.sample-banner[hidden] { display: none; }  /* no sample data on the site (e.g. published real-results build) */

/* ===== Header ===== */
.site-header { position: sticky; top: 0; z-index: 20; border-width: 0 0 1px 0; border-radius: 0; }
.header-inner {
  max-width: var(--maxw); margin: 0 auto; min-height: var(--header-h);
  padding: 10px 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav search toggles";
  align-items: center; gap: 10px 14px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: .02em;
  color: var(--on-accent); background: var(--accent-grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 4px 14px var(--accent-glow);
}
.brand-text { font-weight: 700; font-size: 17px; display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }

.main-nav {
  grid-area: nav; display: flex; gap: 2px; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  position: relative; flex-shrink: 0;
  text-decoration: none; padding: 7px 13px; border-radius: var(--radius-pill);
  font-size: 14px; color: var(--text-2); white-space: nowrap;
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
}
.main-nav a:hover { background: var(--btn-hover); color: var(--text); }
.main-nav a[aria-current="page"] {
  color: var(--text); font-weight: 650;
  background: var(--sheen), var(--btn-sel);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 var(--edge), 0 3px 10px var(--accent-soft);
}
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 30%; right: 30%; bottom: 3px; height: 2px; border-radius: 2px;
  background: var(--accent);
}

.search-box { grid-area: search; position: relative; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; width: 220px;
  border-radius: var(--radius-pill);
  background: var(--sheen), var(--glass-strong);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--edge);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; font-size: 14px; }
.search input::placeholder { color: var(--text-3); }

.search-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 400px; max-width: calc(100vw - 32px);
  max-height: min(70vh, 520px); overflow: auto;
  border-radius: var(--radius-md); padding: 8px; z-index: 30;
}
.sp-summary { font-size: 13px; color: var(--text-2); padding: 6px 10px 4px; }
.sp-group { font-size: 12px; color: var(--accent-text); font-weight: 650; padding: 10px 10px 4px; letter-spacing: .04em; }
.sp-item {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: var(--radius-sm); font-size: 14px;
}
.sp-item:hover, .sp-item:focus-visible { background: var(--accent-soft); }
.sp-item > span:first-child { min-width: 0; }
.sp-side { font-size: 12.5px; color: var(--text-3); flex-shrink: 0; }
.sp-empty { padding: 14px 10px; font-size: 14px; color: var(--text-2); }

.toggles { grid-area: toggles; display: flex; align-items: center; gap: 8px; }
.theme-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-switch button { min-width: 44px; }

/* ===== Page ===== */
.page { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 24px; }
.view[hidden] { display: none !important; }
.view { animation: viewIn .25s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head h1:focus { outline: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--text-3); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .12em; color: var(--accent-text); }
.panel { border-radius: var(--radius-lg); padding: 22px 24px; }
.empty { padding: 28px; text-align: center; color: var(--text-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }

.meta-strip { display: flex; gap: 8px; margin: 0; flex-wrap: wrap; }
.meta-strip div { padding: 6px 12px; border-radius: var(--radius-sm); background: var(--glass-strong); border: 1px solid var(--border); }
.meta-strip dt { font-size: 11px; color: var(--text-3); }
.meta-strip dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Today */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.overview-research { grid-column: 1 / -1; }
.summary-list { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.75; }
.summary-list li + li { margin-top: 6px; }
.quick-list { display: flex; flex-direction: column; }
.quick-row {
  display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 9px 6px; border-bottom: 1px solid var(--border); text-decoration: none; border-radius: 6px;
}
.quick-row:last-child { border-bottom: 0; }
.quick-row:hover { background: var(--accent-soft); }
.q-name { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-val { font-weight: 700; font-size: 15px; text-align: right; white-space: nowrap; }
.q-val small { font-weight: 500; font-size: 12px; color: var(--text-3); }
.q-chg { font-size: 13px; font-weight: 600; text-align: right; }
.entry-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.entry {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-pill); text-decoration: none;
  font-size: 14px; font-weight: 600; color: var(--accent-text);
}
.entry.small { padding: 4px 12px; font-size: 13px; }
.latest-list { display: flex; flex-direction: column; }
.latest-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 10px 6px; border-radius: 6px;
}
.latest-row:last-child { border-bottom: 0; }
.latest-row:hover { background: var(--accent-soft); }
.l-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.l-date { font-size: 12.5px; color: var(--text-3); flex-shrink: 0; }

/* Chips */
.category-bar, .indicator-picker { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { cursor: pointer; padding: 7px 16px; border-radius: var(--radius-pill); font-size: 14px; color: var(--text-2); }
.chip .count { margin-left: 6px; font-size: 12px; opacity: .8; }

/* ===== Indicator cards ===== */
.indicator-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ind-card {
  text-align: left; cursor: pointer;
  border-radius: var(--radius-md); padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.ind-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-hover); }
.ind-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ind-name { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag {
  font-size: 11px; padding: 1px 8px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); color: var(--accent-text); white-space: nowrap; flex-shrink: 0;
}
.ind-value { display: flex; align-items: baseline; gap: 6px; }
.ind-value strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ind-value .unit { font-size: 13px; color: var(--text-3); }
.ind-change { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 36px; display: block; }
.spark path { fill: none; stroke-width: 1.6; }
.ind-meta { font-size: 11.5px; color: var(--text-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ===== Chart ===== */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.chart-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart-wrap { position: relative; margin-top: 14px; }
#chart-svg { width: 100%; height: 320px; display: block; touch-action: pan-y; }
#chart-svg .axis-label, .mc-chart .axis-label { font-size: 12px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
#chart-svg .unit-label, .mc-chart .unit-label { font-size: 12px; fill: var(--text-2); font-weight: 600; }
#chart-svg .gridline, .mc-chart .gridline { stroke: var(--grid); stroke-width: 1; }
#chart-svg .line, .mc-chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; }
#chart-svg .cross, .mc-chart .cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
#chart-svg .cross-dot, .mc-chart .cross-dot { fill: var(--chart-line); stroke: var(--data); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2;
  padding: 7px 11px; border-radius: var(--radius-sm);
  background: var(--data); border: 1px solid var(--border-strong);
  font-size: 13px; line-height: 1.45; white-space: nowrap; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.chart-tip b { font-size: 15px; }
.source-line { margin-top: 10px; font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.source-line strong { color: var(--accent-text); font-weight: 650; }

/* ===== Research ===== */
.research-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.res-card {
  text-align: left; cursor: pointer; border-radius: var(--radius-md); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.res-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-hover); }
.res-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.type-badge { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.res-card h3 { font-size: 16.5px; }
.res-card p { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.res-tags { display: flex; gap: 6px 10px; flex-wrap: wrap; }
.res-tags span { font-size: 12px; color: var(--text-3); }
.res-tags span::before { content: "#"; opacity: .7; }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--accent); }

/* ===== Notes ===== */
.notes ul { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.notes li + li { margin-top: 6px; }

/* ===== Footer ===== */
.site-footer { max-width: var(--maxw); margin: 24px auto 0; padding: 20px 24px 40px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.site-footer .foot-legal { max-width: 760px; margin: 8px auto 0; line-height: 1.65; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(660px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  border-radius: var(--radius-lg); padding: 28px 28px 24px;
  animation: pop .22s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--sheen), var(--btn); cursor: pointer; font-size: 20px; line-height: 1;
  box-shadow: inset 0 1px 0 var(--edge);
}
.modal-card h2 { font-size: 22px; margin: 10px 40px 12px 0; }
.modal-card .lead { font-size: 15px; color: var(--text-2); }
.modal-card .body p { margin-top: 10px; font-size: 15px; line-height: 1.8; }
.kd-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.kd-table th, .kd-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.kd-table th { font-size: 12px; color: var(--text-3); font-weight: 600; }
.kd-table td.num, .kd-table th.num { text-align: right; }
.modal-note { margin-top: 14px; font-size: 12.5px; color: var(--accent-text); }

/* ===== Module tabs: second row of horizontal tabs for the current category's modules ===== */
.sub-nav {
  display: flex; gap: 6px; margin: 0 0 18px; padding-bottom: 2px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}
.sub-nav[hidden] { display: none; }
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav a {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; padding: 8px 4px 10px; margin-right: 14px;
  font-size: 14px; color: var(--text-2); white-space: nowrap;
  transition: color .2s;
}
.sub-nav a:hover { color: var(--text); }
.sub-nav a[aria-current="page"] { color: var(--text); font-weight: 650; }
.sub-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent);
}

/* ===== Shared chart extras + multi-chart page layout (round 11) ===== */
.refline { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 5 4; opacity: .8; }
.mk-entry { fill: var(--accent); stroke: var(--data); stroke-width: 1.4; }
.mk-exit { fill: var(--data); stroke: var(--text); stroke-width: 1.6; }
/* direction colours (round 12): Long TWD / Short TWD; shape still tells start (▲) from end (▼) */
.mk.mk-twd { fill: var(--mk-twd); stroke: var(--data); stroke-width: 1.2; }
.mk.mk-usd { fill: var(--mk-usd); stroke: var(--data); stroke-width: 1.2; }
.mk-lead { stroke: var(--text-3); stroke-width: 1; opacity: .85; }
.mk-pt { fill: var(--text-2); }
/* latest value: small pulsing dot (user 2026-11-11); the halo is hidden when motion is reduced */
.live-dot { stroke: var(--data); stroke-width: 1.5; }
.live-halo { opacity: 0; transform-box: fill-box; transform-origin: center; animation: live-pulse 1.6s ease-out infinite; pointer-events: none; }
@keyframes live-pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3.2); opacity: 0; } }
.empty-state { text-align: center; padding: 28px 20px; }
.empty-state .es-title { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.cat-desc { max-width: 520px; }
.mc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mc-note { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-stats { display: flex; gap: 8px 20px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.mc-stats b { color: var(--text); }
.mc-panel + .mc-panel { margin-top: 14px; }
.mc-panel .panel-head { margin-bottom: 4px; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.mc-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mc-legend svg { width: 14px; height: 14px; }
.mc-chart { width: 100%; display: block; touch-action: pan-y; }
.mc-h-index { height: 380px; }
.mc-h-nav { height: 230px; }
.mc-h-dd { height: 170px; }
.mc-basis { margin-top: 14px; }

/* ===== Responsive ===== */
@media (max-width: 1240px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search toggles" "nav nav nav";
    padding-bottom: 8px;
  }
  .search-box { justify-self: end; }
  .search { width: 260px; }
  .main-nav { margin: 0 -8px; padding: 0 8px; }
}
@media (max-width: 860px) {
  .indicator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .research-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .search { width: 220px; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand toggles" "search search" "nav nav";
    gap: 8px 8px; padding: 8px 16px 6px;
  }
  .search-box { justify-self: stretch; }
  .search { width: 100%; height: 36px; }
  .search-panel { left: 0; right: 0; width: auto; max-width: none; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text { font-size: 16px; }
  .toggles { gap: 6px; }
  .seg button { padding: 5px 9px; }
  .lang-switch button { min-width: 38px; }
  .theme-switch .seg-text { display: none; } /* icon only; aria-label keeps the name */
  .main-nav { margin: 0 -16px; padding: 0 16px 2px; }
  .main-nav a { padding: 6px 12px; }
  .page { padding: 18px 16px 16px; }
  .view-head { margin-bottom: 14px; }
  .meta-strip { width: 100%; }
  .meta-strip div { flex: 1 1 0; min-width: 0; padding: 6px 8px; }
  .category-bar, .indicator-picker { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 4px 16px 8px; scrollbar-width: none; }
  .category-bar::-webkit-scrollbar, .indicator-picker::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  .indicator-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ind-card { padding: 12px 12px 10px; }
  .ind-value strong { font-size: 20px; }
  .ind-name { font-size: 13px; white-space: normal; }
  .ind-top { align-items: flex-start; }
  .panel { padding: 16px 14px; border-radius: var(--radius-md); }
  .quick-row { grid-template-columns: minmax(0, 1fr) auto; }
  .q-chg { grid-column: 2; }
  .q-name { white-space: normal; }
  .range-switch { width: 100%; }
  .range-switch button { flex: 1; padding: 6px 4px; }
  #chart-svg { height: 260px; }
  .mc-h-index { height: 310px; }
  .mc-h-nav { height: 200px; }
  .mc-h-dd { height: 150px; }
  .mc-top .range-switch { width: 100%; }
  .modal { padding: 10px; align-items: end; }
  .modal-card { padding: 22px 18px 18px; max-height: calc(100vh - 20px); }
  .sample-banner { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .live-halo { display: none; }
}
