/* ============================================================
   股票分析網頁 — 編輯雜誌風 / 高級明亮
   英文:Times New Roman   中文:標楷體
   ============================================================ */

@font-face {
  font-family: 'BiauKai';
  src: local('DFKai-SB'), local('BiauKai'), local('標楷體'), local('Kaiti TC'), local('Kaiti SC'), local('STKaiti');
}

:root {
  /* 紙張 + 墨水 — 編輯雜誌色票 */
  --paper:        #f6f1e4;
  --paper-bright: #fbf7eb;
  --paper-deep:   #ede5d0;
  --paper-line:   #d8cdb0;
  --ink:          #1a2438;
  --ink-soft:     #3a4763;
  --ink-mute:     #6a6f80;
  --ink-faint:    #9a9789;

  /* 金箔 + 配色 */
  --gold:         #b8924d;
  --gold-deep:    #8a6a2a;
  --gold-leaf:    #d4b370;
  /* 金箔漸層三色(2026-07-18 體檢收斂:原散落 stock.jsx/fundamental.jsx SVG 漸層硬寫)*/
  --gold-hi:      #efd79b;   /* 漸層亮部 */
  --gold-lo:      #c79d5e;   /* 漸層暗部 */
  --gold-pale:    #f2e2af;   /* 印章/投信面淡金 */
  --accent-yuanta:#e6a817;   /* 元大標色(獨立品牌色,不併入金箔系) */
  --crimson:      #9c2b2b;
  --teal:         #2a6b6b;
  --olive:        #7c7a30;

  /* 字體(2026-07-18 體檢收斂:原 ~500 處 inline 堆疊,含 37 處錯誤 sans-serif fallback)*/
  --font-cn:      'BiauKai', '標楷體', 'DFKai-SB', serif;
  --font-en:      'Times New Roman', 'Songti TC', serif;

  /* 圓角 / 間距 scale(2026-07-18 新增:原各頁硬寫 18/25/28 漂移)*/
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --space-1:      4px;
  --space-2:      8px;
  --space-3:      16px;
  --space-4:      24px;
  --space-5:      40px;

  /* 三段色 */
  --up-tint:      #c79653;   /* 暖琥珀 上游 */
  --mid-tint:     #2c5e8e;   /* 靛藍   中游 */
  --dn-tint:      #4a7a4e;   /* 苔綠   下游 */
  --bull:         #2a6b4c;
  --bear:         #9c2b2b;

  --shadow-sm:    0 1px 2px rgba(26,36,56,.08);
  --shadow-md:    0 4px 18px rgba(26,36,56,.07), 0 1px 3px rgba(26,36,56,.05);
  --shadow-lg:    0 18px 48px rgba(26,36,56,.12), 0 4px 12px rgba(26,36,56,.06);

  /* 字級 scale（2026-07-19 量化平台整合新增）
     原則：正文較舊慣例 +2px、表格保底 --fs-xs、meta 保底 --fs-nano。
     ⚠ 新程式碼禁止裸 fontSize 數字，一律取 token（DESIGN.md 有規則） */
  --fs-nano:  11.5px;   /* 印章 / eyebrow / 表格 meta */
  --fs-xs:    13px;     /* 表格內文下限 / chip / 註腳 */
  --fs-sm:    14.5px;   /* 密集表格主文 / 卡片副文 */
  --fs-base:  16px;     /* 敘事正文 */
  --fs-md:    18px;     /* 小標 / 卡片標題 */
  --fs-lg:    22px;     /* SectionHead 中文標 */
  --fs-xl:    30px;     /* 頁面 hero 標題 */
  --fs-num:   38px;     /* 統計大數字 */
  --fs-mega:  clamp(52px, 9vw, 88px);  /* 終端 hero 大盤數字 */
  --lh-tight: 1.25;
  --lh-body:  1.7;      /* 楷體正文行高 */

  /* 終端面板色（2026-07-19 雜誌×終端混血）
     ⚠ --term-* 只准出現在 .qd-term 容器內；紙張區 --bull/--bear 語意不變。
     紅漲綠跌是台股行情慣例，僅限終端面板 */
  --term-bg:     #16130d;   /* 暖黑 espresso（2026-07-23 從冷海軍藍 #0e1730 改暖，貼合 Formosa 金/紙暖調） */
  --term-panel:  #211b12;   /* 暖深棕黑面板（原 #16223f 冷藍） */
  --term-line:   rgba(212, 179, 112, .18);
  --term-text:   #e9e0c9;
  --term-dim:    #9a9280;   /* 暖灰（原 #8b91a5 冷藍灰） */
  --term-gold:   var(--gold-leaf);
  --term-up:     #e0564f;   /* 紅 = 漲 */
  --term-dn:     #3fa17a;   /* 綠 = 跌 */
  --term-flat:   #b9bdc9;
}

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

html, body { background: var(--paper); color: var(--ink); }

body {
  font-family: 'Times New Roman', 'BiauKai', 'DFKai-SB', '標楷體', serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 紙張紋理 + 邊角暈染 */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(212,179,112,.10), transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(44,94,142,.06), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(26,36,56,.012) 2px 3px);
}
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .08  0 0 0 0 .05  0 0 0 .035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

#root, #zone-root { position: relative; z-index: 1; }

/* ----------- 字體規則 ----------- */
.serif      { font-family: 'Times New Roman', serif; }
.kai        { font-family: 'BiauKai', 'DFKai-SB', '標楷體', 'Kaiti TC', serif; letter-spacing: .04em; }
.num        { font-family: 'Times New Roman', serif; font-variant-numeric: tabular-nums; font-feature-settings: "lnum"; }
.italic-en  { font-style: italic; font-family: 'Times New Roman', serif; }

/* small-caps title style */
.eyebrow {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  letter-spacing: .22em;
  text-transform: lowercase;
  color: var(--gold-deep);
  font-weight: 600;
  font-size: 12px;
}

/* ============================================================
   Layout shell
   ============================================================ */
.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 44px 64px;
}
@media (max-width: 900px) { .shell { padding: 20px 18px 60px; } }

/* ============================================================
   Header / Masthead
   ============================================================ */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 14px 0 22px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.masthead::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -6px;
  height: 1px; background: var(--ink);
}
.brand {
  display: flex; align-items: flex-end; gap: 12px;
}
.brand-mark {
  width: 56px; height: 56px;
  border: 1.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-bright);
  position: relative;
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; inset: 3px; border: 1px solid var(--ink); pointer-events: none;
}
.brand-mark svg { width: 32px; height: 32px; color: var(--ink); }
.brand-title {
  font-family: 'Times New Roman', serif;
  font-size: 36px;
  letter-spacing: -.01em;
  line-height: 1;
  font-weight: 700;
}
.brand-sub {
  font-family: 'BiauKai', '標楷體', serif;
  letter-spacing: .35em;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 6px;
  display: block;
}
.masthead-meta {
  text-align: center;
  font-style: italic;
  color: var(--ink-mute);
  font-size: 13px;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  padding: 6px 18px;
}
.masthead-meta b {
  font-style: normal; color: var(--ink); font-weight: 700;
  font-variant: small-caps; letter-spacing: .15em;
}
.masthead-actions { display: flex; gap: 10px; align-items: center; }

/* ============================================================
   Market Switcher — TW / US edition toggle
   ============================================================ */
.mkt-switcher {
  display: flex;
  border: 1px solid var(--ink);
  overflow: hidden;
  flex-shrink: 0;
}
.mkt-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  font-family: 'Times New Roman', serif;
  text-decoration: none;
  background: var(--paper-bright);
  border-right: 1px solid var(--paper-line);
  transition: background .15s ease, transform .12s ease;
  white-space: nowrap;
}
.mkt-btn:last-child { border-right: none; }
.mkt-btn:hover { background: var(--paper-deep); }
.mkt-btn.mkt-active { background: var(--ink); pointer-events: none; }
.mkt-flag {
  font-variant: small-caps;
  font-weight: 700;
  font-size: var(--fs-nano);
  letter-spacing: .12em;
  color: var(--gold-deep);
}
.mkt-btn.mkt-active .mkt-flag { color: var(--gold-leaf); }
.mkt-name {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 12px;
  letter-spacing: .15em;
  color: var(--ink-soft);
}
.mkt-btn.mkt-active .mkt-name { color: var(--paper-bright); }
@media (max-width: 700px) {
  .mkt-name { display: none; }
  .mkt-btn { padding: 7px 9px; }
}
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--ink); color: var(--paper-bright); }
.icon-btn svg { width: 18px; height: 18px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  font-family: 'Times New Roman', serif;
  font-size: 15px;
  min-width: 220px;
}
.search-box input {
  border: none; outline: none; background: transparent;
  font: inherit; flex: 1; color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-faint); font-style: italic; }
.search-box svg { width: 14px; height: 14px; color: var(--ink-mute); }

/* ============================================================
   Ticker tape
   ============================================================ */
