/* ============================================================
   Vibe 詞典 · 溫暖紙感詞典設計系統
   palette: 紙米白 / 墨色 / 紅筆硃砂 / 藍筆墨藍
   ============================================================ */

:root {
  --paper: #f8f3e7;
  --paper-2: #f2ead9;
  --paper-3: #e9dec6;
  --ink: #262014;
  --ink-2: #55492f;
  --ink-3: #857757;
  --line: #d8cbae;
  --line-soft: #e6dcc4;
  --red: #b23a2a;
  --red-deep: #8f2b1e;
  --red-wash: #f5e3dc;
  --blue: #2f4d6b;
  --blue-wash: #e3e9ee;
  --marker: rgba(238, 197, 84, 0.42);
  --card: #fdfaf2;
  --shadow: 0 1px 2px rgba(66, 52, 22, 0.06), 0 6px 24px -12px rgba(66, 52, 22, 0.22);
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --container: 1060px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 平滑捲動尊重「減少動態效果」 */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(120, 98, 50, 0.035) 27px 28px),
    radial-gradient(1200px 500px at 85% -8%, rgba(178, 58, 42, 0.05), transparent 60%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 紙張顆粒 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0 0.22 0 0 0 0.028 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer { position: relative; z-index: 1; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 28px; }

::selection { background: var(--marker); color: var(--ink); }

a { color: var(--red-deep); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
a:hover { color: var(--red); }

h1, h2, h3 { font-family: var(--serif); font-weight: 900; line-height: 1.35; letter-spacing: 0.01em; }

mark {
  background: linear-gradient(104deg, transparent 2%, var(--marker) 8%, var(--marker) 92%, transparent 98%);
  color: inherit;
  padding: 0.08em 0.2em;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--red); color: #fff; padding: 10px 18px; z-index: 99;
  border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; color: #fff; }

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

/* ---------------- header ---------------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(248, 243, 231, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 26px;
  height: 64px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-seal { width: 34px; height: 34px; color: var(--red); flex: none; }
.brand-name {
  font-family: var(--serif); font-weight: 900; font-size: 21px; letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-name em { font-style: normal; margin-left: 4px; }

/* ---------------- 多層導覽 ---------------- */

.site-nav { display: flex; gap: 2px; align-items: stretch; }
.nav-drop { position: relative; }
.nav-drop-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 6px 8px; border-radius: 6px;
  white-space: nowrap;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.nav-drop-btn svg { width: 10px; height: 10px; transition: transform 0.15s ease; color: var(--ink-3); }
.nav-drop-btn:hover { color: var(--ink); background: var(--paper-2); }
.nav-drop[data-active="true"] .nav-drop-btn { color: var(--red-deep); box-shadow: inset 0 -2.5px 0 var(--red); }
.nav-drop[data-course-drop] .nav-drop-btn { color: var(--ink); font-weight: 600; }
.nav-drop.open .nav-drop-btn { color: var(--ink); background: var(--paper-2); }
.nav-drop.open .nav-drop-btn svg { transform: rotate(180deg); }
.nav-drop-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;
  min-width: 208px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.nav-drop.open .nav-drop-menu { opacity: 1; transform: none; pointer-events: auto; }
.nav-drop-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  text-decoration: none; color: var(--ink); font-size: 14px;
  padding: 8px 12px; border-radius: 7px;
}
.nav-drop-menu a:hover { background: var(--paper-2); }
.nav-drop-menu a:first-child { color: var(--red-deep); font-weight: 600; }
.nav-drop-menu a i { font-style: normal; color: var(--ink-3); font-size: 12px; font-family: var(--mono); }

/* 桌機中段（1151–1330px）：導覽收緊，避免擠出橫向捲軸 */
@media (min-width: 1151px) and (max-width: 1330px) {
  .nav-drop-btn { font-size: 13px; padding: 6px 5px; gap: 4px; }
  .site-nav { gap: 0; }
  .header-search { min-width: 120px; }
}

.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 4.5px;
  width: 38px; height: 38px; padding: 0 8px;
  background: none; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer;
}
.nav-burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink-2); transition: transform 0.18s ease, opacity 0.18s ease; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-nav {
  border-top: 1.5px solid var(--line);
  background: var(--paper);
  max-height: 0; overflow: hidden;
  transition: max-height 0.25s ease;
}
.mobile-nav:not([hidden]) { max-height: 70vh; overflow-y: auto; }
.mobile-nav-inner { padding: 10px 28px 22px; }
.mnav-group { border-bottom: 1px solid var(--line-soft); }
.mnav-btn {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  font: inherit; font-size: 15.5px; font-weight: 600; color: var(--ink);
  background: none; border: 0; cursor: pointer; padding: 13px 2px;
}
.mnav-btn span { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 400; font-family: var(--mono); }
.mnav-btn::after { content: "＋"; color: var(--red); font-size: 16px; margin-left: 14px; }
.mnav-group.open .mnav-btn::after { content: "－"; }
.mnav-subs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px;
  max-height: 0; overflow: hidden; transition: max-height 0.22s ease;
}
.mnav-group.open .mnav-subs { max-height: 400px; padding-bottom: 12px; }
.mnav-subs a { font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 2px; }
.mnav-subs a:hover { color: var(--red-deep); }
.mnav-subs .mnav-all { grid-column: 1 / -1; color: var(--red-deep); font-weight: 600; }

