:root {
  color-scheme: light;
  --ink: #2b1a0b;
  --paper: #fbf3e6;
  --card: #fdf9f0;
  --accent: #b45309;
  --accent-2: #8f4207;
  --seal: #8f4207;
  --ok: #2f8f5b;
  --bad: #c0432f;
  --line: #e6d3bf;
  --muted: #6f5d4a;
  --grad: linear-gradient(135deg, #3d2408 0%, #b45309 55%, #d97706 100%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at top left, rgba(180, 83, 9, .06), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(61, 36, 8, .07), transparent 55%);
  font-family: "Songti TC", "Noto Serif TC", serif;
  line-height: 1.75;
}
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--seal); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.no-print {}
.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;
}
.skiplink {
  position: absolute; left: -999px; top: 0; z-index: 100;
  padding: 10px 16px; color: white; background: var(--seal); border-radius: 0 0 8px 0;
}
.skiplink:focus { left: 0; }

.hero-header {
  min-height: 238px;
  position: relative;
  overflow: hidden;
  color: #f4f6ee;
  background: var(--grad);
  text-align: center;
}
.hero-header::before,
.hero-header::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
}
.hero-header::before { width: 390px; height: 390px; left: -110px; top: -235px; }
.hero-header::after { width: 260px; height: 260px; right: -55px; bottom: -180px; }
.formula-field {
  position: absolute;
  inset: 0;
  opacity: .2;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  user-select: none;
}
.formula-field span { position: absolute; text-shadow: 0 3px 22px rgba(0, 0, 0, .28); }
.formula-field span:nth-child(1) { left: 7%; top: 15%; font-size: 5.4rem; transform: rotate(-7deg); }
.formula-field span:nth-child(2) { left: 26%; top: 52%; font-size: 2.6rem; }
.formula-field span:nth-child(3) { left: 73%; top: 12%; font-size: 3rem; transform: rotate(7deg); }
.formula-field span:nth-child(4) { right: 8%; top: 54%; font-size: 2.2rem; }
.formula-field span:nth-child(5) { left: 54%; top: 10%; font-size: 2.4rem; }
.formula-field span:nth-child(6) { left: 42%; bottom: 5%; font-size: 2rem; }
.htext {
  position: absolute;
  z-index: 1;
  left: 0; right: 0; bottom: 0;
  padding: 64px 16px 18px;
  background: linear-gradient(180deg, transparent, rgba(7, 27, 29, .7) 60%, rgba(7, 27, 29, .88));
}
.htext h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: .2em; text-shadow: 0 1px 10px rgba(0, 0, 0, .5); }
.htext p { margin: 4px 0 0; font-size: .88rem; opacity: .92; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }

.checklink {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; z-index: 60;
  padding: 5px 12px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px;
  color: #eef9f7; background: rgba(15, 38, 43, .78); backdrop-filter: blur(4px);
  font-size: .8rem; text-decoration: none; opacity: .76;
}
.checklink::before { content: "⌕ "; }
.checklink:hover, .checklink:focus-visible { opacity: 1; }
.fontsize-ctrl {
  position: fixed; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); box-shadow: 0 1px 6px rgba(22, 34, 44, .2);
  transition: opacity .15s ease;
}
.fontsize-ctrl.folded { opacity: .55; }
.fontsize-ctrl:hover, .fontsize-ctrl:focus-within { opacity: 1; }
.fontsize-ctrl button {
  min-width: 36px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); background: #f6efe1; cursor: pointer;
}
.fontsize-ctrl.folded .fs-opt { display: none; }
html.fs-lg body { font-size: 1.15rem; }
html.fs-xl body { font-size: 1.3rem; }

