/* Google 試算表實體課程（助教網站）與課後作業（作業網站）：共用樣式
   視覺語言與課前自學網站（sheets-start.pages.dev）改版後的外框相同：
   米白底、白色圓角卡片、大字標題、單一綠色強調色；淺色／深色依系統設定，或 html[data-theme] 指定。
   模擬的 Google 試算表（simulator.css）與介面示意圖維持固定淺色。 */

/* ---------- 設計 token ---------- */
:root {
  --bg: #FAFAF7; --surface: #FFFFFF; --sunk: #F1F1EC; --ink: #17191C; --ink-2: #3B4047; --muted: #596068;
  --line: #E3E2DC; --line-2: #CBC9C1;
  --accent: #0F7A5A; --accent-hover: #0B6249; --accent-ink: #FFFFFF; --accent-soft: #E2F2EB; --accent-line: #A9D9C4;
  --ok: #11734B; --ok-soft: #E1F3E9; --bad: #B3261E; --bad-soft: #FBEAE8; --warn: #8A5A00; --warn-soft: #FFF2D6;
  --info: #1d5fa8; --info-soft: #e6eef9; --preview: #6b3fa0; --preview-soft: #f1eafa; --warn-border: #e3b341;
  --on-bad: #fff; --focus: #1d5fa8;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 10px 30px rgba(20, 22, 26, .06);
  --r: 14px; --r-lg: 22px;
  --sans: "Figtree", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono-d1: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #191C1F; --sunk: #202428; --ink: #ECEDE9; --ink-2: #CACCC7; --muted: #A4A9AF;
    --line: #2B3035; --line-2: #3C434A;
    --accent: #6FD3A8; --accent-hover: #8FE0BC; --accent-ink: #06291C; --accent-soft: #16342A; --accent-line: #2E6B53;
    --ok: #6FD3A8; --ok-soft: #163026; --bad: #FF9C92; --bad-soft: #3A1D1A; --warn: #F3C766; --warn-soft: #352A12;
    --info: #8ab8f0; --info-soft: #1c2a3b; --preview: #c4a3f0; --preview-soft: #2b2238; --warn-border: #a8801f;
    --on-bad: #2a0d0b; --focus: #8ab8f0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #191C1F; --sunk: #202428; --ink: #ECEDE9; --ink-2: #CACCC7; --muted: #A4A9AF;
  --line: #2B3035; --line-2: #3C434A;
  --accent: #6FD3A8; --accent-hover: #8FE0BC; --accent-ink: #06291C; --accent-soft: #16342A; --accent-line: #2E6B53;
  --ok: #6FD3A8; --ok-soft: #163026; --bad: #FF9C92; --bad-soft: #3A1D1A; --warn: #F3C766; --warn-soft: #352A12;
  --info: #8ab8f0; --info-soft: #1c2a3b; --preview: #c4a3f0; --preview-soft: #2b2238; --warn-border: #a8801f;
  --on-bad: #2a0d0b; --focus: #8ab8f0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
/* 舊名稱（simulator.css 與各網站自己的樣式仍在使用），對應到新 token */
:root {
  --surface-2: var(--sunk); --text: var(--ink); --text-2: var(--muted); --border: var(--line);
  --primary: var(--accent); --primary-hover: var(--accent-hover); --primary-soft: var(--accent-soft); --on-primary: var(--accent-ink);
  --radius: 12px; --font: var(--sans); --mono: var(--mono-d1);
  --header-h: 64px; --rail-w: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-padding-top: calc(var(--header-h) + 64px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.3; margin: 1.6em 0 0.6em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 4.2vw, 42px); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin-top: 0; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: 0.3em; }
li::marker { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
strong { color: inherit; }
pre { font-family: var(--mono-d1); font-size: 14px; }

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

.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;
}

.skip-link { position: absolute; left: 8px; top: -100px; z-index: 100; background: var(--surface); color: var(--accent); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); font-weight: 700; }
.skip-link:focus { top: 8px; }

/* ---------- Windows／Mac 切換 ---------- */
html[data-os="mac"] .only-win,
html:not([data-os="mac"]) .only-mac { display: none !important; }

