@font-face {
  font-family: "JFOpenHuninn";
  src: url("assets/fonts/jf-openhuninn.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   沃田 Verdi · 作品說明頁

   色彩沿用產品本身 web/style.css 的色票（clay / leaf / sky / ink 四家族），
   而不是另外調一組 —— 這頁在講的就是那個 App，用它自己的顏色才對得上。

   兩件事是跑過驗證才定案的（dataviz skill 的 validate_palette.js）：
   1. 四階級作物是「序數」而非「分類」資料（初→中→高→頂 有順序），
      所以用單一綠色的明度階梯，不是四個不同色相。
      淺色底的階梯最亮端原本用 leaf-300 #A8CB8C，對比僅 1.77:1 沒過，
      壓到 leaf-400 #8FBB6E 才達 2.15:1。
   2. 連結色原本想用 sky-600 #3A7BC0，實測對 clay-100 底只有 3.85:1，
      未達正文 4.5:1，改用 sky-700 #2E5F94（5.78:1）。
      警示色同理由 #C24A3E（4.24:1）改為 #A93E33（5.37:1）。
   ========================================================= */

:root {
  /* ---- 產品色票 ---- */
  --clay-50:#FDF8F3; --clay-100:#FBEEDF; --clay-200:#F5D9B8; --clay-300:#E8C08A;
  --clay-400:#D9A566; --clay-500:#C9915F; --clay-600:#B5773A; --clay-700:#8B6F47;
  --clay-800:#6B5842; --clay-900:#4A3B2A;

  --leaf-100:#E8F3DC; --leaf-200:#C9DCC0; --leaf-300:#A8CB8C; --leaf-400:#8FBB6E;
  --leaf-500:#6FA84A; --leaf-600:#5C8A3A; --leaf-700:#4E7830; --leaf-800:#3D5C28;
  --leaf-900:#2A4019;

  --sky-100:#DCEEE8; --sky-200:#B8DCD0; --sky-300:#8FC4D9; --sky-400:#6BA8D0;
  --sky-500:#4A90D9; --sky-600:#3A7BC0; --sky-700:#2E5F94; --sky-800:#244868;
  --sky-900:#1A3348;

  --ink-100:#F0E9DE; --ink-200:#DED1BC; --ink-300:#C0AF91; --ink-600:#6B5842;
  --ink-700:#52432F; --ink-800:#3D3120; --ink-900:#241A10;

  /* ---- 語意層（元件只用這一層，切主題時只要換這裡） ---- */
  --ground: var(--clay-100);
  --surface: #FFF8ED;
  --surface-2: #FDF8F3;
  --line: var(--ink-200);
  --line-soft: #EADDCA;

  --ink: var(--ink-800);
  --ink-2: var(--ink-600);
  --ink-3: #7A6448;

  --brand: var(--leaf-700);
  --brand-strong: var(--leaf-800);
  --brand-soft: var(--leaf-100);
  --on-brand: #FFF8ED;          /* 實心綠底上的字色 */
  --water: var(--sky-700);
  --water-mark: var(--sky-600);
  --water-soft: var(--sky-100);
  --alarm: #A93E33;
  --alarm-soft: #FBE8E6;

  /* 序數階梯：四個作物階級（已驗證 · 淺色） */
  --tier-1: #8FBB6E;
  --tier-2: #6FA84A;
  --tier-3: #4E7830;
  --tier-4: #2A4019;

  --nav-h: 60px;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --prose: 68ch;

  --shadow-sm: 0 1px 2px rgba(58,45,28,.05), 0 2px 8px rgba(58,45,28,.045);
  --shadow-md: 0 4px 14px rgba(58,45,28,.07), 0 16px 40px rgba(58,45,28,.08);
  --shadow-lg: 0 10px 30px rgba(58,45,28,.10), 0 30px 70px rgba(58,45,28,.12);

  --font-display: "JFOpenHuninn", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-body: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  color-scheme: light;
}

/* 深色：只覆寫語意層與階梯，不動元件樣式。
   guard 成 :not([data-theme="light"])，讓明確選淺色的人贏過作業系統設定。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: var(--ink-900);
    --surface: #2E2317;
    --surface-2: #332818;
    --line: #4A3B24;
    --line-soft: #3E301D;

    --ink: var(--ink-100);
    --ink-2: var(--clay-300);
    --ink-3: #BFA98A;

    --brand: var(--leaf-300);
    --brand-strong: var(--leaf-200);
    --brand-soft: #33421F;
    --on-brand: var(--ink-900);   /* 亮綠底上要用深字 */
    --water: var(--sky-300);
    --water-mark: var(--sky-400);
    --water-soft: #22384A;
    --alarm: #E88C82;
    --alarm-soft: #46231E;

    --tier-1: #4E7830;
    --tier-2: #6FA84A;
    --tier-3: #A8CB8C;
    --tier-4: #E8F3DC;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.25);
    --shadow-md: 0 4px 14px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.4), 0 30px 70px rgba(0,0,0,.35);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ground: var(--ink-900);
  --surface: #2E2317;
  --surface-2: #332818;
  --line: #4A3B24;
  --line-soft: #3E301D;

  --ink: var(--ink-100);
  --ink-2: var(--clay-300);
  --ink-3: #BFA98A;

  --brand: var(--leaf-300);
  --brand-strong: var(--leaf-200);
  --brand-soft: #33421F;
  --on-brand: var(--ink-900);   /* 亮綠底上要用深字 */
  --water: var(--sky-300);
  --water-mark: var(--sky-400);
  --water-soft: #22384A;
  --alarm: #E88C82;
  --alarm-soft: #46231E;

  --tier-1: #4E7830;
  --tier-2: #6FA84A;
  --tier-3: #A8CB8C;
  --tier-4: #E8F3DC;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 4px 14px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.4), 0 30px 70px rgba(0,0,0,.35);

  color-scheme: dark;
}

