/* 又一圈：蓝晒法的三种状态
   纸（paper）是没涂感光液的地方，黄绿（sun）是涂了还没晒的，普鲁士蓝（blue）是晒过冲过的。 */
@font-face {
  font-family: 'Zhuque';
  src: url('../fonts/zhuque-ui.woff2') format('woff2');
  font-display: swap;
}

:root {
  --blue: #123f7c;
  --deep: #0a2a57;
  --paper: #f3f5f2;
  --wash: #dde6ee;
  --sun: #d8e25b;
  --display: 'Zhuque', 'FangSong', 'STFangsong', 'Songti SC', 'Noto Serif CJK SC', serif;
  --body: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'PingFang HK', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif;
  --gut: clamp(16px, 4vw, 48px);
  --measure: 40rem;
}

body {
  --bg: var(--paper);
  --fg: var(--deep);
  --soft: #4c6488;
  --field: var(--wash);
  --rule: rgba(18, 63, 124, 0.22);
  --mark: var(--sun);
  --solid: var(--blue);
  --on-solid: var(--paper);
}
body[data-tone='night'] {
  --bg: var(--deep);
  --fg: var(--paper);
  --soft: #a9bbd4;
  --field: rgba(243, 245, 242, 0.09);
  --rule: rgba(243, 245, 242, 0.25);
  --solid: var(--paper);
  --on-solid: var(--deep);
}
body[data-tone='sun'] {
  --bg: var(--sun);
  --fg: var(--deep);
  --soft: #3d4f2a;
  --field: rgba(255, 255, 255, 0.6);
  --rule: rgba(10, 42, 87, 0.3);
  --mark: var(--paper);
  --solid: var(--deep);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.75 var(--body);
  transition: background-color 0.7s ease, color 0.4s ease;
}
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
body[data-tone='paper'] :focus-visible { outline-color: var(--blue); }
::selection { background: var(--sun); color: var(--deep); }

h1, h2, .brand, .lead, .qtext { font-family: var(--display); font-weight: 400; }
.lead { font-size: 1.3rem; line-height: 1.7; max-width: var(--measure); }
.hint, .note, .src { color: var(--soft); font-size: 0.9rem; max-width: var(--measure); }
.dim { color: var(--soft); }

