/* 408大观园 · 园林式排版：纸墨为底，印章为记 */
:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d7;
  --card: #fffdf7;
  --ink: #2c2a24;
  --ink-2: #5c574c;
  --ink-3: #8a8474;
  --line: #ded3bd;
  --seal: #a63428;
  --seal-soft: #f3e0da;
  --gold: #9a7b2d;
  --green: #2f6f4f;
  --shadow: 0 2px 14px rgba(60, 50, 30, .08);
  --radius: 14px;
}
html.dark {
  --paper: #1d1c18;
  --paper-2: #24231e;
  --card: #282620;
  --ink: #e8e2d2;
  --ink-2: #b5ad98;
  --ink-3: #857f6d;
  --line: #3d3a30;
  --seal: #d4544a;
  --seal-soft: #3a2b26;
  --gold: #c8a24e;
  --shadow: 0 2px 16px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(154, 123, 45, .10), transparent 60%),
    radial-gradient(900px 400px at -10% 30%, rgba(166, 52, 40, .06), transparent 60%);
}
a { color: inherit; }
.serif { font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand .seal-mini {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--seal); color: #fff; display: grid; place-items: center;
  font-size: 15px; font-family: "Noto Serif SC", serif; font-weight: 900;
}
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-size: 14.5px;
  padding: 6px 12px; border-radius: 999px; transition: .18s;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a.active { color: var(--seal); background: var(--seal-soft); font-weight: 600; }
.mode-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px;
}
.mode-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------- Hero ---------- */
.hero { max-width: 1080px; margin: 0 auto; padding: 72px 20px 40px; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--ink-2);
}
.hero-badge b { color: var(--seal); }
.hero h1 {
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: clamp(40px, 7vw, 66px); font-weight: 900;
  letter-spacing: .06em; margin: 18px 0 6px; line-height: 1.15;
}
.hero h1 .dgy { color: var(--seal); }
.hero .sub { font-size: 18px; color: var(--ink-2); max-width: 640px; }
.hero .motto {
  margin-top: 14px; color: var(--ink-3); font-size: 15px;
  font-family: "Noto Serif SC", serif; letter-spacing: .12em;
}
.hero-side {
  position: absolute; right: 24px; top: 84px;
  writing-mode: vertical-rl; font-family: "Noto Serif SC", serif;
  font-size: 15px; letter-spacing: .5em; color: var(--ink-3);
  border-left: 1px solid var(--line); padding-left: 12px; height: 300px;
}
@media (max-width: 900px) { .hero-side { display: none; } }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 22px; box-shadow: var(--shadow); min-width: 130px;
}
.stat b { font-size: 24px; font-family: "Noto Serif SC", serif; }
.stat b i { font-style: normal; color: var(--seal); }
.stat span { display: block; font-size: 12.5px; color: var(--ink-3); }

/* ---------- 区块 ---------- */
section.block { max-width: 1080px; margin: 0 auto; padding: 46px 20px 8px; }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; }
.block-head h2 {
  font-family: "Noto Serif SC", serif; font-size: 28px; font-weight: 900; letter-spacing: .04em;
}
.block-head h2::before { content: "◆"; color: var(--seal); font-size: 16px; margin-right: 10px; vertical-align: 3px; }
.block-head .more { margin-left: auto; font-size: 14px; color: var(--ink-3); text-decoration: none; }
.block-head .more:hover { color: var(--seal); }
.block-head p { color: var(--ink-3); font-size: 14px; }

