/* 四下期末复习站 · 公共样式 */
:root {
  --paper: #fbf7f0;
  --card: #ffffff;
  --ink: #262523;
  --ink-2: #3f3d3a;
  --muted: #6f6a62;
  --line: #e7dfd2;
  --soft: #f4eee4;
  --cn: #b8432f;
  --math: #2f6fb7;
  --en: #2e7d52;
  --plan: #a9761d;
  --accent: #2f5d62;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38, 37, 35, .04), 0 8px 24px rgba(38, 37, 35, .06);
  --max: 1080px;
}

body.theme-cn { --accent: var(--cn); }
body.theme-math { --accent: var(--math); }
body.theme-en { --accent: var(--en); }
body.theme-plan { --accent: var(--plan); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 240, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  display: flex; align-items: center; gap: 20px;
  min-height: 60px; padding-top: 8px; padding-bottom: 8px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; color: var(--ink);
  letter-spacing: .02em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cn), var(--math) 55%, var(--en));
  box-shadow: 0 0 0 3px rgba(47, 93, 98, .1);
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  padding: 6px 12px; border-radius: 999px; font-size: 14.5px;
  color: var(--ink-2); white-space: nowrap;
}
.nav a:hover { background: var(--soft); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 300px at 85% -60%, rgba(47, 111, 183, .11), transparent 60%),
    radial-gradient(900px 260px at 0% -40%, rgba(184, 67, 47, .1), transparent 55%),
    linear-gradient(180deg, #fffdf9, var(--paper));
  border-bottom: 1px solid var(--line);
  padding: 52px 0 44px;
}
.eyebrow {
  display: inline-block; margin: 0 0 14px;
  font-size: 13px; letter-spacing: .12em; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 4px 12px; border-radius: 999px;
}
h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.28; letter-spacing: -.01em;
}
h1 .hl { color: var(--accent); }
.lead {
  margin: 0; max-width: 60ch; color: var(--muted); font-size: 16.5px;
}
.hero-meta {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px;
  color: var(--muted); font-size: 14px;
}
.chip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px;
}

/* ---------- sections ---------- */
main { padding: 8px 0 24px; }
.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 {
  margin: 0; font-size: clamp(21px, 2.6vw, 26px); letter-spacing: -.01em;
}
.section-head .num {
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 6px; padding: 2px 8px;
}
.section .sub { color: var(--muted); margin: -6px 0 18px; font-size: 14.5px; }

/* ---------- cards & grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 8px; font-size: 17.5px; line-height: 1.45;
}
.card h3 .tag { font-size: 12px; vertical-align: 2px; }
.card p { margin: 6px 0; }
.card ul { margin: 8px 0 0; padding-left: 1.2em; }
.card li { margin: 4px 0; }
.card .meta { color: var(--muted); font-size: 13.5px; }
.card-link {
  display: block; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-link:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 2px 4px rgba(38,37,35,.05), 0 14px 34px rgba(38,37,35,.09);
}
.card .go {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--accent);
}
.card .go::after { content: "→"; }

/* subject card top bar */
.subj-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.subj-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; color: #fff;
}
.ico-cn { background: var(--cn); }
.ico-math { background: var(--math); }
.ico-en { background: var(--en); }

/* ---------- tables ---------- */
.table-wrap {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.table-wrap .scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; }
thead th {
  background: var(--soft); font-size: 13.5px; color: var(--ink-2);
  font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #fdfbf7; }
td.num { color: var(--muted); white-space: nowrap; }

/* ---------- checklist ---------- */
.check { list-style: none; margin: 10px 0 0; padding: 0; }
.check li { margin: 0; }
.check label {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 4px; border-radius: 8px; cursor: pointer;
}
.check label:hover { background: var(--soft); }
.check input {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 3px 0 0; flex: none;
  border: 1.5px solid #c8bfae; border-radius: 5px; background: #fff;
  cursor: pointer; position: relative; transition: .12s;
}
.check input:checked {
  background: var(--accent); border-color: var(--accent);
}
.check input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1.5px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check input:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.check input:checked + span {
  color: var(--muted); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent);
}
.progress {
  font-size: 13px; color: var(--muted); background: var(--soft);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.progress b { color: var(--accent); }

/* ---------- details / Q&A ---------- */
details.qa {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); margin: 10px 0; overflow: hidden;
}
details.qa + details.qa { margin-top: 8px; }
details.qa summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600;
  list-style: none; display: flex; gap: 10px; align-items: baseline;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before {
  content: "＋"; flex: none; color: var(--accent); font-weight: 700;
  font-size: 15px;
}
details.qa[open] summary::before { content: "－"; }
details.qa summary:hover { background: var(--soft); }
details.qa .ans {
  padding: 2px 18px 14px 40px; border-top: 1px dashed var(--line);
  color: var(--ink-2); font-size: 15px;
}
details.qa .ans p:first-child { margin-top: 10px; }
details.qa .ans .step { margin: 6px 0; }
details.qa .ans em { font-style: normal; color: var(--accent); font-weight: 600; }

