/* ═══════════════════════════════════════════════════════
   文箋 · 作品介紹頁

   視覺方向：宣紙與墨綠。與同作品集的 PAC-MAN 頁（霓虹電玩）
   刻意分開，色彩沿用軟體本身的識別色。

   RWD：以 clamp() 與 auto-fit 為主，斷點僅在版面必須換排時使用。
        360px（小手機）→ 768px（平板）→ 1024px（筆電）→ 1440px 以上
   ═══════════════════════════════════════════════════════ */

:root {
  /* 色彩 —— 與軟體本體一致：宣紙為底，墨綠為字
     （軟體的墨綠用在圖示、按鈕、標題等前景，底色是米白宣紙） */
  --ground: #eeece4;
  --ground-2: #e6e3d8;
  --panel: #f8f7f2;
  --paper: #fffdf7;
  --ink: #19372f;
  --ink-soft: #566b62;
  --ink-faint: #7d8d85;
  --moss: #27614f;
  --moss-deep: #143b31;
  --vermilion: #a9543c;
  --vermilion-soft: #8a4030;
  --gold: #8a6a34;
  --line: rgba(25, 55, 47, 0.16);
  --line-soft: rgba(25, 55, 47, 0.08);

  --serif: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  /* 間距與尺寸：全部隨視窗縮放 */
  --wrap: 1120px;
  --pad-x: clamp(1.1rem, 4vw, 2.5rem);
  --sec-y: clamp(3.5rem, 9vw, 7rem);
  --nav-h: 60px;
  --radius: 4px;
}

/* ══════════ 毛筆游標 ══════════
   CSS 的 cursor 只能放靜態圖，筆永遠是同一個角度，看起來就很生硬。
   改用跟隨滑鼠的 DOM 元素：筆能依移動方向傾側、按下時筆尖壓開、
   移動時在後方留下漸淡的墨跡。
   觸控裝置與 prefers-reduced-motion 不啟用，維持系統游標。 */
body.has-brush,
body.has-brush a, body.has-brush button, body.has-brush select,
body.has-brush .pill, body.has-brush .type-card, body.has-brush .term-cell,
body.has-brush [role='button'], body.has-brush summary, body.has-brush label {
  cursor: none;
}
/* 輸入區維持系統游標，避免影響編輯定位 */
body.has-brush textarea, body.has-brush input { cursor: text; }

#brushCursor {
  position: fixed; top: 0; left: 0;
  width: 54px; height: 54px;
  z-index: 9999; pointer-events: none;
  will-change: transform;
  opacity: 0;
  transition: opacity .25s;
}
#brushCursor.is-on { opacity: 1; }
/* 筆尖是熱點，對齊 (7, 6)；旋轉軸心設在筆尖 */
#brushCursor svg { display: block; overflow: visible; }

/* 墨跡：跟在筆後方，逐漸淡去 */
#brushInk {
  position: fixed; top: 0; left: 0;
  z-index: 9998; pointer-events: none;
  width: 100%; height: 100%;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  #brushCursor, #brushInk { display: none; }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.85 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 700; text-wrap: balance; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip {
  position: fixed; left: -999px; top: .5rem; z-index: 999;
  padding: .6rem 1rem; background: var(--paper); color: var(--ground);
  border-radius: var(--radius);
}
.skip:focus { left: .5rem; }

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

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad-x);
  position: relative;
  z-index: 1;
}

/* ══════════ 導覽 ══════════ */
#nav {
  position: fixed; inset-inline: 0; top: 0; z-index: 100;
  background: rgba(248, 247, 242, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  max-width: var(--wrap); margin-inline: auto;
  padding-inline: var(--pad-x);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-brand {
  display: flex; align-items: center; gap: .55rem;
  color: var(--ink); font: 600 1.05rem var(--serif); letter-spacing: .08em;
  text-decoration: none; flex: none;
}
.nav-brand img { border-radius: 6px; }

.nav-links { display: none; gap: .15rem; }
.nav-links a {
  padding: .45rem .7rem; border-radius: var(--radius);
  color: var(--ink-soft); font-size: .82rem; text-decoration: none;
  white-space: nowrap; transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--moss-deep); background: rgba(25,55,47,.06); text-decoration: none; }
