/* 如果城市会做梦 — art picture book reader */

:root {
  --night: #070a18;
  --night-2: #0d1130;
  --ink: #f4ecd9;
  --ink-dim: #c8c0b2;
  --gold: #e9bd74;
  --gold-soft: #f3d8a8;
  --violet: #6a4aa8;
  --teal: #2f9e97;
  --ember: #e1783c;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --turn-ease: cubic-bezier(.5, .04, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- ambient room ---------- */
.room {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #161c3d 0%, #0a0e24 42%, #05070f 100%);
  z-index: 0;
}
.room__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  animation: breathe 18s ease-in-out infinite alternate;
}
.room__glow--violet {
  width: 62vmax; height: 62vmax;
  left: -18vmax; top: -22vmax;
  background: radial-gradient(circle, rgba(106, 74, 168, .55), transparent 65%);
}
.room__glow--amber {
  width: 48vmax; height: 48vmax;
  right: -14vmax; bottom: -20vmax;
  background: radial-gradient(circle, rgba(225, 120, 60, .32), transparent 65%);
  animation-delay: -7s;
}
@keyframes breathe {
  from { transform: scale(1) translate3d(0, 0, 0); opacity: .42; }
  to { transform: scale(1.14) translate3d(1%, 2%, 0); opacity: .62; }
}
.room__grain {
  position: absolute;
  inset: 0;
  opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.5'/></svg>");
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(12px, 2.2vh, 26px) clamp(14px, 3vw, 40px);
  pointer-events: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--ink-dim);
  font-family: var(--serif);
  font-size: clamp(12px, 1.1vw, 14px);
  letter-spacing: .18em;
  cursor: pointer;
  pointer-events: auto;
  transition: color .3s var(--ease);
}
.brand:hover { color: var(--gold-soft); }
.brand__mark {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  color: var(--gold);
}
.brand__mark svg { width: 100%; height: 100%; animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar__tools { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(233, 189, 116, .28);
  border-radius: 999px;
  background: rgba(10, 14, 36, .4);
  backdrop-filter: blur(8px);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .12em;
  cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease), background .3s var(--ease);
}
.ghost:hover { color: var(--gold-soft); border-color: rgba(233, 189, 116, .6); background: rgba(20, 26, 56, .6); }
.ghost__dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(233, 189, 116, .9);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.ghost[aria-pressed="false"] .ghost__dot { opacity: .2; box-shadow: none; }

/* ---------- stage & book ---------- */
.stage {
  position: relative;
  z-index: 10;
  display: grid;
  place-items: center;
  height: 100dvh;
  padding: clamp(52px, 7vh, 76px) clamp(14px, 2.6vw, 44px) clamp(58px, 7.4vh, 78px);
}

.book {
  --book-fit: calc(100dvh - clamp(118px, 15vh, 156px));
  position: relative;
  width: min(1480px, 100%, calc(var(--book-fit) * 16 / 9));
  aspect-ratio: 16 / 9;
  perspective: 2600px;
  perspective-origin: 50% 50%;
  outline: none;
  background: #0a0d1e;
  filter: drop-shadow(0 42px 74px rgba(3, 5, 14, .82));
}
.book__edge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  border: 1px solid rgba(233, 189, 116, .22);
  box-shadow:
    inset 0 0 110px rgba(5, 7, 15, .5),
    inset 0 0 0 1px rgba(255, 255, 255, .045);
}
/* 画框里再收一道细线，像印刷画册的版框 */
.book__edge::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(233, 189, 116, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
}
/* 极淡的纸纹，把插画与文字压到同一张纸上 */
.book__grain {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  opacity: .13;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23g)' opacity='.55'/></svg>");
}
/* 中缝：让 16:9 的一整幅读成摊开的左右两页 */
.book__gutter {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 16;
  width: clamp(26px, 3.2%, 52px);
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(to right,
    rgba(4, 6, 14, 0) 0%,
    rgba(4, 6, 14, .06) 18%,
    rgba(4, 6, 14, .38) 44%,
    rgba(3, 5, 12, .52) 50%,
    rgba(4, 6, 14, .38) 56%,
    rgba(4, 6, 14, .06) 82%,
    rgba(4, 6, 14, 0) 100%);
}
.book__gutter::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom,
    rgba(233, 189, 116, 0) 0%,
    rgba(233, 189, 116, .16) 14%,
    rgba(233, 189, 116, .26) 50%,
    rgba(233, 189, 116, .16) 86%,
    rgba(233, 189, 116, 0) 100%);
}
.book__shadow {
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(100deg, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, .18) 34%, transparent 62%);
  transition: opacity .5s var(--ease);
}
/* 整版压暗交给翻页纸页自身的明暗，避免二次叠暗 */
.book.is-turning .book__shadow { opacity: 0; }