.header-search { margin-left: auto; position: relative; flex: 1 1 180px; min-width: 150px; max-width: 280px; }
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}
#search-input {
  width: 100%; height: 40px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card);
  padding: 0 16px 0 36px;
  font: inherit; font-size: 14.5px; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#search-input::placeholder { color: var(--ink-3); }
#search-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3.5px rgba(178, 58, 42, 0.12); }

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.search-results:not([hidden]) { display: block; }
.sr-item { display: block; padding: 10px 16px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.active { background: var(--paper-2); }
.sr-item .sr-zh { font-family: var(--serif); font-weight: 700; font-size: 16px; }
.sr-item .sr-en { color: var(--ink-3); font-size: 12.5px; margin-left: 6px; letter-spacing: 0.04em; }
.sr-item .sr-def { display: block; color: var(--ink-2); font-size: 13px; line-height: 1.6; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: 14px 16px; color: var(--ink-3); font-size: 14px; }
.sr-kind {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--red-deep); background: var(--red-wash);
  border: 1px solid #e3c1b6; border-radius: 999px; vertical-align: 2px;
}

/* ---------------- hero ---------------- */

.hero { padding: 84px 0 66px; }
.hero-eyebrow {
  font-size: 14.5px; font-weight: 700; letter-spacing: 0.32em;
  color: var(--red-deep); margin-bottom: 22px;
}
.hero-eyebrow::before { content: ""; display: inline-block; width: 34px; height: 2px; background: var(--red); vertical-align: middle; margin-right: 14px; }
.hero-title { font-size: clamp(38px, 6.2vw, 62px); font-weight: 900; margin-bottom: 26px; }
.hero-sub { font-size: 18px; color: var(--ink-2); max-width: 34em; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-meta { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 14.5px; letter-spacing: 0.06em; }
.hero-meta i { font-style: normal; color: var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 700;
  padding: 12px 26px; border-radius: 999px; cursor: pointer;
  text-decoration: none; border: 2px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
.btn-primary { background: var(--red); color: #fdf6ec; }
.btn-primary:hover { background: var(--red-deep); color: #fff; transform: translateY(-1.5px); box-shadow: 0 8px 18px -8px rgba(143, 43, 30, 0.55); }
.btn-ghost { border-color: var(--ink-2); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); transform: translateY(-1.5px); }

/* ---------------- section head ---------------- */

.section-head { margin-bottom: 34px; }
.section-head h2 { font-size: 30px; display: flex; align-items: baseline; gap: 14px; }
.section-head h2::after { content: ""; flex: 1; border-bottom: 1.5px dashed var(--line); }
.section-head p { color: var(--ink-3); margin-top: 8px; font-size: 15.5px; }

/* ---------------- 目錄：章節卡 ---------------- */

.chapters { padding: 30px 0 40px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.chapter-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--ink-3); }
.cc-head { display: flex; align-items: center; gap: 14px; }
.cc-num {
  width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 900; font-size: 22px;
  color: var(--red); border: 2px solid var(--red); border-radius: 9px;
  background: var(--red-wash);
}
.cc-head-text { min-width: 0; }
.cc-title-link { position: static; text-decoration: none; color: var(--ink); }
.cc-title-link::after { content: ""; position: absolute; inset: 0; }
.cc-title { font-family: var(--serif); font-weight: 900; font-size: 22px; line-height: 1.3; display: block; }
.chapter-card:hover .cc-title { color: var(--red-deep); }
.cc-en {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink-3); text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.cc-blurb { font-size: 14px; color: var(--ink-2); line-height: 1.75; margin: 12px 0 16px; text-wrap: pretty; }
.cc-subs {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  border-top: 1px dashed var(--line); padding-top: 12px; margin-top: auto;
}
.cc-subs a { font-size: 12.5px; color: var(--ink-3); text-decoration: none; }
.cc-subs a:hover { color: var(--red-deep); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- 精選課堂 ---------------- */

.featured { padding: 30px 0 60px; }
.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* ---------------- 章節頁 ---------------- */

.chapter-head { padding: 20px 0 30px; border-bottom: 3px double var(--line); margin-bottom: 8px; }
.chapter-eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.22em; color: var(--red-deep); margin-bottom: 12px; }
.chapter-head h1 { font-size: clamp(32px, 5vw, 44px); margin-bottom: 14px; }
.chapter-lede { font-size: 17px; color: var(--ink-2); max-width: 40em; text-wrap: pretty; }
.chapter-meta { display: flex; gap: 12px; align-items: center; margin-top: 18px; color: var(--ink-3); font-size: 14px; }
.chapter-meta i { font-style: normal; color: var(--line); }

.sub-section { padding: 38px 0 8px; border-bottom: 1.5px solid var(--line-soft); scroll-margin-top: 84px; }
.sub-section:last-of-type { border-bottom: 0; }
.sub-head { display: flex; align-items: baseline; gap: 14px; }
.sub-head h2 { font-size: 23px; display: flex; align-items: center; gap: 12px; }
.sub-head h2::before { content: ""; width: 5px; height: 21px; background: var(--red); border-radius: 2px; }
.sub-count { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); letter-spacing: 0.1em; }
.sub-blurb { color: var(--ink-3); font-size: 14px; margin: 6px 0 18px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.chip-grid-tight { margin-bottom: 8px; }
.term-chip {
  position: relative; display: inline-flex; align-items: baseline; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 8px 16px 8px 14px;
  text-decoration: none; color: var(--ink);
  transition: border-color 0.13s ease, transform 0.13s ease, box-shadow 0.13s ease;
}
.term-chip:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow); }
.term-chip b { font-family: var(--serif); font-weight: 700; font-size: 15.5px; }
.term-chip span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; }
.term-chip.compact { background: transparent; border-style: dashed; padding: 6px 14px 6px 12px; }
.term-chip.compact b { font-size: 14.5px; font-weight: 600; }
.chip-demo {
  font-style: normal; font-size: 10.5px; font-weight: 700;
  color: #fff; background: var(--red); border-radius: 4px;
  padding: 1.5px 5px; align-self: center;
}