.nav-links a.is-active { color: var(--gold); }

.nav-tools { display: flex; align-items: center; gap: .4rem; flex: none; }

.nav-tool {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink-soft);
  font: inherit; font-size: .78rem; cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.nav-tool:hover { border-color: var(--gold); color: var(--gold); }
@media (max-width: 560px) { .nav-tool span { display: none; } }

.nav-menu-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink); cursor: pointer;
}
.nav-progress { height: 2px; background: transparent; }
.nav-progress span { display: block; height: 100%; width: 0; background: var(--vermilion); }

.nav-mobile {
  border-top: 1px solid var(--line-soft);
  background: rgba(248, 247, 242, .98);
  padding: .5rem var(--pad-x) .9rem;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .2rem;
}
/* display:grid 會蓋掉 hidden 屬性，須明確還原 */
.nav-mobile[hidden] { display: none; }
.nav-mobile a {
  padding: .6rem .5rem; color: var(--ink-soft);
  font-size: .85rem; text-decoration: none; border-radius: var(--radius);
}
.nav-mobile a:hover { background: rgba(25,55,47,.06); color: var(--moss-deep); text-decoration: none; }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-menu-btn { display: none; }
  .nav-mobile { display: none !important; }
}

/* ══════════ 區塊通用 ══════════ */
.sec {
  padding-block: var(--sec-y);
  border-top: 1px solid var(--line-soft);
  position: relative; z-index: 1;
}
.sec:first-of-type { border-top: 0; }

.eyebrow {
  color: var(--vermilion-soft);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .18em; margin-bottom: .7rem;
}
.sec-title {
  font: 700 clamp(1.55rem, 4.2vw, 2.5rem)/1.35 var(--serif);
  letter-spacing: -.01em;
  margin-bottom: .8rem;
}
.sec-sub {
  max-width: 62ch; color: var(--ink-soft);
  font-size: clamp(.92rem, 2.2vw, 1rem);
  margin-bottom: clamp(1.8rem, 4vw, 2.6rem);
}
.body { max-width: 62ch; margin-bottom: 1.1rem; color: var(--ink-soft); }
.body strong { color: var(--ink); }
.body-sm { color: var(--ink-soft); font-size: .89rem; line-height: 1.85; }
.body-sm + .body-sm { margin-top: .7rem; }
.note {
  max-width: 62ch; margin-top: 1rem;
  color: var(--ink-faint); font-size: .85rem;
}
.note strong { color: var(--gold); }

code {
  font: .88em var(--mono);
  background: rgba(25,55,47,.07);
  padding: .1em .38em; border-radius: 3px;
}

/* ══════════ 1. 封面 ══════════ */
.sec-cover { padding-top: calc(var(--nav-h) + clamp(2.5rem, 7vw, 5rem)); }