.folio {
  position: absolute;
  bottom: 3.6%;
  z-index: 15;
  font-variant-numeric: tabular-nums;
  transition: opacity .22s var(--ease);
  font-family: var(--sans);
  font-size: clamp(8px, .72vw, 10px);
  line-height: 1;
  letter-spacing: .26em;
  color: rgba(244, 236, 217, .42);
  text-shadow: 0 2px 10px rgba(3, 5, 14, .8);
  pointer-events: none;
}
.folio--l { left: 3.4%; }
.folio--r { right: 3.4%; }

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform-origin: left center;
  background: #0b0f22;
  backface-visibility: hidden;
}
.slide.is-active { opacity: 1; visibility: visible; z-index: 5; }

/* 柔和换页（封面 / 扉页 / 竖屏） */
.slide.is-soft-out {
  visibility: visible;
  z-index: 8;
  animation: softOut .46s var(--ease) forwards;
}
.slide.is-soft-in { animation: softIn .52s var(--ease) both; }
@keyframes softOut { to { opacity: 0; transform: scale(1.008); } }
@keyframes softIn { from { opacity: 0; transform: translateY(1%); } to { opacity: 1; transform: none; } }

/* ---------- 翻页：右页绕书脊翻到左边，背面就是下一页的左页 ---------- */
.turn { position: absolute; inset: 0; z-index: 19; pointer-events: none; }
.turn__under {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
  background-repeat: no-repeat;
  background-color: #0a0e20;
}
.turn--fwd .turn__under { left: 50%; right: 0; }
.turn--back .turn__under { left: 0; right: 50%; }
.turn__under::after { content: ""; position: absolute; inset: 0; animation: underFade .82s var(--turn-ease) forwards; }
.turn--fwd .turn__under::after {
  background: linear-gradient(to right, rgba(3, 5, 12, .62), rgba(3, 5, 12, .16) 22%, rgba(3, 5, 12, 0) 52%);
}
.turn--back .turn__under::after {
  background: linear-gradient(to left, rgba(3, 5, 12, .62), rgba(3, 5, 12, .16) 22%, rgba(3, 5, 12, 0) 52%);
}
.turn__leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  transform-style: preserve-3d;
  will-change: transform;
  backface-visibility: hidden;
}
.turn--fwd .turn__leaf {
  left: 50%;
  right: 0;
  transform-origin: left center;
  animation: leafFwd .82s var(--turn-ease) forwards;
}
.turn--back .turn__leaf {
  left: 0;
  right: 50%;
  transform-origin: right center;
  animation: leafBack .82s var(--turn-ease) forwards;
}
.turn__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  background-repeat: no-repeat;
  background-color: #0a0e20;
}
.turn__face--back { transform: rotateY(180deg); }
/* 纸的白边与压痕，让翻起的那一页有厚度 */
.turn__face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* 书脊侧的白边跟着页一起出现，避免翻起的第一帧突然亮一条线 */
.turn__face--front::after { opacity: 0; animation: edgeIn .34s var(--ease) forwards; }
@keyframes edgeIn { from { opacity: 0; } to { opacity: 1; } }
.turn--fwd .turn__face--front::after {
  box-shadow: inset -1px 0 0 rgba(255, 246, 228, .22), inset -22px 0 28px -24px rgba(255, 246, 228, .55);
}
.turn--back .turn__face--front::after {
  box-shadow: inset 1px 0 0 rgba(255, 246, 228, .22), inset 22px 0 28px -24px rgba(255, 246, 228, .55);
}
.turn--fwd .turn__face--back::after {
  box-shadow: inset 1px 0 0 rgba(255, 246, 228, .26), inset 20px 0 26px -22px rgba(255, 246, 228, .5);
}
.turn--back .turn__face--back::after {
  box-shadow: inset -1px 0 0 rgba(255, 246, 228, .26), inset -20px 0 26px -22px rgba(255, 246, 228, .5);
}
/* 翻起的那一页连同版面文字一起抬起：宽度取两倍，好让内部百分比与整幅一致 */
.turn__page {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  pointer-events: none;
}
.slide.is-ink-out .panel { opacity: 0; transition: opacity .18s var(--ease); }
.turn__shade { position: absolute; inset: 0; background: #050710; }
.turn__shade--front { opacity: 0; animation: shadeUp .82s var(--turn-ease) forwards; }
.turn__shade--back { opacity: .52; animation: shadeDown .82s var(--turn-ease) forwards; }
@keyframes leafFwd {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-180deg); }
}
@keyframes leafBack {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}
@keyframes shadeUp { 0% { opacity: 0; } 40% { opacity: .4; } 100% { opacity: .68; } }
@keyframes shadeDown { 0% { opacity: .6; } 58% { opacity: .3; } 100% { opacity: 0; } }
@keyframes underFade { 0% { opacity: 1; } 72% { opacity: .34; } 100% { opacity: 0; } }