/* —— 蓝晒版：手刷感光液留下毛边 —— */
.plate { position: relative; color: var(--paper); isolation: isolate; }
.plate::before {
  content: '';
  position: absolute;
  inset: 10px;
  background: var(--blue);
  filter: url(#brush);
  z-index: -1;
}

/* —— 年轮 —— */
.rg { display: block; width: 100%; height: 100%; overflow: visible; color: var(--paper); }
.rg path, .rg line { fill: none; stroke: currentColor; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rg-pith, .rg-scar { fill: currentColor; }
.rg-edge { stroke-width: 1.6; }
.rg-grain { stroke-width: 0.6; opacity: 0.5; }
.rg-now { color: var(--sun); }
.rg-now .rg-edge { stroke-width: 2.4; }
.rg .rg-band { fill: currentColor; stroke: none; opacity: 0.14; }
.rg-ghost .rg-edge { stroke-width: 0.8; stroke-dasharray: 2 7; opacity: calc(0.6 - var(--i) * 0.035); }
.rg-label { fill: currentColor; font-family: var(--display); paint-order: stroke; stroke: var(--blue); stroke-width: 5px; stroke-linejoin: round; }
.rg-ghost .rg-label { opacity: 0.55; }
.rg-months line { stroke-width: 1; opacity: 0.6; }
.rg-months text { fill: currentColor; font-family: var(--display); opacity: 0.85; }
.rg-anim g { animation: fadein 1s ease both; animation-delay: calc(0.15s + var(--i) * 0.13s); }
@keyframes fadein { from { opacity: 0; } }

/* —— 按钮与链接 —— */
.btn {
  display: inline-block;
  padding: 0.7em 1.4em;
  border: 2px solid var(--solid);
  background: var(--solid);
  color: var(--on-solid);
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--sun); border-color: var(--sun); color: var(--deep); }
body[data-tone='sun'] .btn:hover:not(:disabled) { background: var(--paper); border-color: var(--paper); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-line { background: transparent; color: var(--solid); }
.btn-sun { background: var(--sun); border-color: var(--sun); color: var(--deep); }
.btn-sun:hover:not(:disabled) { background: var(--paper); border-color: var(--paper); }
.plate .btn-line { border-color: var(--paper); color: var(--paper); }
.textlink { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; color: inherit; }
.textlink:hover { text-decoration-thickness: 3px; text-decoration-color: var(--mark); }

/* —— 首页 —— */
.hero {
  min-height: min(100svh, 880px);
  margin: 8px;
  padding: clamp(32px, 5vw, 64px);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}
.hero-ring {
  position: absolute;
  width: min(132vh, 1180px);
  aspect-ratio: 1;
  left: clamp(-300px, -16vw, -90px);
  top: 50%;
  translate: 0 -46%;
  z-index: -1;
}
.hero-brand { grid-column: 1 / -1; display: flex; gap: 0.8em; align-items: baseline; }
.hero-brand .brand { font-size: 1.5rem; }
.hero-brand [lang='en'] { font-family: var(--display); opacity: 0.75; }
.hero-h1 {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  writing-mode: vertical-rl;
  font-size: clamp(2.6rem, 5vh + 1vw, 4.6rem);
  line-height: 1.35;
  letter-spacing: 0.06em;
}
.hero-h1 span { display: block; }
.hero-h1 span + span { padding-top: 1.2em; }
.hero-foot { grid-column: 2; grid-row: 3; justify-self: end; max-width: 25rem; display: grid; gap: 18px; justify-items: start; }
.acts { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .note { color: var(--paper); opacity: 0.7; }

.duebar { display: flex; justify-content: space-between; gap: 16px; margin: 8px var(--gut); padding: 14px 20px; background: var(--sun); color: var(--deep); text-decoration: none; font-family: var(--display); font-size: 1.15rem; }
.duebar span { text-decoration: underline; text-underline-offset: 0.25em; }

.sec { max-width: 68rem; margin: 0 auto; padding: clamp(48px, 9vw, 112px) var(--gut) 0; }
.sec > h2, .sec > div > h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.3; margin-bottom: 0.5em; }
.sec.two { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 6vw, 96px); }
.sec.two p { max-width: var(--measure); margin-bottom: 1em; }
.why dt { font-family: var(--display); font-size: 1.35rem; margin-top: 1em; }
.why dd { color: var(--soft); }

.ledger li + li, .chlist li + li { border-top: 1px solid var(--rule); }
.ledger a { display: grid; grid-template-columns: 7rem 5rem 1fr auto; gap: 16px; align-items: baseline; padding: 14px 0; text-decoration: none; }
.ledger a:hover .led-year, .chlist a:hover .ch-name { background: linear-gradient(transparent 62%, var(--mark) 62%); }
.led-year { font-family: var(--display); font-size: 2.2rem; line-height: 1.2; justify-self: start; }
.led-word { font-family: var(--display); font-size: 1.35rem; }
.led-no, .led-stat { color: var(--soft); font-size: 0.9rem; }
.row-acts { display: flex; gap: 24px; margin-top: 20px; }

.chlist { margin-top: 28px; counter-reset: ch; }
.chlist a { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 20px; align-items: baseline; padding: 18px 0; text-decoration: none; }
.ch-name { font-family: var(--display); font-size: 1.9rem; line-height: 1.2; justify-self: start; }
.ch-what small { display: block; color: var(--soft); font-size: 0.85rem; }
.ch-meta { color: var(--soft); font-size: 0.9rem; white-space: nowrap; }
.chlist .has .ch-meta { color: var(--fg); background: var(--mark); padding: 0 0.5em; }
.quickline { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 0.3em 1em; align-items: baseline; }
.quickline a { font-family: var(--display); font-size: 1.3rem; }
.quickline small { color: var(--soft); }

.foot { max-width: 68rem; margin: clamp(64px, 10vw, 128px) auto 0; padding: 28px var(--gut) 40px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: baseline; font-size: 0.9rem; }
.foot .brand { font-size: 1.3rem; margin-right: auto; }

/* —— 顶栏 —— */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px var(--gut); background: var(--bg); border-bottom: 1px solid var(--rule); transition: background-color 0.7s ease; }
.top .brand { font-size: 1.3rem; text-decoration: none; white-space: nowrap; }
.top-year { font-family: var(--display); font-size: 1.3rem; text-decoration: none; color: var(--soft); }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 6px 10px; text-decoration: none; white-space: nowrap; font-size: 0.95rem; color: var(--soft); }
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--fg); background: linear-gradient(transparent 68%, var(--mark) 68%); }
.mini { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--blue); padding: 4px; }
.demobar { background: var(--sun); color: var(--deep); padding: 8px var(--gut); display: flex; justify-content: space-between; gap: 16px; font-size: 0.9rem; }
.demobar button { background: none; border: 0; text-decoration: underline; padding: 0; }