.cover-grid {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
@media (min-width: 1000px) {
  .cover-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

.cover-title {
  font: 700 clamp(3.2rem, 13vw, 5.5rem)/1.1 var(--serif);
  letter-spacing: .1em;
  margin-bottom: 1rem;
}
.cover-title rt {
  font: 500 .2em var(--sans);
  color: var(--ink-faint); letter-spacing: 0;
}
.cover-lead {
  font: 600 clamp(1.05rem, 3vw, 1.35rem)/1.7 var(--serif);
  margin-bottom: .9rem;
}
.cover-sub {
  max-width: 46ch; color: var(--ink-soft);
  font-size: clamp(.88rem, 2.2vw, .96rem);
  margin-bottom: 1.5rem;
}
.cover-sub strong { color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.7rem; }
.chip {
  padding: .3rem .7rem; border: 1px solid var(--line);
  border-radius: 99px; font-size: .76rem; color: var(--ink-soft);
  white-space: nowrap;
}
.chip-accent { border-color: rgba(169,84,60,.5); color: var(--vermilion); }

.cover-cta { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .7rem 1.3rem; border-radius: var(--radius);
  font-size: .88rem; font-weight: 700; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: background .16s, border-color .16s, transform .16s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--vermilion); color: #fff; border-color: var(--vermilion); }
.btn-primary:hover { background: var(--vermilion-soft); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: rgba(25,55,47,.05); }

.cover-shot {
  margin: 0; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(25,55,47,.16);
}

/* ══════════ 2. 動機 ══════════ */
.quote {
  margin: 0 0 1.6rem; padding: clamp(1rem, 3vw, 1.5rem) clamp(1.1rem, 3.5vw, 1.8rem);
  border-left: 3px solid var(--vermilion);
  background: rgba(255,253,247,.72);
  border-radius: 0 var(--radius) var(--radius) 0;
  font: 500 clamp(.95rem, 2.4vw, 1.1rem)/2 var(--serif);
  max-width: 60ch;
}
.quote strong { color: var(--gold); }

.pull {
  margin: 1.8rem 0;
  font: 700 clamp(1.3rem, 4vw, 2rem)/1.5 var(--serif);
  color: var(--gold);
  letter-spacing: .02em;
}

/* ── 命名說明 ── */
.naming {
  display: grid; gap: clamp(1.2rem, 3.5vw, 2.2rem);
  align-items: start;
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: clamp(1.3rem, 4vw, 2.2rem);
  border: 1px solid var(--line);
  border-left: 3px solid var(--vermilion);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(110deg, rgba(169,84,60,.07), rgba(255,253,247,.7) 60%);
}
@media (min-width: 720px) { .naming { grid-template-columns: auto 1fr; } }

.naming-glyph {
  display: flex; gap: .3rem; align-items: flex-start;
  font-family: var(--serif);
}
.naming-char {
  font-size: clamp(3.4rem, 12vw, 5rem);
  font-weight: 700; line-height: 1;
  color: var(--moss-deep);
}
.naming-char-hot { color: var(--vermilion); }
.naming-char rt {
  font: 500 .19em var(--sans);
  color: var(--ink-faint); letter-spacing: 0;
}

.naming-pron {
  font: 500 .88rem var(--mono);
  color: var(--gold); letter-spacing: .1em;
  margin-bottom: .7rem;
}
.naming-def, .naming-why {
  max-width: 52ch; font-size: .9rem;
  color: var(--ink-soft); line-height: 2;
}
.naming-def strong { color: var(--moss-deep); font-size: 1.15em; font-family: var(--serif); }
.naming-why {
  margin-top: .8rem; padding-top: .8rem;
  border-top: 1px solid var(--line-soft);
}

.cards-2 {
  display: grid; gap: clamp(.8rem, 2.5vw, 1.2rem);
  margin-top: clamp(1.8rem, 4vw, 2.5rem);
}
@media (min-width: 760px) { .cards-2 { grid-template-columns: 1fr 1fr; } }

.card {
  padding: clamp(1.1rem, 3vw, 1.6rem);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,253,247,.62);
}
.card h3 { font-size: 1.02rem; margin-bottom: .7rem; }
.card-muted { background: transparent; }
.card-accent { border-color: rgba(169,84,60,.4); }

.list { margin: 0; padding-left: 1.15rem; color: var(--ink-soft); }
.list li { margin-bottom: .45rem; font-size: .89rem; }
.list strong { color: var(--ink); }
.list-sm li { font-size: .85rem; }

/* ══════════ 3. 功能 ══════════ */
.term-grid {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 1rem;
}
.term-cell {
  padding: 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); text-align: center;
  background: rgba(255,253,247,.62);
}
.term-hot { border-color: rgba(169,84,60,.45); }
.term-rel { display: block; font-size: .74rem; color: var(--ink-faint); margin-bottom: .4rem; }
.term-char {
  display: block; font: 700 clamp(2.2rem, 7vw, 3rem)/1 var(--serif);
  color: var(--moss-deep); margin-bottom: .45rem;
}
.term-hot .term-char { color: var(--vermilion); }
.term-eg { display: block; font-size: .76rem; color: var(--ink-faint); }