.book.is-turning .folio { opacity: 0; }

.slide__art { position: absolute; inset: 0; overflow: hidden; background: #0b0f22; }
.slide__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
  display: block;
  transform: scale(1.002);
  transition: filter .9s var(--ease);
}
.slide.is-lit .slide__art img { filter: brightness(1.1) saturate(1.08); }
.slide__veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(6, 9, 22, .96) 0%, rgba(6, 9, 22, .82) 16%, rgba(6, 9, 22, .26) 42%, rgba(6, 9, 22, 0) 62%),
    linear-gradient(to right, rgba(6, 9, 22, .5) 0%, rgba(6, 9, 22, .12) 34%, rgba(6, 9, 22, 0) 52%),
    radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(4, 6, 16, .4) 100%);
}

/* ---------- cover ---------- */
.slide--cover .slide__veil {
  background:
    linear-gradient(to top, rgba(5, 7, 18, .92) 0%, rgba(5, 7, 18, .45) 38%, rgba(5, 7, 18, .05) 70%),
    linear-gradient(105deg, rgba(5, 7, 18, .8) 0%, rgba(5, 7, 18, .3) 42%, rgba(5, 7, 18, 0) 72%);
}
.cover {
  position: absolute;
  left: clamp(18px, 5.6%, 82px);
  bottom: clamp(18px, 8%, 66px);
  max-width: min(600px, 44%);
  z-index: 3;
}
.eyebrow {
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .55em;
  font-family: var(--sans);
  font-size: clamp(9px, .82vw, 11px);
  letter-spacing: .3em;
  color: var(--gold);
  text-transform: uppercase;
}
.eyebrow__dot { opacity: .6; letter-spacing: 0; }
.eyebrow__en { letter-spacing: .26em; color: rgba(233, 189, 116, .78); }
.cover__title {
  margin: 0;
  font-size: clamp(34px, 5.4vw, 86px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: .06em;
  color: #fdf6e6;
  text-shadow: 0 6px 34px rgba(4, 6, 18, .7);
}
.cover__title span { display: block; }
.cover__title span + span { margin-left: .34em; }
.cover__en {
  margin: 14px 0 0;
  font-family: var(--sans);
  font-size: clamp(9px, .9vw, 12px);
  letter-spacing: .52em;
  color: var(--gold-soft);
  opacity: .85;
}
.cover__rule {
  width: clamp(48px, 8vw, 92px);
  height: 1px;
  margin: 20px 0 16px;
  background: linear-gradient(to right, var(--gold), rgba(233, 189, 116, 0));
}
.cover__sub {
  margin: 0;
  font-size: clamp(11px, 1.02vw, 14px);
  line-height: 2;
  letter-spacing: .08em;
  color: rgba(244, 236, 217, .78);
}
.enter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-top: clamp(16px, 3.2vh, 28px);
  padding: 0 22px;
  border: 1px solid rgba(233, 189, 116, .55);
  border-radius: 2px;
  background: rgba(233, 189, 116, .08);
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .26em;
  cursor: pointer;
  transition: background .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), gap .35s var(--ease);
}
.enter svg { width: 18px; height: 18px; transition: transform .35s var(--ease); }
.enter:hover { background: rgba(233, 189, 116, .2); color: #fff7e6; gap: 15px; }
.enter:hover svg { transform: translateX(3px); }
.cover__imprint {
  margin: 18px 0 0;
  font-family: var(--sans);
  font-size: clamp(8px, .72vw, 10px);
  letter-spacing: .32em;
  color: rgba(233, 189, 116, .48);
  text-transform: uppercase;
}
.cover__hint {
  position: absolute;
  right: clamp(14px, 3%, 34px);
  bottom: clamp(14px, 2.6%, 26px);
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .22em;
  color: rgba(244, 236, 217, .42);
  z-index: 3;
}

/* ---------- title page：左页题辞，右页书名 ---------- */
.slide__art--paper {
  background:
    radial-gradient(90% 70% at 72% 18%, rgba(106, 74, 168, .34), transparent 62%),
    radial-gradient(70% 60% at 18% 88%, rgba(225, 120, 60, .18), transparent 60%),
    linear-gradient(160deg, #101433 0%, #0a0d22 55%, #070a18 100%);
}
.slide__art--paper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='200' height='200' filter='url(%23p)' opacity='.28'/></svg>");
  opacity: .35;
  mix-blend-mode: overlay;
}
.titlepage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  height: 100%;
}
.titlepage__verso {
  padding: 0 7% 0 9%;
  max-width: 94%;
}
.titlepage__recto {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 8%;
  text-align: center;
}
.titlepage__kicker {
  margin: 0 0 clamp(16px, 3.6vh, 34px);
  font-family: var(--sans);
  font-size: clamp(9px, .82vw, 11px);
  letter-spacing: .38em;
  color: rgba(233, 189, 116, .8);
}
.titlepage__title {
  margin: 0;
  font-size: clamp(30px, 3.7vw, 56px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .16em;
  color: #fbf3e2;
}
.titlepage__en {
  margin: clamp(10px, 1.8vh, 18px) 0 0;
  font-family: var(--sans);
  font-size: clamp(8px, .74vw, 10px);
  letter-spacing: .58em;
  color: rgba(233, 189, 116, .72);
}
.titlepage__quote {
  margin: 0;
  font-size: clamp(14px, 1.5vw, 22px);
  line-height: 2.05;
  letter-spacing: .1em;
  color: rgba(244, 236, 217, .9);
}
.titlepage__quote::before {
  content: "";
  display: block;
  width: clamp(38px, 4vw, 62px);
  height: 1px;
  margin-bottom: clamp(14px, 2.6vh, 26px);
  background: linear-gradient(to right, rgba(233, 189, 116, .75), rgba(233, 189, 116, 0));
}
.titlepage__dedi {
  margin: clamp(16px, 3vh, 30px) 0 0;
  font-family: var(--sans);
  font-size: clamp(9px, .84vw, 11px);
  letter-spacing: .26em;
  color: rgba(244, 236, 217, .45);
}
.titlepage__sky {
  width: min(520px, 92%);
  margin: clamp(10px, 2.4vh, 26px) 0 0;
  color: rgba(233, 189, 116, .6);
}
.titlepage__sky svg { width: 100%; height: auto; display: block; }
.titlepage__turn {
  margin: clamp(10px, 2vh, 20px) 0 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .26em;
  color: rgba(244, 236, 217, .4);
  animation: nudge 3.4s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateX(0); opacity: .34; }
  50% { transform: translateX(5px); opacity: .7; }
}