.wrap { width: min(860px, calc(100% - 32px)); margin: 0 auto; padding: 16px 0; }
.panel, .question-card {
  position: relative;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 4px 16px;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(30, 42, 54, .08);
}
.panel h2, .question-card h2 {
  margin: 0 0 10px;
  padding-left: 8px;
  border-left: 4px solid var(--seal);
  color: var(--accent);
  font-size: 1.05rem;
}
.introbox {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-left: 3px solid var(--seal);
  border-radius: 0 8px 8px 0;
  color: var(--accent-2);
  background: #e8edf5;
  font-size: .88rem;
}
.introbox h2 { margin: 0 0 6px; color: var(--accent); font-size: .96rem; line-height: 1.45; }
.introbox p { margin: .25em 0; }
.introbox b { color: var(--ink); }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stat {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px 12px 4px 12px;
  background: rgba(248, 250, 255, .72);
}
.stat b { display: block; color: var(--ink); font-size: 1.1rem; line-height: 1.25; }
.stat span { display: block; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.quickstart {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 4px 16px 4px 16px;
  color: #f4f6ee;
  background: var(--grad);
  text-align: center;
}
.quickstart p { margin: 8px 0 0; opacity: .86; font-size: .82rem; }

.scorebar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 55;
  padding: 7px max(18px, calc((100% - 824px) / 2));
  border-bottom: 2px solid var(--seal);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 3px 12px rgba(19, 35, 44, .1);
  backdrop-filter: blur(12px);
  font-size: .86rem;
}
.scorebar > span { display: block; }
.scoreprog { height: 5px; margin-top: 4px; overflow: hidden; border-radius: 999px; background: #d8e0e9; }
.scoreprog i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--seal); transition: width .2s ease; }

