:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #6f6860;
  --line: #e7e0d4;
  --line-strong: #d4cdc0;
  --accent: #0f5c56;
  --accent-2: #0b7a70;
  --accent-soft: #dceeea;
  --gold: #8a5a10;
  --gold-soft: #f8ead0;
  --ok: #0d6b45;
  --ok-bg: #e6f5ee;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --warn: #9a4b08;
  --warn-bg: #fdecd4;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 10px 28px rgba(28, 25, 23, 0.06);
  --radius: 16px;
  --font: "PingFang HK", "Noto Sans TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Source Han Sans TC", sans-serif;
  --serif: "Songti TC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", "PingFang HK", serif;
  --content: 44rem;
  --focus: 0 0 0 3px rgba(15, 92, 86, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(15, 92, 86, 0.08), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(138, 90, 16, 0.07), transparent 45%),
    var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--ink);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { top: 0.75rem; }
.hero, .home-main, .site-footer {
  width: min(1100px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}
.hero { padding: 2.5rem 0 1.5rem; }
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.lede {
  margin: 0 0 1.25rem;
  max-width: 42rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
  word-break: keep-all;
}
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.hero-pills li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.home-main { padding-bottom: 3rem; }
.home-main h2 {
  margin: 2rem 0 0.85rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 650;
}
.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
@media (min-width: 640px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .bento { grid-template-columns: repeat(5, 1fr); }
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.15rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  min-height: 8.5rem;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.card .issue {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 650;
  letter-spacing: 0.06em;
}
.card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.card .go { margin-top: auto; padding-top: 0.7rem; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.card.featured {
  background: linear-gradient(180deg, rgba(15, 92, 86, 0.08), transparent 40%), var(--paper);
  min-height: 9.5rem;
}
@media (min-width: 640px) {
  .card.featured { grid-column: 1 / -1; flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .card.featured .go { padding-top: 0; }
}
.site-footer { padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: 0.82rem; }

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  width: min(var(--content), calc(100% - 1.5rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
}
.bar-title {
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  flex: 1 1 auto;
  min-width: 8rem;
}
.bar-meta { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.chip {
  font-size: 0.8rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-weight: 600;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 6.2rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line);
}
.timer.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.timer.danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.timer.ended { background: var(--ink); color: #fff; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: #fff; }
.btn-danger { background: var(--bad); }

.nav-pills {
  width: min(var(--content), calc(100% - 1.5rem));
  margin: 0 auto;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.45rem 0 0.65rem;
  scrollbar-width: thin;
}
.nav-pills a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  min-width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 650;
}
.nav-pills a.answered { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.nav-pills a.correct { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.nav-pills a.wrong { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.nav-pills a.reviewed { background: var(--gold-soft); color: var(--gold); border-color: transparent; }

.wrap { width: min(var(--content), calc(100% - 1.5rem)); margin: 0 auto 3.5rem; }
.cover, .paper, .results-hero, .question, .dialog, .passage {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
}
.cover { margin-top: 1.25rem; padding: 1.6rem 1.35rem 1.5rem; }
.cover h1 { margin: 0 0 0.4rem; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -0.03em; }
.cover .meta { color: var(--muted); margin: 0 0 1rem; }
.cover .title-en { margin: 0 0 0.85rem; color: var(--muted); font-size: 0.95rem; }
.cover ol { margin: 0 0 0.5rem; padding-left: 1.2rem; color: var(--ink-soft); }
.cover .inst-en { margin: 0 0 1.2rem; color: var(--muted); font-size: 0.9rem; }
.cover .aid-banner { margin: 0 0 1.2rem; }
.cover .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.section-head { margin: 1.6rem 0 0.7rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }

.passage { margin: 0.85rem 0 1.1rem; padding: 1.25rem 1.2rem 1.3rem; }
.passage-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 650;
}
.passage h3 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  font-family: var(--serif);
}
.passage-author, .passage-source, .passage-words {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.passage-source { margin-top: 0.45rem; }
.aid-banner, .aid-label {
  background: var(--gold-soft);
  color: #5c3b0a;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  margin: 0.85rem 0 0.7rem;
}
.aid-label { display: inline-block; margin: 0 0 0.6rem; font-size: 0.78rem; letter-spacing: 0.04em; padding: 0.3rem 0.6rem; }
.passage-zh {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.9;
  letter-spacing: 0.02em;
}
.passage-zh p, .passage-en p { margin: 0 0 1em; }
.passage-zh p:last-child, .passage-en p:last-child { margin-bottom: 0; }
.passage-en {
  margin-top: 1.1rem;
  padding: 0.9rem 0.95rem;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}
.passage-en-title { font-weight: 650; color: var(--muted); font-size: 0.88rem; margin: 0 0 0.6rem; }
.passage-notes {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.passage-notes h4 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.passage-notes ul { margin: 0; padding-left: 1.15rem; }
.passage-notes li { margin: 0.3rem 0; }
.jump-passage {
  font-size: 0.82rem;
  margin: 0.4rem 0 0.8rem;
}
.jump-passage a { font-weight: 600; }

.question { margin: 0.85rem 0; padding: 1.15rem 1.15rem 1.2rem; }
.q-head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; margin-bottom: 0.7rem; }
.q-head h3 { margin: 0; font-size: 1rem; }
.q-points { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.q-stem { overflow-wrap: anywhere; }
.q-stem p:first-child { margin-top: 0; }
.q-stem p:last-child { margin-bottom: 0; }
.stem-en, .option-en, .expl-en, .model-en {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92em;
  line-height: 1.55;
  font-weight: 400;
}
.options { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.option {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.6rem;
  align-items: start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}
.option .key {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--ink-soft);
}
.option p { margin: 0; }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.selected .key { background: var(--accent); color: #fff; }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.correct .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.written { margin-top: 0.9rem; display: grid; gap: 0.45rem; }
.written label { font-size: 0.85rem; font-weight: 650; color: var(--ink-soft); display: grid; gap: 0.3rem; }
.char-count { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  font: inherit;
  line-height: 1.7;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: inherit;
}
textarea.writing { min-height: 12rem; }
textarea:disabled, .option:disabled { opacity: 0.85; cursor: default; }

.results-hero { margin: 1.25rem 0 1rem; padding: 1.3rem 1.2rem; }
.results-hero h1 { margin: 0 0 0.35rem; font-size: 1.5rem; letter-spacing: -0.03em; }
.score-line { font-size: 2rem; font-weight: 750; letter-spacing: -0.04em; }
.score-line small { font-size: 1rem; font-weight: 550; color: var(--muted); }
.score-break { margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.score-note {
  margin: 0.75rem 0 0;
  background: var(--gold-soft);
  color: #5c3b0a;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.timeout-note { margin: 0.6rem 0 0; color: var(--warn); font-weight: 650; }
.review { margin-top: 1rem; display: grid; gap: 0.75rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }
.review h4 {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.review-block { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; }
.review-block p:first-child { margin-top: 0; }
.review-block p:last-child { margin-bottom: 0; }
.review-block.ok { background: var(--ok-bg); border-color: transparent; }
.review-block.bad { background: var(--bad-bg); border-color: transparent; }
.mark-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.2rem 0; }
.mark-table th, .mark-table td {
  border: 1px solid var(--line-strong);
  padding: 0.4rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.mark-table th { background: #f6f1e8; font-weight: 650; }
.mark-table td:nth-child(2) { width: 3.5rem; text-align: center; white-space: nowrap; }
.self-mark { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.self-mark span { font-size: 0.85rem; font-weight: 650; margin-right: 0.2rem; }
.self-mark button {
  appearance: none;
  font: inherit;
  font-weight: 650;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  min-width: 2rem;
  height: 2rem;
  cursor: pointer;
}
.self-mark button.on { background: var(--accent); color: #fff; border-color: transparent; }
.self-mark-note { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.42);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}
.dialog { max-width: 26rem; width: 100%; padding: 1.2rem 1.15rem; }
.dialog h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.dialog p { margin: 0 0 1rem; color: var(--ink-soft); }
.dialog .actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
.hidden { display: none !important; }
.passages-toc {
  font-size: 0.88rem;
  margin: 0 0 0.8rem;
}
@media (max-width: 639px) {
  .bar-title { font-size: 0.88rem; }
  .question, .cover, .results-hero, .passage { padding-left: 0.95rem; padding-right: 0.95rem; }
  .timer { min-width: 5.4rem; }
  .passage-zh { font-size: 1.05rem; line-height: 1.85; }
}
