/* ── Design tokens ───────────────────────────────────────────
   Morandi palette: low-saturation colours with grey mixed in, so
   nothing shouts. Layout follows blog.ichentsai.tw — one reading
   column at 784px, serif headings, generous paragraph rhythm — but
   on a light greige ground rather than a dark shell.

   Two levels per hue: --x is the soft surface/line colour, --x-deep
   carries text weight where contrast is needed.
   ────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --shell: #EDEAE4;          /* page ground, warm greige */
  --header: #E3DED6;         /* header band, a shade deeper */
  --header-text: #4C4842;
  --header-muted: #8A837A;

  --card: #FBF9F6;           /* reading column, cards */
  --card-sunken: #F2EEE7;    /* callouts, filter panel */
  --border: #DED8CF;
  --border-strong: #C6BEB2;

  --heading: #4A453E;        /* warm near-black, never pure black */
  --text: #5C564F;
  --muted: #8A837A;
  --faint: #A9A199;

  --accent: #B08A72;         /* muted clay — lines, hovers */
  --accent-deep: #8C6450;    /* same hue with text-weight contrast */
  --accent-hover: #79543F;
  --accent-soft: #EFE5DC;

  --debt: #A97A66;           /* dusty terracotta */
  --debt-deep: #8A5C49;
  --debt-soft: #F0E4DE;
  --accum: #7F93A4;          /* dusty blue */
  --accum-deep: #5C7186;
  --accum-soft: #E3E9EE;

  --column: 784px;
  --radius: 10px;
  --gap: 40px;               /* paragraph rhythm */

  --serif: "Noto Serif TC", "Songti TC", Georgia, serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
          -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* ── Base ────────────────────────────────────────────────── */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--shell);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 2;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Sticky header ───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header);
  border-bottom: 1px solid var(--border-strong);
}

.site-header-inner {
  max-width: var(--column);
  margin: 0 auto;
  height: 61px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--header-text);
  text-decoration: none;
  min-width: 0;
}

.brand .mark { font-size: 1.15rem; flex: none; }
.brand .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.header-actions { display: flex; align-items: center; gap: .35rem; flex: none; }

.header-btn {
  font: inherit;
  font-size: .85rem;
  font-family: var(--sans);
  color: var(--header-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: .3rem .7rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.8;
  transition: color .15s, background .15s;
}

.header-btn:hover { color: var(--accent-deep); background: rgba(255, 255, 255, .55); }

/* ── Reading column ──────────────────────────────────────── */
.column {
  max-width: var(--column);
  margin: 0 auto;
  background: var(--card);
  padding: 28px 1rem 60px;
  min-height: 100vh;
}

/* ── Article head ────────────────────────────────────────── */
.crumbs {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.crumb-pill {
  background: var(--accent-deep);
  color: #fff;
  border-radius: 999px;
  padding: .15rem .85rem;
  font-size: .82rem;
  font-weight: 500;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4.2vw, 2.05rem);
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--heading);
  margin: 0 0 1.2rem;
}

.standfirst {
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 var(--gap);
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

/* ── Body rhythm ─────────────────────────────────────────── */
p { margin: 0 0 var(--gap); }

a { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); text-decoration-color: var(--accent); }

strong { font-weight: 700; color: var(--heading); }

ul, ol { margin: 0 0 var(--gap); padding-left: 1.5rem; }
li { margin-bottom: .75rem; }
li > ul, li > ol { margin: .75rem 0 0; }
li:last-child { margin-bottom: 0; }

section { scroll-margin-top: 76px; margin-bottom: 4.5rem; }

h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.7;
  font-weight: 700;
  color: var(--accent-deep);
  margin: 2.15rem 0 .55rem;
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
}

section:first-of-type h2 { margin-top: 0; }

h2 .num {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--faint);
  font-weight: 500;
  letter-spacing: .04em;
}

h3 {
  font-family: var(--sans);
  font-size: 1.12rem;
  line-height: 1.65;
  font-weight: 700;
  color: var(--heading);
  margin: 2.4rem 0 .6rem;
}

.section-note {
  color: var(--muted);
  font-size: .92rem;
  margin: 0 0 2rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--border);
}