kbd {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.85em;
  line-height: 1.3;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

code {
  font-family: var(--mono-d1);
  font-size: 0.88em;
  background: var(--sunk);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- 頁首（與課前自學網站相同） ---------- */
.site-header.app-top {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h); display: flex; align-items: center; gap: 22px; padding: 0 36px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.app-top .sp { flex: 1; }
.app-top .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); text-decoration: none; flex: none; }
.app-top .logo:hover { color: var(--ink); }
.logo-mark { width: 28px; height: 28px; flex: none; }
.logo-mark .logo-bg { fill: var(--accent); }
.logo-mark .logo-fg { stroke: var(--bg); stroke-width: 2; stroke-linecap: round; fill: none; }
.logo-short { display: none; }

.app-nav { display: flex; gap: 18px; font-size: 14px; font-weight: 600; min-width: 0; }
.app-nav a { color: var(--ink-2); text-decoration: none; padding: 6px 2px; border-radius: 6px; white-space: nowrap; }
.app-nav a:hover { color: var(--accent); }
.app-nav a[aria-current] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }

.app-progress { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.app-progress-bar { width: 88px; box-shadow: inset 0 0 0 1px var(--line); }

.os-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; flex: none; }
.os-btn { font: inherit; font-size: 13px; font-weight: 700; padding: 3px 12px; min-height: 30px; border-radius: 999px; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.os-btn:hover { color: var(--ink); }
.os-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.app-menu-btn { display: none; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 700; min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer; flex: none; }
.app-menu-btn:hover { background: var(--sunk); }
.app-menu-btn[aria-expanded="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 14px; height: 2px; background: currentColor; border-radius: 2px; }
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }

.app-menu {
  position: absolute; top: 60px; right: 16px; z-index: 60;
  width: min(320px, calc(100vw - 32px)); max-height: calc(100dvh - 76px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 8px;
}
.app-menu ul, .app-menu ol { list-style: none; margin: 0; padding: 0; }
.app-menu li + li { margin-top: 2px; }
.app-menu-links a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.4; }
.app-menu-links a:hover { background: var(--sunk); color: var(--ink); }
.app-menu-links a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.app-menu-heading { margin: 12px 12px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.app-menu-progress { margin: 6px 12px 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.app-menu-progress:empty { display: none; }

/* ---------- 版面：主欄（＋助教網站的教學項目側欄） ---------- */
.site-body { max-width: 1360px; margin: 0 auto; min-width: 0; }
.site-main { padding: 48px 56px 96px; min-width: 0; }
.site-main > * { max-width: 880px; }
.site-main > .wide { max-width: 1160px; }

body.has-rail .site-body { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: 48px; padding: 0 40px; }
body.has-rail .site-main { padding: 48px 0 96px; }

.site-nav { min-width: 0; }
.rail { position: sticky; top: calc(var(--header-h) + 32px); margin-top: 48px; max-height: calc(100vh - var(--header-h) - 64px); overflow-y: auto; padding: 2px; }
.rail-heading { margin: 0 12px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.rail-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail-units li { margin: 0; }
.rail-units a {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 12px; border: 1px solid transparent;
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 600; line-height: 1.35;
}
.rail-units a:hover { background: var(--sunk); color: var(--ink); }
.rail-units a[aria-current] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); color: var(--ink); font-weight: 700; }
.rail-n {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line-2); background: var(--bg); color: var(--muted);
  font-family: var(--mono-d1); font-size: 13px; font-weight: 700;
}
.is-in_progress .rail-n { border-color: var(--accent); color: var(--accent); }
.is-completed .rail-n { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rail-units a[aria-current] .rail-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.app-menu .rail-units a { padding: 8px 10px; font-size: 15px; }
.app-menu .rail-units a[aria-current] { box-shadow: none; background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.rail-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 18px 12px 0; font-size: 12px; color: var(--muted); }
.rail-legend .status-icon:not(:first-child) { margin-left: 8px; }

.status-icon { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); display: inline-block; position: relative; background: var(--bg); }
.status-in_progress { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.status-completed { border-color: var(--ink); background: var(--ink); }
.status-completed::after {
  content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 7px;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* 頁首寬度：寬螢幕顯示主要連結與側欄；窄螢幕改用「選單」 */
@media (max-width: 1099px) {
  .app-nav { display: none; }
  .app-menu-btn { display: inline-flex; }
  body.has-rail .site-body { display: block; padding: 0; }
  body.has-rail .site-main { padding: 40px 32px 80px; }
  .site-nav { display: none; }
  .site-main { padding: 40px 32px 80px; }
  .site-header.app-top { gap: 14px; padding: 0 24px; }
}
@media (max-width: 767px) {
  .site-main, body.has-rail .site-main { padding: 28px 16px 64px; }
  .site-header.app-top { gap: 10px; padding: 0 16px; }
  .app-progress { display: none; }
  h1 { font-size: clamp(28px, 8vw, 34px); }
}
@media (max-width: 560px) {
  .logo-long { display: none; }
  .logo-short { display: inline; }
  .app-top .logo { font-size: 15px; }
  .os-btn { padding: 3px 9px; }
}
/* 很窄（含電腦放大 400%）：網站名稱只留圖示 */
@media (max-width: 359px) {
  .logo-short { display: none; }
}

/* ---------- 按鈕、標籤 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1.3;
  min-height: 44px; padding: 10px 22px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .12s ease, background-color .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary, .btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--sunk); color: var(--ink); }
.btn-text { background: none; color: var(--ink-2); padding: 8px 6px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; border-radius: 6px; }
.btn-text:hover { color: var(--ink); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-lg { min-height: 48px; padding: 12px 24px; font-size: 16px; }
.btn[disabled] { background: var(--sunk); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.btn-danger { background: var(--bad); color: var(--on-bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 85%, var(--ink)); color: var(--on-bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mt-s { margin-top: 10px; }
.mt-m { margin-top: 14px; }
.page-narrow { margin: 0 auto; max-width: 800px; }
@media (prefers-reduced-motion: reduce) {
  .btn, .bar i { transition: none; }
  .btn:active { transform: none; }
  html { scroll-behavior: auto !important; }
}

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; line-height: 1.6; padding: 2px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.chip.acc { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- 提示框 ---------- */
.callout {
  --c: var(--info); --c-soft: var(--info-soft);
  border: 0; border-radius: 12px;
  background: var(--c-soft);
  padding: 12px 16px;
  margin: 0 0 1.2em;
  color: var(--ink);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--c); margin-bottom: 0.3em; }
.callout-title::before {
  content: "i"; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--c); color: var(--surface);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.callout-key { --c: var(--ok); --c-soft: var(--ok-soft); }
.callout-key .callout-title::before { content: "★"; }
.callout-warn { --c: var(--warn); --c-soft: var(--warn-soft); }
.callout-warn .callout-title::before { content: "!"; }
.callout-os .callout-title::before { content: "⌘"; }
.callout-os.only-win .callout-title::before { content: "⊞"; }
.callout-preview { --c: var(--preview); --c-soft: var(--preview-soft); }
.callout-preview .callout-title::before { content: "→"; }
.callout-story { --c: var(--info); --c-soft: var(--info-soft); }
.callout-story .callout-title::before { content: "✎"; }
.storage-warning { max-width: 880px; }

/* 看更多、截圖收合 */
details.more, details.shot-more {
  margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
details.more > summary, details.shot-more > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 700; color: var(--accent); list-style: none; border-radius: 12px;
}
details.more > summary::-webkit-details-marker, details.shot-more > summary::-webkit-details-marker { display: none; }
details.more > summary::before, details.shot-more > summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; }
details[open].more > summary::before, details[open].shot-more > summary::before { transform: rotate(90deg); }
details.more > summary:hover, details.shot-more > summary:hover { background: var(--sunk); }
details.more > :not(summary), details.shot-more > :not(summary) { margin-left: 14px; margin-right: 14px; }
details.more > :last-child, details.shot-more > :last-child { margin-bottom: 14px; }
details.more > summary + *, details.shot-more > summary + * { margin-top: 8px; }

/* ---------- 頁面開頭 ---------- */
.unit-head, .hero { margin: 0 0 32px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.unit-head h1, .hero h1 { margin: 0 0 12px; }
.hero-lead, .lead { font-size: 17px; color: var(--muted); margin: 0; }
.unit-head > :last-child, .hero > :last-child { margin-bottom: 0; }
.unit-head .mobile-note { margin-top: 16px; }
.mobile-note { display: none; }
@media (max-width: 767px) {
  .mobile-note { display: block; }
  .unit-head, .hero { margin-bottom: 22px; }
  .hero-lead, .lead { font-size: 16px; }
}

/* ---------- 內容卡片：主欄的每個 section 是一張白卡 ---------- */
.site-main > section {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px 32px; margin: 0 0 20px; min-width: 0;
}
.site-main > section > :last-child:not(.section-end),
.site-main > section > :nth-last-child(2):has(+ .section-end) { margin-bottom: 0; }
.site-main > section > h2:first-child { margin: 0 0 12px; font-size: clamp(22px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -.015em; }
.site-main > section h3 { margin: 28px 0 8px; }
/* 內文用次要墨色（設在卡片上讓子元素繼承，自己有顏色的元件不受影響） */
.site-main > section { color: var(--ink-2); }
.site-main > section :where(strong, b, th) { color: var(--ink); }
.site-main > section[id] { scroll-margin-top: calc(var(--header-h) + 64px); }
@media (max-width: 767px) {
  .site-main > section { padding: 20px 18px; border-radius: 18px; margin-bottom: 16px; }
}

.goal-list { list-style: none; padding: 0; }
.goal-list li { position: relative; padding-left: 1.8em; }
.goal-list li::before { content: "✓"; position: absolute; left: 0.15em; color: var(--accent); font-weight: 700; }

/* 步驟：圓形號碼 */
/* 步驟內容是一般的行內文字（含 code、kbd、換行），號碼用絕對定位，不用格線 */
.steps { list-style: none; padding: 0; margin: 0 0 1.2em; counter-reset: step; }
.steps > li { position: relative; counter-increment: step; padding-left: 42px; margin: 0; min-height: 28px; }
.steps > li + li { margin-top: 10px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0.05em;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--mono-d1); font-size: 13px; font-weight: 700;
}
.steps-title { font-weight: 700; margin-bottom: 0.4em; color: var(--ink); }
.summary-list li::marker { color: var(--accent); }

/* ---------- 表格（一律放在 .table-wrap 裡，窄螢幕橫向捲動） ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); max-width: 100%; }
/* 網站的資料表格；模擬器（.sim-window）與示意工作表（.mini-sheet）有自己的樣子 */
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 14px; text-align: left; vertical-align: top; }
:where(table:not(.mini-sheet, .sim-window *)) thead th { background: var(--sunk); color: var(--ink-2); font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
:where(table:not(.mini-sheet, .sim-window *)) tbody th { color: var(--ink); font-weight: 700; }
:where(table:not(.mini-sheet, .sim-window *)) tbody td { color: var(--ink-2); }
tbody tr:last-child > * { border-bottom: 0; }
:where(table:not(.mini-sheet, .sim-window *)) tbody tr:hover > * { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
caption { caption-side: top; text-align: left; }
/* 窄螢幕：欄位多的表格保留最小寬度，在 .table-wrap 裡橫向捲動，不把文字擠成一字一行 */
@media (max-width: 767px) {
  .table-wrap table:not(.mini-sheet):has(tr > :nth-child(4)) { min-width: 600px; }
  .table-wrap table:not(.mini-sheet):has(tr > :nth-child(5)) { min-width: 760px; }
  .table-wrap table:not(.mini-sheet):has(tr > :nth-child(6)) { min-width: 960px; }
  .table-wrap table:not(.mini-sheet):has(tr > :nth-child(3)) th, .table-wrap table:not(.mini-sheet):has(tr > :nth-child(3)) td { min-width: 5em; }
}
/* 第一欄是時間等短資料時不換行 */
.col1-nowrap td:first-child { white-space: nowrap; }

/* 示意用的小型工作表（不是模擬器；固定淺色，與 Google 試算表一致） */
.mini-sheet { border-collapse: collapse; width: auto; font-size: 0.88rem; background: #fff; color: #1f1f1f; font-family: var(--sans); }
.mini-sheet th, .mini-sheet td { border: 1px solid #d4d4d4; padding: 3px 10px; min-width: 64px; white-space: nowrap; color: #1f1f1f; }
.mini-sheet thead th, .mini-sheet tbody th { background: #f3f3f3; color: #555; font-weight: 400; text-align: center; min-width: 32px; }
.mini-sheet .num { text-align: right; }
.mini-sheet .bad-cell { background: #fde2e1; outline: 2px solid #c42b1c; outline-offset: -2px; }
.mini-sheet .hl { background: #dff0e5; outline: 2px solid #17703f; outline-offset: -2px; }
.mini-sheet .merged { text-align: center; vertical-align: middle; }
.sheet-caption { font-size: 14px; color: var(--muted); margin: 0.4em 0 1.2em; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin-bottom: 1.4em; }
.compare-item { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-width: 0; }
.compare-item .table-wrap { border: 0; margin: 0; background: transparent; }
.compare-label { font-weight: 700; margin-bottom: 0.5em; }
.compare-label.bad { color: var(--bad); }
.compare-label.ok { color: var(--ok); }

/* ---------- 段落內的模擬練習：琥珀色框＋「動手做」標籤，和截圖明顯不同；完成後變綠色 ---------- */
.sim-inline { margin: 1.4em 0 1.6em; min-width: 0; }
.sim-inline:has(.sim-panel) {
  border: 2px solid var(--warn-border); border-radius: 18px; padding: 14px;
  background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface));
}
.sim-inline.is-done:has(.sim-panel) { border-color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.sim-inline-tag {
  align-self: flex-start; margin: -2px 0 0; padding: 2px 12px; border-radius: 99px;
  background: var(--warn); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
}
.sim-inline.is-done .sim-inline-tag { background: var(--ok); color: #fff; }
/* 深色模式的 --warn、--ok 是淺色，白字對比不足，改用深色字 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sim-inline-tag { color: #2a1d00; }
  :root:not([data-theme="light"]) .sim-inline.is-done .sim-inline-tag { color: #06291C; }
}
:root[data-theme="dark"] .sim-inline-tag { color: #2a1d00; }
:root[data-theme="dark"] .sim-inline.is-done .sim-inline-tag { color: #06291C; }
.sim-inline .sim-task-line { font-size: 17px; font-weight: 700; }
.sim-inline .sim-task-line::before { content: "👉 "; }
.sim-inline-label { font-weight: 700; color: var(--accent); margin: 0 0 6px; }

/* ---------- 小節進度列（教學項目頁上方固定） ---------- */
.section-progress {
  position: sticky; top: var(--header-h); z-index: 20;
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  margin: 0 0 20px; padding: 8px 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px;
  font-size: 14px;
}
.section-progress-label { margin: 0; font-weight: 700; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 200px; }
.section-progress ol { display: flex; gap: 0; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.section-progress li + li { margin-top: 0; }
.section-dot {
  /* 點擊範圍 24px（WCAG 2.5.8），看得見的圓點 12px；未完成的邊框用次要文字色，對比 ≥ 3:1 */
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
}
.section-dot::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid var(--muted); background: var(--surface);
}
.section-dot.is-done::before { background: var(--accent); border-color: var(--accent); }
.section-dot.is-current::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.section-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- 練習檔、勾選清單 ---------- */
.download-line { margin-bottom: 1em; }
.checklist { list-style: none; padding: 0; margin: 0 0 0.6em; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); }
.checklist li + li { margin-top: 6px; }
.checklist li:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-line); }
.checklist input { width: 20px; height: 20px; margin-top: 0.25em; flex: none; accent-color: var(--accent); }
.checklist label { cursor: pointer; flex: 1; min-width: 0; }
.checklist input:checked + label { color: var(--ink-2); }
.checklist-count { font-size: 14px; color: var(--muted); }
.checklist-count.ok { color: var(--ok); font-weight: 700; }

/* ---------- 測驗 ---------- */
.quiz-question {
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg); padding: 20px 22px; margin: 0 0 14px; min-width: 0;
}
.quiz-question legend { display: contents; }
.quiz-num { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.quiz-q { display: block; font-size: 17px; font-weight: 700; color: var(--ink); margin: 2px 0 12px; }
.quiz-code { font-family: var(--mono-d1); background: var(--sunk); padding: 10px 14px; border-radius: 10px; overflow-x: auto; font-size: 14px; margin: 0 0 0.8em; white-space: pre-wrap; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.quiz-option:hover { background: var(--sunk); }
.quiz-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.quiz-option input { width: 18px; height: 18px; margin-top: 0.3em; accent-color: var(--accent); flex: none; }
.quiz-option-text { flex: 1; min-width: 0; }
.quiz-option:has(input:disabled) { cursor: default; }
.quiz-option:has(input:disabled):hover { background: var(--surface); }
.quiz-option.is-answer { border-color: var(--ok); background: var(--ok-soft); }
.quiz-option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.quiz-mark { font-size: 13px; font-weight: 700; margin-left: auto; }
.mark-ok { color: var(--ok); }
.mark-bad { color: var(--bad); }
.quiz-feedback:empty { display: none; }
.quiz-confirm { margin-top: 12px; }
.quiz-feedback:focus { outline: none; }
.quiz-feedback { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.quiz-feedback > :last-child { margin-bottom: 0; }
.feedback-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 0.3em; }
.feedback-title.ok, .quiz-score.ok, .complete-status.ok { color: var(--ok); }
.feedback-title.bad, .quiz-score.bad { color: var(--bad); }
.feedback-icon {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 13px;
  border: 2px solid currentColor;
}
.quiz-summary { border-radius: 18px; background: var(--bg); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 16px; }
.quiz-summary:empty { display: none; }
.quiz-summary:focus { outline: none; }
.quiz-summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.quiz-score { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 0.4em; color: var(--ink); }
.quiz-score:focus { outline: none; }
.quiz-score:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.exam-intro { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; }
.exam-submit { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); }
.exam-status { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- 完成區 ---------- */
.complete-box { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; }
.complete-box > :last-child { margin-bottom: 0; }
.complete-status { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--ink); }
.complete-status:focus { outline: none; }
.complete-status:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.condition-list { list-style: none; padding: 0; }
.condition-list li.ok { color: var(--ok); }
.quiz-optional-note { font-size: 14px; color: var(--muted); }
.backup-reminder { margin-top: 1em; }

.resume-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  background: var(--accent-soft); border: 0; border-radius: 14px;
  padding: 10px 10px 10px 18px; margin: 0 0 20px;
}
.resume-bar p { margin: 0; font-weight: 600; color: var(--ink); }

.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 8px; }
.pager-link { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; line-height: 1.5; font-weight: 700; min-width: 0; }
.pager-link:hover { border-color: var(--accent); color: var(--accent); }
.pager-next { text-align: right; grid-column: 2; }
.pager-dir { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- 首頁 ---------- */
.continue-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; margin-bottom: 1.4em; box-shadow: var(--shadow); }
.continue-label { font-size: 13px; color: var(--muted); margin-bottom: 0.2em; font-weight: 700; }
.continue-where { font-size: 20px; font-weight: 800; }
.continue-section { font-weight: 400; color: var(--muted); font-size: 16px; }
.overview-line { color: var(--muted); }
.unit-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.unit-cards li + li { margin-top: 0; }
.unit-card a {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); text-decoration: none; line-height: 1.5;
}
.unit-card a:hover { border-color: var(--accent); }
.unit-card.is-completed a { border-color: var(--accent-line); }
.unit-card-num { font-size: 13px; color: var(--muted); font-weight: 700; font-family: var(--mono-d1); }
.unit-card-title { font-weight: 800; font-size: 17px; }
.unit-card-meta { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-top: auto; }
.badge-completed { color: var(--ok); }
.badge-in_progress { color: var(--info); }
.badge-not_started { color: var(--muted); }

/* ---------- 其他頁面：面板、表單 ---------- */
.plain-list { list-style: none; padding: 0; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 1.2em; }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { margin-top: 0; font-size: 20px; }
.rbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 32px; margin: 0 0 20px; min-width: 0; }
.rbox > :last-child { margin-bottom: 0; }
@media (max-width: 767px) { .rbox { padding: 20px 18px; border-radius: 18px; } }

.form-msg { font-weight: 600; font-size: 15px; min-height: 1.75em; margin: 0.6em 0 0; }
.form-msg.ok { color: var(--ok); }
.form-msg.bad { color: var(--bad); }
.form-msg.ok:not(:empty), .form-msg.bad:not(:empty) { padding: 12px 16px; border-radius: 14px; border: 1px solid transparent; }
.form-msg.ok:not(:empty) { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.form-msg.bad:not(:empty) { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.form-msg:focus { outline: none; }
.form-msg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 模擬器（.sim-window）裡的輸入框維持 Google 試算表的樣子，不套用網站的表單樣式 */
:where(textarea, input[type="text"], input[type="number"], input[type="search"], select):not(.sim-window *) {
  font: inherit; font-size: 16px; width: 100%; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px 14px; min-height: 44px;
}
select:not(.sim-window *) { width: auto; max-width: 100%; padding-right: 10px; cursor: pointer; }
textarea:not(.sim-window *) { min-height: 120px; font-family: var(--mono-d1); font-size: 13px; word-break: break-all; }
:is(textarea, input[type="text"], input[type="number"], input[type="search"], select):not(.sim-window *):hover { border-color: var(--muted); }
:is(textarea, input[type="text"], input[type="number"], input[type="search"], select):not(.sim-window *):focus { border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--bad); }
input:disabled { background: var(--sunk); color: var(--muted); }
label.field { display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin: 16px 0 6px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.field-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
input[type="file"] { font: inherit; font-size: 15px; max-width: 100%; color: var(--ink-2); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; font-size: 14px; margin-right: 12px; min-height: 40px; padding: 6px 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--sunk); }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; list-style: none; padding: 0; }
.shortcut-grid li + li { margin-top: 0; }
.shortcut-card { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; height: 100%; }
.shortcut-name { font-weight: 700; margin: 0 0 0.3em; color: var(--ink); }
.shortcut-keys { margin: 0; line-height: 2; }
.shortcut-note { font-size: 13px; color: var(--muted); margin: 0.3em 0 0; }

.download-list { list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: 10px; }
.download-item { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: space-between; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin: 0; }
.download-item + .download-item { margin-top: 0; }
.download-info { flex: 1 1 280px; min-width: 0; }
.download-info p { margin: 0; }
.download-name { font-weight: 700; color: var(--ink); }
.download-desc, .download-units { font-size: 14px; color: var(--muted); }

.cert-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 36px 32px 28px; text-align: center; max-width: 560px; margin: 0 auto 1.4em;
}
.cert-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--accent); }
.cert-eyebrow { color: var(--muted); margin-bottom: 0.2em; font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.cert-title { font-size: clamp(24px, 3.4vw, 30px); font-weight: 800; color: var(--ink); letter-spacing: -.015em; }
.cert-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; text-align: left; max-width: 340px; margin: 0 auto 1.2em; }
.cert-fields dt { color: var(--muted); }
.cert-fields dd { margin: 0; font-weight: 700; color: var(--ink); }
.cert-code { font-family: var(--mono-d1); font-size: 20px; letter-spacing: 0.08em; color: var(--accent); }
.cert-units { list-style: none; padding: 0; text-align: left; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 2px 16px; font-size: 14px; color: var(--muted); }
.cert-units li + li { margin-top: 0; }
.cert-units li.ok { color: var(--ok); }

