  :root {
    /* 暖編輯 ink（token 名保留給 JS：各處 var(--navy) 引用，只改值不改名） */
    --navy: #2b2621;        /* 主 ink：暖近黑（原冷 navy → 暖） */
    --ink: #4a423a;         /* 次 ink：暖褐，內文強調 */
    --muted: #6f665c;       /* 說明/caption（paper 上 ~4.9:1，過 AA） */
    --line: #e6ded0;        /* 紙上細分隔線 */
    --paper: #f6f2e9;       /* 主紙色（暖、低彩） */
    --paper2: #efe8da;      /* 次紙面：卡背/內嵌 */
    --card: #fdfbf5;        /* 卡片亮面 */
    --accent: #b0472f;      /* 赭紅（與 mindmap 同源）：主動作/選中/底線 */
    --accent-soft: #eed9cf;
    /* 台股語意色：紅漲綠跌（精煉、去糖果感） */
    --rose: #c0392b;   --up: #c0392b;
    --emerald: #1c6e50; --down: #1c6e50;
    /* 題材分類 tint：糖果粉彩 → 檔案紙印刷色（低彩、和諧） */
    --lilac: #e5e0e9;
    --sky: #dde3e8;
    --mint: #dde6dd;
    --sand: #ece0cd;
    --cream: #efe7d3;
    --blush: #eeddd6;
  }
  body {
    font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    background-color: var(--paper);
    background-image: radial-gradient(rgba(92,74,54,0.04) 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--navy);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  .font-display { font-family: 'Noto Serif TC', 'Songti TC', serif; font-weight: 600; letter-spacing: -0.01em; }
  .font-script { font-family: 'Caveat', cursive; }
  .font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum'; }

  .scrollbar-hide::-webkit-scrollbar { display: none; }
  .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

  @keyframes fadeUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
  .fade-up { animation: fadeUp 0.5s ease both; }
  .no-anim .fade-up { animation: none !important; }  /* 跳轉觸發的重繪不跑進場動畫 */

  .bg-paper { background: var(--paper); }
  .bg-paper2 { background: var(--paper2); }
  .bg-lilac { background: var(--lilac); }
  .bg-sky { background: var(--sky); }
  .bg-mint { background: var(--mint); }
  .bg-sand { background: var(--sand); }
  .bg-cream { background: var(--cream); }
  .bg-blush { background: var(--blush); }
  .bg-navy { background: var(--navy); }

  .ring-paper { box-shadow: 0 1px 2px rgba(43,38,33,0.04), 0 10px 26px -14px rgba(43,38,33,0.12); }
  .grain {
    background-image: radial-gradient(rgba(43,38,33,0.045) 1px, transparent 1px);
    background-size: 16px 16px;
  }

  /* 信心徽章 */
  .badge-conf {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .01em;
  }
  .badge-strong { background: rgba(28,110,80,0.10); color: var(--down); }
  .badge-medium { background: rgba(176,71,47,0.10); color: var(--accent); }
  .badge-weak { background: rgba(111,102,92,0.12); color: var(--muted); }

  /* hover */
  .hover-lift { transition: transform 200ms cubic-bezier(.22,1,.36,1), box-shadow 200ms ease; }
  .hover-lift:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(43,38,33,0.22); }

  .divider-dot {
    background-image: radial-gradient(circle, rgba(43,38,33,0.22) 1px, transparent 1px);
    background-size: 6px 6px; height: 6px; width: 100%; opacity: 0.4;
  }

  /* 連結線 hover */
  .stock-card { cursor: pointer; }
  .stock-card:hover { background: var(--card); }

  /* Detail Panel */
  #detail-panel { transition: transform 280ms cubic-bezier(0.4,0,0.2,1); transform: translateY(100%); }
  #detail-panel.open { transform: translateY(0); }

  /* 產業樹 — marked.js 渲染後的 markdown 樣式 */
  .deep-dive-content h1 { font-family: 'Noto Serif TC', serif; font-size: 1.875rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: var(--navy); letter-spacing: -0.01em; }
  .deep-dive-content h2 { font-family: 'Noto Serif TC', serif; font-size: 1.5rem; font-weight: 600; margin: 2rem 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); color: var(--navy); }
  .deep-dive-content h3 { font-size: 1.125rem; font-weight: 700; margin: 1.25rem 0 0.5rem; color: var(--navy); }
  .deep-dive-content h4 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.5rem; color: var(--ink); }
  .deep-dive-content p { margin: 0.5rem 0; line-height: 1.8; color: var(--ink); }
  .deep-dive-content ul, .deep-dive-content ol { margin: 0.5rem 0 0.75rem 1.25rem; color: var(--ink); }
  .deep-dive-content li { margin: 0.25rem 0; line-height: 1.75; }
  .deep-dive-content ul li { list-style: disc; }
  .deep-dive-content ol li { list-style: decimal; }
  .deep-dive-content strong, .deep-dive-content b { font-weight: 700; color: var(--navy); }
  .deep-dive-content em { font-style: italic; color: var(--muted); }
  .deep-dive-content blockquote { background: var(--paper2); border: 1px solid var(--line); padding: 0.6rem 1rem; margin: 0.9rem 0; color: var(--ink); font-size: 0.92em; border-radius: 8px; }
  .deep-dive-content blockquote p { margin: 0.25rem 0; color: var(--ink); }
  .deep-dive-content code { background: var(--accent-soft); padding: 0.1rem 0.35rem; border-radius: 4px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.85em; color: var(--accent); }
  .deep-dive-content pre { background: #2b2621; color: #efe8da; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: 0.85em; margin: 0.75rem 0; }
  .deep-dive-content pre code { background: transparent; color: inherit; padding: 0; }
  .deep-dive-content hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
  .deep-dive-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
  .deep-dive-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9em; }
  .deep-dive-content table th { background: var(--paper2); padding: 0.5rem 0.75rem; text-align: left; font-weight: 700; border: 1px solid var(--line); color: var(--navy); }
  .deep-dive-content table td { padding: 0.5rem 0.75rem; border: 1px solid var(--line); color: var(--ink); }
  .deep-dive-content table tr:nth-child(even) td { background: rgba(239,232,218,0.5); }

