:root {
  --bg: #f2f4f7;
  --panel: #fff;
  --line: #e2e6ed;
  --line-strong: #cfd6e0;
  --ink: #16202e;
  --dim: #6d7889;
  --brand: #2f6fb5;
  --brand-dark: #24578f;
  --brand-soft: #eaf1fa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 32, 50, .05), 0 8px 24px rgba(20, 32, 50, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  height: 58px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
header.top h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}
header.top .sub { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
header.top .spacer { flex: 1; }
header.top input[type=search] {
  width: 250px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13.5px;
  outline: none;
  background: #f7f9fc;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
header.top input[type=search]:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 111, 181, .12);
}

main { max-width: 1140px; margin: 0 auto; padding: 22px 24px 90px; }

/* ---------- 首页 ---------- */

.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.filters .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filters .lbl {
  color: var(--dim);
  font-size: 12.5px;
  width: 34px;
  flex: 0 0 auto;
}

.chip {
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #38455a;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all .14s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.count { color: var(--dim); font-size: 13px; margin: 0 2px 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 15px 17px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.card:hover {
  border-color: #a9c4e4;
  box-shadow: 0 6px 20px rgba(47, 111, 181, .12);
  transform: translateY(-2px);
  text-decoration: none;
}
.card .t { font-weight: 600; font-size: 14.5px; line-height: 1.42; }
.card .meta { margin-top: 7px; color: var(--dim); font-size: 12.5px; }
.card .tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11.5px;
  padding: 1.5px 8px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: #2a6199;
}
.tag.warn { background: #fdf1e4; color: #9a5a13; }

/* ---------- 试卷页 ---------- */

.paper-head {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.paper-head .ph-main { flex: 1; min-width: 260px; }
.paper-head h2 { margin: 0 0 5px; font-size: 18.5px; font-weight: 650; line-height: 1.4; }
.paper-head .meta { color: var(--dim); font-size: 12.8px; }

.tabs { display: flex; gap: 4px; flex: 0 0 auto; }
.tab {
  padding: 7px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .14s;
}
.tab:hover { color: var(--brand); border-color: var(--brand); }
.tab.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ---------- PDF 阅读器 ---------- */

.pdfbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.pdftool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pdftool .pt-l,
.pdftool .pt-r { display: flex; align-items: center; gap: 6px; }

.pdfbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: #33415a;
  font-size: 13.5px;
  line-height: 1;
  cursor: pointer;
  transition: all .13s;
}
.pdfbtn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}
.pdfbtn:disabled { opacity: .38; cursor: default; }
.pdfbtn.wide { padding: 0 13px; font-size: 12.8px; }
.pdfbtn.accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  padding: 0 15px;
}
.pdfbtn.accent:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.pdfpos {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  min-width: 58px;
  justify-content: center;
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.pdfpos b { color: var(--ink); font-weight: 650; font-size: 14px; }
.pdfpos i { font-style: normal; opacity: .5; }

.pdfview {
  height: calc(100vh - 232px);
  min-height: 460px;
  overflow-y: auto;
  overflow-x: auto;
  background: #eef1f5;
  padding: 14px;
  scroll-behavior: smooth;
}
.pdfpages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.pdfsheet {
  position: relative;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(20, 32, 50, .10), 0 6px 18px rgba(20, 32, 50, .07);
  overflow: hidden;
  max-width: 100%;
}
.pdfsheet .skel {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #f4f6f9 30%, #e9edf3 50%, #f4f6f9 70%);
  background-size: 220% 100%;
  animation: shimmer 1.25s infinite linear;
}
@keyframes shimmer {
  from { background-position: 130% 0; }
  to { background-position: -30% 0; }
}
.pdfsheet.ready .skel { display: none; }
.pdfsheet canvas { display: block; max-width: 100%; height: auto; }

.pdfstate {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--dim);
  font-size: 13.5px;
  text-align: center;
  line-height: 2;
  padding: 24px;
}

/* ---------- 题号条 ---------- */

.numstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 17px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.numstrip .lbl {
  color: var(--dim);
  font-size: 12.5px;
  margin-right: 5px;
}
.numchip {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 12.8px;
  color: #33415a;
  background: #fff;
  font-variant-numeric: tabular-nums;
  transition: all .13s;
}
.numchip:hover {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  text-decoration: none;
}

/* ---------- 导航与按钮 ---------- */

.qnav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.qnav .crumb {
  color: var(--dim);
  font-size: 13px;
  margin-right: auto;
}
.qnav .crumb:hover { color: var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #33415a;
  font-size: 13.4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .13s;
}
.btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  text-decoration: none;
}
.btn.on {
  background: var(--brand-soft);
  border-color: #b6d0ee;
  color: #275b93;
  font-weight: 600;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { background: #fff; border-color: var(--line-strong); color: #33415a; }

/* ---------- 单题页 ---------- */

.qview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.pane h3 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--dim);
  font-weight: 600;
}
.pane img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.qpane { padding: 22px 24px; }
.qpane img { max-width: 820px; margin: 0 auto; }
.apane { background: #fcfdff; }

.ansbar { display: flex; gap: 8px; }
.ansbar .btn { flex: 0 0 auto; }

video { width: 100%; border-radius: 8px; background: #000; }
.vcap { color: var(--dim); font-size: 12.5px; margin-top: 6px; }

/* ---------- 杂项 ---------- */

.empty {
  color: var(--dim);
  padding: 46px 0;
  text-align: center;
  font-size: 13.5px;
}
.hidden { display: none !important; }

@media (max-width: 720px) {
  header.top { padding: 0 14px; gap: 10px; }
  header.top .sub { display: none; }
  header.top input[type=search] { width: 150px; }
  main { padding: 16px 14px 70px; }
  .pdfview { height: calc(100vh - 210px); min-height: 360px; padding: 8px; }
  .pdfpages { gap: 8px; }
  .grid { grid-template-columns: 1fr; }
}
