:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --ink: #1c2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --mc: #7c3aed;
  --mc-soft: #ede9fe;
  --fill: #0891b2;
  --fill-soft: #cffafe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  padding: 34px 0 26px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: .5px; }
.hero .sub { margin: 0; max-width: 78ch; font-size: 14px; opacity: .92; }
.hero code { background: rgba(255,255,255,.16); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.hero b { color: #fde68a; }

.stats { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.stats .chip {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  padding: 3px 12px; border-radius: 999px; font-size: 13px;
}
.stats .chip strong { font-variant-numeric: tabular-nums; }

.controls { margin: 22px 0 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
  transition: all .15s ease;
}
.tabs button span { color: var(--muted); font-size: 12.5px; margin-left: 2px; }
.tabs button:hover { border-color: var(--accent); color: var(--accent); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs button.active span { color: #dbeafe; }

.toolbar {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.toolbar select, .toolbar input[type="search"] {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px;
  font-size: 14px; color: var(--ink); background: #fff; min-width: 150px;
}
.toolbar input[type="search"] { flex: 1; min-width: 220px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }

.hintbar { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px 16px; margin-bottom: 16px;
  scroll-margin-top: 20px;
}
.card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

.card .top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge {
  font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.badge.no { background: var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge.mc { background: var(--mc-soft); color: var(--mc); }
.badge.fill { background: var(--fill-soft); color: var(--fill); }
.badge.dlg { background: var(--warn-soft); color: var(--warn); }
.badge.lvl { background: #f1f5f9; color: var(--muted); }
.src { margin-left: auto; font-size: 12px; color: var(--muted); max-width: 46ch; text-align: right; }

.question { font-size: 16px; white-space: pre-wrap; word-break: break-word; }
.question.flat { white-space: normal; }
.question.flat::after { content: ""; display: block; }
.junyi-note {
  margin-top: 6px; font-size: 12.5px; color: var(--warn);
  background: var(--warn-soft); display: inline-block; padding: 2px 10px; border-radius: 8px;
}

.blankline { border-bottom: 2px solid var(--ink); padding: 0 2px; letter-spacing: -1px; }
.blank {
  display: inline-flex; align-items: baseline; gap: 0; margin: 0 3px;
  border-bottom: 2px solid var(--ink); padding: 0 2px; vertical-align: baseline;
}
.blank .edge { font-size: 15px; font-weight: 600; }
.blank input {
  border: none; outline: none; width: 8ch; text-align: center; font-size: 15px;
  background: transparent; padding: 0 2px 1px; font-family: inherit; color: var(--ink);
}
.blank input.revealed { color: var(--ok); font-weight: 700; }

.choices { margin-top: 12px; display: grid; gap: 6px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
}
.choice .letter {
  font-weight: 700; color: var(--muted); flex: 0 0 auto;
  width: 1.4em; font-variant-numeric: tabular-nums;
}
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.correct .letter { color: var(--ok); }
.choice.hidden-answer .mark { visibility: hidden; }
.choice.empty { opacity: .45; }
.choice .mark { margin-left: auto; color: var(--ok); font-size: 13px; font-weight: 600; white-space: nowrap; }
.x-choice { opacity: .55; }

details.hint { margin-top: 12px; font-size: 13.5px; }
details.hint summary {
  cursor: pointer; color: var(--muted); user-select: none; width: fit-content;
  padding: 2px 10px; border-radius: 8px; background: #f1f5f9;
}
details.hint .body { padding: 8px 2px 0; color: #334155; white-space: pre-wrap; }

.foot { padding: 26px 20px 40px; color: var(--muted); font-size: 13px; }

.empty-tip { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 20px; }
  .src { margin-left: 0; text-align: left; max-width: 100%; }
  .toolbar input[type="search"] { min-width: 160px; }
}