/* ════ v2.6 美化層（對話 34）：純 CSS、不動任何 JS 邏輯 ════ */

/* 1. 進場：區塊級淡入（v3：捨棄逐卡 stagger 的機械節奏） */
@keyframes pulseFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#intraday-pulse, #intraday-clusters, #intraday-strong, #intraday-top30,
#setup-mapped, #setup-unmapped {
  animation: pulseFadeUp .4s cubic-bezier(.22,1,.36,1) both;
}

/* 3. 盤中「活著」指示：updated 時間前的呼吸綠點 */
#intraday-updated::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 9999px;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: 1px;
  animation: pulseBreath 2s ease-in-out infinite;
}
@keyframes pulseBreath {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
  50%      { opacity: .55; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

/* 4. filter chip：按下回饋 + 平滑 */
button[data-quad], button[data-pb] {
  transition: transform .12s ease, background-color .15s ease, color .15s ease;
}
button[data-quad]:active, button[data-pb]:active { transform: scale(.94); }

/* 6. 美股隔夜 sidebar */
  #us-toggle {
    position: fixed; bottom: 24px; right: 24px; z-index: 20;
    width: 52px; height: 52px; border-radius: 50%;
    border: none; background: var(--navy); color: #fff;
    box-shadow: 0 4px 20px -4px rgba(26,26,46,0.35);
    cursor: pointer; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
  }
  #us-toggle:hover { transform: scale(1.12); box-shadow: 0 6px 24px -4px rgba(26,26,46,0.45); }
  #us-toggle.has-alert {
    background: var(--accent);
    box-shadow: 0 4px 16px -6px rgba(176,71,47,0.45);
    animation: alertPulse 2.8s ease-in-out infinite;
  }
  @keyframes alertPulse {
    0%, 100% { box-shadow: 0 4px 14px -6px rgba(176,71,47,0.40); }
    50% { box-shadow: 0 4px 18px -6px rgba(176,71,47,0.55); }
  }
  #us-sidebar {
    position: fixed; bottom: 84px; right: 24px; width: 360px;
    max-height: calc(100vh - 180px); overflow-y: auto; z-index: 19;
    background: var(--paper);
    border: 1px solid rgba(26,26,46,0.06);
    border-radius: 20px; padding: 0;
    box-shadow: 0 12px 48px -12px rgba(26,26,46,0.22), 0 0 0 1px rgba(26,26,46,0.04);
    display: none;
    animation: sidebarSlide 0.25s cubic-bezier(.4,0,.2,1);
  }
  @keyframes sidebarSlide {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  #us-sidebar.open { display: block; }
  #us-sidebar::-webkit-scrollbar { width: 4px; }
  #us-sidebar::-webkit-scrollbar-track { background: transparent; }
  #us-sidebar::-webkit-scrollbar-thumb { background: rgba(26,26,46,0.12); border-radius: 4px; }
  .us-header {
    position: sticky; top: 0; z-index: 1;
    background: var(--navy); color: #fff;
    padding: 16px 20px 14px; border-radius: 20px 20px 0 0;
  }
  .us-header-title { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
  .us-header-sub { font-size: 11px; opacity: 0.55; margin-top: 2px; }
  .us-body { padding: 16px 16px 12px; }
  .us-section-label {
    font-size: 11px; font-weight: 600; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 1.2px;
    margin-bottom: 8px;
  }
  .us-theme-card {
    background: var(--paper2); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    border: 1px solid var(--line);
    transition: background 0.15s;
  }
  .us-theme-card:hover { background: var(--sky); }
  .us-theme-name { font-size: 14px; font-weight: 600; color: var(--navy); }
  .us-theme-trigger { font-size: 11px; color: #94a3b8; margin-top: 1px; }
  .us-member-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0; font-size: 13px; color: var(--ink);
  }
  .us-member-ticker { font-weight: 600; min-width: 36px; }
  .us-member-name { color: #64748b; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .us-rho {
    font-size: 11px; font-weight: 600; padding: 2px 7px;
    border-radius: 999px; font-family: 'JetBrains Mono', monospace;
  }
  .us-rho-hi { background: rgba(99,102,241,0.12); color: #6366f1; }
  .us-rho-lo { background: rgba(148,163,184,0.12); color: #94a3b8; }
  #us-sidebar .us-alert {
    padding: 12px 14px; border-radius: 12px; margin-bottom: 8px;
    background: var(--navy); color: #fff; position: relative; overflow: hidden;
  }
  #us-sidebar .us-alert::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  }
  #us-sidebar .us-alert.up::before { background: linear-gradient(90deg, #dc2626, #f87171); }
  #us-sidebar .us-alert.down::before { background: linear-gradient(90deg, #047857, #34d399); }
  .us-alert-top { display: flex; justify-content: space-between; align-items: baseline; }
  .us-alert-ticker { font-weight: 700; font-size: 15px; }
  .us-alert-pct { font-weight: 700; font-size: 15px; }
  .us-alert-pct.up { color: #f87171; }
  .us-alert-pct.down { color: #34d399; }
  .us-alert-sub { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 2px; }
  .us-alert-etf { font-size: 10px; color: rgba(255,255,255,0.35); margin-left: 5px; font-weight: 400; }
  #us-sidebar .us-chip {
    display: inline-block; font-size: 11px;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7);
    margin: 2px 2px 0 0;
  }

  /* ════ 消 AI 味層（保留暖編輯、只動視覺層；對話 35）════ */

  /* A. 對比：洗白 slate 灰 → 過 WCAG AA（body 前綴蓋過 tailwind CDN 同特異性後注入） */
  body .text-slate-400 { color: #6f665c; }   /* paper 上 ~4.9:1 */
  body .text-slate-500 { color: #574f46; }   /* ~6.3:1 */
  body .text-slate-600 { color: #453e37; }
  input::placeholder { color: #857b70; opacity: 1; }

  /* B. 分頁 nav：去泡泡 pill、編輯化（active 由 JS 加 text-white + inline navy bg 呈現實心） */
  .tab-btn {
    font-size: 14px; font-weight: 500; color: var(--muted);
    padding: 8px 14px; border-radius: 8px; line-height: 1;
    display: inline-flex; align-items: center;
    white-space: nowrap; flex: 0 0 auto;   /* 手機不擠壓、不折字：整列可橫向捲動 */
    transition: color .15s, background-color .15s;
  }
  .tab-btn:hover { color: var(--navy); background: var(--paper2); }
  .tab-btn.text-white { color: #fff !important; background: var(--navy) !important; }

  /* C. 族群/Setup/Top30 卡：2px 糖果框 → 1px 細線（保留紅漲綠跌語意色相），圓角/陰影編輯化 */
  #intraday-clusters .grid > div, #setup-mapped .grid > div, #setup-unmapped .grid > div,
  #intraday-top30 .grid > div, #intraday-strong .grid > div {
    border-width: 1px; border-radius: 12px; box-shadow: 0 1px 2px rgba(43,38,33,0.03);
  }

  /* D. 消側邊強調條（AI 招牌 tell）：三色訊號卡 左粗條 → 全框圓角，保留紅/琥珀/綠語意 */
  .border-l-4.rounded-r-2xl {
    border-style: solid; border-width: 1px !important; border-radius: 12px !important;
  }

  /* E. 觸控目標 ≥44px（coarse pointer 或窄視窗；手機閱讀友善） */
  @media (pointer: coarse), (max-width: 767px) {
    .tab-btn, .filter-conf, .filter-theme, #filter-huitai,
    #stock-search, #thesis-search, #industry-search, input[type="text"] { min-height: 44px; }
    .ledger-row { padding-top: 12px; padding-bottom: 12px; }
  }

  /* ════ v3 帳冊語彙（版面重構：榜單 = 排行帳冊列，不是卡片海）════ */
  .ledger { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .ledger-row { display: block; width: 100%; text-align: left; border-top: 1px solid var(--line); padding: 10px 16px; transition: background .12s; }
  .ledger-row:first-child { border-top: 0; }
  .ledger-row[onclick] { cursor: pointer; }
  .ledger-row[onclick]:hover { background: var(--paper2); }
  .ledger-foot { display: block; border-top: 1px solid var(--line); width: 100%; padding: 9px 16px; font-size: 12px; color: var(--muted); background: var(--paper2); text-align: center; cursor: pointer; }
  .ledger-foot:hover { color: var(--navy); }
  .lr-rank { font-family: 'Noto Serif TC', serif; font-style: italic; font-size: 13px; color: var(--muted); display: inline-block; width: 1.7em; }
  .row-label { font-size: 10.5px; color: var(--muted); letter-spacing: .07em; }
  .num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum'; }
  .chg-up { color: var(--up); } .chg-dn { color: var(--down); } .chg-warn { color: #8a5f14; }
  .chip { display: inline-block; font-size: 10px; line-height: 1; padding: 3px 7px; border-radius: 5px; background: var(--paper2); color: var(--ink); }
  .chip-up   { background: rgba(192,57,43,.09);  color: var(--up); }
  .chip-dn   { background: rgba(28,110,80,.10);  color: var(--down); }
  .chip-warn { background: rgba(154,107,31,.14); color: #8a5f14; }
  .chip-hi   { background: var(--accent-soft);   color: var(--accent); }
  .chip-mute { background: var(--paper2);        color: var(--muted); }
  .sec-head { font-family: 'Noto Serif TC', serif; font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--navy); }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
  .seg button { font-size: 11px; padding: 5px 11px; color: var(--muted); background: transparent; transition: background .12s, color .12s; }
  .seg button + button { border-left: 1px solid var(--line); }
  .seg button.on { background: var(--navy); color: #fff; }

  /* 交易訊號展開詳情：內文放大好讀（只作用在點開的區塊；標題卡不變） */
  .thesis-open { font-size: 15px; line-height: 1.7; }
  .thesis-open .text-sm  { font-size: 15.5px; line-height: 1.75; }
  .thesis-open .text-xs  { font-size: 14px; }
  .thesis-open .text-\[11px\] { font-size: 13.5px; }
  .thesis-open .text-\[10px\] { font-size: 12px; }
  .thesis-open table td { padding-top: 4px; padding-bottom: 4px; }
  .conf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .badge-strong .conf-dot { background: var(--down); }
  .badge-medium .conf-dot { background: #b7791f; }
  .badge-weak .conf-dot { background: #a89d90; }

  /* ════ v3 全域暖色 alias：JS 模板殘留的 tailwind 冷色/糖果色整批轉暖 ════ */
  body .text-red-500, body .text-red-600, body .text-red-700,
  body .text-rose-500, body .text-rose-600, body .text-rose-700, body .text-rose-800 { color: var(--up); }
  body .text-emerald-600, body .text-emerald-700, body .text-green-600 { color: var(--down); }
  body .text-amber-600, body .text-amber-700, body .text-amber-800, body .text-amber-900, body .text-orange-700 { color: #8a5f14; }
  body .text-indigo-500, body .text-indigo-600, body .text-indigo-700 { color: var(--accent); }
  body .text-sky-800, body .text-purple-800, body .text-pink-800, body .text-violet-800, body .text-indigo-800, body .text-emerald-800 { color: var(--ink); }
  body .text-slate-700 { color: #3d362e; }
  body .text-slate-800, body .text-slate-900 { color: var(--navy); }
  body .text-slate-300 { color: #b6ab9d; }
  body .bg-red-50, body .bg-rose-50 { background-color: rgba(192,57,43,.07); }
  body .bg-red-100, body .bg-rose-100 { background-color: rgba(192,57,43,.12); }
  body .bg-emerald-50 { background-color: rgba(28,110,80,.08); }
  body .bg-emerald-100 { background-color: rgba(28,110,80,.13); }
  body .bg-amber-50, body .bg-orange-50 { background-color: rgba(176,124,31,.10); }
  body .bg-amber-100 { background-color: rgba(176,124,31,.16); }
  body .bg-yellow-200 { background-color: #eeda9f; }
  body .bg-indigo-50, body .bg-indigo-100, body .bg-violet-100, body .bg-purple-100, body .bg-pink-100, body .bg-sky-100 { background-color: var(--accent-soft); }
  body .bg-indigo-600 { background-color: var(--accent); }
  body .bg-slate-50 { background-color: var(--paper2); }
  body .bg-slate-100, body .bg-slate-200 { background-color: #e9e1d2; }
  body .bg-white { background-color: var(--card); }
  body .bg-white\/60, body .bg-white\/70, body .bg-white\/80, body .bg-white\/90 { background-color: rgba(253,251,245,.78); }
  body .border-red-200, body .border-red-300, body .border-red-400,
  body .border-rose-100, body .border-rose-200,
  body .border-emerald-200, body .border-emerald-400,
  body .border-amber-200, body .border-amber-300, body .border-amber-500,
  body .border-orange-300, body .border-indigo-300,
  body .border-slate-100, body .border-slate-200, body .border-slate-300,
  body .border-slate-200\/40, body .border-slate-200\/60, body .border-slate-200\/50 { border-color: var(--line); }
  body .hover\:bg-slate-50:hover, body .hover\:bg-slate-100:hover { background-color: var(--paper2); }
  body .hover\:bg-indigo-50:hover, body .hover\:bg-indigo-100:hover { background-color: var(--accent-soft); }
  body .hover\:bg-rose-100:hover { background-color: rgba(192,57,43,.12); }
  body .hover\:bg-amber-100:hover { background-color: rgba(176,124,31,.16); }
  body .hover\:bg-white:hover { background-color: var(--card); }
  body .divide-slate-100 > * + *, body .divide-slate-200 > * + * { border-color: var(--line); }

  /* 7. 動畫偏好尊重（暈眩使用者 / 省電） */
@media (prefers-reduced-motion: reduce) {
  #intraday-pulse, #intraday-clusters, #intraday-strong, #intraday-top30,
  #setup-mapped, #setup-unmapped, #intraday-updated::before,
  .fade-up, #us-sidebar { animation: none !important; }
}