/* ---------- story panels ---------- */
.panel {
  position: absolute;
  left: clamp(16px, 6.4%, 96px);
  bottom: clamp(16px, 11%, 78px);
  z-index: 3;
  isolation: isolate;
  width: min(540px, 35%);
  padding-left: clamp(12px, 1.5vw, 22px);
  border-left: 1px solid rgba(233, 189, 116, .42);
}
.panel::before {
  content: "";
  position: absolute;
  inset: -30px -46px -30px -34px;
  z-index: -1;
  background:
    radial-gradient(130% 130% at 0% 100%, rgba(5, 8, 20, .9) 0%, rgba(5, 8, 20, .62) 44%, rgba(5, 8, 20, 0) 80%),
    linear-gradient(to right, rgba(5, 8, 20, .42) 0%, rgba(5, 8, 20, 0) 92%);
  filter: blur(6px);
  pointer-events: none;
}
.chapter {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: clamp(10px, 1.7vh, 16px);
}
.chapter::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  margin-bottom: .28em;
  background: linear-gradient(to right, rgba(233, 189, 116, .46), rgba(233, 189, 116, .16) 55%, rgba(233, 189, 116, 0));
}
.chapter__num {
  font-family: var(--serif);
  font-size: clamp(11px, .9vw, 12.5px);
  color: var(--gold-soft);
  letter-spacing: .16em;
  padding: 3px 8px 3px 9px;
  border: 1px solid rgba(233, 189, 116, .34);
  border-radius: 1px;
  line-height: 1.35;
  box-shadow: inset 0 0 12px rgba(233, 189, 116, .08);
}
.chapter__title {
  font-family: var(--sans);
  font-size: clamp(10px, .86vw, 12px);
  letter-spacing: .3em;
  color: rgba(244, 236, 217, .72);
}
.para {
  margin: 0 0 .7em;
  font-size: clamp(12px, 1.1vw, 15px);
  line-height: 1.95;
  letter-spacing: .055em;
  color: rgba(240, 233, 219, .84);
  text-shadow: 0 2px 14px rgba(3, 5, 14, .85);
  text-wrap: pretty;
}
.em {
  margin: 0;
  font-size: clamp(14px, 1.42vw, 20px);
  line-height: 1.85;
  letter-spacing: .075em;
  color: #fdf3de;
  text-shadow: 0 3px 20px rgba(3, 5, 14, .9);
  text-wrap: pretty;
}
.note {
  margin: clamp(10px, 1.8vh, 16px) 0 0;
  max-height: 0;
  overflow: hidden;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.8;
  letter-spacing: .06em;
  color: var(--gold-soft);
  opacity: 0;
  transition: max-height .6s var(--ease), opacity .5s var(--ease), margin .5s var(--ease);
}
.note.is-shown {
  max-height: 6em;
  opacity: .92;
}
.note.is-shown::before {
  content: "— ";
  color: rgba(233, 189, 116, .6);
}

