/* 單元介紹頁（/math/…）的樣式。這些頁是給搜尋引擎收錄的靜態頁，由 tools/build_seo_pages.py 產生；
 * 不載 App 的 design.css／style.css（那兩份跟著 App 的畫面走，動輒幾十 KB），
 * 只沿用同一組顏色與「膠囊按鈕＋硬陰影」的語彙，讓從這裡點進 App 不會像換了一個網站。 */

:root {
  --navy: #1B3A6B; --navy-deep: #0F2548;
  --ink: #24324A; --muted: #5B6B85; --faint: #8A97AD;
  --bg: #F3F7FD; --surface: #ffffff; --surface-2: #F8FAFE;
  --border: #DCE6F5; --border-lite: #EDF2F9;
  --cta: #F0573A; --cta-hover: #E24A2E; --cta-shadow: #C7402A; --cta-tint: #FFF1EC;
  --ok: #1E7A4C; --ok-tint: #E3F6EC;
  --bad: #C0353A; --bad-tint: #FDE8E8;
  --accent-tint: #E6F0FD; --accent: #1F5FB8;
  --paper: #ffffff;   /* 題目的圖形是白底線稿，深色模式也墊白底 */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E3E9F4; --muted: #A7B3C8; --faint: #7D8AA3;
    --bg: #0E1626; --surface: #16213A; --surface-2: #1A2742;
    --border: #2A3A5C; --border-lite: #22314F;
    --cta-tint: #3A2320; --ok: #6FD39E; --ok-tint: #173528; --bad: #F08A8D; --bad-tint: #3A1E22;
    --accent-tint: #1B2E50; --accent: #8DB8F2;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.75 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
.wrap { max-width: 760px; margin: 0 auto; padding-inline: 16px; }

/* ── 頂部欄 ── */
.top { background: var(--navy); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 900; letter-spacing: .02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }

/* ── 按鈕：網站的主要動作一律橘紅膠囊＋硬陰影 ── */
.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--cta); color: #fff; text-decoration: none; font-weight: 700;
  padding: 12px 22px; border-radius: 999px; box-shadow: 0 3px 0 var(--cta-shadow);
  white-space: nowrap; transition: transform .08s, box-shadow .08s, background .15s;
}
.btn-cta:hover { background: var(--cta-hover); }
.btn-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--cta-shadow); }
.btn-cta.small { padding: 7px 16px; font-size: 14px; }

/* ── 內文 ── */
main { padding-block: 20px 48px; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.eyebrow { margin: 22px 0 4px; font-size: 14px; color: var(--muted); letter-spacing: .04em; }
h1 { margin: 0 0 12px; font-size: clamp(26px, 6vw, 34px); line-height: 1.3; font-weight: 900; color: var(--navy); text-wrap: balance; }
@media (prefers-color-scheme: dark) { h1 { color: #fff; } }
h2 { margin: 40px 0 12px; font-size: 21px; line-height: 1.4; font-weight: 900; text-wrap: balance; }
h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.5; }
.lead { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 20px 22px; }
.cta-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; flex-wrap: wrap; }
.cta-box p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.cta-box > div { min-width: 0; flex: 1 1 260px; }

/* ── 三家課本對照 ── */
.books { width: 100%; border-collapse: collapse; font-size: 15px; }
.books th, .books td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-lite); vertical-align: top; }
.books th { width: 4.5em; color: var(--muted); font-weight: 500; white-space: nowrap; }
.books tr:last-child th, .books tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ── 容易錯的觀念 ── */
.miscs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.miscs li p { margin: 4px 0 0; }
.fix { color: var(--ink); }
.fix b { color: var(--ok); }

/* ── 例題 ── */
.q + .q { margin-top: 16px; }
.q-no { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.stem { margin: 0 0 10px; font-size: 17px; font-weight: 500; }
.fig { background: var(--paper); border-radius: 14px; padding: 8px; margin: 8px 0 12px; text-align: center; overflow-x: auto; }
.fig svg { max-width: 100%; height: auto; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.opts li { display: flex; gap: 8px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; overflow-wrap: anywhere; }
.opts b { color: var(--muted); font-weight: 700; }
details { margin-top: 12px; }
summary {
  cursor: pointer; display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 700;
  background: var(--accent-tint); color: var(--accent); list-style: none;
}
summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 10px; }
.ans { margin: 0 0 8px; font-weight: 700; color: var(--ok); }
.steps { margin: 0; padding-left: 1.4em; }
.steps li + li { margin-top: 6px; }
.steps ul { margin: 4px 0 0; padding-left: 1.1em; color: var(--muted); font-size: 15px; }
.rule { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.whywrong { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bad-tint); }
.whywrong b { color: var(--bad); }
.whywrong ul { margin: 6px 0 0; padding-left: 1.2em; }
.note { margin: 6px 0 14px; font-size: 14px; color: var(--muted); }

/* ── 單元清單（總覽頁、同一冊的其他單元） ── */
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.toc a { display: block; text-decoration: none; color: inherit; }
.toc .card:hover { border-color: var(--accent); }
.toc .sec { font-weight: 700; color: var(--accent); margin-right: 6px; }
.toc p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.chapter { margin: 28px 0 10px; font-size: 16px; font-weight: 700; color: var(--muted); }
.grades { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 24px; }
.grades a { text-decoration: none; color: inherit; }
.grades .card { height: 100%; }
.grades h2 { margin: 0 0 4px; font-size: 19px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; font-size: 15px; flex-wrap: wrap; }
.pager a { max-width: 48%; }

footer { border-top: 1px solid var(--border); padding-block: 20px 32px; color: var(--muted); font-size: 14px; }
footer p { margin: 4px 0; }
footer a { color: inherit; white-space: nowrap; }

/* ── 服務條款與隱私權政策（/terms/、/privacy/）── */
.legal { max-width: 68ch; }
.legal h2 { margin: 32px 0 8px; font-size: 19px; scroll-margin-top: 16px; }
.legal p, .legal li { line-height: 1.85; }
.legal ul { margin: 6px 0 0; padding-left: 1.3em; }
.legal li + li { margin-top: 6px; }
.legal-toc { margin: 20px 0 8px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; font-size: 15px; }
.legal-toc ol { margin: 0; padding-left: 1.4em; columns: 2 12em; column-gap: 24px; }
.legal-toc li { break-inside: avoid; margin: 2px 0; }
.legal-contact { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.legal-co { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 8px 0 0; }
.legal-co dt { color: var(--muted); }
.legal-co dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