/* ── 互動 Demo ── */
.demo {
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: clamp(1.1rem, 3.5vw, 2rem);
  border: 1px solid rgba(169,84,60,.35);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(169,84,60,.05), rgba(255,253,247,.75));
}
.demo-head {
  display: flex; flex-wrap: wrap; gap: .8rem;
  align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.2rem;
}
.demo-title { font: 700 clamp(1.15rem, 3vw, 1.4rem) var(--serif); margin-bottom: .25rem; }
.demo-sub { color: var(--ink-soft); font-size: .86rem; }
.demo-badge {
  flex: none; padding: .35rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .72rem; color: var(--ink-faint); text-align: right;
}
.demo-badge-sub { display: block; opacity: .75; font-size: .95em; }

.demo-controls { margin-bottom: .9rem; }
.field { display: block; margin-bottom: .9rem; }
.field-label {
  display: block; margin-bottom: .35rem;
  font-size: .78rem; font-weight: 700; color: var(--ink-soft);
}
.demo select, .demo textarea {
  width: 100%; padding: .7rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fffefa; color: var(--ink);
  font: inherit; font-size: .92rem;
}
.demo textarea {
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.95;
  resize: vertical; min-height: 92px;
}
.demo select:focus, .demo textarea:focus {
  outline: none; border-color: var(--vermilion-soft);
  box-shadow: 0 0 0 3px rgba(169,84,60,.16);
}

.demo-samples {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: 1.2rem;
}
.demo-samples-label { font-size: .78rem; color: var(--ink-faint); margin-right: .15rem; }
.pill {
  padding: .35rem .75rem; border: 1px solid var(--line);
  border-radius: 99px; background: transparent; color: var(--ink-soft);
  font: inherit; font-size: .78rem; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.pill:hover { border-color: var(--gold); color: var(--gold); }

.demo-result { border-top: 1px solid var(--line); padding-top: 1rem; }
.demo-result-head { font-size: .86rem; font-weight: 700; margin-bottom: .8rem; }
.demo-result-head.is-clear { color: #2f7a54; }
.demo-result-head.is-bad { color: var(--vermilion); }

.demo-findings { display: grid; gap: .6rem; }
.finding {
  padding: .8rem .95rem;
  border-left: 3px solid; border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255,253,247,.85);
}
.finding-error { border-color: var(--vermilion); }
.finding-warning { border-color: var(--gold); }

.finding-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: .35rem;
}
.finding-kind { font-size: .75rem; font-weight: 700; }
.finding-error .finding-kind { color: var(--vermilion); }
.finding-warning .finding-kind { color: var(--gold); }
.finding-strength {
  margin-left: auto; font-size: .68rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 3px; padding: .05rem .4rem;
}
.finding-msg { font-size: .9rem; line-height: 1.75; }
.finding-fix {
  margin-top: .4rem; font-size: .83rem; color: var(--ink-soft);
  padding: .4rem .6rem; background: rgba(25,55,47,.05); border-radius: 3px;
}
.finding-basis { margin-top: .4rem; font-size: .73rem; color: var(--ink-faint); }