/* ---------- misc blocks ---------- */
.callout {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
  border-radius: 0 12px 12px 0;
  padding: 14px 18px; margin: 18px 0; font-size: 15px;
}
.callout.warn {
  border-left-color: #c0392b;
  background: #fdf3f1;
}
.callout p { margin: 4px 0; }
.callout .t { font-weight: 700; }

.poem {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px; margin: 10px 0;
  box-shadow: var(--shadow);
}
.poem .pt { font-weight: 700; font-size: 16px; margin: 0 0 2px; }
.poem .pd { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.poem .pl { margin: 0; white-space: pre-line; font-size: 15.5px; line-height: 2; }
.poem .note { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.poem b { color: var(--cn); font-weight: 600; }

.tag {
  display: inline-block; font-size: 12px; line-height: 1.6;
  border-radius: 6px; padding: 0 7px; background: var(--soft);
  color: var(--muted); white-space: nowrap;
}

.two-col { columns: 2; column-gap: 32px; }
.two-col > * { break-inside: avoid; }

hr.sep { border: 0; border-top: 1px dashed var(--line); margin: 26px 0; }

/* ---------- countdown ---------- */
.countdown {
  background: linear-gradient(160deg, #fffdf8, #f6efe2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.countdown .label { color: var(--muted); font-size: 13.5px; margin: 0 0 6px; }
.countdown .days {
  font-size: 42px; font-weight: 800; line-height: 1.1; color: var(--accent);
  letter-spacing: -.02em;
}
.countdown .days small { font-size: 15px; font-weight: 600; margin-left: 4px; color: var(--muted); }
.countdown input[type="date"] {
  margin-top: 12px; width: 100%; max-width: 220px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 14px;
}
.countdown .hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ---------- footer ---------- */
.site-foot {
  margin-top: 48px; border-top: 1px solid var(--line);
  padding: 26px 0 40px; color: var(--muted); font-size: 13.5px;
  background: linear-gradient(180deg, transparent, #f6f0e6);
}
.site-foot .wrap { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.site-foot .sep { color: #cfc5b4; }
.site-foot button {
  margin-left: auto; background: none; border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; padding: 5px 12px;
  border-radius: 999px; cursor: pointer; font-family: inherit;
}
.site-foot button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  body { font-size: 15.5px; }
  .hero { padding: 38px 0 32px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .two-col { columns: 1; }
  .site-head .wrap { min-height: 54px; }
  .nav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; }
  .nav a { padding: 5px 10px; font-size: 14px; }
  .card { padding: 18px; }
  .section { padding: 30px 0 4px; }
  table { font-size: 14px; min-width: 0; }
  th, td { padding: 9px 10px; }
  .table-wrap .scroll { -webkit-overflow-scrolling: touch; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
}

/* ---------- print ---------- */
@media print {
  :root { --paper: #fff; --shadow: none; }
  body { background: #fff; font-size: 12.5px; }
  .site-head, .site-foot, .no-print, .nav { display: none !important; }
  .hero { border-bottom: 1px solid #ddd; padding: 16px 0; }
  .wrap { max-width: none; padding: 0; }
  .card, .table-wrap, .poem, details.qa { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  details.qa { display: block; }
  details.qa > .ans { display: block !important; }
  details.qa summary::before { content: ""; }
  .section { padding: 14px 0 0; }
  a { color: inherit; text-decoration: none; }
  .check input { border-color: #999; }
}

/* progress bar */
.bar { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 12px; max-width: 280px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