/* ---------- sparks ---------- */
.spark {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 4;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--gold-soft);
}
.spark__core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: rgba(255, 244, 220, .95);
  box-shadow: 0 0 14px 5px rgba(233, 189, 116, .5), 0 0 40px 14px rgba(225, 120, 60, .22);
  animation: pulse 3.2s ease-in-out infinite;
}
.spark__ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 244, 220, .55);
  animation: ripple 3.2s ease-out infinite;
}
.spark__tag {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 3px 10px;
  border: 1px solid rgba(233, 189, 116, .28);
  border-radius: 999px;
  background: rgba(6, 9, 20, .5);
  backdrop-filter: blur(4px);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .18em;
  color: rgba(255, 246, 230, .82);
  opacity: .9;
  transition: opacity .3s var(--ease);
}
@media (hover: hover) {
  .spark__tag { opacity: 0; }
  .spark:hover .spark__tag, .spark:focus-visible .spark__tag { opacity: 1; }
}
.spark:hover .spark__tag { color: #fff; }
.spark:focus-visible { outline: 1px solid var(--gold-soft); outline-offset: 4px; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.28); opacity: 1; }
}
@keyframes ripple {
  0% { transform: scale(.7); opacity: .8; }
  70% { transform: scale(1.9); opacity: 0; }
  100% { opacity: 0; }
}
.slide.is-lit .spark { display: none; }
.spark:disabled { cursor: default; }