.ticker {
  margin: 0 -44px 24px;
  padding: 10px 44px;
  background: var(--ink);
  color: var(--paper-bright);
  overflow: hidden;
  position: relative;
  font-family: 'Times New Roman', serif;
  border-top: 1px solid var(--gold-deep);
  border-bottom: 1px solid var(--gold-deep);
}
@media (max-width: 900px) { .ticker { margin: 0 -18px 20px; padding: 10px 18px; } }
.ticker-track {
  display: flex; gap: 56px;
  white-space: nowrap;
  animation: ticker 50s linear infinite;
  will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: baseline; gap: 10px; font-size: 14px; }
.ticker-item .name { font-family: 'BiauKai', '標楷體', serif; color: var(--gold-leaf); letter-spacing: .15em; font-size: 12px; }
.ticker-item .val  { font-weight: 700; }
.ticker-item .chg.up   { color: #f0c378; }
.ticker-item .chg.dn   { color: #e89090; }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   Hero — Cover + Sector switcher
   ============================================================ */
.cover {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 36px;
  padding: 30px 0 26px;
  border-bottom: 1px solid var(--paper-line);
  margin-bottom: 28px;
  align-items: center;
}
@media (max-width: 900px) { .cover { grid-template-columns: 1fr; gap: 18px; } }

.cover h1 {
  font-family: 'Times New Roman', serif;
  font-size: clamp(46px, 6.2vw, 88px);
  line-height: .95;
  letter-spacing: -.02em;
  font-weight: 700;
  margin-bottom: 14px;
}
.cover h1 .amp { color: var(--gold); font-style: italic; font-weight: 400; padding: 0 .15em; }
.cover h1 .kai-title {
  display: block;
  font-family: 'BiauKai', '標楷體', serif;
  font-size: .42em;
  letter-spacing: .35em;
  color: var(--ink-soft);
  margin-top: 14px;
  font-weight: normal;
}
.cover-lede {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 16px;
  line-height: 2;
  letter-spacing: .06em;
  color: var(--ink-soft);
  border-left: 2px solid var(--gold);
  padding-left: 18px;
  margin-top: 18px;
  max-width: 540px;
}
.cover-side {
  border: 1px solid var(--ink);
  padding: 22px 24px;
  background: var(--paper-bright);
  position: relative;
}
.cover-side::before {
  content: ""; position: absolute; inset: 4px; border: 1px solid var(--paper-line); pointer-events: none;
}
.cover-side h3 {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 18px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.cover-side h3::after { content:""; flex:1; height: 1px; background: var(--paper-line); }
.cover-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.cover-stat .lbl { font-size: var(--fs-nano); letter-spacing: .14em; color: var(--ink-mute); text-transform: uppercase; }
.cover-stat .val { font-family: 'Times New Roman', serif; font-size: 22px; font-weight: 700; line-height: 1.1; margin-top: 3px; }
.cover-stat .val small { font-size: 12px; font-weight: 400; color: var(--ink-mute); margin-left: 4px; }

/* ============================================================
   Two-level nav: Category tabs + Industry pills
   ============================================================ */
.nav-block {
  margin: 4px 0 28px;
}
.cat-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  margin-bottom: 16px;
}
.cat-tab {
  --cat-accent: var(--gold);
  padding: 14px 22px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--paper-line);
  cursor: pointer;
  text-align: left;
  display: flex; flex-direction: column; gap: 2px;
  position: relative;
  transition: background .18s ease;
}
.cat-tab:last-child { border-right: none; }
.cat-tab .cat-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.cat-tab .cat-cn {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 22px;
  letter-spacing: .25em;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.1;
}
.cat-tab .cat-sub {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: var(--fs-nano);
  color: var(--ink-mute);
  letter-spacing: .04em;
  margin-top: 4px;
}
.cat-tab::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--cat-accent);
  opacity: 0;
  transition: opacity .18s ease;
}
.cat-tab:hover { background: var(--paper-deep); }
.cat-tab:hover::after { opacity: .35; }
.cat-tab.active {
  background: var(--ink);
}
.cat-tab.active .cat-en  { color: var(--gold-leaf); }
.cat-tab.active .cat-cn  { color: var(--paper-bright); }
.cat-tab.active .cat-sub { color: var(--paper-line); }
.cat-tab.active::after { opacity: 1; }

.industry-pills {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--paper-line);
  background: var(--paper);
  position: relative;
}
.industry-pills::before {
  content: "";
  position: absolute; left: 12px; right: 12px; top: 50%;
  height: 1px; background: var(--paper-line);
  opacity: .4; z-index: 0;
}
.industry-pills .pills-label {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--gold-deep);
  border-right: 1px solid var(--paper-line);
  padding-right: 14px;
  white-space: nowrap;
  flex-shrink: 0;
  z-index: 1;
}
.industry-pills .pills-row {
  display: flex; gap: 6px; flex-wrap: wrap; flex: 1;
  z-index: 1;
}
.ind-pill {
  padding: 6px 14px;
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  letter-spacing: .04em;
  background: var(--paper-bright);
  border: 1px solid var(--paper-line);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
  display: inline-flex; align-items: baseline; gap: 4px;
}
.ind-pill .kai { font-size: 15px; color: var(--ink); letter-spacing: .08em; }
.ind-pill .pill-en { font-style: italic; font-size: var(--fs-nano); color: var(--ink-mute); }
.ind-pill:hover {
  border-color: var(--ink);
  background: var(--paper-bright);
  transform: translateY(-1px);
}
.ind-pill.active {
  background: var(--ink);
  border-color: var(--ink);
}
.ind-pill.active .kai { color: var(--paper-bright); }
.ind-pill.active .pill-en { color: var(--gold-leaf); }

/* category overview inside cover side */
.cat-overview { display: flex; flex-direction: column; gap: 12px; }
.cat-overview-row {
  --cat-accent: var(--gold);
  padding: 10px 12px 10px 14px;
  border-left: 3px solid var(--cat-accent);
  background: var(--paper);
  cursor: pointer;
  transition: all .18s ease;
}
.cat-overview-row:hover { background: var(--paper-deep); transform: translateX(2px); }
.cor-head { display: flex; align-items: baseline; gap: 10px; }
.cor-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--ink);
}
.cor-cn {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 15px;
  letter-spacing: .15em;
  color: var(--ink-soft);
  font-weight: 700;
}
.cor-count {
  margin-left: auto;
  font-size: 18px;
  font-weight: 700;
  color: var(--cat-accent);
  font-family: 'Times New Roman', serif;
}
.cor-list {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-mute);
  margin-top: 4px;
  line-height: 1.7;
}

/* category badge above industry title in map header */
.map-cat-badge {
  --cat-accent: var(--gold);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 14px;
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: var(--fs-nano);
  letter-spacing: .22em;
  color: var(--cat-accent);
  border: 1px solid var(--cat-accent);
  margin-bottom: 6px;
  background: var(--paper-bright);
}
.map-cat-badge .dot {
  width: 6px; height: 6px;
  background: var(--cat-accent);
  border-radius: 50%;
  display: inline-block;
}
.map-cat-badge .kai {
  font-variant: normal;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: .12em;
  font-size: 12px;
}

/* outlook strip */
.outlook {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 14px 10px 16px;
  margin: 6px 0 18px;
  background: var(--ink);
  color: var(--paper-bright);
  border-left: 3px solid var(--gold);
}
.outlook .ol-label {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: var(--fs-nano);
  letter-spacing: .22em;
  color: var(--gold-leaf);
  border-right: 1px solid rgba(255,255,255,.15);
  padding-right: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}
.outlook .ol-label .kai {
  font-variant: normal;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--paper-bright);
  font-weight: 700;
}
.outlook .ol-body {
  font-size: 13px;
  letter-spacing: .06em;
  line-height: 1.75;
  color: var(--paper-bright);
}

/* ============================================================
   Industry Map — hand-drawn SVG
   ============================================================ */
.map-wrap {
  position: relative;
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  padding: 30px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}
.map-wrap::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--paper-line); pointer-events: none;
}
.map-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 6px; padding-bottom: 14px;
  border-bottom: 1px solid var(--paper-line);
  position: relative; z-index: 2;
  gap: 18px;
}
.map-head h2 {
  font-family: 'Times New Roman', serif;
  font-size: 32px;
  font-style: italic;
  font-weight: 600;
  display: flex; align-items: baseline; gap: 14px;
}
.map-head h2 .ch {
  font-family: 'BiauKai', '標楷體', serif;
  font-style: normal;
  font-size: 24px;
  letter-spacing: .2em;
  color: var(--ink-soft);
  font-weight: 600;
}
.map-head h2 .ornament { color: var(--gold); font-size: 22px; }
.map-head .legend {
  display: flex; gap: 18px;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: .04em;
}
.map-head .legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-head .legend i {
  width: 14px; height: 14px; border: 1.5px solid; display: inline-block; transform: rotate(45deg);
}

.map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1480 / 760;
}
.map-canvas svg {
  width: 100%; height: 100%;
  display: block;
  font-family: 'Times New Roman', serif;
  overflow: visible;
}

/* hand-drawn lines & markers */
.hand-stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.flow-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
  animation: dashFlow 28s linear infinite;
}
@keyframes dashFlow { to { stroke-dashoffset: -200; } }

