/* 英语真题在线 · 本地复刻版 —— 通用与列表页样式 */

:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --fg: #1d1f25;
  --fg-2: #454b57;
  --muted: #8a909c;
  --line: #e6e8ee;
  --line-2: #eef0f4;
  --brand: #0070c9;
  --brand-weak: #eaf3fc;
  --ok: #159a63;
  --warn: #e08b00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 35, .06), 0 8px 24px rgba(20, 24, 35, .05);
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #101216;
  --surface: #171a20;
  --surface-2: #1c2027;
  --fg: #e8ebf1;
  --fg-2: #b9bfcb;
  --muted: #868d9b;
  --line: #272b34;
  --line-2: #21252c;
  --brand: #63a9ee;
  --brand-weak: #16273a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- 顶部标识 ---------- */
.masthead {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 18px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0070c9, #45b1ff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.brand-name { font-size: 18px; }
.brand-tag { color: var(--muted); font-size: 10px; padding-left: 2px; }

.masthead .spacer { flex: 1; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 10px;
}

.badge svg { width: 12px; height: 12px; }

/* ---------- 页面主体 ---------- */
main.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 18px 60px;
}

h1.title {
  text-align: center;
  font-weight: 400;
  font-size: clamp(20px, 4.2vw, 30px);
  margin: 26px 0 6px;
}

.title-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.features li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-2);
}

.features svg { width: 16px; height: 16px; color: var(--brand); }

.feat-new {
  font-size: 10px;
  color: #fff;
  background: #ff5a5f;
  border-radius: 999px;
  padding: 1px 6px;
  transform: translateY(-6px);
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--fg-2);
  font-size: 13px;
  text-align: center;
}

.countdown b { color: var(--brand); font-weight: 600; }

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 2px;
}

.toolbar-row .spacer { flex: 1; }

.field {
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  outline: none;
}

.field:focus { border-color: var(--brand); }

.btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--fg-2);
  white-space: nowrap;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.on { background: var(--brand-weak); border-color: var(--brand); color: var(--brand); }
.btn svg { width: 15px; height: 15px; }

/* ---------- 年份分组 ---------- */
section.period { margin-top: 28px; }

section.period h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--fg);
}

.year-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 14px;
}

.paper-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease;
}

.paper-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--brand);
}

.paper-card .thumb {
  aspect-ratio: 280 / 395;
  width: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
  border-bottom: 1px solid var(--line-2);
  display: block;
}

.paper-card .card-body { padding: 9px 11px 11px; }

.paper-card .card-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.paper-card .card-title small { font-size: 12px; font-weight: 400; color: var(--fg-2); }

.progress {
  margin-top: 8px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-2);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #45b1ff, #0070c9);
  transition: width .3s ease;
}

.progress-text {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.tag-new {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #ff5a5f;
  color: #fff;
  font-size: 11px;
  border-radius: 6px;
  padding: 1px 7px;
  z-index: 2;
}

.tag-done {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  border-radius: 6px;
  padding: 1px 7px;
  z-index: 2;
}

.paper-card[hidden] { display: none; }

.expand-more {
  display: block;
  margin: 22px auto 0;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--brand);
  font-size: 14px;
}

.expand-more svg { width: 16px; height: 16px; vertical-align: -3px; }

.hint-text {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

footer.site-footer {
  max-width: 1080px;
  margin: 40px auto 0;
  padding: 22px 18px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 2;
}

footer.site-footer a { color: var(--muted); text-decoration: none; }
footer.site-footer a:hover { color: var(--brand); }

/* ---------- 通用弹层 ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 15, 22, .38);
  z-index: 60;
  display: none;
}

.sheet-backdrop.open { display: block; }

.sheet {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px));
  max-height: min(82vh, 900px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  display: none;
}

.sheet.open { display: block; }

.sheet-head {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

.sheet-head h3 { margin: 0; font-size: 16px; flex: 1; }

.sheet-body { padding: 16px 18px 22px; }

.sheet-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.sheet-close:hover { color: var(--fg); }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.toc-list { display: flex; flex-wrap: wrap; gap: 8px; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 26px 10px;
}

@media (max-width: 560px) {
  .year-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .paper-card .card-title { font-size: 13px; }
  main.page { padding: 4px 12px 40px; }
  .masthead { padding: 12px 12px 0; }
}