.term-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 16px;
  text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 0 rgba(66, 52, 22, 0.04);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.term-card::after {
  content: "→"; position: absolute; right: 16px; top: 16px;
  color: var(--red); opacity: 0; transform: translateX(-6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.term-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--ink-3); color: var(--ink); }
.term-card:hover::after { opacity: 1; transform: translateX(0); }
.term-card .tc-no { font-family: var(--mono); font-size: 12px; color: var(--ink-3); letter-spacing: 0.1em; }
.term-card .tc-name { font-family: var(--serif); font-weight: 900; font-size: 21px; }
.term-card .tc-name span { font-size: 13px; color: var(--ink-3); font-family: var(--mono); font-weight: 400; margin-left: 8px; letter-spacing: 0.05em; }
.term-card .tc-quote { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.term-card .tc-quote::before { content: "「"; color: var(--red); }
.term-card .tc-quote::after { content: "」"; color: var(--red); }

/* ---------------- breadcrumb ---------------- */

.breadcrumb { padding: 26px 0 4px; font-size: 14.5px; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--red-deep); text-decoration: underline; }
.breadcrumb em { font-style: normal; color: var(--ink); }

/* ---------------- term article ---------------- */

.term-article { max-width: 780px; margin: 0 auto 90px; padding: 12px 0 0; }