.col-header {
  text-anchor: middle;
}
.col-header-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 16px;
  fill: var(--ink);
  letter-spacing: .04em;
}
.col-header-cn {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 26px;
  letter-spacing: .35em;
  fill: var(--ink);
  font-weight: 700;
}
.col-roman {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: 13px;
  letter-spacing: .25em;
  fill: var(--gold-deep);
}

.node-card {
  cursor: pointer;
  transition: transform .25s ease;
  transform-origin: center;
  transform-box: fill-box;
}
.node-card:hover { transform: translateY(-3px); }
.node-rect {
  fill: var(--paper-bright);
  stroke: var(--ink);
  stroke-width: 1.5;
}
.node-card.active .node-rect { fill: var(--ink); }
.node-inner {
  fill: none;
  stroke: var(--paper-line);
  stroke-width: 1;
}
.node-card.active .node-inner { stroke: var(--gold-leaf); }
.node-icon {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.node-card.active .node-icon { stroke: var(--gold-leaf); }

/* 雷達區：掃描線持續緩慢旋轉的簽名動效（雷達盤圖示內的 .radar-sweep 子群組） */
@keyframes radarSweep { to { transform: rotate(360deg); } }
.radar-sweep {
  transform-origin: 12px 12px;
  animation: radarSweep 4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .radar-sweep { animation: none; }
}

.node-title-cn {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 18px;
  letter-spacing: .12em;
  fill: var(--ink);
  font-weight: 700;
  text-anchor: middle;
}
.node-card.active .node-title-cn { fill: var(--paper-bright); }
.node-title-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: var(--fs-nano);
  fill: var(--ink-mute);
  text-anchor: middle;
  letter-spacing: .04em;
}
.node-card.active .node-title-en { fill: var(--gold-leaf); }
.node-count {
  font-family: 'Times New Roman', serif;
  font-size: var(--fs-nano);
  fill: var(--ink-faint);
  text-anchor: middle;
  letter-spacing: .12em;
}
.node-card.active .node-count { fill: var(--paper-line); }
.node-tag {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: var(--fs-nano);
  letter-spacing: .2em;
  text-anchor: middle;
}
.node-card .tag-up  { fill: var(--up-tint); }
.node-card .tag-mid { fill: var(--mid-tint); }
.node-card .tag-dn  { fill: var(--dn-tint); }

.arrow-head {
  fill: var(--gold);
  stroke: none;
}

/* tooltip */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper-bright);
  padding: 10px 14px;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  z-index: 20;
  max-width: 260px;
  box-shadow: var(--shadow-md);
  transform: translate(-50%, calc(-100% - 12px));
  opacity: 0; transition: opacity .15s ease;
  border-left: 2px solid var(--gold);
}
.map-tooltip.show { opacity: 1; }
.map-tooltip .tt-title {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 15px; letter-spacing: .12em; font-weight: 700;
  color: var(--gold-leaf);
}
.map-tooltip .tt-en { font-style: italic; font-size: var(--fs-nano); color: var(--paper-line); margin-bottom: 6px; }
.map-tooltip .tt-desc { font-family: 'BiauKai', '標楷體', serif; font-size: var(--fs-xs); line-height: 1.7; letter-spacing: .04em; color: var(--paper-bright); }
.map-tooltip::after {
  content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border: 6px solid transparent;
  border-top-color: var(--ink); border-bottom-width: 0;
}

/* ============================================================
   Detail panel (drawer)
   ============================================================ */
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 92vw);
  background: var(--paper-bright);
  border-left: 1.5px solid var(--ink);
  box-shadow: -12px 0 32px rgba(26,36,56,.18);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  z-index: 60;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }
.detail-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 100% 40% at 50% 0%, rgba(212,179,112,.18), transparent 60%);
}
.dp-head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--paper-line);
  display: flex; justify-content: space-between; align-items: flex-start;
  position: relative;
}
.dp-tag {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: var(--fs-nano);
  letter-spacing: .2em;
  color: var(--gold-deep);
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.dp-tag::before { content: ""; width: 14px; height: 1px; background: var(--gold); display: inline-block; }
.dp-title-cn {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 28px;
  letter-spacing: .18em;
  font-weight: 700;
  line-height: 1.1;
}
.dp-title-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
  margin-top: 4px;
  letter-spacing: .03em;
}
.dp-close {
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: all .15s ease;
}
.dp-close:hover { background: var(--ink); color: var(--paper-bright); transform: rotate(90deg); }
.dp-body { flex: 1; overflow-y: auto; padding: 22px 28px 32px; position: relative; }
.dp-body::-webkit-scrollbar { width: 6px; }
.dp-body::-webkit-scrollbar-thumb { background: var(--paper-line); }
.dp-desc {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 14px;
  line-height: 2;
  letter-spacing: .05em;
  color: var(--ink-soft);
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--paper);
  border-left: 2px solid var(--gold);
  position: relative;
}
.dp-section-head {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  letter-spacing: .2em;
  font-size: 12px;
  color: var(--gold-deep);
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 14px;
}
.dp-section-head::after { content: ""; flex: 1; height: 1px; background: var(--paper-line); }
.dp-section-head .ch { font-family: 'BiauKai', '標楷體', serif; color: var(--ink); font-variant: normal; letter-spacing: .15em; font-size: 13px; font-weight: 700; }

.company-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--paper-line);
  cursor: pointer;
  transition: background .15s ease;
}
.company-row:hover { background: var(--paper); }
.company-row:last-child { border-bottom: none; }
.co-code {
  font-family: 'Times New Roman', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.co-code small {
  display: block;
  font-size: var(--fs-nano); color: var(--ink-mute); letter-spacing: .15em;
  font-weight: 400; font-variant: small-caps; margin-top: 2px;
}
.co-info {}
.co-name {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 17px;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--ink);
}
.co-mcap {
  font-family: 'Times New Roman', serif;
  font-size: var(--fs-nano);
  color: var(--ink-mute);
  letter-spacing: .04em;
  margin-top: 2px;
}
.co-mcap span { font-family: 'BiauKai', '標楷體', serif; letter-spacing: .08em; }
.co-quote {
  text-align: right;
}
.co-price {
  font-family: 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.co-chg {
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.co-chg.up { color: var(--bull); }
.co-chg.dn { color: var(--bear); }
.co-chg::before { content: "▲"; margin-right: 2px; font-size: var(--fs-nano); }
.co-chg.dn::before { content: "▼"; }

/* sparkline column */
.dp-snap {
  margin-top: 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.snap-card {
  border: 1px solid var(--paper-line);
  padding: 12px 14px;
  background: var(--paper);
}
.snap-card .lbl { font-size: var(--fs-nano); letter-spacing: .18em; color: var(--ink-mute); text-transform: uppercase; }
.snap-card .val { font-family: 'Times New Roman', serif; font-size: 22px; font-weight: 700; margin-top: 4px; }
.snap-card .val small { font-size: var(--fs-nano); font-weight: 400; color: var(--ink-mute); margin-left: 4px; }

/* Backdrop */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(26,36,56,.25);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  z-index: 50;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

/* ============================================================
   Bottom feature strip
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 38px;
  padding-top: 32px;
  border-top: 1px solid var(--paper-line);
}
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  padding: 22px 24px;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  position: relative;
}
.feature::before {
  content: ""; position: absolute; inset: 5px;
  border: 1px solid var(--paper-line); pointer-events: none;
}
.feature-num {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 56px;
  line-height: 1;
  color: var(--gold);
  font-weight: 400;
  position: absolute; top: 12px; right: 16px;
  opacity: .5;
}
.feature h4 {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 22px;
  letter-spacing: .18em;
  font-weight: 700;
  margin-bottom: 4px;
}
.feature h4 em {
  display: block;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--ink-mute);
  margin-top: 4px;
}
.feature p {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 13px;
  line-height: 1.95;
  letter-spacing: .05em;
  color: var(--ink-soft);
  margin-top: 14px;
}

/* ============================================================
   Footer
   ============================================================ */
.foot {
  margin-top: 64px;
  padding: 32px 0 12px;
  border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: .04em;
}
.foot .crest {
  font-family: 'BiauKai', '標楷體', serif;
  letter-spacing: .25em;
  color: var(--ink);
}

/* ============================================================
   Search results dropdown
   ============================================================ */
.search-results {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: min(320px, calc(100vw - 32px));
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
  z-index: 30;
}
.search-results::before {
  content: ""; position: absolute; inset: 4px; border: 1px solid var(--paper-line); pointer-events: none;
}
.search-result {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px dashed var(--paper-line);
  display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center;
  transition: background .12s ease;
}
.search-result:hover { background: var(--paper-deep); }
.search-result:last-child { border-bottom: none; }
.search-result .code { font-family: 'Times New Roman', serif; font-weight: 700; font-size: 17px; }
.search-result .name { font-family: 'BiauKai', '標楷體', serif; font-size: 14px; letter-spacing: .08em; color: var(--ink-soft); }
.search-result .ind  { font-family: 'Times New Roman', serif; font-style: italic; font-size: var(--fs-nano); color: var(--ink-mute); }

/* ============================================================
   Top Nav Bar — shared across pages
   ============================================================ */
.nav-bar {
  margin: 0 -44px 0;
  padding: 0 44px;
  background: var(--paper-bright);
  border-bottom: 1px solid var(--paper-line);
  position: sticky; top: 0;
  z-index: 40;
  backdrop-filter: blur(6px);
}
@media (max-width: 900px) { .nav-bar { margin: 0 -18px; padding: 0 18px; } }
.nav-bar-inner {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-bar-inner::-webkit-scrollbar { display: none; }
.nav-link {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 14px 22px;
  text-decoration: none;
  color: var(--ink-soft);
  border-right: 1px solid var(--paper-line);
  transition: all .18s ease;
  white-space: nowrap;
  position: relative;
}
.nav-link:first-child { border-left: 1px solid var(--paper-line); }
.nav-link .nav-kai {
  font-size: 15px;
  letter-spacing: .15em;
  font-weight: 700;
  color: var(--ink);
}
.nav-link .nav-en {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: var(--fs-nano);
  letter-spacing: .14em;
  color: var(--ink-mute);
}
.nav-link:hover { background: var(--paper-deep); }
.nav-link-dev {
  cursor: default;
  opacity: 0.45;
  position: relative;
}
.nav-link:hover .nav-en { color: var(--gold-deep); }
.nav-link.active {
  background: var(--ink);
}
.nav-link.active .nav-kai { color: var(--paper-bright); }
.nav-link.active .nav-en  { color: var(--gold-leaf); }
.nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--gold);
}

/* ============================================================
   Section heads
   ============================================================ */
.sec-head { margin: 28px 0 16px; }
.sec-kicker {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  letter-spacing: .25em;
  font-size: 12px;
  color: var(--gold-deep);
  margin-bottom: 4px;
}
.sec-title-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 18px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  position: relative;
}
.sec-title-row::after {
  content: ""; position: absolute; left: 0; bottom: -5px;
  height: 1px; right: 0; background: var(--ink);
}
.sec-title {
  font-family: 'Times New Roman', serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 12px;
}
.sec-title .ornament { color: var(--gold); font-size: 22px; line-height: 1; }
.sec-title .kai { font-family: 'BiauKai', '標楷體', serif; letter-spacing: .12em; }
.sec-title-en { font-style: italic; font-size: 20px; color: var(--ink-soft); margin-left: 8px; }
.sec-sub { font-size: 13px; color: var(--ink-mute); letter-spacing: .1em; }

/* ============================================================
   Reusable Cards / Grids
   ============================================================ */
.frame-card {
  position: relative;
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  padding: 24px 26px;
  box-shadow: var(--shadow-md);
}
.frame-card::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--paper-line); pointer-events: none;
}
.frame-card > * { position: relative; z-index: 1; }
.frame-card .corner-tl,
.frame-card .corner-tr,
.frame-card .corner-bl,
.frame-card .corner-br {
  position: absolute; width: 12px; height: 12px;
  border-color: var(--gold); border-style: solid; border-width: 0;
  z-index: 2;
}
.frame-card .corner-tl { top: 2px;  left: 2px;  border-top-width: 1.2px; border-left-width: 1.2px; }
.frame-card .corner-tr { top: 2px;  right: 2px; border-top-width: 1.2px; border-right-width: 1.2px; }
.frame-card .corner-bl { bottom: 2px; left: 2px;  border-bottom-width: 1.2px; border-left-width: 1.2px; }
.frame-card .corner-br { bottom: 2px; right: 2px; border-bottom-width: 1.2px; border-right-width: 1.2px; }

