:root {
  --ink: #241c16;
  --muted: #6d6258;
  --paper: #f4efe6;
  --card: #fffdf9;
  --line: #e4d8c8;
  --cinnabar: #9d342c;
  --pine: #1c6842;
  --pine-bg: #e5f3eb;
  --gold: #8a6232;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.04), 0 12px 28px rgba(60, 40, 20, 0.05);
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 240px at 100% -40px, rgba(163, 59, 50, 0.05), transparent 50%),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid #c4896a; outline-offset: 2px; }

.wrap { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
body:has(.tabs) .wrap { width: min(860px, calc(100% - 32px)); }

.hero {
  background:
    radial-gradient(900px 160px at 0% -40%, rgba(196, 92, 74, 0.35), transparent 55%),
    #241c16;
  color: #f7f1e8;
}
.hero-inner {
  padding: 26px 0 22px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}
body:has(.tabs) .hero-inner { padding: 16px 0 14px; align-items: center; }
.brand { display: flex; gap: 14px; align-items: center; min-width: 0; }
.seal {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid rgba(247, 241, 232, 0.7);
  color: #f3d2b0;
  font-family: var(--serif);
  letter-spacing: 0.14em;
  font-size: 15px;
}
body:has(.tabs) .seal { width: 42px; height: 42px; font-size: 13px; }
.hero h1 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 650;
  font-size: 32px;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-wrap: pretty;
}
body:has(.tabs) .hero h1 { font-size: 22px; font-weight: 600; letter-spacing: 0; }
.hero p { margin: 6px 0 0; color: rgba(247, 241, 232, 0.72); font-size: 14px; }
.hero .crumb { color: rgba(247, 241, 232, 0.72); font-size: 13px; }
.hero .crumb:hover { color: #fff; }
.hero-stats { display: flex; gap: 22px; padding-bottom: 2px; flex: none; }
.hero-stats b {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.hero-stats span { color: rgba(247, 241, 232, 0.6); font-size: 12px; letter-spacing: 0.08em; }

.page { padding: 8px 0 72px; }
.filters {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  gap: 10px;
  margin: 0 -8px;
  padding: 14px 8px 10px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px);
}
.search {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  outline: none;
  box-shadow: var(--shadow);
}
.search:focus { border-color: #c4a27a; box-shadow: 0 0 0 4px rgba(157, 52, 44, 0.08); }
.chips, .tabs { scrollbar-width: none; }
.chips::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; }
.chip, .select {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip.is-on {
  color: #f7f1e8;
  background: var(--ink);
  border-color: var(--ink);
}
.selects { display: flex; gap: 8px; flex-wrap: wrap; }
.select { border-radius: 10px; padding: 8px 12px; }
.result-line { color: var(--muted); font-size: 13px; min-height: 1.2em; }

.year { margin: 6px 0 26px; }
.year h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.year h2 span { color: var(--muted); font-size: 13px; font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  min-height: 132px;
}
.card:hover { border-color: #d7b39a; }
.card .region {
  align-self: flex-start;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cinnabar);
  background: #f8ecea;
  border-radius: 999px;
  padding: 2px 8px;
}
.card strong { font-size: 16.5px; font-weight: 650; line-height: 1.45; }
.card .mods { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.card .mods span {
  color: var(--muted);
  font-size: 12px;
  background: #f6f1e8;
  border-radius: 999px;
  padding: 2px 8px;
}
.card .mods span:first-child { color: var(--ink); background: transparent; padding-left: 0; font-weight: 650; }

.crumb { color: var(--muted); text-decoration: none; font-size: 14px; }
.crumb:hover { color: var(--cinnabar); }

.toolbar { display: flex; gap: 8px; flex: none; }
.toolbar button {
  background: transparent;
  color: #f7f1e8;
  border: 1px solid rgba(247, 241, 232, 0.4);
  border-radius: 999px;
  padding: 7px 14px;
}
.toolbar button:hover { background: rgba(255, 255, 255, 0.08); border-color: #fff; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tabs a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
.tabs a.is-on, .tabs a:hover { color: var(--ink); border-color: #c9b39a; }
.tabs a.is-on { background: var(--ink); color: #f7f1e8; border-color: var(--ink); }

.module { margin-top: 22px; scroll-margin-top: 58px; }
.module > h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 650;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.module > h2 small { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 8px; }

.material {
  background: #fbf7f1;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 14px;
  padding: 14px 16px 6px;
  margin-bottom: 14px;
}
.material > h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.12em; color: var(--gold); font-weight: 650; }
.material-body p { margin: 0 0 10px; }

.q {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 14px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
  scroll-margin-top: 64px;
}
.q-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-no {
  min-width: 26px; height: 26px; padding: 0 6px; flex: none;
  display: grid; place-items: center;
  background: var(--cinnabar);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.q-topic { color: var(--gold); font-size: 13px; }
.q-id { color: #b3a496; font-size: 12px; }
.reveal {
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
}
.reveal:hover { border-color: #d7b39a; color: var(--ink); }
.q.is-open .reveal { background: var(--pine-bg); border-color: #b7d7c6; color: var(--pine); }

.stem, .analysis, .material-body { font-size: 16.5px; line-height: 1.85; }
.stem p, .analysis p { margin: 0 0 8px; }
.stem u, .material-body u { text-decoration: none; border-bottom: 1px solid #9a8b78; padding: 0 0.2em; }

.opts {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 8px;
}
.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  background: #faf6f1;
  border: 1px solid transparent;
  cursor: pointer;
}
.opt:hover { border-color: #e0d0bc; }
.opt.is-picked {
  background: #f8ebe3;
  border-color: #e0b79a;
}
.opt.is-picked .k { background: var(--cinnabar); color: #fff; }
.opt .k {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #efe4d4;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}
.q.is-open .opt.is-answer, body.show-all .opt.is-answer {
  background: var(--pine-bg);
  border-color: #c5e4d2;
}
.q.is-open .opt.is-answer .k, body.show-all .opt.is-answer .k { background: var(--pine); color: white; }
.q.is-open .opt.is-picked:not(.is-answer),
body.show-all .opt.is-picked:not(.is-answer) {
  background: #fdeeee;
  border-color: #f0c2be;
}
.q.is-open .opt.is-picked:not(.is-answer) .k,
body.show-all .opt.is-picked:not(.is-answer) .k { background: var(--cinnabar); color: #fff; }

.solution {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f4faf6;
}
.q.is-open .solution, body.show-all .solution { display: block; }
.ans-line { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.ans-line span { color: var(--muted); }
.ans-line b {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 6px;
  border-radius: 7px;
  background: var(--pine);
  color: #fff;
  font-size: 14px;
}

.stem img, .material-body img, .analysis img, .opt img { cursor: zoom-in; border-radius: 8px; }
img[flag="tex"] {
  vertical-align: -0.15em;
  width: auto !important;
  height: auto !important;
  max-width: min(100%, 520px);
  max-height: 7em;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}

.lightbox {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(24, 18, 14, 0.86);
  display: grid; place-items: center;
  padding: 28px 24px 56px;
}
.lightbox img {
  max-width: min(1100px, 100%);
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  background: white;
}
.lightbox::after {
  content: "点击任意处关闭";
  position: absolute;
  bottom: 18px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.foot { color: var(--muted); font-size: 13px; padding: 18px 0 8px; }
.empty { padding: 36px 0; color: var(--muted); }

@media (max-width: 720px) {
  .wrap, body:has(.tabs) .wrap { width: min(100% - 24px, 1100px); }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero h1, body:has(.tabs) .hero h1 { font-size: 22px; }
  .hero-stats b { font-size: 22px; }
  .opts { grid-template-columns: 1fr; }
  .q { padding: 14px 12px; }
  .stem, .analysis, .material-body { font-size: 16px; }
}
@media print {
  .hero, .filters, .tabs, .toolbar, .reveal, .foot, .crumb, .to-top, .lightbox { display: none !important; }
  body { background: white; }
  .solution { display: block !important; }
  .opt.is-answer { background: #e6f3eb !important; }
  .q, .card, .material { break-inside: avoid; box-shadow: none; }
}