/* —— 某一年 —— */
.yr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 72px); max-width: 76rem; margin: 0 auto; padding: clamp(24px, 4vw, 56px) var(--gut) 96px; align-items: start; }
.yr-plate { position: sticky; top: 84px; aspect-ratio: 1; padding: 9%; }
.yr-num { font-size: clamp(4rem, 11vw, 8rem); line-height: 1; margin-bottom: 0.15em; }
.yr-body .note { margin-top: 0.8em; }

/* —— 章节通用 —— */
.ch-head { max-width: 68rem; margin: 0 auto; padding: clamp(40px, 7vw, 88px) var(--gut) clamp(28px, 4vw, 48px); }
.ch-head h1 { font-size: clamp(3.2rem, 9vw, 6rem); line-height: 1.1; margin-bottom: 0.25em; }
.ch-head .src { margin-top: 1em; }
.stack { max-width: 68rem; margin: 0 auto; padding: 0 var(--gut); display: grid; gap: 40px; }
.stack > * { max-width: var(--measure); }
.wide .ch-head, .wide .pager, .wide .foot, .wide > .stack { max-width: 82rem; }
.pager { max-width: 68rem; margin: 88px auto 0; padding: 24px var(--gut) 72px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; }
.pager a { text-decoration: none; font-family: var(--display); font-size: 1.7rem; line-height: 1.3; }
.pager a:hover { background: linear-gradient(transparent 68%, var(--mark) 68%); }
.pager small { display: block; font-family: var(--body); font-size: 0.85rem; color: var(--soft); }
.pager-next { text-align: right; }

.field { display: grid; gap: 8px; }
.field-label { font-family: var(--display); font-size: 1.35rem; line-height: 1.4; }
.bigq .field-label { font-size: 1.9rem; }
textarea, input[type='text'], input[type='date'] {
  width: 100%;
  background: var(--field);
  border: 0;
  border-bottom: 2px solid var(--fg);
  border-radius: 0;
  padding: 12px 14px;
  line-height: 1.75;
  resize: none;
  outline-offset: 0;
}
textarea { display: block; overflow: hidden; min-height: 3.2em; }
::placeholder { color: var(--soft); opacity: 0.8; }
.bigword { font-family: var(--display); font-size: 2.6rem; padding: 6px 14px; max-width: 12em; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.lv { display: flex; align-items: center; gap: 2px; min-height: 44px; }
.lv-b { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; padding: 0; }
.lv-b i { display: block; width: calc(9px + var(--s) * 6px); aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--fg); transition: background-color 0.15s; }
.lv-b:hover i { background: var(--mark); }
.lv-b.on i { background: var(--fg); box-shadow: 0 0 0 4px var(--mark); }
.lv-out { margin-left: 10px; font-family: var(--display); font-size: 1.15rem; min-width: 3em; }
.lv-out.dim { font-family: var(--body); font-size: 0.85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--field); border-bottom: 2px solid var(--fg); }
.chips input[type='text'] { flex: 1; min-width: 9em; background: none; border: 0; padding: 2px 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 10px; background: var(--fg); color: var(--bg); font-size: 0.95rem; }
.chip button { background: none; border: 0; color: inherit; width: 28px; height: 28px; font-size: 1.1rem; line-height: 1; }