/* ---------- hud ---------- */
.hud {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto auto 1fr;
  align-items: center;
  gap: clamp(10px, 2vw, 22px);
  padding: clamp(10px, 2vh, 20px) clamp(14px, 3vw, 36px) clamp(12px, 2.4vh, 24px);
  background: linear-gradient(to top, rgba(5, 7, 15, .78), rgba(5, 7, 15, 0));
  pointer-events: none;
}
.hud__nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: rgba(244, 236, 217, .6);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .2em;
  cursor: pointer;
  pointer-events: auto;
  transition: color .3s var(--ease);
}
.hud__nav svg { width: 20px; height: 20px; }
.hud__nav:hover:not(:disabled) { color: var(--gold-soft); }
.hud__nav:disabled { opacity: .22; cursor: default; }
.hud__nav--next { justify-self: end; }
.hud__meta {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .28em;
  color: rgba(244, 236, 217, .48);
  min-width: 4.4em;
  text-align: center;
}
.dots { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 1px solid rgba(233, 189, 116, .4);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background .3s var(--ease), transform .3s var(--ease), border-color .3s var(--ease);
}
.dot[aria-selected="true"] {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.32);
  box-shadow: 0 0 10px rgba(233, 189, 116, .7);
}
.dot:focus-visible { outline: 1px solid var(--gold-soft); outline-offset: 3px; }

/* ---------- index overlay ---------- */
.index {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: clamp(20px, 5vh, 60px) clamp(16px, 5vw, 64px);
  background: rgba(5, 7, 16, .9);
  backdrop-filter: blur(16px) saturate(1.1);
  overflow-y: auto;
  animation: fadeIn .4s var(--ease) both;
}
.index[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.index__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto clamp(16px, 3vh, 30px);
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(233, 189, 116, .2);
}
.index__head h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 400;
  letter-spacing: .4em;
  color: var(--gold-soft);
}
.index__close {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(233, 189, 116, .3);
  border-radius: 999px;
  background: none;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .2em;
  cursor: pointer;
}
.index__close:hover { color: var(--gold-soft); border-color: rgba(233, 189, 116, .6); }
.index__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: clamp(12px, 1.6vw, 22px);
  max-width: 1180px;
  margin: 0 auto;
}
.thumb {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-dim);
  text-align: left;
  cursor: pointer;
}
.thumb__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(233, 189, 116, .18);
  background: #0b0f22;
  transition: border-color .35s var(--ease), transform .35s var(--ease);
}
.thumb__frame img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .82; transition: opacity .35s var(--ease), transform .5s var(--ease); }
.thumb--titlepage .thumb__frame {
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #161b40, #080b1c);
}
.thumb--titlepage .thumb__frame span {
  font-size: 13px;
  letter-spacing: .2em;
  color: rgba(244, 236, 217, .7);
}
.thumb:hover .thumb__frame, .thumb:focus-visible .thumb__frame { border-color: rgba(233, 189, 116, .7); transform: translateY(-2px); }
.thumb:hover .thumb__frame img { opacity: 1; transform: scale(1.04); }
.thumb:focus-visible { outline: none; }
.thumb:focus-visible .thumb__frame { outline: 1px solid var(--gold-soft); outline-offset: 3px; }
.thumb__label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .14em;
  color: rgba(244, 236, 217, .58);
}
.thumb[aria-current="true"] .thumb__label { color: var(--gold); }
.index__foot {
  max-width: 1180px;
  margin: clamp(20px, 4vh, 40px) auto 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .3em;
  color: rgba(244, 236, 217, .3);
  text-align: center;
}

/* ---------- focus ---------- */
:focus-visible { outline: 1px solid rgba(233, 189, 116, .8); outline-offset: 3px; }