/* ---------- 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.78;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.3;
  text-wrap: balance;
  font-weight: 700;
}

a { color: var(--water); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand); }

img, svg { max-width: 100%; height: auto; display: block; }
strong { font-weight: 700; color: var(--ink); }
em { font-style: normal; font-weight: 700; color: var(--brand); }

::selection { background: var(--leaf-300); color: var(--leaf-900); }

:focus-visible {
  outline: 2.5px solid var(--water-mark);
  outline-offset: 3px;
  border-radius: 4px;
}

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--surface); color: var(--ink);
  padding: 12px 20px; border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700; box-shadow: var(--shadow-md);
}
.skip:focus { left: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 5vw, 40px); }

/* ---------- 背景 canvas ---------- */
#soilCanvas {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ---------- 導覽 ---------- */
#nav {
  position: sticky; top: 0; z-index: 90;
  transition: background .28s ease, box-shadow .28s ease, border-color .28s ease;
  border-bottom: 1px solid transparent;
}
#nav.is-stuck {
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom-color: var(--line-soft);
  box-shadow: 0 6px 26px -22px rgba(58,45,28,.6);
}

.nav-in {
  max-width: var(--maxw); margin: 0 auto;
  padding: 10px clamp(20px, 5vw, 40px);
  display: flex; align-items: center; gap: 18px;
  min-height: var(--nav-h);
}

.nav-brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.06rem;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.nav-brand small {
  font-family: var(--font-mono); font-size: .62rem; font-weight: 500;
  color: var(--ink-3); letter-spacing: .14em; text-transform: uppercase;
  display: block; margin-top: -3px;
}
.nav-brand img { border-radius: 6px; }

.nav-links { margin-left: auto; display: flex; gap: 1px; }
.nav-links a {
  position: relative; padding: .42rem .68rem; border-radius: 7px;
  font-size: .855rem; font-weight: 600; color: var(--ink-2);
  text-decoration: none; white-space: nowrap; transition: color .16s, background .16s;
}
.nav-links a:hover { color: var(--brand); background: var(--brand-soft); }
.nav-links a.is-active { color: var(--brand); }
.nav-links a.is-active::after {
  content: ''; position: absolute; left: .68rem; right: .68rem; bottom: .1rem;
  height: 2px; border-radius: 2px; background: var(--brand);
}
@media (max-width: 940px) { .nav-links { display: none; } }