/* —— 回看 —— */
.look { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); max-width: 68rem; margin: 0 auto; padding: 0 var(--gut); align-items: start; }
.look-side { position: sticky; top: 84px; display: grid; gap: 12px; }
.look-ring { aspect-ratio: 1; padding: 12%; }
.month { display: grid; gap: 14px; padding: 28px 0; border-top: 1px solid var(--rule); }
.month:first-child { border-top: 0; padding-top: 0; }
.month h2 { font-size: 2.2rem; line-height: 1.2; }
.month .field-label { font-family: var(--body); font-size: 0.9rem; color: var(--soft); }
.sumbox { padding-top: 40px; border-top: 2px solid var(--fg); }
.sumbox h2 { font-size: 2.2rem; }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.sum h3 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; }
.sum b { margin-left: 0.5em; font-weight: 400; color: var(--soft); }

/* —— 盘点 —— */
.areas { max-width: 68rem; margin: 0 auto; padding: 0 var(--gut); }
.areabox { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: clamp(20px, 4vw, 56px); padding: 32px 0; border-top: 1px solid var(--rule); }
.area-head h2 { font-size: 2.2rem; line-height: 1.2; }
.area-head .lv { margin-top: 10px; margin-left: -12px; }
.area-body { display: grid; gap: 16px; }
.area-body .field-label { font-family: var(--body); font-size: 0.9rem; color: var(--soft); }