.demo-clear {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem; border: 1px dashed rgba(47,122,84,.45);
  border-radius: var(--radius); color: var(--ink-soft); font-size: .88rem;
}
.demo-clear b { color: #2f7a54; }

.demo-foot {
  margin-top: 1rem; padding-top: .8rem;
  border-top: 1px solid var(--line-soft);
  font-size: .76rem; color: var(--ink-faint);
}
.demo-foot strong { color: var(--ink-soft); }

/* ── 功能卡 ── */
.feat-grid {
  display: grid; gap: clamp(.8rem, 2.5vw, 1.2rem);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: clamp(2rem, 5vw, 3rem);
}
.feat {
  padding: clamp(1.1rem, 3vw, 1.5rem);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.feat-no {
  display: block; font: 700 2.4rem/1 var(--serif);
  color: var(--vermilion); margin-bottom: .3rem;
}
.feat h3 { font-size: .95rem; margin-bottom: .6rem; color: var(--ink-soft); font-weight: 600; }
.feat p { font-size: .86rem; color: var(--ink-soft); line-height: 1.8; }
.feat strong { color: var(--ink); }

/* ── 截圖 ── */
.shots {
  display: grid; gap: clamp(1rem, 3vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: clamp(2rem, 5vw, 3rem);
}
.shots figure { margin: 0; }
.shots img {
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 10px 26px rgba(25,55,47,.13);
}
.shots figcaption {
  margin-top: .6rem; font-size: .8rem; color: var(--ink-faint); line-height: 1.7;
}

/* ══════════ 4. 架構 ══════════ */
.diagram {
  margin: 0 0 clamp(1.8rem, 4vw, 2.5rem);
  padding: clamp(1rem, 3vw, 1.8rem);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,253,247,.6);
  overflow-x: auto;
}
.diagram svg {
  display: block; width: 100%; height: auto;
  min-width: 620px;   /* 小於此寬度則水平捲動，避免文字擠壓 */
  color: var(--ink-soft);
}
.diagram figcaption {
  margin-top: 1rem; padding-top: .8rem;
  border-top: 1px solid var(--line-soft);
  font-size: .82rem; color: var(--ink-faint); line-height: 1.8;
  min-width: 0;
}

/* ══════════ 5. 套件 ══════════ */
.pkg-list {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.pkg {
  padding: clamp(1rem, 2.6vw, 1.3rem);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,253,247,.62);
}
.pkg-name { font-weight: 700; font-size: .95rem; margin-bottom: .45rem; }
.pkg-ver {
  font: .74rem var(--mono); color: var(--ink-faint);
  margin-left: .35rem; font-weight: 400;
}
.pkg-why { font-size: .84rem; color: var(--ink-soft); line-height: 1.8; }
.pkg-none { border-style: dashed; opacity: .8; }
.pkg-none .pkg-name { color: var(--ink-faint); }

/* ══════════ 6. 成果 ══════════ */
.decisions {
  display: grid; gap: clamp(.8rem, 2.5vw, 1.1rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: clamp(2.2rem, 5vw, 3.2rem);
}
.dec {
  padding: clamp(1.1rem, 3vw, 1.5rem);
  border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 2px solid var(--vermilion);
  background: rgba(255,253,247,.62);
}
.dec h3 { font: 700 1.05rem var(--serif); margin-bottom: .6rem; }
.dec p { font-size: .87rem; line-height: 1.85; }
.dec em { color: var(--gold); font-style: normal; font-weight: 700; }
.dec-why {
  margin-top: .6rem; padding-top: .6rem;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-soft); font-size: .83rem !important;
}

/* ── 驗證 ── */
.verify {
  padding: clamp(1.2rem, 3.5vw, 2rem);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,253,247,.62);
  margin-bottom: clamp(1.8rem, 4vw, 2.5rem);
}
.verify-nums {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  padding-bottom: 1.3rem; margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--line-soft);
}
.num { text-align: center; }
.num-v {
  display: block; font: 700 clamp(2.4rem, 8vw, 3.4rem)/1 var(--serif);
  color: var(--moss-deep); font-variant-numeric: tabular-nums;
}
.num-hot .num-v { color: var(--vermilion); }
.num-l { display: block; margin-top: .4rem; font-size: .78rem; color: var(--ink-faint); }