@media print {
  .site-header, .site-nav, .no-print, .pager, .section-progress { display: none !important; }
  .site-main, body.has-rail .site-main { padding: 0; }
  body.has-rail .site-body { display: block; padding: 0; }
  .site-main > section { border: 0; padding: 0; break-inside: auto; }
  body { background: #fff; color: #000; }
}

/* ---------- 404 ---------- */
.page-404 { max-width: 560px; margin: 40px auto 0; text-align: left; }
.page-404-code { font-family: var(--mono-d1); font-size: 15px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }
.page-404 h1 { font-size: clamp(26px, 4vw, 34px); margin: 0 0 10px; }

/* ---------- 介面示意圖（固定淺色，與試算表預設一致） ---------- */
.ui-map {
  margin: 0 0 1.4em; border: 1px solid #c8c8c8; border-radius: 12px; overflow: hidden;
  background: #fff; color: #1f1f1f; font-size: 0.85rem; line-height: 1.4;
}
.ui-no {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #c42b1c; color: #fff; font-size: 0.75rem; font-weight: 700; margin-right: 6px;
}
.ui-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; padding: 6px 12px; background: #f3f3f3; border-bottom: 1px solid #e0e0e0; }
.ui-tab.is-on { color: #17703f; font-weight: 700; border-bottom: 2px solid #17703f; }
.ui-ribbon { display: flex; align-items: center; padding: 16px 12px; background: #f9f9f9; border-bottom: 1px solid #e0e0e0; color: #555; }
.ui-formula { display: flex; align-items: stretch; gap: 6px; padding: 5px 8px; border-bottom: 1px solid #e0e0e0; }
.ui-namebox { display: flex; align-items: center; border: 1px solid #c8c8c8; padding: 2px 8px; min-width: 90px; }
.ui-fx { display: flex; align-items: center; padding: 0 6px; font-style: italic; color: #555; }
.ui-bar { display: flex; align-items: center; flex: 1; border: 1px solid #c8c8c8; padding: 2px 8px; color: #555; }
.ui-grid { display: grid; grid-template-columns: 34px repeat(4, minmax(48px, 1fr)); }
.ui-grid > span { height: 26px; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; }
.ui-corner, .ui-colhead, .ui-rowhead { background: #f3f3f3; color: #555; display: grid; place-items: center; }
.ui-cell.is-active { outline: 2px solid #17703f; outline-offset: -2px; }
.ui-labels { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 12px; border-top: 1px solid #e0e0e0; }
.ui-labels > span { display: flex; align-items: center; }
.ui-sheets { display: flex; align-items: center; gap: 10px; padding: 4px 12px; background: #f3f3f3; border-top: 1px solid #e0e0e0; }
.ui-sheet.is-on { background: #fff; padding: 0 10px; border-bottom: 2px solid #17703f; color: #17703f; font-weight: 700; }
.ui-plus { color: #555; }
.ui-status { display: flex; align-items: center; padding: 3px 12px; background: #f3f3f3; border-top: 1px solid #e0e0e0; color: #555; }
.ui-zoom { margin-left: auto; }

/* 實際畫面截圖 */
figure.shot { margin: 0 0 1.4em; }
figure.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
figure.shot figcaption { font-size: 14px; color: var(--muted); margin-top: 0.4em; }
.shot-note { display: block; font-size: 13px; }

/* 課前檢測：實作結果與各面向成績 */
.evidence-item { margin-bottom: 6px; }
.evidence-item input { max-width: 240px; }
.evidence-item .form-msg { min-height: 0; margin-top: 0.3em; }
.exam-areas td:first-of-type { white-space: nowrap; }
.exam-areas .ok { color: var(--ok); font-weight: 600; }
.cert-who { margin-bottom: 20px; }
.cert-who input { max-width: 320px; }
.practice-verify { margin-top: 16px; }
.practice-verify input { max-width: 240px; }

/* ---------- 作業網站：自動檢核；助教網站：驗證作業代碼 ---------- */
.hw-part { margin: 1.6em 0 0.4em; font-size: 17px; }
.hw-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.hw-answer input { width: min(240px, 100%); }
.hw-unit { color: var(--muted); }
.hw-submission { white-space: pre-wrap; font-size: 15px; line-height: 1.6; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.hw-result { margin-top: 1em; }
.answer-table td:nth-child(3) code { word-break: break-all; }
.hw-form .cert-fields { margin: 0 0 1em; max-width: 420px; align-items: center; }
.verify-text { margin: 0 0 12px; }
.hw-hint { color: var(--muted); font-size: 0.95em; margin: -0.2em 0 0.6em; }