/* ── Key badge ───────────────────────────────────────────── */
.key {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
  background: var(--accent-deep);
  padding: .1rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
  position: relative;
  top: -.15em;
}

/* ── Callouts ────────────────────────────────────────────── */
.callout {
  background: var(--card-sunken);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  margin: 0 0 var(--gap);
}

.callout > :last-child { margin-bottom: 0; }
.callout p { margin-bottom: 1.1rem; }

.callout-title {
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .03em;
  color: var(--accent-deep);
  margin-bottom: .5rem;
}

.callout.warn { border-left-color: var(--debt); }
.callout.warn .callout-title { color: var(--debt-deep); }

/* A line meant to be said out loud */
.script {
  font-family: var(--serif);
  font-size: 1.14rem;
  line-height: 1.9;
  background: var(--card-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  margin: 0 0 var(--gap);
  color: var(--heading);
  text-align: center;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--gap);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

table { border-collapse: collapse; width: 100%; font-size: .92rem; line-height: 1.8; }

th, td {
  text-align: left;
  padding: .75rem .95rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  font-size: .78rem;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  background: var(--card-sunken);
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
td.when { white-space: nowrap; font-family: var(--mono); font-size: .86rem; color: var(--muted); }
td small { color: var(--faint); }

/* ── Debt vs accumulation cards ──────────────────────────── */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0 0 var(--gap);
}

.type-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  background: var(--card);
}

.type-card h4 {
  font-family: var(--serif);
  margin: 0 0 .25rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: .5px;
}

.type-card .tagline {
  font-size: .88rem;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 1.1rem;
  padding-bottom: .95rem;
  border-bottom: 1px solid var(--border);
}

.type-card dl { margin: 0; font-size: .9rem; }

.type-card dt {
  font-size: .74rem;
  letter-spacing: .07em;
  color: var(--faint);
  font-weight: 700;
  margin-top: 1rem;
  line-height: 1.6;
}

.type-card dt:first-child { margin-top: 0; }
.type-card dd { margin: .1rem 0 0; line-height: 1.85; }

.type-card.debt { border-top: 3px solid var(--debt); }
.type-card.debt h4 { color: var(--debt-deep); }
.type-card.accum { border-top: 3px solid var(--accum); }
.type-card.accum h4 { color: var(--accum-deep); }

.pill {
  display: inline-block;
  font-size: .78rem;
  line-height: 1.9;
  padding: .05rem .6rem;
  border-radius: 999px;
  margin: 0 .3rem .35rem 0;
  font-weight: 500;
}

.pill.debt { background: var(--debt-soft); color: var(--debt-deep); }
.pill.accum { background: var(--accum-soft); color: var(--accum-deep); }

/* ── Ordered steps ───────────────────────────────────────── */
.steps { list-style: none; padding: 0; margin: 0 0 var(--gap); counter-reset: step; }

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.35rem 2.9rem;
  margin: 0 0 0 .9rem;
  border-left: 1px solid var(--border);
}

.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }

.steps li::before {
  content: counter(step);
  position: absolute;
  left: -.9rem;
  top: .1rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-family: var(--mono);
}

.steps .step-title { font-weight: 700; color: var(--heading); display: block; line-height: 1.8; }
.steps .step-body { color: var(--muted); font-size: .94rem; line-height: 1.85; }
.steps .step-body strong { color: var(--heading); }

/* ── Tonight checklist ───────────────────────────────────── */
.checklist {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-sunken);
  padding: 1.3rem 1.4rem;
  margin: 0 0 var(--gap);
}

.checklist-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.checklist h3 { margin: 0; font-size: 1.05rem; }

.checklist-sub {
  font-size: .86rem;
  color: var(--muted);
  margin: .2rem 0 1rem;
  padding-bottom: .95rem;
  border-bottom: 1px solid var(--border);
}

.checklist ul { list-style: none; padding: 0; margin: 0; }
.checklist li { margin: 0; }

.checklist label {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .5rem .55rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .94rem;
  line-height: 1.75;
  transition: background .12s;
}

.checklist label:hover { background: var(--card); }

.checklist input[type="checkbox"] {
  margin: .55rem 0 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  flex: none;
  cursor: pointer;
}

