:root,
[data-theme="dark"] {
  --bg: #0f141a;
  --surface: #1a212b;
  --surface-2: #222b37;
  --text: #e6e9ee;
  --text-muted: #9aa5b1;
  --border: #2a333f;
  --divider: #232c38;
  --header-bg: #0a0e13;
  --link: #5aa2ff;
  --active-bg: #2b6cb0;
  --active-text: #ffffff;
  --badge-pos-bg: #14331e; --badge-pos-fg: #69e0a0;
  --badge-neg-bg: #3a1b1b; --badge-neg-fg: #ff8f87;
  --badge-neu-bg: #2a313c; --badge-neu-fg: #aeb6c2;
  /* 台股慣例:多=紅、空=綠(利多/利空、偏多/偏空 等方向徽章用) */
  --badge-bull-bg: #3a1b1b; --badge-bull-fg: #ff8f87;
  --badge-bear-bg: #14331e; --badge-bear-fg: #69e0a0;
  --badge-risk-low-bg: #16304a; --badge-risk-low-fg: #79c0ff;   /* 風險低=淡藍 */
  --badge-risk-high-bg: #3a2a12; --badge-risk-high-fg: #ffa657; /* 風險高=亮橘 */
  --rank-news-bg: #2b6cb0; --rank-stock-bg: #7c5cd6;
  --stripe-bg: #2a3441;
  --source-bg: #0e7490;
}
[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1f2933;
  --text-muted: #7b8794;
  --border: #e4e7eb;
  --divider: #edf0f3;
  --header-bg: #1f2933;
  --link: #2b6cb0;
  --active-bg: #2b6cb0;
  --active-text: #ffffff;
  --badge-pos-bg: #e3f3e8; --badge-pos-fg: #1f7a44;
  --badge-neg-bg: #fbe4e4; --badge-neg-fg: #b42318;
  --badge-neu-bg: #eceef1; --badge-neu-fg: #52606d;
  --badge-bull-bg: #fbe4e4; --badge-bull-fg: #b42318;
  --badge-bear-bg: #e3f3e8; --badge-bear-fg: #1f7a44;
  --badge-risk-low-bg: #e1effe; --badge-risk-low-fg: #1a56db;
  --badge-risk-high-bg: #fdecd8; --badge-risk-high-fg: #c2410c;
  --rank-news-bg: #2b6cb0; --rank-stock-bg: #6d28d9;
  --stripe-bg: #eef1f4;
  --source-bg: #0e7490;
}

* { box-sizing: border-box; }
/* overflow-x: clip 防任何意外的橫向捲動(iOS Safari 對 html 的 overflow-x:hidden 支援不完整,clip 才擋得住),
   確保滿版的 footer 文字恆置中;clip 不產生捲動容器,對 sticky 等無副作用 */
html, body { overflow-x: clip; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }

.container { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 1.5rem; }
.site-header { background: var(--header-bg); color: #fff; }
.header-inner { display: flex; align-items: center; gap: 1rem 1.25rem; flex-wrap: wrap; padding-block: 1rem; }
.site-title { color: #fff; text-decoration: none; font-size: 1.2rem; font-weight: 700; }
.tagline { color: #aeb6c2; font-size: .85rem; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.site-nav { flex-wrap: wrap; } /* 窄螢幕整個連結換行,搭配 nowrap 禁止字內斷行(避免「小百/科」被拆兩行) */
.site-nav a { color: #cbd2d9; text-decoration: none; font-size: .95rem; white-space: nowrap; }
.site-nav a:hover { color: #fff; }
.site-nav a.active { color: #fff; font-weight: 600; }
.theme-toggle { border: 1px solid #3a4654; background: transparent; color: #cbd2d9; font-size: 1rem; line-height: 1; padding: .3rem .5rem; border-radius: 6px; cursor: pointer; }
.theme-toggle:hover { color: #fff; border-color: #6b7785; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 120px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem; }
.sidebar h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 .5rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: .4rem .6rem; border-radius: 6px; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.active { background: var(--active-bg); color: var(--active-text); font-weight: 600; }
.date-jump { margin-top: .75rem; }
.date-jump label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: .25rem; }
.date-jump input { width: 100%; max-width: 220px; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }
.search { margin: 0 0 1rem; }
.search input { width: 100%; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }

.content { padding: 1.5rem 2rem; min-width: 0; }
.content h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
.content a { color: var(--link); text-decoration: none; }
.content a:hover { text-decoration: none; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.ingest-time { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.market-bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .7rem; padding: .5rem .85rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-variant-numeric: tabular-nums; }
.market-bar .mkt-name { font-size: .85rem; color: var(--text-muted); }
.market-bar .mkt-close { font-weight: 700; font-size: 1.05rem; }
.market-bar .mkt-change { font-weight: 600; }
.market-bar .mkt-change.up { color: var(--badge-bull-fg); }   /* 漲=紅(台股慣例) */
.market-bar .mkt-change.down { color: var(--badge-bear-fg); } /* 跌=綠 */
.market-bar .mkt-change.flat { color: var(--text-muted); }
.market-bar .mkt-turnover { font-size: .82rem; color: var(--text-muted); margin-left: auto; }
/* 三大法人買賣超(日頁,接在加權指數下方;一法人一列,grid 三欄對齊;負 margin 讓兩卡貼近成一組) */
.inst-bar { display: grid; grid-template-columns: max-content 1fr max-content; align-items: baseline; gap: .25rem 1rem; padding: .5rem .85rem; margin: -.6rem 0 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-variant-numeric: tabular-nums; font-size: .85rem; }
.inst-bar .inst-title { grid-column: 1 / -1; color: var(--text-muted); font-size: .78rem; }
.inst-row { display: contents; }
.inst-row .inst-name { font-weight: 600; }
.inst-row .inst-bs { color: var(--text-muted); font-size: .82rem; }
.inst-row .inst-net { font-weight: 600; justify-self: end; }
.inst-row .inst-net.up { color: var(--badge-bull-fg); }   /* 買超=紅(台股慣例) */
.inst-row .inst-net.down { color: var(--badge-bear-fg); } /* 賣超=綠 */
.inst-row .inst-net.flat { color: var(--text-muted); }
.day-nav { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: 1.25rem; }
.day-nav-link { display: inline-flex; align-items: baseline; gap: .4rem; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-decoration: none; font-size: .8rem; }
.content a.day-nav-link { color: var(--text); }
.content a.day-nav-link:hover { background: var(--surface-2); }
.day-nav-link.next { flex-direction: row-reverse; }
.day-nav-link .dir { font-size: .72rem; color: var(--text-muted); }
.day-nav-link .d { font-weight: 600; font-variant-numeric: tabular-nums; }
.day-nav-link.disabled { opacity: .45; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.panel > h2 { margin-top: 0; font-size: 1.1rem; border-bottom: 2px solid var(--divider); padding-bottom: .5rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; border-bottom: 2px solid var(--divider); padding-bottom: .5rem; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.toggle-all { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .82rem; padding: .25rem .7rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.toggle-all:hover { background: var(--surface-2); }

.news-item { border-radius: 6px; padding: 0 .75rem; }
.news-item:nth-child(even) { background: var(--stripe-bg); }
.news-item > summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .6rem 0; list-style: none; }
.news-item > summary::-webkit-details-marker { display: none; }
.news-item > summary::before { content: "\203A"; color: var(--text-muted); font-size: 1.1rem; line-height: 1; transition: transform .15s; }
.news-item[open] > summary::before { transform: rotate(90deg); }
.rank { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--rank-news-bg); color: var(--active-text); font-size: .76rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stock-table .rank { background: var(--rank-stock-bg); }
.news-item .news-title { flex: 1; font-weight: 600; }
.news-body { padding: 0 0 .85rem 2rem; }
.news-body p { margin: 0 0 .4rem; color: var(--text-muted); }
.news-body .impact { color: var(--text); }
.news-body .sources { font-size: .82rem; color: var(--text-muted); }
.news-body .sources a { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--source-bg); color: var(--active-text); font-size: .72rem; font-weight: 600; text-decoration: none; vertical-align: middle; margin: 0 .12rem; font-variant-numeric: tabular-nums; }
.news-body .sources a:hover { filter: brightness(1.18); }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.pos { background: var(--badge-pos-bg); color: var(--badge-pos-fg); }
.badge.neg { background: var(--badge-neg-bg); color: var(--badge-neg-fg); }
.badge.neu { background: var(--badge-neu-bg); color: var(--badge-neu-fg); }
.badge.bull { background: var(--badge-bull-bg); color: var(--badge-bull-fg); }
.badge.bear { background: var(--badge-bear-bg); color: var(--badge-bear-fg); }
.badge.risk-low { background: var(--badge-risk-low-bg); color: var(--badge-risk-low-fg); }
.badge.risk-high { background: var(--badge-risk-high-bg); color: var(--badge-risk-high-fg); }
/* 命中率:命中=亮橘、未中=淡藍,皆加同色圓角外框(與風險徽章共用色票,靠外框區分) */
.badge.hit { background: var(--badge-risk-high-bg); color: var(--badge-risk-high-fg); border: 1px solid var(--badge-risk-high-fg); }
.badge.miss { background: var(--badge-risk-low-bg); color: var(--badge-risk-low-fg); border: 1px solid var(--badge-risk-low-fg); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stock-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 600px; }
.stock-table th, .stock-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--divider); vertical-align: top; }
.stock-table th { color: var(--text-muted); font-weight: 600; }
.stock-table tbody tr:nth-child(even) { background: var(--stripe-bg); }
.stock-table .nowrap { white-space: nowrap; }
.stock-table td:first-child { font-variant-numeric: tabular-nums; }
.stock-table .reason { min-width: 16rem; color: var(--text-muted); }

/* Yahoo 股市外連(地球 icon):代號前另開新頁看當日走勢。
   icon 用 CSS mask 產生(SVG 只在此定義一次、走長快取),HTML 端連結留空不含 inline SVG。
   單色由 background-color: currentColor 上色,故隨主題與 hover 自動變色。 */
/* 用 a.yh(特異度勝過 .content a)確保預設是 muted、hover 才轉連結色 */
a.yh {
  --globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18Z'/%3E%3C/svg%3E");
  display: inline-flex; align-items: center; margin-left: .35rem; color: var(--text-muted); vertical-align: -.12em; text-decoration: none;
}
a.yh::before {
  content: ""; width: .95em; height: .95em; background-color: currentColor;
  -webkit-mask: var(--globe) center / contain no-repeat;
  mask: var(--globe) center / contain no-repeat;
}
a.yh:hover, a.yh:focus-visible { color: var(--link); }
/* 前導版:icon 置於代號前面,改用右間距與代號區隔 */
.yh-lead { margin-left: 0; margin-right: .3rem; }

.disclaimer-note { font-size: .78rem; font-weight: 400; color: var(--text-muted); }
/* 「開→收」欄上方的說明:與下方表格拉開一點間距,行內 strong 略為顯眼 */
.oc-note { margin: 0 0 .6rem; line-height: 1.5; }
.oc-note strong { color: var(--text); font-weight: 600; }
.empty { color: var(--text-muted); }

.search-list { display: flex; flex-direction: column; gap: .5rem; }
.search-hit { display: block; border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; }
.content a.search-hit { text-decoration: none; color: var(--text); }
.content a.search-hit:hover { background: var(--surface-2); }
.search-hit .hit-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .15rem; }
.search-hit .hit-date { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.search-hit .hit-title { font-weight: 600; }
.search-hit .hit-sub { font-size: .88rem; color: var(--text-muted); margin: .1rem 0 0; }
.search-hit .hit-impact { font-size: .88rem; color: var(--text); margin: .15rem 0 0; }
.search-hit .hit-more { margin-left: auto; font-size: .8rem; white-space: nowrap; }
.search-hit .hit-sources { font-size: .82rem; color: var(--text-muted); margin: .3rem 0 0; }
.search-hit .hit-sources a { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--source-bg); color: var(--active-text); font-size: .72rem; font-weight: 600; text-decoration: none; margin: 0 .12rem; }
.search-hit .hit-sources a:hover { filter: brightness(1.18); }

.overview { display: flex; flex-direction: column; gap: .6rem; }
.stat { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; gap: .75rem; }
.stat-label { font-size: .85rem; color: var(--text-muted); }
.stat-bar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.stat-bar .seg { flex-basis: 0; flex-shrink: 1; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0 .3rem; font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; }
.stat-bar .seg.pos { background: var(--badge-pos-bg); color: var(--badge-pos-fg); }
.stat-bar .seg.neg { background: var(--badge-neg-bg); color: var(--badge-neg-fg); }
.stat-bar .seg.neu { background: var(--badge-neu-bg); color: var(--badge-neu-fg); }
.stat-bar .seg.bull { background: var(--badge-bull-bg); color: var(--badge-bull-fg); }
.stat-bar .seg.bear { background: var(--badge-bear-bg); color: var(--badge-bear-fg); }

.about-head { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.about-head img { width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--border); }
.about-head .role { color: var(--text-muted); margin: .25rem 0 0; }
.about-links { list-style: none; padding: 0; margin: 0; }
.about-links li { margin-bottom: .4rem; overflow-wrap: anywhere; } /* 長網址可斷行,避免窄螢幕撐出橫向捲動 */

/* 頁尾:關於我 + 站群相關網站(單行 flex,窄螢幕換行)+ 免責聲明,與 tarot/astro/jp 各站頁尾一致 */
.site-footer { padding: 1.1rem 0 1.75rem; font-size: .8rem; color: var(--text-muted); background: var(--surface-2); border-top: 1px solid var(--border); }
.footer-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .75rem; margin-bottom: .6rem; }
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--text); text-decoration: underline; }
.footer-label { margin-left: .5rem; }
.footer-current { color: var(--text); }
.footer-disclaimer { margin: 0; }

@media (max-width: 768px) {
  .container { padding-inline: .75rem; }
  /* minmax(0,...) + sidebar min-width:0:側欄的日期/熱門橫向清單(flex 不換行)min-content 會隨資料量變大
     (5 個日期就近 600px),不擋下來會把整個網格軌道與頁面撐寬 → 真機出現橫向捲軸;
     壓回 0 之後清單才會如預期在自己的 overflow-x:auto 內捲動 */
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; border-right: none; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
  .sidebar h2 { margin-bottom: .4rem; }
  .sidebar ul { display: flex; gap: .4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .2rem; }
  .sidebar li { flex: 0 0 auto; }
  .sidebar a { white-space: nowrap; }
  .content { padding: 1.25rem .75rem; }
}
/* 表格 RWD 輔助:.m-label 只在窄螢幕顯示(補回被藏掉的表頭語意),.d-label 只在寬螢幕顯示(長表頭的可省略字) */
.m-label { display: none; }

/* 窄螢幕表格版面:
   .picks(當沖觀察,帶「觀察理由」欄)與 .hot-rank(熱門排行)改為每檔多行的 flex 版面,
   .slim(/stats 純數字表)保留表格型態,僅解除最小寬與縮小內距,配合 .d-label 縮短表頭 */
@media (max-width: 640px) {
  .stock-table.picks, .stock-table.hot-rank,
  .stock-table.picks tbody, .stock-table.hot-rank tbody { display: block; min-width: 0; }
  .stock-table.picks thead, .stock-table.hot-rank thead { display: none; }
  .stock-table.picks tr, .stock-table.hot-rank tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; row-gap: .3rem; padding: .55rem .4rem; border-bottom: 1px solid var(--divider); }
  .stock-table.picks td, .stock-table.hot-rank td { display: block; padding: 0; border-bottom: none; }
  .stock-table.picks .reason { flex-basis: 100%; min-width: 0; }
  .stock-table.hot-rank .dir-stats { display: flex; flex-basis: 100%; order: 1; }
  .stock-table.hot-rank .hot-last { margin-left: auto; font-size: .82rem; }
  .m-label { display: inline; color: var(--text-muted); }
  .d-label { display: none; }
  .stock-table.slim { min-width: 0; font-size: .88rem; }
  .stock-table.slim th, .stock-table.slim td { padding: .45rem .4rem; }
}
@media (max-width: 560px) {
  .tagline { display: none; }
  .header-inner { gap: .75rem; padding-block: .85rem; }
  .content h1 { font-size: 1.3rem; }
  /* 手機縮減巢狀內距,把寬度還給內文(避免標題折成多行、看起來又小又擠) */
  .panel { padding: 1rem .75rem; }
  .news-item { padding-inline: .5rem; }
  .news-body { padding-left: 1.25rem; }
}

/* 熱門觀察(側欄與 /hot 頁) */
.hot-n { color: var(--text-muted); font-size: .85em; }
.hot-more { margin: .35rem 0 0; font-size: .85rem; }
.dir-stats { display: flex; flex-wrap: wrap; gap: .25rem; }
.trend-block { margin-bottom: 1.25rem; }
.trend-block h3 { margin: 0 0 .5rem; font-size: 1rem; }
.trend-chart { display: block; width: 100%; max-width: 560px; height: auto; }
.trend-chart text { fill: var(--text-muted); font-size: 10px; }
.trend-legend { display: flex; gap: .5rem; margin-top: .5rem; }

/* 新聞分類標籤 */
.news-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .1rem .5rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: .8rem; text-decoration: none; border: 1px solid var(--border);
}
.tag-chip:hover { color: var(--link); border-color: var(--link); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-cloud .tag-chip { font-size: .85rem; }

/* 當沖結果(開→收)與戰績頁 */
.oc-chg { font-weight: 600; white-space: nowrap; }
.oc-chg.chg-up { color: var(--badge-bull-fg); }   /* 漲=紅(台股慣例) */
.oc-chg.chg-down { color: var(--badge-bear-fg); } /* 跌=綠 */
.oc-chg.chg-flat { color: var(--text-muted); }
.oc-cell { display: flex; align-items: center; gap: .35rem; border: 0; }
.stats-rules { margin: 0; padding-left: 1.25rem; color: var(--text-muted); font-size: .9rem; line-height: 1.7; }

/* 小百科(/wiki 索引與內容頁) */
.wiki-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--text-muted); font-size: .85rem; margin: -0.5rem 0 1rem; }
.wiki-summary { color: var(--text-muted); border-left: 3px solid var(--border); padding-left: .85rem; margin: 0 0 1rem; }
.wiki-body { line-height: 1.75; }
.wiki-body h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; padding-bottom: .35rem; border-bottom: 2px solid var(--divider); }
.wiki-body h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.wiki-body p { margin: .6rem 0; }
.wiki-body ul, .wiki-body ol { padding-left: 1.4rem; margin: .6rem 0; }
.wiki-body li { margin: .25rem 0; }
.wiki-body code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; font-size: .88em; }
.wiki-body pre { background: var(--surface-2); padding: .75rem 1rem; border-radius: 8px; overflow-x: auto; }
.wiki-body pre code { background: none; padding: 0; }
.wiki-body blockquote { margin: .75rem 0; padding: .25rem 1rem; border-left: 3px solid var(--border); color: var(--text-muted); }
/* 表格在窄螢幕以自身捲動,不撐破版面(RWD) */
.wiki-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: .75rem 0; }
.wiki-body th, .wiki-body td { border: 1px solid var(--divider); padding: .4rem .6rem; text-align: left; }
.wiki-body img { max-width: 100%; height: auto; }
/* 草稿預覽橫幅(/api/wiki/:slug/preview) */
.preview-banner { background: var(--badge-risk-high-bg); color: var(--badge-risk-high-fg); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
.preview-banner ul { margin: .35rem 0 0; padding-left: 1.2rem; }

/* 自動連結詞條(每日內容 → /wiki/:slug):虛線底線與一般連結區隔,文字顏色沿用所在段落 */
.content a.wiki-link { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--link); text-underline-offset: 3px; }
.content a.wiki-link:hover { color: var(--link); }