/* Numbers w/ scale */
.big-num {
  font-family: 'Times New Roman', serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "lnum";
  font-weight: 700;
}
.bull-c  { color: var(--bull); }
.bear-c  { color: var(--bear); }
.arrow-up::before   { content: "▲"; font-size: .7em; margin-right: 4px; }
.arrow-down::before { content: "▼"; font-size: .7em; margin-right: 4px; }

/* Generic data table — editorial */
.ed-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Times New Roman', serif;
  font-size: 14px;
}
.ed-table thead th {
  text-align: left;
  font-variant: small-caps;
  letter-spacing: .14em;
  font-size: var(--fs-nano);
  color: var(--gold-deep);
  padding: 10px 12px;
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
  background: var(--paper);
}
.ed-table thead th.right { text-align: right; }
.ed-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px dashed var(--paper-line);
  vertical-align: middle;
}
.ed-table tbody td.right { text-align: right; }
.ed-table tbody tr { transition: background .12s ease; }
.ed-table tbody tr:hover { background: var(--paper); }
.ed-table tbody tr:last-child td { border-bottom: none; }
.ed-table .code-cell {
  font-family: 'Times New Roman', serif;
  font-weight: 700;
  font-size: 16px;
}
.ed-table .code-cell small {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 13px;
  letter-spacing: .08em;
  font-weight: 400;
  color: var(--ink-soft);
  margin-left: 8px;
}
.ed-table .num-cell {
  font-variant-numeric: tabular-nums;
}

/* Stat strip / number row */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.stat-cell {
  padding: 14px 18px;
  border-right: 1px solid var(--paper-line);
}
.stat-cell:last-child { border-right: none; }
.stat-cell .lbl {
  font-family: 'Times New Roman', serif;
  font-variant: small-caps;
  letter-spacing: .2em;
  font-size: var(--fs-nano);
  color: var(--ink-mute);
}
.stat-cell .val {
  font-family: 'Times New Roman', serif;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  line-height: 1.1;
}
.stat-cell .val small {
  font-size: var(--fs-nano); font-weight: 400; color: var(--ink-mute);
  margin-left: 4px; letter-spacing: .04em;
}
.stat-cell .chg {
  font-family: 'Times New Roman', serif;
  font-size: 13px; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-cell .chg.up { color: var(--bull); }
.stat-cell .chg.dn { color: var(--bear); }

/* Big editorial column index */
.col-index {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 56px;
  line-height: 1;
  color: var(--gold);
  font-weight: 400;
}

/* ============================================================
   AI Today's Pick section
   ============================================================ */
.ai-pick-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--paper-line);
  position: relative;
}
.ai-pick-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 22px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.ai-pick-title {
  font-family: 'Times New Roman', serif;
  font-size: 32px;
  font-weight: 700;
  display: flex; align-items: baseline; gap: 12px;
  margin: 6px 0 4px;
  flex-wrap: wrap;
}
.ai-pick-title .ornament { color: var(--gold); font-size: 22px; line-height: 1; }
.ai-pick-title .kai { font-family: 'BiauKai', '標楷體', serif; letter-spacing: .15em; }
.ai-pick-en { font-style: italic; font-size: 16px; color: var(--ink-mute); margin-left: 4px; }
.ai-pick-sub {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: .08em;
  line-height: 1.7;
  max-width: 600px;
}

.ai-pick-btn {
  padding: 12px 22px;
  background: var(--ink);
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  border-left: 3px solid var(--gold);
  cursor: pointer;
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  white-space: nowrap;
  transition: all .15s ease;
  display: inline-flex; align-items: baseline;
}
.ai-pick-btn .kai {
  font-family: 'BiauKai', '標楷體', serif;
  letter-spacing: .15em;
  font-weight: 700;
  color: var(--gold-leaf);
}
.ai-pick-btn:hover:not(:disabled) {
  background: var(--gold-deep); border-color: var(--gold-deep);
}
.ai-pick-btn:disabled { opacity: .7; cursor: wait; }
.ai-pick-btn .dots span {
  display: inline-block;
  animation: pickDot 1.4s ease-in-out infinite;
}
.ai-pick-btn .dots span:nth-child(2) { animation-delay: .2s; }
.ai-pick-btn .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pickDot {
  0%,100% { opacity: .2; transform: translateY(0); }
  50%     { opacity: 1;  transform: translateY(-2px); }
}

.ai-pick-error {
  padding: 12px 16px;
  background: rgba(156,43,43,.06);
  border: 1px solid var(--bear);
  border-left: 3px solid var(--bear);
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  color: var(--bear);
}
.ai-pick-error .kai {
  font-family: 'BiauKai', '標楷體', serif;
  font-style: normal;
  font-weight: 700;
}

.ai-pick-empty {
  padding: 40px 24px;
  background: var(--paper-bright);
  border: 1px dashed var(--paper-line);
  text-align: center;
  position: relative;
}
.ai-pick-empty::before {
  content: ""; position: absolute; inset: 4px; border: 1px dashed var(--paper-line); pointer-events: none;
}
.empty-icon { margin-bottom: 14px; }
.empty-text {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 460px;
  margin: 0 auto;
}
.empty-text-sub {
  margin-top: 8px;
  font-size: var(--fs-nano);
  color: var(--ink-mute);
  letter-spacing: .12em;
}

.ai-pick-loading {
  padding: 50px;
  text-align: center;
  background: var(--paper-bright);
  border: 1px solid var(--paper-line);
}
.loading-bars {
  display: inline-flex; gap: 6px; margin-bottom: 18px;
}
.loading-bar {
  width: 5px; height: 28px;
  background: var(--gold);
  animation: barWave 1.2s ease-in-out infinite;
}
.loading-bar:nth-child(2) { animation-delay: .15s; }
.loading-bar:nth-child(3) { animation-delay: .3s; }
@keyframes barWave {
  0%,100% { transform: scaleY(.4); opacity: .5; }
  50%     { transform: scaleY(1);  opacity: 1; }
}
.loading-text {
  font-size: 13px; letter-spacing: .08em;
  color: var(--ink-mute);
}