.nav-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
@media (min-width: 941px) { .nav-tools { margin-left: 0; } }

.nav-tool, .nav-menu-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); cursor: pointer; font-family: inherit;
  transition: border-color .16s, color .16s, background .16s;
}
.nav-tool:hover, .nav-menu-btn:hover { border-color: var(--brand); color: var(--brand); }
.nav-menu-btn { display: none; }
@media (max-width: 940px) { .nav-menu-btn { display: inline-flex; } }

/* 主題按鈕：只顯示「將要切換到」的那個圖示 */
.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
  :root[data-theme="light"] .ico-sun { display: block; }
  :root[data-theme="light"] .ico-moon { display: none; }
}

.nav-progress { height: 2px; background: transparent; }
.nav-progress > span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--brand), var(--water-mark));
  /* 用 transform 而非 width：改 width 會每幀觸發版面重算，捲動時明顯掉幀 */
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .1s linear;
}

/* [hidden] 的預設 display:none 會被下面的 display:flex 蓋掉，
   所以要明確寫一條把它擋回來，否則桌機寬度也會看到行動選單。 */
.nav-mobile[hidden] { display: none; }

.nav-mobile {
  display: flex; flex-direction: column;
  padding: 8px clamp(20px, 5vw, 40px) 16px;
  background: var(--surface); border-top: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}
/* 桌機寬度就算 JS 沒關也不顯示 */
@media (min-width: 941px) { .nav-mobile { display: none; } }
.nav-mobile a {
  padding: .7rem .2rem; font-weight: 600; font-size: .95rem;
  color: var(--ink-2); text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.nav-mobile a:last-child { border-bottom: none; }

/* ---------- 段落骨架 ---------- */
.sec { padding: clamp(58px, 8vw, 96px) 0; border-bottom: 1px solid var(--line-soft); }
.sec:last-of-type { border-bottom: none; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft);
  padding: .32rem .78rem; border-radius: 99px; margin-bottom: 16px;
}

.sec-title {
  font-size: clamp(1.55rem, 3.4vw, 2.35rem);
  letter-spacing: -.02em; margin-bottom: 14px; max-width: 22ch;
}
.sec-sub {
  color: var(--ink-2); max-width: var(--prose);
  font-size: 1.02rem; margin-bottom: 38px;
}

.prose { max-width: var(--prose); display: flex; flex-direction: column; gap: 1.1em; }
.prose p { color: var(--ink-2); }
.prose strong { color: var(--ink); }

.pull {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  line-height: 1.5; color: var(--brand-strong);
  border-left: 3px solid var(--brand);
  padding: .1em 0 .1em 1em; margin: .3em 0;
}

/* ---------- 封面 ---------- */
.sec-cover { padding-top: clamp(34px, 5vw, 58px); }
.cover-grid {
  display: grid; grid-template-columns: 1.08fr .92fr;
  gap: clamp(28px, 5vw, 60px); align-items: center;
}
@media (max-width: 900px) {
  .cover-grid { grid-template-columns: 1fr; }
  .cover-shot { order: -1; }
}

.cover-copy { display: flex; flex-direction: column; align-items: flex-start; }

.cover-title {
  font-size: clamp(3.2rem, 9vw, 5.4rem);
  line-height: 1.02; letter-spacing: .02em;
  display: flex; align-items: baseline; gap: .5em; flex-wrap: wrap;
  margin-bottom: .3em;
}
.cover-latin {
  font-family: var(--font-mono); font-size: .26em; font-weight: 500;
  letter-spacing: .3em; text-transform: uppercase; color: var(--brand);
}

.cover-lead {
  font-family: var(--font-display);
  font-size: clamp(1.14rem, 2.3vw, 1.42rem);
  color: var(--ink); margin-bottom: .7em;
}
.cover-sub {
  color: var(--ink-2); max-width: 44ch; font-size: 1rem; margin-bottom: 1.5em;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; margin-bottom: 1.7em; }