/* ---------- 四大观卡片 ---------- */
.gate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.gate-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; text-decoration: none;
  box-shadow: var(--shadow); transition: .2s; overflow: hidden; display: block;
}
.gate-card:hover { transform: translateY(-3px); border-color: var(--gc, var(--seal)); }
.gate-card .seal {
  width: 52px; height: 52px; border-radius: 10px; background: var(--gc, var(--seal));
  color: #fff; display: grid; place-items: center;
  font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 13px;
  writing-mode: vertical-rl; letter-spacing: .2em; line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.gate-card h3 { margin-top: 14px; font-size: 21px; font-family: "Noto Serif SC", serif; }
.gate-card .w { color: var(--gold); font-size: 13.5px; font-weight: 700; margin-top: 2px; }
.gate-card p { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.gate-card .go { margin-top: 14px; font-size: 13.5px; color: var(--gc, var(--seal)); font-weight: 700; }

/* ---------- 表格 ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--paper-2); font-weight: 700; font-size: 13.5px; color: var(--ink-2); letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
td b.bar { color: var(--seal); }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 26px; }
.tl-item::before {
  content: ""; position: absolute; left: -26px; top: 7px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--card); border: 3px solid var(--seal);
}
.tl-item h3 { font-family: "Noto Serif SC", serif; font-size: 19px; }
.tl-item .tag {
  display: inline-block; margin-left: 10px; font-size: 12px; color: var(--seal);
  background: var(--seal-soft); border-radius: 999px; padding: 2px 10px; vertical-align: 2px;
}
.tl-item ul { margin: 8px 0 0 18px; color: var(--ink-2); font-size: 14.5px; }
.tl-item li { margin: 4px 0; }

/* ---------- 科目页 ---------- */
.subject-hero { max-width: 1080px; margin: 0 auto; padding: 56px 20px 10px; display: flex; gap: 24px; align-items: flex-start; }
.subject-hero .bigseal {
  flex: none; width: 84px; height: 84px; border-radius: 16px; color: #fff;
  display: grid; place-items: center; writing-mode: vertical-rl;
  font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 19px; letter-spacing: .18em;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.3), var(--shadow);
}
.subject-hero h1 { font-family: "Noto Serif SC", serif; font-size: 36px; font-weight: 900; }
.subject-hero .w { color: var(--gold); font-weight: 700; margin-top: 2px; }
.subject-hero p { color: var(--ink-2); max-width: 660px; margin-top: 8px; font-size: 15.5px; }

.subject-layout { max-width: 1080px; margin: 0 auto; padding: 26px 20px 60px; display: grid; grid-template-columns: 250px 1fr; gap: 26px; align-items: start; }
@media (max-width: 860px) { .subject-layout { grid-template-columns: 1fr; } .toc { position: static !important; } }
.toc { position: sticky; top: 78px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.toc h4 { font-size: 13px; color: var(--ink-3); letter-spacing: .1em; margin-bottom: 10px; }
.toc a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--ink-2); font-size: 13.5px; padding: 6px 8px; border-radius: 8px; }
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.toc a .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: 8px; }
.toc a.done .dot { background: var(--green); }
.toc a.learning .dot { background: var(--gold); }
.toc .prog { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.toc .bar { height: 7px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: 6px; }
.toc .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--seal), var(--gold)); border-radius: 99px; transition: .4s; }