/* Pick cards */
.ai-pick-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .ai-pick-cards { grid-template-columns: 1fr; } }

.ai-pick-card {
  position: relative;
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  padding: 0;
  display: grid;
  grid-template-columns: 56px 1fr;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all .2s ease;
}
.ai-pick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.ai-pick-card::before {
  content: ""; position: absolute; inset: 4px; border: 1px solid var(--paper-line);
  pointer-events: none; z-index: 0;
}

.pick-rank {
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.pick-rank-roman {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 32px;
  color: var(--gold);
  font-weight: 400;
}

.pick-body {
  padding: 16px 18px;
  position: relative; z-index: 1;
}
.pick-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pick-id {
  display: flex; align-items: baseline; gap: 10px;
  text-decoration: none; color: inherit;
}
.pick-id:hover .pick-code { color: var(--gold-deep); }
.pick-code {
  font-family: 'Times New Roman', serif;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color .15s ease;
}
.pick-name {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 18px;
  letter-spacing: .12em;
  font-weight: 700;
}
.pick-tag {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 700;
  padding: 3px 10px;
  background: var(--gold);
  color: var(--ink);
}

.pick-meta {
  display: flex; gap: 14px; align-items: baseline;
  padding: 6px 0 10px;
  border-bottom: 1px dashed var(--paper-line);
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  color: var(--ink-mute);
  flex-wrap: wrap;
}
.pick-seg {
  font-family: 'BiauKai', '標楷體', serif;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--ink-soft);
}
.pick-mcap b { color: var(--ink); font-weight: 600; }
.pick-mcap b, .pick-chg {
  font-family: 'Times New Roman', serif;
  font-variant-numeric: tabular-nums;
}
.pick-chg { font-size: 13px; font-weight: 600; margin-left: auto; }

.pick-reason {
  position: relative;
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 13px;
  letter-spacing: .04em;
  line-height: 1.9;
  color: var(--ink);
  padding: 12px 4px 12px 30px;
  margin: 6px 0 4px;
}
.pick-quote-mark {
  position: absolute;
  left: 0; top: -2px;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 48px;
  line-height: 1;
  color: var(--gold);
  opacity: .5;
}

.pick-foot {
  padding-top: 8px;
  border-top: 1px dashed var(--paper-line);
}
.pick-cta {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--gold-deep);
  text-decoration: none;
  display: inline-flex; align-items: baseline;
  transition: color .15s ease;
}
.pick-cta:hover { color: var(--gold); }

.ai-pick-disclaimer {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--paper);
  border-left: 3px solid var(--gold);
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: .04em;
  line-height: 1.7;
}
.ai-pick-disclaimer .kai {
  font-family: 'BiauKai', '標楷體', serif;
  font-style: normal;
  letter-spacing: .12em;
  color: var(--ink);
  font-weight: 700;
}

/* ============================================================
   Mobile Bottom Navigation Bar
   ============================================================ */
.mobile-bottom-nav {
  display: none;
}
@media (max-width: 700px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(251,247,235,.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid var(--paper-line);
    z-index: 200;
  }
  .mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--ink-mute);
    -webkit-tap-highlight-color: transparent;
    transition: color .15s, transform .12s ease;
  }
  .mbn-item:active { transform: scale(.88); }
  .mbn-item.mbn-active { color: var(--ink); }
  .mbn-item.mbn-active .mbn-icon { color: var(--gold-deep); transform: translateY(-1px); }
  .mbn-icon { width: 22px; height: 22px; display: flex; align-items: center; transition: transform .15s ease; }
  .mbn-icon svg { width: 22px; height: 22px; }
  .mbn-label { font-size: var(--fs-nano); letter-spacing: .06em; }
}

/* ============================================================
   Global Mobile Overrides  (≤ 700px)
   ============================================================ */