.chip {
  font-size: .78rem; font-weight: 600; padding: .3rem .7rem;
  border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
}
.chip-accent {
  border-color: var(--brand); color: var(--brand); background: var(--brand-soft);
}

.cover-cta { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 2em; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px;
  font-family: inherit; font-weight: 700; font-size: .94rem;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: .18s;
}
/* 實心按鈕的字色要跟著底色走：淺色主題底是深綠配淺字，
   深色主題的 --brand 變成亮綠，這時字要反過來用深色。
   統一由 --on-brand 這個 token 決定，不在元件裡寫死。 */
.btn-primary {
  background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--brand-strong); transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.cover-meta { display: flex; gap: 30px; flex-wrap: wrap; }
.cover-meta dt {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 2px;
}
.cover-meta dd { font-size: .9rem; font-weight: 600; color: var(--ink); }

.cover-shot { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.shot-frame {
  border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}
.shot-frame img { width: 100%; }
.cover-shot figcaption {
  font-size: .78rem; color: var(--ink-3); font-family: var(--font-mono);
}

/* ---------- 卡片 ---------- */
.cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 36px; }
@media (max-width: 760px) { .cards-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-muted { background: var(--surface-2); }
.card-h {
  font-size: 1.04rem; margin-bottom: 12px;
  display: flex; align-items: center; gap: .5rem;
}
.card-muted .card-h { color: var(--ink-2); }

.list { list-style: none; display: flex; flex-direction: column; gap: .6em; }
.list li {
  position: relative; padding-left: 1.3em;
  font-size: .935rem; color: var(--ink-2); line-height: 1.65;
}
.list li::before {
  content: ''; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 2px;
  background: var(--brand);
}
.card-muted .list li::before { background: var(--ink-3); border-radius: 50%; }

/* ---------- 命名解字 ---------- */
.naming {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 38px);
  align-items: center; margin-top: 40px; padding: clamp(22px, 4vw, 34px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
@media (max-width: 700px) { .naming { grid-template-columns: 1fr; } }

.naming-glyph { display: flex; gap: .12em; font-family: var(--font-display); }
.naming-char {
  font-size: clamp(3.2rem, 8vw, 4.6rem); line-height: 1;
  color: var(--ink-3);
}
.naming-char-hot { color: var(--brand); }

.naming-body { display: flex; flex-direction: column; gap: .7em; max-width: 54ch; }
.naming-pron {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.naming-def, .naming-why { font-size: .945rem; color: var(--ink-2); }
.naming-why { padding-top: .2em; border-top: 1px solid var(--line-soft); }

/* ---------- 次級標題 ---------- */
.sub-h {
  font-size: clamp(1.14rem, 2.2vw, 1.4rem);
  margin: clamp(48px, 7vw, 72px) 0 10px;
  padding-top: clamp(24px, 4vw, 36px);
  border-top: 1px solid var(--line-soft);
  max-width: 26ch;
}
.sub-p { color: var(--ink-2); max-width: var(--prose); margin-bottom: 26px; font-size: .97rem; }
.fig-note {
  color: var(--ink-3); font-size: .86rem; max-width: var(--prose);
  margin-top: 14px; line-height: 1.7;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 互動 Demo ---------- */
.demo {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-md);
}
.demo-head {
  padding: clamp(20px, 3.4vw, 28px);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.demo-title { font-size: 1.16rem; margin-bottom: 6px; }
.demo-note { font-size: .9rem; color: var(--ink-2); max-width: 60ch; }
.demo-body { padding: clamp(20px, 3.4vw, 28px); }

.demo-controls {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(18px, 3vw, 32px); margin-bottom: 30px;
}
@media (max-width: 700px) { .demo-controls { grid-template-columns: 1fr; } }

.ctrl-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: .89rem; font-weight: 700; color: var(--ink); margin-bottom: 10px;
}
.ctrl-out {
  font-size: 1.5rem; font-weight: 700; color: var(--brand); line-height: 1;
}
.ctrl-help { font-size: .8rem; color: var(--ink-3); margin-top: 8px; }

/* 滑桿：兩個瀏覽器引擎要分開寫，不能合併成一條選擇器
   （其中一個不認識另一個的偽元素時，整條規則會被丟掉） */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--water-mark) var(--fill, 50%), var(--line) var(--fill, 50%));
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 99px; background: var(--line);
}
input[type="range"]::-moz-range-progress {
  height: 6px; border-radius: 99px; background: var(--water-mark);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--water-mark);
  box-shadow: var(--shadow-sm); transition: transform .12s;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--water-mark);
  box-shadow: var(--shadow-sm);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