.verify-text { max-width: 64ch; font-size: .89rem; color: var(--ink-soft); margin-bottom: .8rem; }
.verify-text strong { color: var(--ink); }
.verify-hit {
  padding: .7rem .9rem; border-left: 3px solid var(--gold);
  background: rgba(201,160,99,.14); color: var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.verify-bars { display: grid; gap: .5rem; margin-top: 1.4rem; }
.bar { display: grid; grid-template-columns: 5.2em 1fr 2.2em; align-items: center; gap: .7rem; }
.bar-l { font-size: .78rem; color: var(--ink-faint); }
.bar-t { height: 7px; background: rgba(25,55,47,.1); border-radius: 4px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--vermilion); border-radius: 4px; }
.bar-n {
  font: 700 .84rem var(--mono); color: var(--ink-soft);
  text-align: right; font-variant-numeric: tabular-nums;
}

/* ══════════ 7. Reference ══════════ */
.refs { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.refs li {
  padding: .9rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; gap: .3rem;
}
.refs a, .ref-t { font-weight: 700; font-size: .92rem; }
.ref-t { color: var(--ink); }
.refs span:last-child { font-size: .83rem; color: var(--ink-soft); line-height: 1.8; }

/* ══════════ 頁尾 ══════════ */
.site-foot {
  border-top: 1px solid var(--line-soft);
  padding-block: clamp(2rem, 5vw, 3rem);
  position: relative; z-index: 1;
}
.foot-inner {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: flex-start; justify-content: space-between;
  color: var(--ink-faint); font-size: .82rem;
}
.foot-note { text-align: right; line-height: 1.9; }
@media (max-width: 620px) { .foot-note { text-align: left; } }

/* ══════════ 簡報模式 ══════════
   一次顯示一段，鍵盤或按鈕換頁。適合實際報告時使用。 */
body.is-deck { overflow: hidden; }

body.is-deck .sec {
  display: none;
  min-height: calc(100vh - var(--nav-h));
  padding-block: clamp(1.5rem, 4vh, 3rem);
  border-top: 0;
  overflow-y: auto;
}
body.is-deck .sec.is-slide {
  display: flex; flex-direction: column; justify-content: center;
  animation: slideIn .38s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: none; }
}
body.is-deck .site-foot { display: none; }
body.is-deck .sec-cover { padding-top: clamp(1.5rem, 4vh, 3rem); }

/* 簡報模式下縮小尺寸，讓整段塞得進一個畫面 */
body.is-deck .cover-title { font-size: clamp(2.6rem, 8vw, 4rem); }
body.is-deck .sec-title { font-size: clamp(1.4rem, 3.4vw, 2.1rem); }
body.is-deck .shots { display: none; }
body.is-deck .reveal { opacity: 1; transform: none; }

.deck-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; gap: .8rem;
  padding: .6rem var(--pad-x);
  background: rgba(248, 247, 242, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.deck-bar[hidden] { display: none; }

.deck-btn {
  min-width: 38px; padding: .35rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; line-height: 1.2; cursor: pointer;
}
.deck-btn:hover { border-color: var(--gold); color: var(--gold); }
.deck-exit { font-size: .78rem; }
.deck-pos {
  font: 700 .84rem var(--mono); color: var(--gold);
  min-width: 4.2em; text-align: center;
  font-variant-numeric: tabular-nums;
}
.deck-hint { font-size: .74rem; color: var(--ink-faint); }
@media (max-width: 620px) { .deck-hint { display: none; } }

/* ══════════ 背景降級：WebGL 不可用時的靜態紙紋 ══════════ */
body.bg-static #bgCanvas { display: none; }
body.bg-static {
  background-image:
    radial-gradient(rgba(232, 227, 213, .028) 1px, transparent 1px),
    radial-gradient(rgba(176, 58, 46, .022) 1px, transparent 1px);
  background-position: 0 0, 13px 13px;
  background-size: 26px 26px;
  background-attachment: fixed;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
}

/* ══════════ 極小螢幕微調 ══════════ */
@media (max-width: 380px) {
  body { font-size: 15px; }
  .demo-badge { display: none; }
  .bar { grid-template-columns: 4.6em 1fr 2em; gap: .5rem; }
}