@media (max-width: 700px) {
  /* Extra bottom clearance for fixed bottom nav (also pre-set in HTML <head>) */
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 8px); -webkit-tap-highlight-color: transparent; }

  /* ── Masthead: sticky + frosted glass, like an iOS large-title nav bar ── */
  .masthead {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 18px 10px;
    margin: 0 -18px;
    position: sticky; top: 0;
    background: rgba(251,247,235,.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: .5px solid var(--paper-line);
    z-index: 90;
  }
  .masthead::after { display: none; }
  .masthead-meta { display: none; }          /* hide date/vol/edition */
  .brand-mark { width: 36px; height: 36px; }
  .brand-title { font-size: 20px; }
  .brand-sub { font-size: var(--fs-nano); letter-spacing: .12em; }

  /* ── Top nav: hide English labels, tighten padding, frosted sticky bar ── */
  .nav-bar {
    background: rgba(251,247,235,.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    top: calc(56px + env(safe-area-inset-top, 0px));
  }
  .nav-bar-inner { -webkit-overflow-scrolling: touch; }
  .nav-link { padding: 14px 14px; min-height: 44px; justify-content: center; -webkit-tap-highlight-color: transparent; transition: all .18s ease, transform .12s ease; }
  .nav-link:active { transform: scale(.94); }
  .nav-link .nav-en { display: none; }
  .nav-link .nav-kai { font-size: 13px; letter-spacing: .08em; }

  /* ── Tactile press feedback for buttons (iOS-style) ── */
  .icon-btn, .mkt-btn, .search-box { -webkit-tap-highlight-color: transparent; }
  .icon-btn:active, .mkt-btn:active { transform: scale(.92); }

  /* ── Ticker tape ── */
  .ticker-item { padding: 0 14px; }

  /* ── Section heads ── */
  .sec-title { font-size: 22px; }
  .sec-sub { display: none; }

  /* ── Tables: horizontal scroll ── */
  .ed-table-wrap, .frame-card:has(.ed-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ed-table { min-width: 560px; }

  /* ── frame-card inner padding ── */
  .frame-card { padding: 14px !important; }

  /* ── Footer ── */
  .foot { flex-direction: column; gap: 4px; text-align: center; font-size: var(--fs-nano); }
  .foot .crest { display: none; }

  /* ── Ruflo Sidebar: narrower on mobile ── */
  .rs-panel { width: 88vw; max-width: 340px; }
  .ruflo-toggle-btn span { display: none; }
}

/* ══════════════════════════════════════════════════════════
   Ruflo Sidebar  (.rs-*)
   ══════════════════════════════════════════════════════════ */

.rs-backdrop {
  position: fixed; inset: 0; z-index: 498;
  background: rgba(26,36,56,.42);
  backdrop-filter: blur(3px);
  display: none; pointer-events: none;
}
body[data-ruflo] .rs-backdrop { display: block; pointer-events: auto; animation: rsBd .22s ease; }
@keyframes rsBd { from { opacity:0 } to { opacity:1 } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.rs-panel {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: 340px;
  background: var(--paper);
  border-right: 2px solid rgba(184,146,77,.3);
  box-shadow: 8px 0 48px rgba(26,36,56,.22);
  z-index: 499;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
body[data-ruflo] .rs-panel { transform: translateX(0); }

/* Header — dark ink */
.rs-header {
  background: var(--ink);
  padding: 16px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(184,146,77,.35);
}
.rs-logo { display: flex; align-items: center; gap: 10px; }
.rs-logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: var(--ink); font-family: 'Times New Roman', serif;
  flex-shrink: 0;
}
.rs-logo-name {
  font-size: 13px; letter-spacing: .18em; color: var(--gold);
  font-family: 'Times New Roman', serif; font-weight: 700;
}
.rs-logo-sub {
  font-size: var(--fs-nano); letter-spacing: .22em; color: rgba(246,241,228,.5); margin-top: 1px;
}
.rs-header-right { display: flex; align-items: center; gap: 10px; }
.rs-counts { display: flex; align-items: center; gap: 5px; }
.rs-count-dot { width: 8px; height: 8px; border-radius: 50%; }
.rs-dot-active { background: #4caf7d; }
.rs-dot-idle   { background: rgba(246,241,228,.3); }
.rs-count-num  { font-size: var(--fs-nano); color: rgba(246,241,228,.85); font-family: 'Times New Roman', serif; }
.rs-count-idle { color: rgba(246,241,228,.4); }
.rs-count-sep  { width: 1px; height: 12px; background: rgba(246,241,228,.2); margin: 0 2px; }
.rs-close {
  background: rgba(246,241,228,.08); border: none; color: rgba(246,241,228,.55);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.rs-close:hover { background: rgba(246,241,228,.15); color: rgba(246,241,228,.9); }

/* Quick search */
.rs-quicksearch {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--paper-deep);
  border-bottom: 1px solid rgba(184,146,77,.2); flex-shrink: 0;
}
.rs-qs-icon { font-size: 16px; color: var(--ink-mute); line-height: 1; }
.rs-qs-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 12px; color: var(--ink); font-family: BiauKai, 標楷體, serif;
}
.rs-qs-input::placeholder { color: var(--ink-faint); }

/* Tabs */
.rs-tabs {
  display: flex; background: var(--paper-deep);
  border-bottom: 1px solid rgba(184,146,77,.2); flex-shrink: 0;
}
.rs-tab {
  flex: 1; padding: 9px 4px; background: none; border: none; cursor: pointer;
  font-size: var(--fs-nano); color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  position: relative;
}
.rs-tab-on { color: var(--ink); border-bottom-color: var(--gold); }
.rs-tab-badge {
  position: absolute; top: 5px; right: 12px;
  font-size: var(--fs-nano); background: var(--gold); color: white;
  padding: 0 4px; border-radius: 8px; min-width: 14px; text-align: center; line-height: 14px; height: 14px;
}

/* Body */
.rs-body { flex: 1; overflow-y: auto; }

/* Dept */
.rs-dept {
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(184,146,77,.1);
  transition: border-color .2s;
}
.rs-dept-hd {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; background: none; border: none; cursor: pointer; text-align: left;
  transition: background .12s;
}
.rs-dept-hd:hover { background: rgba(184,146,77,.06); }
.rs-dept-arrow {
  font-size: 16px; color: var(--ink-mute); display: inline-block;
  transition: transform .2s; line-height: 1; width: 12px;
}
.rs-dept-name { flex: 1; font-size: 12px; font-weight: 600; color: var(--ink); }
.rs-dept-pill {
  font-size: var(--fs-nano); padding: 1px 7px; border-radius: 10px;
  font-family: 'Times New Roman', serif; letter-spacing: .04em;
}

/* Agents */
.rs-agents { padding-bottom: 4px; }
.rs-agent {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px 9px 32px;
  text-decoration: none; color: var(--ink);
  transition: background .12s;
}
.rs-agent:hover { background: rgba(184,146,77,.07); }
.rs-agent:hover .rs-ag-arr { opacity: 1; transform: translateX(3px); }

.rs-ag-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: rgba(26,36,56,.2); transition: box-shadow .3s;
}
.rs-ag-dot-on { background: #4caf7d; }
.rs-ag-body { flex: 1; min-width: 0; }
.rs-ag-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.rs-ag-task { font-size: var(--fs-nano); color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-ag-arr { font-size: 12px; color: var(--gold); opacity: 0; transition: opacity .15s, transform .15s; }

/* System footer */
.rs-sys-footer {
  margin: 10px 12px; padding: 10px 12px;
  background: var(--paper-deep); border: 1px solid rgba(184,146,77,.15);
  border-radius: 6px;
}
.rs-sys-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 0; font-size: var(--fs-nano); color: var(--ink-mute);
}
.rs-sys-val { color: var(--ink-soft); font-family: 'Times New Roman', serif; font-size: var(--fs-nano); letter-spacing: .04em; }

/* Flex col helper */
.rs-flex-col { display: flex; flex-direction: column; height: 100%; }

/* Category buttons */
.rs-cat-row { display: flex; gap: 4px; padding: 10px 12px 6px; }
.rs-cat-btn {
  flex: 1; padding: 6px 4px; background: none;
  border: 1px solid rgba(184,146,77,.2); border-radius: 6px; cursor: pointer;
  font-size: var(--fs-nano); color: var(--ink-mute); text-align: center;
  transition: all .15s; position: relative;
}
.rs-cat-on { background: rgba(184,146,77,.12); border-color: var(--gold); color: var(--ink); }
.rs-cat-n {
  position: absolute; top: -5px; right: -5px;
  font-size: var(--fs-nano); background: var(--gold); color: white;
  padding: 0 4px; border-radius: 8px; min-width: 14px; height: 14px; line-height: 14px; text-align: center;
}

/* Todo list */
.rs-todo-list { flex: 1; overflow-y: auto; padding: 4px 10px 6px; }
.rs-empty { color: var(--ink-mute); font-size: var(--fs-nano); text-align: center; padding: 24px 0; }
.rs-todo-item {
  display: flex; align-items: center; gap: 7px; padding: 8px 6px;
  border-radius: 6px; transition: background .12s;
}
.rs-todo-item:hover { background: rgba(184,146,77,.06); }
.rs-todo-item:hover .rs-del { opacity: 1; }
.rs-chk {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 1.5px solid rgba(184,146,77,.4); border-radius: 4px;
  background: none; cursor: pointer; font-size: var(--fs-nano);
  display: flex; align-items: center; justify-content: center;
  color: white; transition: all .15s;
}
.rs-chk-done { background: var(--gold); border-color: var(--gold); }
.rs-pri-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.rs-todo-txt { font-size: 12px; flex: 1; line-height: 1.4; }
.rs-done { text-decoration: line-through; opacity: .4; }
.rs-del {
  background: none; border: none; color: var(--ink-mute); font-size: var(--fs-nano);
  cursor: pointer; padding: 2px 4px; opacity: 0; transition: opacity .15s, color .15s; flex-shrink: 0;
}
.rs-del:hover { color: var(--bear); }
.rs-note-del { opacity: 0; }

/* Add todo */
.rs-add-todo {
  padding: 8px 10px; border-top: 1px solid rgba(184,146,77,.15);
  display: flex; flex-direction: column; gap: 6px;
}
.rs-pri-row { display: flex; gap: 5px; }
.rs-pri-btn {
  flex: 1; padding: 4px 0; background: none;
  border: 1px solid rgba(184,146,77,.2); border-radius: 4px; cursor: pointer;
  font-size: var(--fs-nano); color: var(--ink-mute); transition: all .15s;
}
.rs-pri-on { background: rgba(184,146,77,.1); }
.rs-inp {
  width: 100%; padding: 8px 10px;
  border: 1px solid rgba(184,146,77,.28); border-radius: 6px;
  background: white; font-size: 12px; color: var(--ink);
  font-family: BiauKai, 標楷體, serif; outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.rs-inp:focus { border-color: var(--gold); }
.rs-add-btn {
  padding: 8px 14px; background: var(--ink); color: var(--paper-bright);
  border: none; border-radius: 6px; cursor: pointer; font-size: 15px;
  transition: background .15s; flex-shrink: 0; font-family: BiauKai, 標楷體, serif;
}
.rs-add-btn:hover { background: var(--ink-soft); }

/* Notes */
.rs-note-list { flex: 1; overflow-y: auto; padding: 8px 10px 4px; }
.rs-note-card {
  margin-bottom: 8px; padding: 10px 12px;
  background: white; border: 1px solid rgba(184,146,77,.2); border-radius: 8px;
  border-left: 3px solid var(--gold);
  transition: border-color .15s, box-shadow .15s;
}
.rs-note-card:hover { box-shadow: 0 2px 10px rgba(26,36,56,.06); border-color: rgba(184,146,77,.45); }
.rs-note-card:hover .rs-note-del { opacity: 1; }
.rs-note-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.rs-note-title { flex: 1; font-size: 12px; font-weight: 600; }
.rs-note-dt { font-size: var(--fs-nano); color: var(--ink-faint); white-space: nowrap; font-family: 'Times New Roman', serif; }
.rs-note-body { font-size: var(--fs-nano); color: var(--ink-mute); line-height: 1.6; white-space: pre-wrap; }
.rs-add-note {
  padding: 8px 10px; border-top: 1px solid rgba(184,146,77,.15);
  display: flex; flex-direction: column; gap: 6px;
}

/* Masthead toggle */
.ruflo-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; background: var(--ink); cursor: pointer;
  border: none; border-radius: 4px; color: var(--paper-bright);
  font-size: var(--fs-nano); letter-spacing: .05em;
  transition: background .15s; flex-shrink: 0;
}
.ruflo-toggle-btn:hover { background: var(--ink-soft); }
.ruflo-toggle-btn svg { width: 15px; height: 15px; }

/* ============================================================
   Utility classes
   ============================================================ */
.text-bull   { color: var(--bull); }
.text-bear   { color: var(--bear); }
.text-gold   { color: var(--gold); }
.text-mute   { color: var(--ink-mute); }
.font-kai    { font-family: BiauKai, 標楷體, serif; }
.font-roman  { font-family: 'Times New Roman', serif; }

/* ============================================================
   動效升級層 v1 — 2026-06-10
   進場節奏 / 懸停浮起 / 漲跌閃色 / 骨架屏
   原則:墨水+金箔色系、緩動克制、支援 reduced-motion
   ============================================================ */

/* ── 進場:卡片依序浮現(雜誌翻頁節奏)── */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.frame-card { animation: riseIn .55s cubic-bezier(.22,.8,.36,1) both; }
.frame-card:nth-of-type(2) { animation-delay: .08s; }
.frame-card:nth-of-type(3) { animation-delay: .16s; }
.frame-card:nth-of-type(4) { animation-delay: .24s; }
.frame-card:nth-of-type(5) { animation-delay: .32s; }
.frame-card:nth-of-type(6) { animation-delay: .40s; }
.frame-card:nth-of-type(7) { animation-delay: .48s; }
.frame-card:nth-of-type(n+8) { animation-delay: .55s; }

/* ── 懸停:輕浮起 + 金角舒展 ── */
.frame-card {
  transition: transform .28s cubic-bezier(.22,.8,.36,1), box-shadow .28s ease;
}
.frame-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.frame-card .corner-tl, .frame-card .corner-tr,
.frame-card .corner-bl, .frame-card .corner-br {
  transition: width .3s cubic-bezier(.22,.8,.36,1), height .3s cubic-bezier(.22,.8,.36,1);
}
.frame-card:hover .corner-tl, .frame-card:hover .corner-tr,
.frame-card:hover .corner-bl, .frame-card:hover .corner-br {
  width: 20px; height: 20px;
}

/* ── 漲跌閃色:報價更新瞬間提示 ── */
@keyframes flashUp { 0% { background: rgba(42,107,76,.16); } 100% { background: transparent; } }
@keyframes flashDn { 0% { background: rgba(156,43,43,.14); } 100% { background: transparent; } }
.px-flash-up { animation: flashUp 1s ease-out; }
.px-flash-dn { animation: flashDn 1s ease-out; }

/* 數字等寬,刷新時不跳動 */
.num, .val, .num-cell, .tabular { font-variant-numeric: tabular-nums; }

/* ── 骨架屏:紙張色微光 ── */
@keyframes skSheen { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk {
  background: linear-gradient(100deg,
    var(--paper-deep) 36%, var(--paper-bright) 50%, var(--paper-deep) 64%);
  background-size: 200% 100%;
  animation: skSheen 1.4s ease-in-out infinite;
  border-radius: 2px;
}
.sk-line  { height: 12px; margin: 6px 0; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
.sk-num   { height: 28px; width: 120px; }
.sk-card  { border: 1px solid var(--paper-line); padding: 12px 18px; flex: 1 1 200px; }

/* ── 互動列:表格列懸停墨染 ── */
.ed-table tbody tr { transition: background .15s ease; }
.ed-table tbody tr:hover { background: rgba(184,146,77,.07); }

/* ── 無障礙:使用者偏好減少動態 ── */
@media (prefers-reduced-motion: reduce) {
  .frame-card { animation: none; }
  .frame-card:hover { transform: none; }
  .sk { animation: none; }
  .px-flash-up, .px-flash-dn { animation: none; }
}

/* ============================================================
   設計升級層 v2 — 2026-06-11
   視覺精緻度:金箔微細節 × 表格墨韻 × 介面質感
   原則:只用既有色票、不改版面結構,整塊刪除即可回退
   ============================================================ */

/* ── 文字選取:金箔底 ── */
::selection { background: rgba(212,179,112,.38); color: var(--ink); }

/* ── 捲軸:紙張底 + 墨線滑塊,懸停鍍金 ── */
html { scrollbar-width: thin; scrollbar-color: var(--paper-line) var(--paper); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb {
  background: var(--paper-line);
  border: 3px solid var(--paper);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── 鍵盤焦點:金圈(無障礙 + 雜誌金線一致)── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Masthead:雙線之下緣中央鍍金,如書名頁燙金 ── */
.masthead::after {
  background: linear-gradient(90deg,
    var(--ink) 0%, var(--ink) 40%,
    var(--gold) 50%,
    var(--ink) 60%, var(--ink) 100%);
}

/* ── Section kicker:前置金短線,如雜誌欄目標記 ── */
.sec-kicker { display: flex; align-items: center; gap: 9px; }
.sec-kicker::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── frame-card:懸停時內框鍍金,與金角舒展呼應 ── */
.frame-card::before { transition: border-color .3s ease; }
.frame-card:hover::before { border-color: var(--gold-leaf); }

/* ── 表格:懸停列左緣金邊書籤 ── */
.ed-table tbody tr:hover { box-shadow: inset 3px 0 0 var(--gold); }
.ed-table tbody tr:hover td:first-child { padding-left: 14px; }
.ed-table tbody td { transition: padding-left .18s ease; }

/* ── stat-cell:頂緣金刻度,如尺規標記 ── */
.stat-cell { position: relative; }
.stat-cell::before {
  content: "";
  position: absolute; top: 0; left: 18px;
  width: 16px; height: 2px;
  background: var(--gold);
}

/* ── Ticker:左右墨色淡出,跑馬燈更像印刷帶 ── */
.ticker::before, .ticker::after {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 56px; z-index: 2;
  pointer-events: none;
}
.ticker::before { left: 0;  background: linear-gradient(90deg,  var(--ink), transparent); }
.ticker::after  { right: 0; background: linear-gradient(270deg, var(--ink), transparent); }

/* ── 按鈕按壓回饋:輕微下沉 ── */
.icon-btn:active, .mkt-btn:active, .ruflo-toggle-btn:active { transform: translateY(1px); }

/* ── 平滑捲動(尊重 reduced-motion)── */
html { scroll-behavior: smooth; }

/* ── 無障礙:減少動態 ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ed-table tbody td { transition: none; }
}

/* ============================================================
   互動升級層 v2.5 — 2026-06-11
   滾動進場 / 墨水tooltip / LIVE呼吸點 / Command Palette
   原則:雜誌節奏、墨水+金箔、整塊可回退
   ============================================================ */

/* ── 滾動進場:捲到視窗才浮現(JS 加 body.sr-on 才生效)── */
body.sr-on .frame-card { animation: none; }   /* 取代 v1 載入即播 */
body.sr-on .sr-hide {
  opacity: 0;
  transform: translateY(18px);
}
body.sr-on .sr-in {
  opacity: 1;
  transform: none;
  transition:
    opacity .65s cubic-bezier(.22,.8,.36,1),
    transform .65s cubic-bezier(.22,.8,.36,1);
  transition-delay: var(--sr-delay, 0s);
}

/* ── 墨水風 tooltip:[data-tip] 通用 ── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: var(--ink);
  color: var(--paper-bright);
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 12px;
  letter-spacing: .12em;
  white-space: nowrap;
  padding: 5px 11px;
  border: 1px solid var(--gold-deep);
  box-shadow: 0 6px 18px rgba(26,36,56,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 90;
}
[data-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gold-deep);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 90;
}
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tip]:hover::before { opacity: 1; }

/* ── LIVE 呼吸點 ── */
@keyframes liveBreath {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(212,179,112,.5); }
  50%      { opacity: .55; box-shadow: 0 0 0 4px rgba(212,179,112,0); }
}
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold-leaf);
  animation: liveBreath 2.2s ease-in-out infinite;
  vertical-align: middle;
}
.ticker-live {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px 0 44px;
  font-variant: small-caps;
  letter-spacing: .2em;
  font-size: var(--fs-nano);
  color: var(--gold-leaf);
  font-weight: 700;
  background: linear-gradient(90deg, var(--ink) 72%, transparent);
  z-index: 3;
  pointer-events: none;
}
@media (max-width: 900px) { .ticker-live { padding-left: 18px; } }

/* ── Ticker item 可點擊 ── */
a.ticker-item { text-decoration: none; color: inherit; transition: opacity .15s ease; }
a.ticker-item:hover .name { text-decoration: underline; text-underline-offset: 3px; }

/* ── Command Palette(⌘K / Ctrl+K)── */
.ckp-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(26,36,56,.42);
  backdrop-filter: blur(2px);
  display: flex; justify-content: center;
  padding-top: 14vh;
  animation: ckpFade .18s ease both;
}
@keyframes ckpFade { from { opacity: 0; } to { opacity: 1; } }
.ckp-panel {
  width: min(560px, calc(100vw - 32px));
  height: fit-content;
  background: var(--paper-bright);
  border: 1.5px solid var(--ink);
  box-shadow: 0 24px 64px rgba(26,36,56,.35);
  position: relative;
  animation: ckpRise .22s cubic-bezier(.22,.8,.36,1) both;
}
@keyframes ckpRise { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.ckp-panel::before {
  content: ""; position: absolute; inset: 5px;
  border: 1px solid var(--paper-line); pointer-events: none;
}
.ckp-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px;
  border-bottom: 2px solid var(--ink);
  position: relative; z-index: 1;
}
.ckp-input-row svg { width: 16px; height: 16px; color: var(--gold-deep); flex-shrink: 0; }
.ckp-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: 'Times New Roman', 'BiauKai', '標楷體', serif;
  font-size: 17px; color: var(--ink);
}
.ckp-input::placeholder { color: var(--ink-faint); font-style: italic; }
.ckp-kbd {
  font-family: 'Times New Roman', serif;
  font-size: var(--fs-nano); letter-spacing: .08em;
  color: var(--ink-mute);
  border: 1px solid var(--paper-line);
  padding: 2px 6px;
  background: var(--paper);
}
.ckp-list { max-height: 46vh; overflow-y: auto; position: relative; z-index: 1; padding: 6px 0; }
.ckp-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.ckp-item.sel {
  background: var(--paper);
  border-left-color: var(--gold);
}
.ckp-item .ckp-zh {
  font-family: 'BiauKai', '標楷體', serif;
  font-size: 15px; letter-spacing: .1em;
}
.ckp-item .ckp-en {
  font-family: 'Times New Roman', serif;
  font-style: italic; font-size: 13px;
  color: var(--ink-mute);
}
.ckp-item .ckp-tag {
  margin-left: auto;
  font-variant: small-caps; letter-spacing: .15em;
  font-size: var(--fs-nano); color: var(--gold-deep);
}
.ckp-empty {
  padding: 26px 20px; text-align: center;
  font-style: italic; color: var(--ink-faint); font-size: 14px;
}

/* ── 無障礙:減少動態 ── */
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .ckp-backdrop, .ckp-panel { animation: none; }
}

/* ============================================================
   流域升級層 — 2026-06-11(產業地圖)
   河道化 / 金沙粒子 / 捲軸進場 / 城鎮點燈 / 山海地形
   原則:古典輿圖工藝,墨水+金箔,整塊可回退
   ============================================================ */

/* ── 河道:halo(河岸暈)+ 河身 + 墨金水紋 ── */
.river-halo {
  fill: none;
  stroke: var(--gold-leaf);
  stroke-linecap: round;
  opacity: .14;
}
.river-base {
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  opacity: .34;
}
.river-core {
  fill: none;
  stroke: var(--gold-deep);
  stroke-linecap: round;
  stroke-dasharray: 3 9;
  opacity: 0;
  animation:
    riverCoreIn .6s ease forwards,
    dashFlow 30s linear infinite;
  animation-delay: calc(var(--rd, 0s) + .85s), 0s;
}
@keyframes riverCoreIn { to { opacity: .5; } }

/* 捲軸進場:河道從上游往下游畫出 */
@keyframes riverDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.river-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: riverDraw 1.15s cubic-bezier(.4, 0, .2, 1) forwards;
  animation-delay: var(--rd, 0s);
}