.toolrow { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 8px; }
.toolrow h2 { margin-bottom: 0; }
.text-toggle {
  min-height: 36px; padding: 2px 4px; border: 0; color: var(--accent-2);
  background: transparent; cursor: pointer; font-size: .82rem;
}
.count { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }
.filter-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .85rem;
}
.catgroup { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.catgroup:last-child { border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.gtitle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}
.gtitle b { margin-right: auto; }
.gtitle .text-toggle { min-height: 34px; padding-inline: 2px; font-size: .75rem; }
.gtitle .expand-toggle { margin-left: 2px; }
.catdot { width: 9px; height: 9px; border-radius: 3px; background: #d7c5a5; }
.catdot-1 { background: #c9dab5; }
.catdot-2 { background: #b9d6d4; }
.catdot-3 { background: #bfcce4; }
.catdot-4 { background: #d4c1e8; }
.catdot-5 { background: #e5c0cf; }
.catdot-6 { background: #e4d1b8; }
.catdot-7 { background: #ccd5c7; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 7px 16px; padding: 0 0 12px 21px; }
.tag-checks label { color: var(--ink); font-size: .8rem; }
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-top: 13px;
  margin-top: 10px;
  border-top: 1px dashed var(--line);
}
.filter-controls label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .86rem; }
.filter-controls select { width: auto; min-width: 130px; min-height: 38px; }
.filter-controls input[type="number"] { width: 74px; min-height: 38px; }
.filter-controls input[type="checkbox"], .tag-checks input[type="checkbox"] { accent-color: var(--seal); }
.more-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.field { display: grid; gap: 4px; }
.field label { color: var(--muted); font-size: .82rem; font-weight: 700; }
select, input[type="text"], input[type="number"] {
  width: 100%; min-height: 44px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); background: #f6efe1;
}
.filter-note { margin: 10px 0 5px; color: var(--muted); font-size: .78rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 22px; border: 0; border-radius: 4px 12px 4px 12px;
  cursor: pointer; font-size: 1rem; text-decoration: none;
}
.btn-main, .btn:not(.btn-outline):not(.btn-sub):not(.ghost):not(.secondary) { color: #fff; background: var(--seal); }
.btn-main:hover, .btn:not(.btn-outline):not(.btn-sub):not(.ghost):not(.secondary):hover { filter: brightness(1.08); }
.btn-outline { border: 1.5px solid var(--seal); color: var(--seal); background: transparent; font-weight: 700; }
.btn-outline:hover { background: rgba(15, 118, 110, .08); }
.btn-sub, .btn.secondary { border: 1px solid var(--accent-2); color: var(--ink); background: #f0e2cc; }
.btn.ghost { border: 1px solid var(--line); color: var(--ink); background: #f6efe1; }
.btn:focus-visible, .choice:focus-visible, select:focus-visible, input:focus-visible,
.text-toggle:focus-visible, .fontsize-ctrl button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .4);
  outline-offset: 2px;
}

#questionArea { scroll-margin-top: 16px; }
.question-card { min-width: 0; }
.question-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.question-card .question-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  font-size: clamp(1.1rem, 3vw, 1.35rem);
}
.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 800; font-size: .78rem; letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.chip {
  padding: 3px 8px; border-radius: 4px 10px 4px 10px;
  color: var(--accent-2); background: #e3e9f3; font-size: .75rem; font-weight: 700;
}
.chip.accent { color: #735018; background: #f6e9c9; }
.counter { white-space: nowrap; color: var(--muted); font-size: .85rem; font-weight: 800; }
.question-image, .group-image {
  display: block; width: 100%; height: auto; margin: 14px auto 0;
  border: 1px solid var(--line); border-radius: 8px; background: white;
}
.structured-question {
  padding: 18px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 88%, white);
}
.structured-question .stem { font-size: 1.04rem; line-height: 2; }
.structured-question .katex-display { margin: .8em 0; overflow-x: auto; overflow-y: hidden; }
.official-source { margin-top: 10px; color: var(--muted); font-size: .82rem; }
.official-source summary { cursor: pointer; }
.official-source .question-image { margin-top: 8px; }
.transcription-pending {
  padding: 8px 11px;
  margin-top: 14px;
  border-left: 3px solid #c98a2e;
  color: var(--muted);
  background: rgba(201, 138, 46, .08);
  font-size: .78rem;
}
.question-figure { margin: 16px auto; text-align: center; }
.question-figure img { max-width: 100%; height: auto; }
.question-figure figcaption { color: var(--muted); font-size: .75rem; }
.group-image { border-left: 4px solid #c98a2e; }
.answer-zone { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.answer-zone p { margin-top: 0; }
.choice-list { display: grid; gap: 8px; }
.choice-list .choice {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 52px;
  padding: 8px 13px;
  text-align: left;
  font-weight: 500;
}
.choice-list .choice > span {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 700;
}
.choice-list .choice > .choice-content {
  display: block;
  flex: 1 1 auto;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  text-align: left;
  font-weight: 500;
}
.choice-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.choice {
  min-height: 46px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: #f6efe1; font-weight: 800; cursor: pointer;
}
.choice:hover, .choice.selected { border-color: var(--seal); color: var(--seal); background: #dff2ef; }
.choice.correct { border-color: var(--ok); color: var(--ok); background: rgba(40, 115, 90, .12); }
.choice:disabled.selected:not(.correct) { border-color: var(--bad); color: var(--bad); background: rgba(192, 67, 47, .09); }
.choice:disabled { cursor: default; opacity: 1; }
.feedback { display: none; margin-top: 12px; padding: 9px 12px; border-left: 4px solid; border-radius: 8px; font-weight: 700; }
.feedback.show { display: block; }
.feedback.ok { border-color: var(--ok); color: var(--ok); background: rgba(40, 115, 90, .1); }
.feedback.bad { border-color: var(--bad); color: var(--bad); background: rgba(192, 67, 47, .09); }
.explainBox, .optionStats {
  padding: 12px 14px;
  margin-top: 12px;
  border-left: 4px solid var(--seal);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--card) 72%, #e2d8bb);
}
.explainBox p { margin: .45em 0 0; }
.optionStats > b { display: block; margin-bottom: 8px; }
.optionStats small { display: block; margin-top: 8px; color: var(--muted); }
.rate-row {
  display: grid;
  grid-template-columns: minmax(74px, auto) 1fr 48px;
  align-items: center;
  gap: 10px;
  margin: 7px 0;
  font-size: .8rem;
}
.rate-row > i { display: block; height: 10px; overflow: hidden; border-radius: 999px; background: #dfe3d4; }
.rate-row > i > b { display: block; height: 100%; background: var(--bad); }
.rate-row > i > b.rate-ok { background: var(--ok); }
.rate-row > em { color: var(--muted); font-style: normal; text-align: right; }
.option-analysis-row { padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent); }
.option-analysis-row:last-of-type { border-bottom: 0; }
.option-analysis-head { display: grid; grid-template-columns: 76px 1fr 48px; align-items: center; gap: 10px; }
.option-analysis-head em { color: var(--muted); font-style: normal; text-align: right; }
.option-analysis-key { font-weight: 700; }
.option-analysis-row.is-correct .option-analysis-key { color: var(--ok); }
.option-analysis-row p { margin: 7px 0 0 86px; color: var(--muted); font-size: .84rem; }
.rate-track { height: 9px; margin: 7px 48px 0 86px; overflow: hidden; border-radius: 999px; background: #dfe3d4; }
.rate-track i { display: block; height: 100%; background: var(--bad); }
.rate-track i.rate-ok { background: var(--ok); }
.solution-steps { margin: 8px 0 0; padding-left: 1.5em; }
.solution-steps li { margin: .6em 0; }
.math-error { color: var(--bad); }
.utility-panel,
.paper-panel { scroll-margin-top: 58px; }
.paper-intro { margin: 0 0 8px; font-size: .9rem; }
.paper-filter-info,
.paper-link-output { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.paper-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.paper-controls label,
.paper-actions label { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; }
.paper-year-filter {
  min-width: min(100%, 250px);
  padding: 0;
  margin: 0;
  border: 0;
}
.main-year-filter { min-width: min(100%, 250px); }
.main-year-filter .paper-year-options { min-width: 0; }
.paper-year-filter legend { margin-bottom: 4px; font-size: .86rem; }
.paper-year-multi { position: relative; }
.paper-year-multi summary {
  min-height: 42px;
  padding: 9px 34px 9px 12px;
  overflow: hidden;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paper-year-options {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 2px 10px;
  width: 100%;
  min-width: 250px;
  max-height: 280px;
  padding: 10px;
  margin-top: 4px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(29, 43, 79, .16);
}
.paper-year-options label { min-height: 38px; cursor: pointer; }
.paper-year-options input { width: 18px; height: 18px; }
.paper-year-all {
  grid-column: 1 / -1;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.paper-controls select,
.paper-actions select { width: auto; min-width: 132px; min-height: 42px; }
.paper-actions { align-items: center; }
#paperSelectedCount { color: var(--muted); font-size: .9rem; }
.paper-link-output {
  padding: 9px 11px;
  margin-top: 10px;
  border-left: 3px solid var(--seal);
  background: color-mix(in srgb, var(--seal) 8%, transparent);
  overflow-wrap: anywhere;
}
.paper-question-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  max-height: 370px;
  padding-top: 10px;
  margin-top: 10px;
  overflow-y: auto;
  border-top: 1px dashed var(--line);
}
.paper-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--card) 88%, white);
  font-size: .78rem;
  line-height: 1.5;
}
.paper-item input { margin-top: 3px; accent-color: var(--seal); }
.paper-body { margin-top: 10px; }
.paper-options {
  columns: 2;
  column-gap: 28px;
  margin: 10px 0 0;
  padding-left: 2em;
}
.paper-options li { break-inside: avoid; margin: 6px 0; padding-left: 4px; }
.paper-teacher { margin-top: 24px; }
.paper-answer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 12px 0 20px;
}
.paper-solution { break-inside: avoid; margin: 12px 0; }
.ranking-list { padding-left: 1.5em; }
.ranking-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.ranking-list li span { float: right; color: var(--seal); font-weight: 800; }
.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.paper-question { break-inside: avoid; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.meta-box { padding: 9px 11px; border-radius: 4px 10px 4px 10px; background: #e8edf5; }
.meta-box b { display: block; font-size: 1rem; }
.meta-box span { color: var(--muted); font-size: .75rem; }
.empty {
  padding: 42px 18px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 4px 16px;
  color: var(--muted); background: var(--card); text-align: center;
}
.footer { padding: 20px 10px 92px; color: var(--muted); font-size: .78rem; text-align: center; }
.footer-report { border: 0; padding: 0; color: inherit; background: none; font: inherit; text-decoration: underline; cursor: pointer; }
.report-dialog { width: min(92vw, 560px); max-height: 90vh; box-sizing: border-box; overflow: auto; border: 1px solid var(--line); border-radius: 18px; padding: 0; color: var(--ink); background: var(--card); box-shadow: 0 24px 80px rgba(0, 0, 0, .28); }
.report-dialog::backdrop { background: rgba(8, 18, 24, .58); backdrop-filter: blur(3px); }
.report-dialog form { display: grid; gap: 10px; padding: 22px; }
.report-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.report-head h2 { margin: 0; }
.dialog-close { border: 0; padding: 0 6px; color: var(--muted); background: none; font-size: 2rem; line-height: 1; cursor: pointer; }
.report-context { margin: 0 0 4px; color: var(--muted); }
.report-dialog select, .report-dialog textarea { width: 100%; box-sizing: border-box; }
.report-dialog textarea { resize: vertical; }
.report-status { min-height: 1.5em; margin: 0; }
.report-status.ok { color: var(--ok); }
.report-status.bad { color: var(--bad); }
.report-trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.report-question-btn { margin-left: auto; }
.flinks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 8px; }

/* 查題與關於頁仍使用原本的共用導覽結構。 */
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(16px);
}
.topbar .shell {
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: .03em;
}
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 4px 12px 4px 12px;
  color: white; background: var(--grad); box-shadow: 0 5px 14px rgba(15, 118, 110, .22);
}
.nav { display: flex; gap: 14px; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 700; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--seal); }

.content-page { width: min(840px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0 90px; }
.content-page h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
.content-page h2 { margin-top: 36px; }
.notice { padding: 16px 18px; border-left: 5px solid #c98a2e; border-radius: 10px; background: #fffbeb; }
.lookup { display: grid; grid-template-columns: 1fr 1fr minmax(90px, .3fr) auto; gap: 10px; margin: 24px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #dfe8ed; --paper: #10171c; --card: #19232a; --accent: #70c9c1;
    --accent-2: #a4bdc7; --seal: #55bcb2; --ok: #7fc79a; --bad: #e08a70;
    --line: #30414a; --muted: #91a3ad;
  }
  body { background-image: none; }
  .introbox, .meta-box { background: #202d35; }
  .stat, select, input[type="text"], input[type="number"], .choice, .fontsize-ctrl button { color: var(--ink); background: #202d35; }
  .chip { background: #293942; }
  .chip.accent { color: #f1d699; background: #443a23; }
  .btn-sub, .btn.secondary, .btn.ghost { color: var(--ink); background: #293942; }
  .question-image, .group-image { background: #fff; }
}
@media (max-width: 700px) {
  .wrap { width: min(100% - 20px, 860px); padding-top: 10px; }
  .hero-header { min-height: 220px; }
  .htext h1 { font-size: 1.3rem; letter-spacing: .12em; }
  .htext p { font-size: .8rem; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .choice-grid { grid-template-columns: repeat(5, minmax(48px, 1fr)); overflow-x: auto; }
  .filter-controls { align-items: flex-start; }
  .filter-controls label { white-space: normal; }
  .meta-grid { grid-template-columns: 1fr; }
  .lookup { grid-template-columns: 1fr; }
  .question-head { gap: 10px; }
  .footer { padding-bottom: 120px; }
  select, input[type="text"], input[type="number"] { font-size: 16px; }
  .topbar .shell { min-height: 58px; }
  .brand { font-size: .9rem; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row span:last-child { grid-column: 1 / -1; }
  .paper-question-list { grid-template-columns: 1fr; max-height: 460px; }
  .paper-controls { align-items: flex-start; }
  .paper-controls label,
  .paper-actions label { white-space: normal; }
  .paper-answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-options { columns: 1; }
}
@media (max-width: 420px) {
  .filter-grid { grid-template-columns: 1fr; }
  .btn { flex: 1 1 auto; padding: 10px 16px; font-size: .95rem; }
  .quickstart .btn { flex: 0 1 auto; }
}
@media print {
  .no-print, .checklink, .fontsize-ctrl, .skiplink, .hero-header, .footer { display: none !important; }
  body { background: white; color: black; }
  .wrap { width: 100%; padding: 0; }
  .question-card, .paper-question { box-shadow: none; border: 0; break-inside: avoid; }
  .paper-teacher { break-before: page; }
  .paper-solution { break-inside: avoid; }
}