.demo-compare {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
@media (max-width: 620px) { .demo-compare { grid-template-columns: 1fr; } }

.plot-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); overflow: hidden;
}
.plot-good { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.plot-bad { border-color: color-mix(in srgb, var(--alarm) 35%, var(--line)); }

.plot-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.plot-head h4 { font-size: .98rem; }
.plot-quota { font-size: .82rem; color: var(--ink-2); }
.plot-quota strong { font-size: 1.1rem; }
.plot-good .plot-quota strong { color: var(--brand); }
.plot-bad .plot-quota strong { color: var(--alarm); }

.plot-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 16px;
}
.cell {
  aspect-ratio: 1; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; line-height: 1;
  background: var(--clay-200); border: 1px dashed var(--clay-400);
  transition: background .3s ease, border-color .3s ease, transform .3s ease;
}
:root[data-theme="dark"] .cell { background: #3E301D; border-color: #5C4728; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cell { background: #3E301D; border-color: #5C4728; }
  :root[data-theme="light"] .cell { background: var(--clay-200); border-color: var(--clay-400); }
}
.cell.is-watered {
  background: var(--brand-soft); border-style: solid;
  border-color: color-mix(in srgb, var(--brand) 50%, transparent);
  transform: scale(1.04);
}
.cell.is-dry { opacity: .55; }
.cell img { width: 62%; height: 62%; }

.plot-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.plot-stat { display: flex; align-items: baseline; justify-content: space-between; }
.plot-stat-l { font-size: .8rem; color: var(--ink-3); }
.plot-stat-v { font-size: 1.24rem; font-weight: 700; color: var(--ink); }

.demo-verdict {
  margin-top: 20px; padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--water-soft); border: 1px solid color-mix(in srgb, var(--water-mark) 30%, transparent);
  font-size: .93rem; color: var(--ink); line-height: 1.7;
}
.demo-verdict strong { color: var(--water); }