.term-head { border-bottom: 3px double var(--line); padding-bottom: 26px; margin-bottom: 14px; }
.term-chapter-tag { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-3); letter-spacing: 0.08em; margin-bottom: 14px; }
.term-no { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.14em; }
.term-title { font-size: clamp(34px, 5vw, 46px); }
.term-en {
  display: block; margin-top: 8px;
  font-family: var(--mono); font-size: 15px; font-weight: 400;
  color: var(--red-deep); letter-spacing: 0.16em; text-transform: uppercase;
}
.alias-line { margin-top: 16px; font-size: 14.5px; color: var(--ink-3); }
.alias-line b { color: var(--ink-2); font-weight: 500; }

.term-block { padding: 34px 0 6px; }
.term-block > h2 {
  font-size: 22px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px;
}
.term-block > h2::before {
  content: ""; width: 5px; height: 22px; background: var(--red); border-radius: 2px; flex: none;
}

.scenario-quote {
  font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.75;
  padding: 4px 0 4px 22px; border-left: 3px solid var(--red);
}
.scenario-note { margin-top: 14px; font-size: 14.5px; color: var(--ink-3); }

.prose p { margin-bottom: 1.1em; }
.prose p:last-child { margin-bottom: 0.2em; }
.prose strong { font-weight: 700; }
.prose code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--paper-2); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 1px 6px;
}

/* 別搞混 vs cards */

.vs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 6px 0 20px; }
.vs-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.vs-card h3 { font-size: 18px; margin-bottom: 8px; display: flex; align-items: center; gap: 9px; }
.vs-card .vs-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.vs-card.is-a .vs-dot { background: var(--red); }
.vs-card.is-b .vs-dot { background: var(--blue); }
.vs-card p { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; }

/* prompt box */