/* —— 四十问 —— */
.q40 { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); max-width: 68rem; margin: 0 auto; padding: 0 var(--gut); align-items: start; }
.q-side { position: sticky; top: 84px; display: grid; gap: 12px; }
.qgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.qcell { aspect-ratio: 1; min-width: 44px; background: none; border: 1px solid var(--rule); font-family: var(--display); font-size: 1.05rem; padding: 0; }
.qcell.done { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.qcell.on { box-shadow: inset 0 0 0 3px var(--sun); border-color: var(--deep); }
.qcount { color: var(--soft); font-size: 0.9rem; }
.qtext { font-size: clamp(1.8rem, 4.4vw, 2.9rem); line-height: 1.4; margin: 0.2em 0 0.7em; max-width: 22em; }
.qstage textarea { font-size: 1.1rem; }
.qnav { display: flex; gap: 10px; margin-top: 16px; }
.prevs { margin-top: 48px; display: grid; gap: 20px; max-width: var(--measure); }
.prev { padding-left: 18px; border-left: 3px solid var(--blue); }
.prev h3 { font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: var(--soft); }
.prev p { white-space: pre-wrap; }

/* —— 告别 —— */
.drop { display: grid; gap: 14px; padding: 36px 0; border-block: 1px solid var(--rule); }
.drop h2 { font-size: 2.2rem; line-height: 1.2; }
.dropbox { position: relative; }
.fall { position: absolute; inset: 0; padding: 12px 14px; pointer-events: none; white-space: pre-wrap; line-height: 1.75; }
.fall span { display: inline-block; white-space: pre; }
.hold { position: relative; justify-self: start; padding: 0.8em 1.8em; background: none; border: 2px solid var(--fg); color: var(--fg); font-family: var(--display); font-size: 1.2rem; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.hold-fill { position: absolute; inset: 0; background: var(--sun); opacity: 0.45; transform: scaleX(0); transform-origin: left; }
.hold.holding .hold-fill { transform: scaleX(1); transition: transform 1.6s linear; }
.hold-text { position: relative; }

/* —— 三条路 —— */
.roads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 82rem; margin: 0 auto 64px; padding: 0 var(--gut); }
.road { display: grid; gap: 22px; align-content: start; padding: 0 clamp(14px, 2.2vw, 32px); border-left: 1px solid var(--rule); }
.road:first-child { border-left: 0; padding-left: 0; }
.road:last-child { padding-right: 0; }
.road-no { font-family: var(--display); color: var(--soft); margin-bottom: -18px; }
.road h2 { font-size: 1.9rem; line-height: 1.25; }
.road > .hint { min-height: 4.8em; }
.yr-row { display: grid; grid-template-columns: 3.6em 1fr; align-items: center; gap: 8px; }
.yr-row span { font-size: 0.9rem; color: var(--soft); }
.yr-row input { padding: 7px 10px; }
.gauge { gap: 0; }
.gauge .lv { margin-left: -12px; }

/* —— 来年 —— */
.yiji { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: none !important; }
.yj > .field-label { font-size: 4.2rem; line-height: 1; }
.sug { margin-top: 10px; font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sug button { background: none; border: 1px dashed var(--fg); padding: 2px 10px; }
.sug button:hover { background: var(--mark); border-style: solid; }
.must { display: grid; grid-template-columns: 1fr 11em; gap: 8px; margin-top: 6px; }
.letter { display: grid; gap: 14px; justify-items: start; }
.sealed { font-family: var(--display); font-size: 1.5rem; padding: 28px; border: 2px solid var(--fg); width: 100%; text-align: center; }
.letter-text { white-space: pre-wrap; background: var(--field); padding: 20px; width: 100%; }

/* —— 显影 —— */
.fin { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); max-width: 68rem; margin: 0 auto; padding: 0 var(--gut); align-items: center; }
.poster { width: min(100%, 78svh * 0.8); height: auto; display: block; }
.fin-side { display: grid; gap: 18px; justify-items: start; }
.fin-acts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seeyou { font-family: var(--display); font-size: 2.2rem; margin-top: 24px; }

/* —— 对照、关于 —— */
.cmps { max-width: 82rem; margin: 0 auto; padding: 0 var(--gut); }
.cmp { padding: 30px 0; border-top: 1px solid var(--rule); }
.cmp h2 { font-size: 1.6rem; line-height: 1.4; display: flex; gap: 0.8em; margin-bottom: 14px; }
.cmp h2 span { color: var(--soft); min-width: 1.5em; }
.cmp-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 20px; }
.cmp-row h3 { font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: var(--soft); }
.cmp-row p { white-space: pre-wrap; }
.prose h2 { font-size: 1.9rem; margin-top: 16px; margin-bottom: -24px; }
.srcs li { padding: 10px 0; border-top: 1px solid var(--rule); display: grid; gap: 2px; }
.srcs span { color: var(--soft); font-size: 0.9rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; min-height: 0; padding: 32px 24px 36px; gap: 18px; }
  .hero-ring { position: relative; grid-row: 2; width: auto; aspect-ratio: auto; height: 80vw; left: 0; top: 0; translate: none; }
  .hero-ring .rg { position: absolute; width: 142vw; height: 142vw; left: 50%; top: 50%; translate: -54% -50%; }
  .hero-ring .rg-label { display: none; }
  .hero-h1 { grid-column: 1; grid-row: 3; justify-self: start; writing-mode: horizontal-tb; font-size: clamp(2.4rem, 11vw, 3.6rem); letter-spacing: 0; }
  .hero-h1 span + span { padding-top: 0; }
  .hero-foot { grid-column: 1; grid-row: 4; justify-self: start; }
  .sec.two, .yr, .look, .q40, .areabox, .fin, .yiji { grid-template-columns: minmax(0, 1fr); }
  .yr-plate, .look-side, .q-side { position: static; }
  .yr-plate, .look-ring { max-width: 420px; width: 100%; margin: 0 auto; }
  .ledger a { grid-template-columns: 5.5rem 1fr; gap: 2px 14px; }
  .led-year { grid-row: span 3; }
  .chlist a { grid-template-columns: 1fr auto; gap: 2px 14px; }
  .ch-what { grid-column: 1 / -1; grid-row: 2; }
  .qgrid { grid-template-columns: repeat(8, 1fr); }
  .qcell { min-width: 0; }
  .roads { grid-template-columns: 1fr; gap: 56px; }
  .road, .road:first-child, .road:last-child { border-left: 0; padding: 0; }
  .road > .hint { min-height: 0; }
  .three { grid-template-columns: 1fr; }
  .must { grid-template-columns: 1fr; }
  .cmp-row { grid-template-columns: 1fr; }
  .top { gap: 12px; }
  .top-year { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .top, .pager, .foot, .demobar { display: none; }
}