.chapter {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow);
  scroll-margin-top: 80px;
}
.ch-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ch-head h3 { font-family: "Noto Serif SC", serif; font-size: 19.5px; flex: 1; min-width: 200px; }
.badge { font-size: 12px; border-radius: 999px; padding: 2.5px 11px; font-weight: 700; white-space: nowrap; }
.badge.hot { background: var(--seal-soft); color: var(--seal); }
.badge.mid { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
.badge.low { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.badge.type { background: var(--paper-2); color: var(--ink-2); font-weight: 500; }
.ch-pts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { font-size: 13px; color: var(--ink-2); background: var(--paper-2); border-radius: 8px; padding: 4px 11px; }
.ch-res { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
.res-link {
  font-size: 13px; text-decoration: none; color: var(--seal);
  border: 1px solid color-mix(in srgb, var(--seal) 35%, transparent);
  border-radius: 999px; padding: 3.5px 13px; transition: .15s;
}
.res-link:hover { background: var(--seal); color: #fff; }
.res-link .pf { color: inherit; opacity: .65; font-size: 11.5px; margin-left: 5px; }

.state-row { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.state-btn {
  font-size: 12.5px; padding: 3px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-3); transition: .15s;
}
.state-btn.on.s0 { background: var(--green); border-color: var(--green); color: #fff; }
.state-btn.on.s1 { background: var(--gold); border-color: var(--gold); color: #fff; }
.state-btn.on.s2 { background: var(--seal); border-color: var(--seal); color: #fff; }
.state-label { font-size: 12px; color: var(--ink-3); }

/* ---------- 资源页 ---------- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-row input {
  flex: 1; min-width: 220px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14.5px; outline: none;
}
.filter-row input:focus { border-color: var(--seal); }
.pf-tab {
  font-size: 13.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
.pf-tab.on { background: var(--seal); border-color: var(--seal); color: #fff; font-weight: 600; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.res-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-decoration: none; box-shadow: var(--shadow); transition: .18s; display: flex; flex-direction: column; gap: 6px;
}
.res-card:hover { transform: translateY(-2px); border-color: var(--seal); }
.res-card h3 { font-size: 16.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf { font-size: 11px; padding: 1.5px 9px; border-radius: 999px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); flex: none; }
.pf.b站, .pf.B站 { background: #fbe9e2; color: #c25b3f; }
html.dark .pf.b站, html.dark .pf.B站 { background: #3c2a23; color: #e08b6f; }
.pf.GitHub { background: #e9e6f5; color: #5b4a9e; }
html.dark .pf.GitHub { background: #2c2a3d; color: #a79ad8; }
.pf.知乎 { background: #e3f0fa; color: #2f6f9e; }
html.dark .pf.知乎 { background: #22303d; color: #7fb0d8; }
.pf.CSDN { background: #fdefd8; color: #a06a12; }
html.dark .pf.CSDN { background: #3a3122; color: #d8a94e; }
.pf.抖音 { background: #e8e8f0; color: #444; }
html.dark .pf.抖音 { background: #30303a; color: #b5b5c8; }
.pf.小红书 { background: #fde8e8; color: #d43c33; }
html.dark .pf.小红书 { background: #3d2624; color: #ef8d86; }
.pf.MOOC, .pf.网站, .pf.官方, .pf.书籍, .pf.资料 { background: #e2efe8; color: #2f6f4f; }
html.dark .pf.MOOC, html.dark .pf.网站, html.dark .pf.官方, html.dark .pf.书籍, html.dark .pf.资料 { background: #24352c; color: #74b590; }
.res-card p { color: var(--ink-2); font-size: 13.5px; }
.res-card .u { font-size: 12px; color: var(--ink-3); word-break: break-all; }

/* ---------- 真题卡片 ---------- */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.exam-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.exam-card b { font-family: "Noto Serif SC", serif; font-size: 18px; color: var(--seal); }
.exam-card p { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }

/* ---------- 提示条 ---------- */
.note {
  max-width: 1080px; margin: 26px auto 0; padding: 14px 20px;
  border: 1px dashed var(--gold); border-radius: var(--radius);
  color: var(--ink-2); font-size: 14px; background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.note b { color: var(--gold); }

/* ---------- 页脚 ---------- */
footer { margin-top: 70px; border-top: 1px solid var(--line); background: var(--paper-2); }
.foot-inner { max-width: 1080px; margin: 0 auto; padding: 34px 20px 44px; color: var(--ink-3); font-size: 13.5px; }
.foot-inner .fbrand { font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 17px; color: var(--ink); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--seal); }
.foot-inner .disclaimer { margin-top: 10px; line-height: 1.8; }

.prevnext { max-width: 1080px; margin: 0 auto 30px; padding: 0 20px; display: flex; justify-content: space-between; gap: 12px; }
.prevnext a {
  text-decoration: none; color: var(--ink-2); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 18px; font-size: 14px;
}
.prevnext a:hover { color: var(--seal); border-color: var(--seal); }

/* 科目页顶部导航 tabs */
.sub-tabs { display: flex; gap: 8px; flex-wrap: wrap; max-width: 1080px; margin: 22px auto 0; padding: 0 20px; }
.sub-tabs a {
  text-decoration: none; font-size: 14px; padding: 6px 16px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--card);
}
.sub-tabs a.on { color: #fff; border-color: transparent; font-weight: 700; }

/* ---------- 云同步弹窗 ---------- */
.cloud-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); width: min(430px, calc(100vw - 40px)); padding: 22px 24px;
}
.cloud-note { font-size: 13px; color: var(--ink-2); margin: 12px 0 6px; line-height: 1.7; }
.cloud-tabs { display: flex; gap: 8px; margin: 12px 0 14px; }
.cloud-label { display: block; font-size: 12.5px; color: var(--ink-3); margin: 8px 0 4px; }
.cloud-input {
  width: 100%; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 15px; outline: none;
}
.cloud-input:focus { border-color: var(--seal); }
.cloud-code { color: var(--seal); letter-spacing: .12em; font-family: Consolas, monospace; }
.cloud-msg { min-height: 22px; margin-top: 12px; font-size: 13.5px; line-height: 1.6; }