/* 金沙粒子 */
.river-dot {
  fill: var(--gold-leaf);
  opacity: .75;
  filter: drop-shadow(0 0 2px rgba(212,179,112,.9));
}

/* ── 城鎮:蓋章進場 + 點燈懸停 ── */
@keyframes stampIn {
  0%   { opacity: 0; transform: scale(1.45); }
  62%  { opacity: 1; transform: scale(.97); }
  100% { opacity: 1; transform: scale(1); }
}
.node-card {
  animation: stampIn .5s cubic-bezier(.22,.8,.36,1) backwards;
  animation-delay: var(--nd, 0s);
}
.node-card:hover {
  filter: drop-shadow(0 0 10px rgba(212,179,112,.65));
}
.node-card.active {
  filter: drop-shadow(0 0 12px rgba(212,179,112,.55));
}
.node-flag {
  transition: transform .25s cubic-bezier(.22,.8,.36,1);
  transform-box: fill-box;
  transform-origin: bottom left;
}
.node-card:hover .node-flag { transform: scale(1.12); }

/* ── 羅盤:進場旋轉定位 ── */
@keyframes compassIn {
  from { transform: rotate(-150deg); opacity: 0; }
  to   { transform: rotate(0deg); opacity: 1; }
}
.compass-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: compassIn 1.4s cubic-bezier(.34,1.3,.5,1) backwards;
  animation-delay: .1s;
}

