:root {
  --bg: #ece9e2;
  --ink: #15161b;
  --soft: rgba(21, 22, 27, .5);
  --faint: rgba(21, 22, 27, .16);
  --blue: #2420bd;
  --serif-en: "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --serif-zh: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, "FangSong", SimSun, serif;
}
body.night {
  --bg: #14151a;
  --ink: #ece9e2;
  --soft: rgba(236, 233, 226, .55);
  --faint: rgba(236, 233, 226, .16);
  --blue: #4a46ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #ece9e2; }
body { font-family: var(--serif-zh); color: var(--ink); -webkit-font-smoothing: antialiased; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hud { position: fixed; pointer-events: none; opacity: 0; transition: opacity 1.2s ease, color .8s ease; color: var(--ink); }
body.open .hud { opacity: 1; }
body.paged .hud, body.paged #hint { opacity: 0; transition-duration: .3s; }

#clock { left: clamp(18px, 4vw, 54px); top: clamp(18px, 5vh, 52px); font-family: var(--serif-en); }
#clock .time { font-size: 26px; letter-spacing: .06em; }
#clock sup { font-size: 12px; margin-left: 5px; color: var(--soft); vertical-align: 2px; }
#clock .date { font-size: 11.5px; letter-spacing: .34em; color: var(--soft); margin-top: 4px; }

#hint { left: 0; right: 0; bottom: 16px; text-align: center; font-size: 12px; letter-spacing: .2em; color: var(--ink); }
#hint span { background: var(--bg); padding: 5px 14px; border-radius: 2px; opacity: .78; transition: background .8s ease; }
body.open #hint { opacity: .85; }

/* ---------- 项目页 ---------- */
#page {
  position: fixed; inset: 0; background: var(--bg); color: var(--ink);
  opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s .45s;
  overflow-y: auto; display: flex; flex-direction: column; align-items: center;
}
#page.show { opacity: 1; visibility: visible; transition: opacity .45s ease; }
#back {
  position: fixed; left: clamp(16px, 4vw, 50px); top: clamp(16px, 4.5vh, 44px);
  background: none; border: 0; color: var(--ink); cursor: pointer; padding: 6px; z-index: 2;
  transition: transform .3s ease;
}
#back:hover { transform: scale(1.12); }
#back:focus-visible, .pager button:focus-visible, #p-go:focus-visible { outline: 1.5px solid var(--blue); outline-offset: 4px; }

.sheet {
  width: min(560px, 84vw); margin: auto; padding: 96px 0 40px 0; position: relative;
}
.sheet::before { content: ""; position: absolute; left: -18px; top: 70px; bottom: 20px; width: 1px; background: var(--faint); }
.sheet > * { opacity: 0; transform: translateY(14px); }
#page.show .sheet > * { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
#page.show .sheet > :nth-child(2) { transition-delay: .08s; }
#page.show .sheet > :nth-child(3) { transition-delay: .16s; }
#page.show .sheet > :nth-child(4) { transition-delay: .24s; }
#page.show .sheet > :nth-child(5) { transition-delay: .32s; }
#page.show .sheet > :nth-child(6) { transition-delay: .40s; }
#page.show .sheet > :nth-child(7) { transition-delay: .50s; }

.no { font-family: var(--serif-en); font-style: italic; font-size: 15px; letter-spacing: .12em; color: var(--soft); }
h1 { font-weight: 300; font-size: clamp(40px, 8vw, 64px); letter-spacing: .28em; margin: 10px 0 2px; }
.en { font-family: var(--serif-en); font-style: italic; font-size: 24px; color: var(--blue); letter-spacing: .04em; }
#emblem { width: 220px; height: 220px; display: block; margin: 26px 0 18px -8px; }
.tag { font-size: 12px; letter-spacing: .3em; color: var(--soft); margin-bottom: 14px; }

#p-lines { list-style: none; margin: 0; padding: 0; counter-reset: ln; }
#p-lines li {
  counter-increment: ln; position: relative; font-size: 17px; line-height: 2.2; letter-spacing: .1em;
  border-bottom: 1px solid var(--faint);
}
#p-lines li:nth-child(even) { padding-left: 2em; color: var(--soft); }
#p-lines li::before {
  content: counter(ln, decimal-leading-zero); position: absolute; left: -62px; width: 34px; text-align: right;
  font-family: var(--serif-en); font-size: 11px; color: var(--soft); letter-spacing: 0;
}
#p-lines li::after {
  content: ""; position: absolute; left: -22px; top: 50%; width: 8px; height: 1px; background: var(--faint);
}

#p-go {
  display: inline-flex; align-items: center; gap: 14px; margin-top: 34px; padding: 10px 0;
  font-size: 18px; letter-spacing: .4em; color: var(--blue); text-decoration: none;
  border-bottom: 1px solid var(--blue);
}
#p-go .arrow { transition: transform .35s ease; letter-spacing: 0; }
#p-go:hover .arrow { transform: translateX(10px); }
#p-go.soon { color: var(--soft); border-bottom-style: dashed; border-color: var(--faint); pointer-events: none; }

.pager { width: min(560px, 86vw); display: flex; justify-content: space-between; padding: 0 0 34px; }
.pager button {
  background: none; border: 0; cursor: pointer; color: var(--soft); font-family: var(--serif-zh);
  font-size: 13px; letter-spacing: .25em; padding: 8px 2px; transition: color .25s;
}
.pager button:hover { color: var(--blue); }

@media (max-width: 560px) {
  #hint { font-size: 11px; letter-spacing: .14em; }
  .sheet { margin-left: 13vw; padding-top: 84px; }
  #emblem { width: 180px; height: 180px; }
}

/* ?still 截图：不要过渡 */
body.still *, body.still *::before, body.still *::after { transition: none !important; }

/* ---------- 声音开关 ---------- */
#snd {
  position: fixed; right: clamp(14px, 3.6vw, 50px); top: clamp(14px, 4.5vh, 44px); z-index: 20;
  width: 36px; height: 36px; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
  color: var(--ink); background: var(--bg); border: 1px solid var(--faint);
  opacity: 0; pointer-events: none; transition: opacity 1.2s ease, color .8s ease, background .8s ease, transform .3s ease;
}
body.open #snd { opacity: .88; pointer-events: auto; }
#snd:hover { opacity: 1; transform: scale(1.08); }
#snd:focus-visible { outline: 1.5px solid var(--blue); outline-offset: 3px; }
#snd .x { display: none; }
#snd.off .x { display: inline; }
#snd.off .w { display: none; }