/* ---------- responsive：竖屏时横版书页留在上方，文字成为页下的注 ---------- */
@media (max-width: 820px) {
  .stage {
    display: block;
    height: 100dvh;
    padding: 52px 10px 62px;
  }
  .book {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    perspective: none;
  }
  .book__gutter { display: none; }
  .slide {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
      radial-gradient(120% 70% at 50% 0%, #131838 0%, #0a0e21 52%, #070a17 100%);
  }
  .slide:not(.slide--cover) { justify-content: flex-start; }
  .slide:not(.slide--cover) .panel { flex: 1 1 auto; justify-content: flex-start; padding-bottom: 34px; }
  .slide__art {
    position: relative;
    inset: auto;
    width: 100%;
    height: calc((100vw - 20px) * 9 / 16);
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    border-top: 1px solid rgba(233, 189, 116, .12);
    border-bottom: 1px solid rgba(233, 189, 116, .16);
  }
  .slide__art img { object-position: center 48%; }
  .folio { bottom: 16px; color: rgba(244, 236, 217, .32); }
  .folio--l { left: 22px; }
  .folio--r { right: 22px; }
  .slide--title .slide__art--paper { height: auto; flex: 1 1 auto; aspect-ratio: auto; }
  .slide--cover { justify-content: flex-start; }
  .slide--cover .cover {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: none;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 22px 24px 30px;
    background: none;
  }
  .cover__title { font-size: clamp(32px, 10.4vw, 52px); letter-spacing: .04em; }
  .cover__sub { font-size: 12px; }
  .cover__hint { display: none; }
  .panel {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-width: 46ch;
    margin: 0 auto;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 26px 24px 0;
    border-left: 0;
    background: none;
    isolation: auto;
  }
  .panel::before { display: none; }
  .chapter { margin-bottom: 10px; }
  .para { font-size: 13px; line-height: 1.95; }
  .em { font-size: 15.5px; line-height: 1.8; }
  .spark { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .spark__core { inset: 20px; }
  .spark__tag { font-size: 9.5px; }
  .titlepage { grid-template-columns: 1fr; align-content: center; }
  .titlepage__verso { order: 2; padding: 0 12%; margin-top: 4vh; text-align: center; max-width: none; }
  .titlepage__recto { order: 1; flex: 0 0 auto; height: auto; padding: 0 10%; }
  .titlepage__kicker { font-size: 9px; letter-spacing: .28em; margin-bottom: 14px; }
  .titlepage__title { font-size: clamp(26px, 8.4vw, 40px); letter-spacing: .1em; line-height: 1.24; }
  .titlepage__en { letter-spacing: .42em; margin-top: 10px; }
  .titlepage__sky { width: min(360px, 80%); margin-top: 10px; }
  .titlepage__quote { font-size: 13px; line-height: 2; }
  .titlepage__quote::before { margin: 0 auto 12px; }
  .titlepage__dedi { margin-top: 10px; font-size: 10px; }
  .titlepage__turn { margin-top: 12px; }
  .topbar { padding: 10px 12px; }
  .brand__text { display: none; }
  .hud { grid-template-columns: auto 1fr auto; gap: 8px; padding: 8px 12px 10px; }
  .hud__meta { display: none; }
  .dots { justify-content: center; }
  .hud__nav span { display: none; }
  .hud__nav { padding: 0 10px; }
  .hud__nav svg { width: 22px; height: 22px; }
  .slide.is-soft-out { animation: softOut .38s var(--ease) forwards; }
  .slide.is-soft-in { animation: softIn .42s var(--ease) both; }
  .index__grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
/* 矮屏横放手机 / 小横屏：压缩上下留白，让展开的两页尽量大 */
@media (max-height: 560px) and (min-width: 821px) {
  .stage { padding: 40px 8px 44px; }
  .book { width: min(1480px, 100%, calc((100dvh - 84px) * 16 / 9)); }
  .topbar { padding: 6px 12px; }
  .brand__text { display: none; }
  .hud { padding: 2px 12px 6px; }
  .hud__nav span { display: none; }
  .hud__nav { min-height: 34px; }
  .panel {
    left: 5%;
    bottom: 9.5%;
    width: 44%;
    padding-left: 12px;
  }
  .chapter { margin-bottom: 5px; gap: 8px; }
  .chapter__title { font-size: 10px; letter-spacing: .18em; }
  .para { font-size: 11.5px; line-height: 1.72; margin-bottom: .5em; }
  .em { font-size: 13.5px; line-height: 1.66; }
  .note { font-size: 10.5px; }
  .cover { max-width: 52%; left: 5%; bottom: 6%; }
  .eyebrow { margin-bottom: 8px; font-size: 8px; letter-spacing: .22em; }
  .cover__title { font-size: clamp(26px, 8.6vh, 42px); }
  .cover__en { margin-top: 8px; font-size: 8px; }
  .cover__rule { margin: 10px 0 8px; }
  .cover__sub { font-size: 10.5px; line-height: 1.7; }
  .enter { min-height: 36px; margin-top: 10px; padding: 0 16px; font-size: 12px; }
  .folio { font-size: 8px; bottom: 2.8%; }
  .titlepage__sky { width: min(360px, 80%); margin-top: 8px; }
  .titlepage__title { font-size: clamp(22px, 7vh, 34px); }
  .titlepage__quote { font-size: clamp(11px, 1.6vh, 15px); line-height: 1.9; }
  .titlepage__kicker { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .room__glow, .brand__mark svg, .spark__core, .spark__ring, .titlepage__turn { animation: none; }
  .turn { display: none; }
  .slide.is-soft-out { animation: leafFade .26s linear forwards; }
  .slide.is-soft-in { animation: none; }
  @keyframes leafFade { to { opacity: 0; } }
  .slide__art img, .note, .book__shadow { transition: opacity .2s linear; }
}

/* ---------- 翻页页面：整幅页面克隆后裁出半页 ---------- */
.turn__page--right { left: -100%; }
.turn__page .slide {
  opacity: 1;
  visibility: visible;
  transform: none;
  animation: none;
  z-index: 0;
}
.turn__page .spark { animation: none; }

/* ---------- 单页（手机）翻页：绕书脊掀开 ---------- */
.turn--mob {
  position: absolute;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  perspective: 1600px;
  perspective-origin: 34% 50%;
}
/* 掀开时底下那一页也来自同一份克隆，落下时与原页严丝合缝 */
.turn__mbase {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0a0e20;
}
.turn__mshade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to right, rgba(3, 5, 12, .66) 0%, rgba(3, 5, 12, .2) 16%, rgba(3, 5, 12, 0) 42%);
  opacity: 0;
  animation: mobVeil .58s var(--turn-ease) forwards;
}
.turn__mleaf {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: left center;
  will-change: transform;
  backface-visibility: hidden;
}
.turn__mleaf::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(255, 246, 228, .3), rgba(255, 246, 228, .07) 60%);
  pointer-events: none;
  opacity: 0;
  animation: edgeIn .26s var(--ease) forwards;
}
.turn__mleaf::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #05070f;
  pointer-events: none;
}
.turn--out .turn__mleaf { animation: mobOut .58s var(--turn-ease) forwards; }
.turn--out .turn__mleaf::after { animation: mobLeafShadeOut .58s var(--turn-ease) forwards; }
.turn--in .turn__mleaf { animation: mobIn .58s var(--turn-ease) forwards; }
.turn--in .turn__mleaf::after { animation: mobLeafShadeIn .58s var(--turn-ease) forwards; }

@keyframes mobOut {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-97deg); }
}
@keyframes mobIn {
  from { transform: rotateY(-97deg); }
  to { transform: rotateY(0deg); }
}
/* 起手一律不压黑：第一帧必须和翻页前一模一样，否则整页会闪一下 */
@keyframes mobVeil {
  0% { opacity: 0; }
  34% { opacity: .46; }
  100% { opacity: 0; }
}
@keyframes mobLeafShadeOut {
  0% { opacity: 0; }
  46% { opacity: .34; }
  100% { opacity: .64; }
}
@keyframes mobLeafShadeIn {
  0% { opacity: .64; }
  40% { opacity: .32; }
  100% { opacity: 0; }
}

.turn--mob .slide {
  opacity: 1;
  visibility: visible;
  transform: none;
  animation: none;
}
.turn--mob .spark { animation: none; }