/* ---------- 四階級表 ---------- */
.tier-table {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.tier-row {
  display: grid;
  grid-template-columns: 5.5rem 4rem 3rem 4.5rem 1fr;
  gap: 12px; align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .9rem;
  transition: background .15s;
}
.tier-row:last-child { border-bottom: none; }
.tier-row:not(.tier-head):hover { background: var(--surface-2); }
.tier-head {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  color: var(--ink-3); background: var(--surface-2);
  text-transform: uppercase;
}
.tier-name { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.tier-dot {
  width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0;
  background: var(--tier-1);
}
.tier-row[data-tier="2"] .tier-dot { background: var(--tier-2); }
.tier-row[data-tier="3"] .tier-dot { background: var(--tier-3); }
.tier-row[data-tier="4"] .tier-dot { background: var(--tier-4); }

.tier-bar-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tier-bar {
  position: relative; flex: 1; height: 9px; min-width: 60px;
  border-radius: 99px; background: var(--line-soft);
}
.tier-bar::after {
  content: ''; position: absolute; top: 0; bottom: 0;
  left: var(--lo); right: calc(100% - var(--hi));
  /* 4px 圓角的資料端，並與軌道留 2px 表面色間隙 */
  border-radius: 4px;
  background: var(--tier-1);
}
.tier-row[data-tier="2"] .tier-bar::after { background: var(--tier-2); }
.tier-row[data-tier="3"] .tier-bar::after { background: var(--tier-3); }
.tier-row[data-tier="4"] .tier-bar::after { background: var(--tier-4); }
.tier-range { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }

@media (max-width: 720px) {
  .tier-row { grid-template-columns: 4.6rem 3.4rem 1fr; row-gap: 6px; }
  .tier-head { display: none; }
  .tier-row .tier-bar-cell { grid-column: 1 / -1; }
}

/* ---------- 截圖列 ---------- */
.screens {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 18px; align-items: start;
}
@media (max-width: 900px) { .screens { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .screens { grid-template-columns: 1fr; } }

.screen { display: flex; flex-direction: column; gap: 10px; }
.screen .shot-frame { max-width: none; border-radius: 14px; box-shadow: var(--shadow-md); }
.screen figcaption { font-size: .82rem; color: var(--ink-2); line-height: 1.6; }
.screen figcaption strong { display: block; color: var(--ink); margin-bottom: 1px; }

/* ---------- 圖表 / 圖說 ---------- */
.diagram {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(18px, 3.4vw, 30px);
  box-shadow: var(--shadow-sm); color: var(--ink-2);
  overflow-x: auto;
}
.diagram svg { min-width: 560px; margin: 0 auto; }
/* 架構圖的兩個重點框：橋接層用水色、純邏輯層用品牌綠，
   同樣走 token 以便跟著主題切換。 */
.diagram .d-water { stroke: var(--water-mark); }
.diagram .d-water-f { fill: var(--water-mark); }
.diagram .d-brand { stroke: var(--brand); }
.diagram .d-brand-f { fill: var(--brand); }
.diagram figcaption {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  font-size: .88rem; color: var(--ink-2); max-width: var(--prose); line-height: 1.75;
}

/* ---------- ADR 清單 ---------- */
.adr-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.adr {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start;
  padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  border-left: 3px solid var(--brand);
}
@media (max-width: 620px) { .adr { grid-template-columns: 1fr; gap: 8px; } }
.adr-no {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  color: var(--brand); background: var(--brand-soft);
  padding: .3rem .6rem; border-radius: 6px; white-space: nowrap;
}
.adr-body h4 { font-size: 1rem; margin-bottom: 6px; }
.adr-body p { font-size: .92rem; color: var(--ink-2); max-width: 62ch; }

code {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: .08em .38em; border-radius: 5px; color: var(--ink);
}

/* ---------- 套件 ---------- */
.pkgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 700px) { .pkgs { grid-template-columns: 1fr; } }

.pkg {
  padding: 22px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.pkg-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.pkg-name { font-size: 1.06rem; }
.pkg-ver {
  font-size: .74rem; font-weight: 600; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: .18rem .5rem; border-radius: 99px; white-space: nowrap;
}
.pkg-why { font-size: .92rem; color: var(--ink-2); }
.pkg-none { background: var(--surface-2); border-style: dashed; }
.pkg-none .pkg-name { color: var(--ink-2); }

/* ---------- 素材表 ---------- */
.assets-table {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; background: var(--surface);
}
.assets-table table { width: 100%; border-collapse: collapse; min-width: 520px; }
.assets-table th, .assets-table td {
  text-align: left; padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft); font-size: .89rem;
}
.assets-table th {
  font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2); font-weight: 700;
}
.assets-table tbody tr:last-child td { border-bottom: none; }
.assets-table td:first-child { color: var(--ink); font-weight: 600; }
.assets-table td { color: var(--ink-2); }

/* ---------- 數字磚 ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 42px;
}
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.stat {
  padding: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-v { font-size: clamp(1.7rem, 3.6vw, 2.3rem); font-weight: 700; line-height: 1; color: var(--ink); }
.stat-v small { font-size: .42em; font-weight: 600; color: var(--ink-3); margin-left: .1em; }
.stat-l { font-size: .8rem; color: var(--ink-3); line-height: 1.45; }
.stat-hot { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-soft); }
.stat-hot .stat-v { color: var(--brand-strong); }
.stat-hot .stat-l { color: var(--ink-2); }

/* ---------- 缺陷區塊 ---------- */
.bug {
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.bug-head {
  padding: 20px clamp(18px, 3vw, 26px);
  border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
}
.bug-tag {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  color: var(--on-brand); background: var(--alarm);
  padding: .26rem .6rem; border-radius: 99px; white-space: nowrap;
}
.bug-head h3 { font-size: 1.08rem; flex: 1; min-width: 14ch; }
.bug-loc {
  font-size: .76rem; background: transparent; border: none;
  color: var(--ink-3); padding: 0;
}

.bug-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 3.6vw, 36px); padding: clamp(18px, 3vw, 26px);
  align-items: center;
}
@media (max-width: 840px) { .bug-grid { grid-template-columns: 1fr; } }
.bug-text { display: flex; flex-direction: column; gap: .9em; }
.bug-text p { font-size: .93rem; color: var(--ink-2); }