.prompt-box { background: var(--ink); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.prompt-box-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid rgba(248, 243, 231, 0.16);
}
.prompt-lang { color: #c9b98f; font-size: 12.5px; letter-spacing: 0.22em; font-family: var(--mono); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: rgba(248, 243, 231, 0.85); background: rgba(248, 243, 231, 0.1);
  border: 1px solid rgba(248, 243, 231, 0.25); border-radius: 999px;
  padding: 5px 14px; cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn:hover { background: rgba(248, 243, 231, 0.2); color: #fff; }
.copy-btn.copied { background: var(--red); border-color: var(--red); color: #fff; }
.prompt-body {
  font-family: var(--serif); font-size: 16.5px; line-height: 2;
  color: #f2ecdd; padding: 22px 26px;
  white-space: pre-wrap; overflow-x: auto;
}
.prompt-note { color: var(--ink-3); font-size: 14px; margin-top: 12px; }

/* references */

.references { list-style: none; margin-top: 4px; }
.references li { padding: 7px 0 7px 26px; position: relative; font-size: 15px; }
.references li::before { content: "◈"; position: absolute; left: 2px; color: var(--red); font-size: 13px; }
.references a { text-decoration: none; }
.references a:hover { text-decoration: underline; }
.references .ref-src { color: var(--ink-3); font-size: 13px; margin-left: 8px; }

/* pager */

.term-pager {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  margin-top: 54px; padding-top: 26px; border-top: 1.5px dashed var(--line);
}
.pager-link {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 13px 18px; text-decoration: none; color: var(--ink);
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.pager-link:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.pager-link .pl-dir { font-size: 12px; color: var(--ink-3); letter-spacing: 0.12em; }
.pager-link .pl-name { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.pager-link.next { text-align: right; }
.pager-home { font-size: 14px; color: var(--ink-2); text-decoration: none; white-space: nowrap; padding: 0 8px; }
.pager-home:hover { color: var(--red-deep); }

/* ---------------- course ---------------- */

.courses-hub { padding: 30px 0 40px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.course-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 24px 26px; text-decoration: none; color: var(--ink);
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--ink-3); }
.co-num { font-family: var(--mono); font-size: 12px; color: var(--red); letter-spacing: 0.18em; }
.co-title { font-family: var(--serif); font-weight: 900; font-size: 23px; line-height: 1.35; }
.course-card:hover .co-title { color: var(--red-deep); }
.co-en { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.12em; text-transform: uppercase; }
.co-blurb { font-size: 14px; color: var(--ink-2); line-height: 1.75; text-wrap: pretty; }
.co-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.co-meta i { font-style: normal; color: var(--line); }
.co-go {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--red-deep);
}
.co-go svg { width: 15px; height: 15px; transition: transform 0.15s ease; }
.course-card:hover .co-go svg { transform: translateX(3px); }

.course-head .hero-actions { margin-top: 22px; }
.progress-summary {
  display: inline-block; margin-left: 12px; padding: 2px 12px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
  color: #55673a; background: #e9eddf; border: 1.5px solid #c4cdb0; border-radius: 999px;
}

/* 課程總覽頁：收尾留白（取代舊的行內 spacer） */
.course-index { padding-bottom: 60px; }
.course-grid-tight { margin-bottom: 0; }

.case-brief {
  position: relative; overflow: hidden;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 30px 34px; margin: 26px 0 30px;
}
.cb-paw { position: absolute; right: 26px; top: 22px; width: 62px; fill: var(--red); opacity: 0.13; }
.cb-label { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.24em; color: var(--red-deep); margin-bottom: 10px; }
.cb-name { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cb-name h2 { font-size: 26px; }
.cb-name span { color: var(--ink-3); font-size: 14.5px; }
.cb-lines { list-style: none; margin-top: 14px; max-width: 46em; }
.cb-lines li { position: relative; padding: 5px 0 5px 24px; font-size: 15px; color: var(--ink-2); line-height: 1.8; }
.cb-lines li::before { content: "◈"; position: absolute; left: 2px; color: var(--red); font-size: 12px; }

.course-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.chc {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 16px 20px; text-decoration: none; color: var(--ink);
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.chc:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.chc-num { font-family: var(--mono); font-size: 21px; font-weight: 700; color: var(--red); letter-spacing: 0.04em; }
.chc-title { display: block; font-family: var(--serif); font-weight: 700; font-size: 18px; }
.chc:hover .chc-title { color: var(--red-deep); }
.chc-summary {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7;
}
.chc-state {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--ink-3); border: 1.5px dashed var(--line); border-radius: 999px;
  padding: 4px 12px; white-space: nowrap;
}
.chc.is-done .chc-state { color: #55673a; border: 1.5px solid #c4cdb0; background: #e9eddf; }
.chc.is-done .chc-title { color: var(--ink-2); }
.chc-state.is-next { color: var(--red-deep); border: 1.5px solid var(--red); }

.boss-quote {
  font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.85;
  padding: 4px 0 4px 22px; border-left: 3px solid var(--red);
}
.steps-list { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: step; }
.steps-list li { counter-increment: step; position: relative; padding: 9px 0 9px 44px; font-size: 15.5px; line-height: 1.8; }
.steps-list li + li { border-top: 1.5px dashed var(--line-soft); }
.steps-list li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 11px;
  font-family: var(--mono); font-size: 13px; color: var(--red); letter-spacing: 0.08em;
}

.ckpt-intro { color: var(--ink-2); font-size: 15px; margin-bottom: 16px; }
.ckpt-list { list-style: none; margin: 4px 0 10px; }
.ckpt-list li { position: relative; padding: 7px 0 7px 26px; font-size: 15px; color: var(--ink-2); }
.ckpt-list li::before { content: "◈"; position: absolute; left: 2px; color: var(--red); font-size: 12px; }

.ch-progress {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 48px; padding: 16px 20px;
  background: var(--card); border: 1.5px dashed var(--line); border-radius: 12px;
}
.ch-progress-note { font-size: 13px; color: var(--ink-3); }
.ch-progress .btn.is-done { background: #e9eddf; border-color: #c4cdb0; color: #55673a; }

/* ---------------- 404 ---------------- */

.notfound { text-align: center; padding: 110px 0 140px; }
.nf-code {
  font-family: var(--serif); font-weight: 900; font-size: 110px; line-height: 1;
  color: transparent; -webkit-text-stroke: 2.5px var(--red);
  margin-bottom: 18px;
}
.notfound h1 { font-size: 32px; margin-bottom: 16px; }
.notfound p { color: var(--ink-2); margin-bottom: 34px; }
.notfound .hero-actions { justify-content: center; margin-bottom: 0; }

/* ---------------- footer ---------------- */

.site-footer { border-top: 1.5px solid var(--line); background: var(--paper-2); margin-top: 20px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 40px; padding: 54px 28px 46px; }
.footer-logo { font-family: var(--serif); font-weight: 900; font-size: 26px; margin-bottom: 12px; }
.footer-logo span { color: var(--red); margin-left: 6px; }
.footer-brand p { font-size: 14.5px; color: var(--ink-2); }
.footer-nav { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.footer-nav .fn-title { font-weight: 700; color: var(--ink); margin-bottom: 8px; letter-spacing: 0.1em; }
.footer-nav a { text-decoration: none; color: var(--ink-2); padding: 2.5px 0; }
.footer-nav a:hover { color: var(--red-deep); }
.footer-note p { font-size: 13.5px; color: var(--ink-3); }
.footer-copy { margin-top: 14px; }

/* ---------------- entrance (克制版) ---------------- */

.term-card, .term-block, .chapter-card, .sub-section { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
  .reveal.in { opacity: 1; transform: none; }
}

/* ---------------- responsive ---------------- */

@media (max-width: 1150px) {
  .site-nav { display: none; }
  .nav-burger { display: inline-flex; }
}

@media (max-width: 860px) {
  .header-inner { gap: 12px; }
  .header-search { width: 200px; }
  .footer-inner { grid-template-columns: 1fr; gap: 30px; }
  .term-pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: left; }
  .pager-home { text-align: center; order: 3; }
  .mnav-subs { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  body { font-size: 16px; }
  .brand-name { font-size: 19px; }
  .header-search { width: auto; flex: 1; min-width: 0; max-width: none; }
  #search-input { padding-right: 10px; }
  .hero { padding: 56px 0 46px; }
  .scenario-quote { font-size: 19px; }
  .prompt-body { font-size: 15px; padding: 18px 20px; }
  .term-grid { grid-template-columns: 1fr; }
  .chapter-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .chc { grid-template-columns: auto 1fr; }
  .chc-state { grid-column: 2; justify-self: start; }
  .boss-quote { font-size: 18px; }
  .case-brief { padding: 24px 22px; }
  .cb-paw { width: 48px; right: 18px; top: 16px; }
}