/* ── 無障礙:減少動態 ── */
@media (prefers-reduced-motion: reduce) {
  .river-draw { animation: none; stroke-dashoffset: 0; }
  .river-core { animation: none; opacity: .5; }
  .node-card { animation: none; }
  .compass-spin { animation: none; }
  .node-flag, .node-card:hover .node-flag { transition: none; transform: none; }
}


/* ── 產業地圖風格切換 ────────────────────────────────── */
.map-style-toggle {
  position: absolute; top: 10px; right: 12px; z-index: 6;
  display: flex; border: 1px solid var(--ink); background: var(--paper-bright);
  box-shadow: 2px 2px 0 rgba(26,36,56,.12);
}
.map-style-toggle button {
  font-family: 'BiauKai','標楷體',serif; font-size: var(--fs-nano); letter-spacing: .12em;
  padding: 5px 14px; background: none; border: none; cursor: pointer;
  color: var(--ink-mute); border-right: 1px solid var(--paper-line); transition: all .15s;
}
.map-style-toggle button:last-child { border-right: none; }
.map-style-toggle button:hover { background: var(--paper-deep); color: var(--ink); }
.map-style-toggle button.on { background: var(--ink); color: var(--paper-bright); }


/* ── 流域圖鑑：玻璃感節點 ─────────────────────────────── */
.node-card .node-rect {
  fill: rgba(252, 250, 243, .68);   /* 半透明：河道從卡片下方隱約透出 */
}
.node-card.active .node-rect { fill: rgba(252, 250, 243, .85); }
.node-sheen { fill: url(#sheenGrad); opacity: 0; }
.node-card:hover .node-sheen {
  animation: sheenSweep .9s ease-out forwards;
}
@keyframes sheenSweep {
  0%   { opacity: 0;   transform: translateX(0); }
  25%  { opacity: .8; }
  100% { opacity: 0;   transform: translateX(var(--sw, 520px)); }
}
@media (prefers-reduced-motion: reduce) {
  .node-card:hover .node-sheen { animation: none; }
}

/* ════════════════════════════════════════════
   Presidential Cycle Roadmap（總統週期羅盤）
   us-dashboard.jsx ElectionCycleRoadmap 使用
   ════════════════════════════════════════════ */
.pc-wrap{border:1px solid var(--ink);background:var(--paper-bright);position:relative;margin-bottom:28px;}
.pc-wrap::before{content:"";position:absolute;inset:4px;border:1px solid var(--paper-line);pointer-events:none;z-index:0;}
.pc-inner{padding:18px 20px 14px;position:relative;z-index:1;}
.pc-lede{font-family:'BiauKai','標楷體',serif;font-size:var(--fs-xs);line-height:1.9;letter-spacing:.05em;color:var(--ink-soft);border-left:2px solid var(--gold);padding-left:12px;margin-bottom:16px;}
.pc-cycle{display:grid;grid-template-columns:repeat(4,1fr);position:relative;margin-bottom:6px;}
.pc-seg{border:1px solid var(--paper-line);border-left:none;padding:9px 12px 8px;}
.pc-seg:first-child{border-left:1px solid var(--paper-line);}
.pc-seg.now{background:rgba(184,146,77,.09);box-shadow:inset 0 0 0 1px var(--gold);}
.pc-seg-y{font-family:'Times New Roman',serif;font-size:16px;font-weight:700;}
.pc-seg-nm{font-family:'BiauKai','標楷體',serif;font-size: var(--fs-nano);letter-spacing:.12em;margin-top:1px;}
.pc-seg-en{font-size:8px;font-variant:small-caps;letter-spacing:.12em;color:var(--ink-mute);}
.pc-seg-avg{font-family:'Times New Roman',serif;font-size:13px;font-weight:700;margin-top:5px;}
.pc-seg-note{font-size: var(--fs-nano);color:var(--ink-mute);margin-top:2px;letter-spacing:.03em;}
.pc-cycle-track{position:relative;height:14px;margin:0 0 18px;border-left:1px solid var(--paper-line);border-right:1px solid var(--paper-line);}
.pc-cycle-pin{position:absolute;top:0;transform:translateX(-50%);font-size: var(--fs-nano);color:var(--gold-deep,#8a6a32);white-space:nowrap;font-family:'BiauKai','標楷體',serif;letter-spacing:.08em;}
.pc-verdict{font-family:'BiauKai','標楷體',serif;font-size:var(--fs-xs);letter-spacing:.06em;line-height:1.8;padding:10px 14px;border:1px solid var(--gold);background:rgba(184,146,77,.07);margin:14px 0;}
.pc-stats{display:grid;grid-template-columns:repeat(5,1fr);border-top:1px solid var(--paper-line);margin-top:4px;}
.pc-stat{padding:10px 12px 8px;border-right:1px solid var(--paper-line);}
.pc-stat:last-child{border-right:none;}
.pc-stat-v{font-family:'Times New Roman',serif;font-size:19px;font-weight:700;line-height:1.1;}
.pc-stat-l{font-family:'BiauKai','標楷體',serif;font-size: var(--fs-nano);letter-spacing:.06em;color:var(--ink-soft);margin-top:4px;line-height:1.5;}
.pc-note{padding:8px 2px 0;font-size: var(--fs-nano);font-style:italic;color:var(--ink-faint);line-height:1.6;}
@media(max-width:760px){.pc-cycle{grid-template-columns:repeat(2,1fr)}.pc-seg{border-left:1px solid var(--paper-line)}.pc-stats{grid-template-columns:repeat(2,1fr)}.pc-stat{border-bottom:1px solid var(--paper-line)}}
.pc-legend{display:flex;flex-wrap:wrap;gap:8px 22px;padding:10px 4px 2px;align-items:center;}
.pc-leg-item{display:flex;align-items:center;gap:7px;}
.pc-leg-swatch{display:inline-block;width:26px;}
.pc-leg-nm{font-family:'BiauKai','標楷體',serif;font-size: var(--fs-nano);letter-spacing:.08em;color:var(--ink);}
.pc-leg-en{font-size: var(--fs-nano);font-style:italic;color:var(--ink-mute);}