.checklist input:checked + .task { color: var(--faint); text-decoration: line-through; }
.checklist .task small { display: block; color: var(--faint); font-size: .82rem; text-decoration: none; line-height: 1.6; }

.btn {
  font: inherit;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .22rem .9rem;
  cursor: pointer;
  line-height: 1.8;
  transition: color .12s, border-color .12s;
}

.btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 2rem;
  font-size: .88rem;
  color: var(--faint);
  line-height: 1.9;
}

.site-footer p { margin: 0 0 .35rem; }

/* ── Back to top ─────────────────────────────────────────── */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 15;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 12px rgba(74, 69, 62, .14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(.5rem);
  transition: opacity .2s, transform .2s, visibility .2s, color .15s, border-color .15s;
}

.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 48rem) {
  body { font-size: 16.5px; }
  :root { --gap: 32px; }
  .column { padding: 24px 1rem 56px; }
}

@media (max-width: 26rem) {
  body { font-size: 16px; }
  .brand .name { font-size: .95rem; }
  .header-btn { padding: .3rem .5rem; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  :root {
    --shell: #fff; --card: #fff; --card-sunken: #f7f6f4;
    --text: #2b2823; --heading: #2b2823; --muted: #555; --faint: #777;
    --gap: 14px;
  }
  body { background: #fff; font-size: 10.5pt; line-height: 1.75; }
  .site-header, .to-top, .btn, .header-actions { display: none !important; }
  .column { max-width: none; padding: 0; min-height: 0; }
  section { margin-bottom: 1.6rem; page-break-inside: avoid; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.15rem; margin-top: 1.2rem; }
  h3 { font-size: 1rem; margin-top: 1rem; }
  .standfirst { margin-bottom: 1.2rem; padding-bottom: 1rem; }
  .type-grid { display: block; }
  .type-card { page-break-inside: avoid; margin-bottom: .8rem; }
  .callout, .script, .checklist, .table-wrap, .steps li { page-break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* ══════════════════════════════════════════════════════════
   Index page — a card grid of articles, one card per chapter
   ══════════════════════════════════════════════════════════ */

body.index { background: var(--shell); }

:root { --card-shadow: 0 1px 2px rgba(74, 69, 62, .05); }

.wide {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* ── Index masthead ──────────────────────────────────────── */
.index-head { text-align: center; margin-bottom: 2.5rem; }

.index-head h1 {
  margin: 0 auto .9rem;
  text-wrap: balance;
}

.index-head .standfirst {
  border: 0;
  padding: 0;
  margin: 0 auto;
  max-width: 40rem;
  text-align: left;
  color: var(--muted);
  font-size: .98rem;
}

.index-stats {
  display: flex;
  justify-content: center;
  gap: 2.75rem;
  flex-wrap: wrap;
  margin: 2.25rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.index-stats div { text-align: center; }

.index-stats .v {
  display: block;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.3;
}

.index-stats .l { font-size: .82rem; color: var(--muted); }

/* ── Category filter ─────────────────────────────────────── */
.filters {
  background: var(--card-sunken);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
}

.filter {
  font: inherit;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: .55rem;
  transition: color .15s, border-color .15s;
}

.filter .n { font-size: .84rem; color: var(--faint); }
.filter:hover { border-color: var(--accent); color: var(--accent); }

.filter[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.filter[aria-pressed="true"] .n { color: var(--accent); }

/* ── Card grid ───────────────────────────────────────────── */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.5rem;
}

.cards li { margin: 0; }

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--card-shadow);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 69, 62, .08);
}

/* Cover: no stock photography, just the chapter number on its own field */
.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: var(--tint);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Scrim so the overlaid pills stay legible on any photo */
.card-cover::after {
  content: "";
  position: absolute;
  inset: 0 0 55% 0;
  background: linear-gradient(rgba(74, 69, 62, .22), transparent);
  pointer-events: none;
}

.card:hover .card-cover img { transform: scale(1.02); }
.card-cover img { transition: transform .3s ease; }

.card-cover .tag {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 2;
  background: rgba(251, 249, 246, .93);
  color: var(--hue-deep);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.9;
  padding: .05rem .8rem;
  border-radius: 999px;
}

.card-cover .key-flag {
  position: absolute;
  top: .75rem;
  right: .75rem;
  z-index: 2;
  background: var(--hue-deep);
  color: #FBF9F6;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.9;
  padding: .05rem .65rem;
  border-radius: 999px;
}

.card-body { padding: 1.1rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }

.card-meta {
  font-size: .82rem;
  color: var(--faint);
  font-family: var(--mono);
  margin-bottom: .5rem;
}

.card h2 {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.6;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 .6rem;
  display: block;
  letter-spacing: .5px;
}

.card p {
  font-size: .93rem;
  line-height: 1.9;
  color: var(--muted);
  margin: 0 0 1.15rem;
}

.card .more {
  margin-top: auto;
  color: var(--accent);
  font-size: .92rem;
  font-weight: 500;
}

.card:hover .more { color: var(--accent-hover); }

/* Category hues — Morandi: dusty, greyed, none of them loud */
.cat-作息安排 { --hue: #B08A72; --hue-deep: #8A6450; --tint: #EDE3DA; }
.cat-讀書方法 { --hue: #8C9C8E; --hue-deep: #5F7263; --tint: #E2E8E2; }
.cat-應試技巧 { --hue: #8795A6; --hue-deep: #5C6D80; --tint: #E2E7ED; }
.cat-給家長  { --hue: #A8909C; --hue-deep: #7C6270; --tint: #EBE2E6; }
.cat-自我判讀 { --hue: #A59470; --hue-deep: #786A4B; --tint: #EAE5D8; }

.cards li[hidden] { display: none; }

/* ── Post breadcrumbs & prev/next ────────────────────────── */
.crumb-home { color: var(--muted); text-decoration: none; }
.crumb-home:hover { color: var(--accent); }
.crumb-sep { color: var(--faint); }
.crumb-num { color: var(--muted); font-size: .85rem; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, color .15s;
}

.post-nav-link:hover { border-color: var(--accent); color: var(--accent); }
.post-nav-link.is-empty { border: 0; }
.post-nav-link .dir { font-size: .8rem; color: var(--faint); line-height: 1.8; }
.post-nav-link .t { font-family: var(--serif); font-weight: 700; line-height: 1.7; }
.post-nav-link.next { text-align: right; }

@media (max-width: 40rem) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.is-empty { display: none; }
  .index-stats { gap: 1.75rem; }
  .wide { padding: 2rem 1rem 3rem; }
}

@media print {
  body.index { background: #fff; }
  .filters, .post-nav, .index-stats { display: none !important; }
  .cards { display: block; }
  .card { page-break-inside: avoid; margin-bottom: .6rem; box-shadow: none; }
  .card-cover { display: none; }
}

/* ── Article hero image ──────────────────────────────────── */
.hero { margin: 0 0 var(--gap); }

.hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  background: var(--card-sunken);
}

.figcredit {
  font-size: .78rem;
  line-height: 1.8;
  color: var(--faint);
  margin: .55rem 0 0;
}

.figcredit a { color: var(--faint); text-decoration-color: var(--border-strong); }
.figcredit a:hover { color: var(--accent); }

@media print {
  .hero, .card-cover { display: none !important; }
}

/* ── Index hero image ────────────────────────────────────── */
/* Constrained to the text measure and scaled proportionally. */
.index-hero {
  margin: 2.25rem auto 0;
  max-width: 40rem;         /* same measure as .index-head .standfirst */
}

.index-hero img {
  width: 100%;
  height: auto;             /* keep the source aspect ratio */
  display: block;
  border-radius: var(--radius);
  background: var(--card-sunken);
}

@media print {
  .index-hero { display: none !important; }
}

.index-hero .figcredit { text-align: center; }

/* ══════════════════════════════════════════════════════════
   Quest — the click-through stages in 09
   Game-shaped, but still inside the Morandi palette.
   ══════════════════════════════════════════════════════════ */

.quest {
  background: var(--card-sunken);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.4rem 1.5rem;
  margin: 0 0 var(--gap);
}

/* ── HUD: progress dots + focus meter ────────────────────── */
.quest-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.1rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.quest-track { display: flex; gap: .4rem; }

.quest-dot {
  width: .62rem;
  height: .62rem;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background .2s, transform .2s;
}

.quest-dot.is-done { background: var(--accent); }
.quest-dot.is-now { background: var(--accent-deep); transform: scale(1.35); }

.quest-meter { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.quest-meter-label { color: var(--faint); letter-spacing: .05em; }

.quest-meter-bar {
  width: 5.5rem;
  height: .45rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.quest-meter-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .35s ease;
}

.quest-meter-num { font-family: var(--mono); color: var(--muted); min-width: 2ch; }

/* ── Stage ───────────────────────────────────────────────── */
.quest-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.quest-icon { font-size: 1.35rem; line-height: 1; }

.quest-tag {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent-deep);
}

.quest-scene {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.9;
  color: var(--heading);
  margin: 0 0 1.2rem;
}

/* ── Options ─────────────────────────────────────────────── */
.quest-options { display: grid; gap: .6rem; }

.quest-option {
  font: inherit;
  font-family: var(--sans);
  font-size: .96rem;
  line-height: 1.75;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  width: 100%;
  padding: .85rem 1rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, transform .12s, background .15s;
}

.quest-option:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateX(2px);
}

.quest-option:disabled { cursor: default; opacity: .72; }

.quest-key {
  flex: none;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-sunken);
  border: 1px solid var(--border);
  margin-top: .18rem;
}

.quest-option.is-right {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
  opacity: 1;
}

.quest-option.is-right .quest-key {
  background: var(--accent-deep);
  color: var(--card);
  border-color: var(--accent-deep);
}

.quest-option.is-wrong { border-color: var(--debt); background: var(--debt-soft); }
.quest-option.is-wrong .quest-key { color: var(--debt-deep); border-color: var(--debt); }

/* ── Feedback ────────────────────────────────────────────── */
.quest-feedback {
  margin-top: 1.1rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-deep);
  background: var(--card);
}

.quest-feedback.is-wrong { border-left-color: var(--debt); }
.quest-feedback p { margin: 0 0 .9rem; font-size: .95rem; line-height: 1.9; }
.quest-feedback > :last-child { margin-bottom: 0; }

.quest-verdict {
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .05em;
  color: var(--accent-deep);
  margin-bottom: .45rem;
}

.quest-feedback.is-wrong .quest-verdict { color: var(--debt-deep); }
.quest-source { font-size: .85rem; color: var(--muted); }

.quest-next {
  font: inherit;
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 500;
  color: var(--card);
  background: var(--accent-deep);
  border: 0;
  border-radius: 999px;
  padding: .45rem 1.35rem;
  cursor: pointer;
  transition: background .15s;
}

.quest-next:hover { background: var(--accent-hover); }

/* ── Ending ──────────────────────────────────────────────── */
.quest-end { text-align: center; }

.quest-rank-label {
  font-size: .78rem;
  letter-spacing: .14em;
  color: var(--faint);
  margin-bottom: .4rem;
}

.quest-rank {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.5;
  letter-spacing: .5px;
}

.quest-rank-say {
  font-size: .95rem;
  line-height: 1.9;
  color: var(--text);
  max-width: 30em;
  margin: .5rem auto 0;
  text-align: left;
}

.quest-score {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 1.5rem 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.quest-score .v {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.4;
}

.quest-score .l { font-size: .8rem; color: var(--muted); }

.quest-recap-title { margin: 0 0 .8rem; font-size: 1rem; }
.quest-recap { list-style: none; margin: 0 0 1.5rem; padding: 0; text-align: left; }

.quest-recap li {
  display: flex;
  align-items: baseline;
  gap: .65rem;
  flex-wrap: wrap;
  font-size: .93rem;
  line-height: 1.85;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.quest-recap li:last-child { border-bottom: 0; }

.quest-recap .n {
  flex: none;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: .05rem .5rem;
}

.quest-recap a { font-size: .85rem; color: var(--muted); white-space: nowrap; }

@media (max-width: 30rem) {
  .quest { padding: 1.1rem 1rem 1.25rem; }
  .quest-score { gap: 1.75rem; }
}

@media print {
  .quest, .quest-hud { display: none !important; }
}