/* 小百科活資料 widget({{標記}} 渲染替換;沿用日頁 inst-bar / market-bar 版型) */
.wiki-widget { margin: .75rem 0 1rem; }
.wiki-widget .inst-bar, .wiki-widget .market-bar { margin: 0; }
.widget-note { font-size: .78rem; color: var(--text-muted); margin: .35rem 0 0; }
.dt-stats-widget { padding: .6rem .85rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; font-variant-numeric: tabular-nums; }

/* 小百科插圖({{fig:名稱}} 展開的 inline SVG;圖庫見 src/figures.ts)。
   顏色一律走 CSS 變數,深淺色主題手動切換時圖跟著變;SVG 不設寬高,由容器撐滿(RWD)。 */
.wiki-fig { margin: 1rem 0 1.2rem; padding: .8rem .6rem .2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
/* viewBox 寬 360,顯示上限 400 → 縮放約 1.1,圖上 11px 文字視覺約 12px、與內文相稱;
   窄螢幕縮到容器寬(手機約 0.95 倍)仍在可讀範圍。不設上限會被撐到 2 倍、字比內文還大 */
.wiki-fig svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }
.wiki-fig figcaption { font-size: .82rem; line-height: 1.6; color: var(--text-muted); margin: .5rem .3rem .6rem; }
.wiki-fig .fig-axis { stroke: var(--text-muted); stroke-width: 1; opacity: .35; }
.wiki-fig .fig-gap { fill: var(--text-muted); opacity: .14; }
/* 已回補區:與未補區同色但更實,才不會和紅色 K 棒影線糊在一起 */
.wiki-fig .fig-gap-filled { fill: var(--text-muted); opacity: .38; }
.wiki-fig .fig-gap-edge { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 3; opacity: .8; }
.wiki-fig .fig-range { fill: var(--text-muted); opacity: .1; }
/* K 棒:台股慣例紅為多(--badge-bull-fg) */
.wiki-fig .fig-k { stroke: var(--badge-bull-fg); stroke-width: 2; }
.wiki-fig .fig-k-body { fill: var(--badge-bull-fg); }
.wiki-fig .fig-trend { stroke: var(--link); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.wiki-fig .fig-label { fill: var(--text-muted); font-size: 11px; }
.wiki-fig .fig-label-em { fill: var(--text); font-size: 11px; font-weight: 600; }
.wiki-fig .fig-note { fill: var(--text-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
