/* no-priors —— 版型 I「市場地圖」(照 Matt Turck 的 MAD Landscape)
 * 淺灰畫布、白色框、十種框色、小字的格子:投資人做的那種產業地圖。
 * 顏色只做一件事:分層。每一層一個顏色,單集頁的卡、鄰居、小地圖都用同一個顏色指回地圖上那一框。 */

:root {
  --bg: #E9ECF1;
  --paper: #FFFFFF;
  --ink: #1C232D;
  --mute: #56606E;
  --faint: #7A8492;
  --rule: #D5DAE1;
  --rule2: #E3E7EC;
  --tile: #FAFBFC;
  --link: #1D5C8C;
  --c-chip: #2D6A4F; --c-cloud: #1D5C8C; --c-lab: #6A3FB5; --c-data: #8A5A12; --c-tool: #1F7A7A;
  --c-ent: #B5452A; --c-con: #C2367A; --c-phys: #4E5D23; --c-bio: #0E7C66; --c-pol: #59626E; --c-host: #3B3B3B;
  --sans: "IBM Plex Sans", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161C; --paper: #1A2029; --ink: #E6EAF0; --mute: #A3ADBA; --faint: #8893A1; --rule: #343D49;
    --rule2: #2A323D; --tile: #202833; --link: #8CBDEB;
    --c-chip: #5FB08A; --c-cloud: #5E9BD0; --c-lab: #A68AE0; --c-data: #C9963F; --c-tool: #4FB3B3;
    --c-ent: #E07A5E; --c-con: #E26FA6; --c-phys: #98AA5C; --c-bio: #3FB89C; --c-pol: #98A2AF; --c-host: #A7A7A7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161C; --paper: #1A2029; --ink: #E6EAF0; --mute: #A3ADBA; --faint: #8893A1; --rule: #343D49;
  --rule2: #2A323D; --tile: #202833; --link: #8CBDEB;
  --c-chip: #5FB08A; --c-cloud: #5E9BD0; --c-lab: #A68AE0; --c-data: #C9963F; --c-tool: #4FB3B3;
  --c-ent: #E07A5E; --c-con: #E26FA6; --c-phys: #98AA5C; --c-bio: #3FB89C; --c-pol: #98A2AF; --c-host: #A7A7A7;
  color-scheme: dark;
}
.b-chip { --c: var(--c-chip); } .b-cloud { --c: var(--c-cloud); } .b-lab { --c: var(--c-lab); }
.b-data { --c: var(--c-data); } .b-tool { --c: var(--c-tool); } .b-ent { --c: var(--c-ent); }
.b-con { --c: var(--c-con); } .b-phys { --c: var(--c-phys); } .b-bio { --c: var(--c-bio); }
.b-pol { --c: var(--c-pol); } .b-host { --c: var(--c-host); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.7 var(--sans); overflow-wrap: anywhere;
}
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1240px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lede { color: var(--mute); margin-top: 12px; max-width: 860px; }
.lede b { color: var(--ink); }