.bug-fig { color: var(--ink-2); overflow-x: auto; }
.bug-fig svg { min-width: 320px; }
/* 圖裡的「修正前／修正後」用語意色，不在 SVG 屬性寫死 hex，
   否則切主題時圖表顏色不會跟著走。 */
.bug-fig .m-bad { stroke: var(--alarm); }
.bug-fig .m-bad-f { fill: var(--alarm); }
.bug-fig .m-good { stroke: var(--brand); }
.bug-fig .m-good-f { fill: var(--brand); }
.bug-fig .m-zone { fill: var(--alarm); opacity: .12; }
.bug-fig figcaption {
  font-size: .8rem; color: var(--ink-3); margin-top: 12px; line-height: 1.65;
}

.card-p { font-size: .93rem; color: var(--ink-2); }
.card-accent {
  border-color: color-mix(in srgb, var(--water-mark) 40%, var(--line));
  background: var(--water-soft);
}

/* ---------- 終端機 ---------- */
.cmd { margin-top: 26px; }
.cmd-label {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.cmd pre {
  background: var(--ink-900); color: var(--clay-100);
  border-radius: var(--radius-sm); padding: 16px 20px;
  overflow-x: auto; border: 1px solid var(--line);
}
.cmd code {
  background: transparent; border: none; padding: 0; color: inherit;
  font-size: .87rem; line-height: 1.85;
}
.cmd-ok { color: var(--leaf-300); font-weight: 700; }

/* ---------- 未來方向 ---------- */
.roadmap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .roadmap { grid-template-columns: 1fr; } }

.road {
  padding: 24px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.road-phase {
  align-self: flex-start;
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  color: var(--ink-3); background: var(--surface-2);
  border: 1px solid var(--line-soft);
  padding: .24rem .6rem; border-radius: 99px;
}
.road-now { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.road-now .road-phase {
  color: var(--on-brand); background: var(--brand); border-color: transparent;
}
.road h3 { font-size: 1.04rem; }
.road p { font-size: .92rem; color: var(--ink-2); }
.road-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.road-tags li {
  font-family: var(--font-mono); font-size: .72rem;
  color: var(--ink-3); background: var(--surface-2);
  border: 1px solid var(--line-soft); padding: .2rem .5rem; border-radius: 5px;
}

/* ---------- Reference ---------- */
.refs { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.refs li {
  display: grid; grid-template-columns: minmax(0, 21rem) 1fr; gap: 8px 22px;
  padding: 15px 4px; border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}
@media (max-width: 720px) { .refs li { grid-template-columns: 1fr; gap: 4px; } }
.refs li > :first-child { font-weight: 700; font-size: .94rem; }
.refs .ref-t { color: var(--ink); }
.refs li > span:last-child { font-size: .88rem; color: var(--ink-2); }

.disclaimer {
  margin-top: 32px; padding: 16px 20px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--ink-2); max-width: var(--prose); line-height: 1.75;
}

/* ---------- 頁尾 ---------- */
.foot {
  border-top: 1px solid var(--line-soft);
  padding: 34px 0; background: var(--surface-2);
}
.foot-in {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.foot-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.04rem; }
.foot-meta { font-size: .84rem; color: var(--ink-3); }

/* ---------- 進場動畫 ---------- */
.reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s cubic-bezier(.2,.7,.3,1), transform .6s cubic-bezier(.2,.7,.3,1);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  #soilCanvas { display: none; }
}