/* ── 站頭站尾 ── */
.top { background: #1C232D; color: #FFFFFF; border-bottom: 1px solid var(--rule); }
.topin { max-width: 1240px; margin: 0 auto; padding: 9px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.top a { text-decoration: none; }
.top a:hover { text-decoration: underline; }
.top .up { opacity: .8; }
.top .brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.top .spacer { flex: 1; }
.tbtn { background: none; border: 1px solid currentColor; padding: 1px 10px; cursor: pointer; font-size: 13px; opacity: .85; }
.tbtn:hover { opacity: 1; }
.foot { border-top: 1px solid var(--rule); margin-top: 56px; padding: 22px 0 36px; font-size: 13px; color: var(--mute); }
.foot .wrap { max-width: 1240px; }
.foot p + p { margin-top: 8px; }

/* ── 地圖的抬頭(首頁與單集頁共用)── */
.md { background: var(--paper); border-bottom: 4px solid var(--ink); }
.mdin { max-width: 1240px; margin: 0 auto; padding: 18px 16px 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.kick { font-weight: 700; font-size: 14px; letter-spacing: .08em; }
.md h1 { font-size: clamp(22px, 3.6vw, 30px); line-height: 1.35; margin-top: 4px; }
.md .sub { font-size: 14px; color: var(--mute); margin-top: 4px; }
.vc { font-family: var(--mono); font-size: 12px; border: 1px solid var(--ink); padding: 2px 8px; white-space: nowrap; }
.crumb { font-size: 14px; color: var(--mute); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ── 首頁:年份 ── */
.yf { display: flex; align-items: center; gap: 6px; padding: 14px 0 10px; font-size: 14px; color: var(--mute); flex-wrap: wrap; }
.yf button { border: 1px solid var(--rule); background: var(--paper); padding: 3px 12px; cursor: pointer; }
.yf button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.yf .cnt { margin-left: auto; font-family: var(--mono); font-size: 12.5px; }

/* ── 首頁:地圖 ── */
.map { max-width: 1240px; margin: 0 auto; padding: 4px 16px 6px; display: grid; gap: 10px;
  grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: "app side" "mid side" "inf side"; }
.map .r-app { grid-area: app; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.map .r-mid { grid-area: mid; display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 10px; }
.map .r-inf { grid-area: inf; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.map .r-side { grid-area: side; display: grid; }
.bx { background: var(--paper); border: 2px solid var(--c); display: flex; flex-direction: column; scroll-margin-top: 12px; }
.bx h3 { background: var(--c); color: #FFF; font-size: 14px; font-weight: 600; padding: 4px 8px; display: flex; justify-content: space-between; gap: 8px; letter-spacing: .02em; }
:root[data-theme="dark"] .bx h3 { color: #10141A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bx h3 { color: #10141A; } }
.bx h3 small { font-family: var(--mono); font-weight: 400; opacity: .85; }
.bx:target { box-shadow: 0 0 0 4px var(--c); }
.ts { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; align-content: flex-start; }
.t { border: 1px solid var(--rule); padding: 2px 6px; line-height: 1.3; background: var(--tile); text-decoration: none; display: block; transition: opacity .15s; }
a.t:hover, .t.multi:hover { border-color: var(--c); }
.t b { display: block; font-size: 13px; font-weight: 600; }
.t small { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.t.multi small { white-space: nowrap; }
.t.multi small a { text-decoration: none; }
.t.multi small a:hover { text-decoration: underline; color: var(--ink); }
.t.multi .nm { text-decoration: none; }
.t .hit { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 2px; }
.t.dim { opacity: .28; }
.mapnote { font-size: 13px; color: var(--mute); padding-top: 4px; }
.hostw { margin-top: 18px; }
.b-host { border-style: dashed; }
.hdesc { font-size: 13.5px; color: var(--mute); padding: 6px 8px 0; }
.t.ht b { font-weight: 500; }

/* ── 首頁:每一層放什麼、跨集主題 ── */
.legend, .themes { margin-top: 40px; }
.legend h2, .themes h2 { font-size: 17px; letter-spacing: .04em; padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.legend dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 24px; margin-top: 14px; }
.legend div { border-left: 5px solid var(--c); padding-left: 10px; }
.legend dt a { font-weight: 600; text-decoration: none; }
.legend dt a:hover { text-decoration: underline; }
.legend dt small { margin-left: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.legend dd { font-size: 14px; color: var(--mute); line-height: 1.65; }
.themes dl { margin-top: 12px; display: grid; gap: 14px; }
.themes dt { font-weight: 600; }
.themes dd { font-size: 14.5px; color: var(--mute); }
.themes .tl { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.themes .tl a { font-family: var(--mono); font-size: 12px; border: 1px solid var(--rule); background: var(--paper); padding: 0 6px; text-decoration: none; color: var(--ink); }
.themes .tl a:hover { border-color: var(--ink); }

/* ── 單集頁:卡 ── */
.card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; margin-top: 22px; background: var(--paper); border: 1px solid var(--rule); padding: 18px; }
.lg { display: grid; place-items: center; text-align: center; border: 2px solid var(--c); color: var(--c); font-weight: 700; font-size: 19px; line-height: 1.25; aspect-ratio: 1; padding: 8px; }
.card .co { font-size: 28px; line-height: 1.3; }
.card .ly { display: inline-block; background: var(--c); color: #FFF; font-size: 13px; padding: 2px 8px; margin: 6px 0 12px; }
:root[data-theme="dark"] .card .ly { color: #10141A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card .ly { color: #10141A; } }
.card dl { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 4px 12px; font-size: 14.5px; }
.card dt { color: var(--mute); }
.card dd a { color: var(--link); }
.visits { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.visits.many { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.v { background: var(--paper); border: 1px solid var(--rule); padding: 12px; display: block; text-decoration: none; }
a.v:hover { border-color: var(--ink); }
.v.now { border: 2px solid var(--ink); }
.vth { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--rule2); margin-bottom: 8px; }
.vth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visits:not(.many) .vth { max-width: 520px; }
.v .k { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.v b { display: block; font-size: 16px; line-height: 1.45; margin-top: 2px; }

/* ── 單集頁:這一集 ── */
.ep { margin-top: 26px; }
.eh { font-size: 23px; line-height: 1.4; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--mute); margin-top: 6px; }
.meta span:first-child { font-family: var(--mono); }
.note { margin-top: 10px; font-size: 13.5px; color: var(--mute); border-left: 3px solid var(--rule); padding-left: 10px; }
.orig { margin-top: 8px; font-size: 14px; color: var(--mute); }
.eplede { margin-top: 14px; font-size: 17px; }
.sh { font-size: 15px; letter-spacing: .06em; margin: 30px 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); display: flex; align-items: baseline; gap: 10px; }
.sh .c { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--faint); letter-spacing: 0; }
.pts { list-style: none; background: var(--paper); border: 1px solid var(--rule); }
.pts li { padding: 10px 14px; border-bottom: 1px solid var(--rule2); line-height: 1.75; font-size: 15.5px; }
.pts li:last-child { border-bottom: 0; }
.pts b { display: block; }
.tl { list-style: none; }
.tl li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.tl .tc { font-family: var(--mono); font-size: 13.5px; color: var(--link); grid-row: span 2; padding-top: 2px; }
.tl .sg { font-weight: 600; font-size: 15px; }
.tl .nt { font-size: 14.5px; color: var(--mute); }
.qs { list-style: none; display: grid; gap: 12px; }
.qs blockquote { background: var(--paper); border-left: 4px solid var(--ink); padding: 10px 14px; }
.qs q { display: block; font-size: 15.5px; quotes: "“" "”"; }
.qs .zh { display: block; color: var(--mute); font-size: 14.5px; margin-top: 4px; }
.qs .atq { font-family: var(--mono); font-size: 12.5px; color: var(--link); }
.tm div { display: grid; grid-template-columns: minmax(110px, 30%) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.tm dt { font-weight: 600; }
.ex { padding-left: 20px; font-size: 14.5px; }
.ex li + li { margin-top: 4px; }
.ytl { margin-top: 20px; }
.ytl a { color: var(--link); font-weight: 600; }

/* ── 單集頁:鄰居、小地圖、上下集 ── */
.nb { display: flex; flex-wrap: wrap; gap: 6px; }
.nb .t { background: var(--paper); }
.nb .t.me { border: 2px solid var(--c); }
.nb .t small a { color: var(--link); text-decoration: none; }
.nb .t small a:hover { text-decoration: underline; }
.nb .t small [aria-current] { color: var(--ink); font-weight: 600; }
.mini { margin-top: 30px; }
.mini p { font-size: 13px; color: var(--mute); margin-bottom: 6px; }
.mini ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
.mini li a { display: block; text-decoration: none; font-size: 13px; padding: 2px 8px; border: 1px solid var(--c); color: var(--ink); background: var(--paper); }
.mini li.off a { border-style: dashed; }
.mini li.on a { background: var(--c); color: #FFF; font-weight: 600; }
:root[data-theme="dark"] .mini li.on a { color: #10141A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mini li.on a { color: #10141A; } }
.mini li span { font-family: var(--mono); font-size: 11px; margin-left: 5px; opacity: .75; }
.epnav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.epnav a { background: var(--paper); border: 1px solid var(--rule); padding: 10px 12px; text-decoration: none; font-size: 14.5px; }
.epnav a:hover { border-color: var(--ink); }
.epnav .r { text-align: right; }
.epnav .k { display: block; font-size: 12px; color: var(--mute); }

/* ── 名詞速查 ── */
.gh { padding-top: 28px; }
.gh h1 { font-size: 28px; }
.gbox { display: flex; gap: 12px; align-items: center; margin: 18px 0 10px; }
.gbox input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--rule); background: var(--paper); }
.gcount { font-family: var(--mono); font-size: 12.5px; color: var(--mute); white-space: nowrap; }
.gl .term { display: grid; grid-template-columns: minmax(120px, 28%) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.gl dt { font-weight: 600; }
.gl dd { font-size: 14.5px; }
.gl dd p + p { margin-top: 4px; }
.gl .src { font-family: var(--mono); font-size: 12px; color: var(--link); text-decoration: none; }

/* ── 窄螢幕 ── */
@media (max-width: 1000px) {
  .map { grid-template-columns: minmax(0, 1fr); grid-template-areas: "app" "mid" "inf" "side"; }
  .map .r-app { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map .r-mid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .map .r-app, .map .r-inf { grid-template-columns: minmax(0, 1fr); }
  .card { grid-template-columns: minmax(0, 1fr); }
  .lg { aspect-ratio: auto; padding: 14px; }
  .tl li { grid-template-columns: minmax(0, 1fr); }
  .tl .tc { grid-row: auto; }
  .tm div, .gl .term { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .epnav { grid-template-columns: minmax(0, 1fr); }
  .epnav .r { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .t { transition: none; } }
