:root {
  --bean: #9ebc7a;
  --moss: #537748;
  --moss-deep: #173d32;
  --forest: #092820;
  --night: #041612;
  --paper: #f8ebcb;
  --paper-deep: #d9bd88;
  --gold: #e9ca6a;
  --gold-deep: #966b2b;
  --wood: #8d5d3e;
  --pink: #eda2bc;
  --ink: #36513e;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --wei: "STXinwei", "FZWeiBei-S03", "KaiTi", "SimKai", serif;
  --gothic: "Old English Text MT", "UnifrakturCook", "Georgia", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
}

body {
  color: var(--ink);
  font-family: var(--wei);
}

button {
  border: 0;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgba(255, 234, 152, 0.95);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 16px 12px calc(72px + var(--safe-bottom));
  isolation: isolate;
}

.forest-backdrop {
  position: fixed;
  inset: -4%;
  z-index: -3;
  background:
    linear-gradient(rgba(4, 26, 22, 0.25), rgba(2, 15, 13, 0.66)),
    url("./assets/board-cover-scene.png") center / cover no-repeat;
  filter: saturate(0.88) brightness(0.72);
  transform: scale(1.08);
}

.forest-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 15, 13, 0.45), transparent 22% 78%, rgba(2, 15, 13, 0.48)),
    linear-gradient(transparent 56%, rgba(2, 15, 13, 0.38));
}

.ambient-petals {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ambient-petals span {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 72% 18% 72% 18%;
  background: rgba(239, 165, 189, 0.74);
  filter: drop-shadow(0 0 5px rgba(244, 183, 201, 0.38));
  animation: petalDrift 10s ease-in-out infinite alternate;
}

.ambient-petals span:nth-child(1) { left: 8%; top: 12%; animation-delay: -2s; }
.ambient-petals span:nth-child(2) { left: 22%; top: 80%; animation-delay: -7s; transform: scale(0.72); }
.ambient-petals span:nth-child(3) { left: 38%; top: 24%; animation-delay: -4s; transform: scale(0.66); }
.ambient-petals span:nth-child(4) { left: 54%; top: 72%; animation-delay: -9s; transform: scale(0.84); }
.ambient-petals span:nth-child(5) { left: 66%; top: 18%; animation-delay: -1s; transform: scale(0.7); }
.ambient-petals span:nth-child(6) { left: 78%; top: 62%; animation-delay: -6s; }
.ambient-petals span:nth-child(7) { left: 91%; top: 34%; animation-delay: -3s; transform: scale(0.68); }
.ambient-petals span:nth-child(8) { left: 46%; top: 92%; animation-delay: -8s; transform: scale(0.76); }
.ambient-petals span:nth-child(9) { left: 84%; top: 88%; animation-delay: -5s; transform: scale(0.62); }

.opening-subtitle {
  position: fixed;
  left: 50%;
  top: max(26px, env(safe-area-inset-top, 0px));
  z-index: 20;
  width: min(88vw, 620px);
  padding: 12px 17px;
  border: 1px solid rgba(255, 239, 176, 0.2);
  border-radius: 18px;
  color: rgba(255, 248, 220, 0.94);
  background: rgba(7, 34, 28, 0.64);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  font-size: clamp(13px, 3.5vw, 16px);
  line-height: 1.72;
  text-align: center;
  backdrop-filter: blur(12px);
  animation: subtitleRise 0.8s ease both, subtitleBreathe 4s 0.8s ease-in-out infinite alternate;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.opening-subtitle p {
  margin: 0;
}

.opening-subtitle p + p {
  margin-top: 4px;
}

.opening-subtitle.is-hidden {
  opacity: 0 !important;
  pointer-events: none;
  transform: translate(-50%, -18px) !important;
  animation: none;
}

.rotate-prompt {
  display: none;
}

.stage {
  width: min(100%, 430px);
  height: min(80dvh, 850px);
  min-height: 620px;
  perspective: 1800px;
}

.book-shell {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.book-shell::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 4%;
  bottom: 2%;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.27);
  filter: blur(18px);
  transform: translateZ(-80px) rotateX(60deg);
}

.book-shell.has-quest-spark::after {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 12;
  pointer-events: none;
  border: 2px solid rgba(255, 230, 141, 0.74);
  border-radius: 26px;
  opacity: 0;
  animation: questSpark 0.72s ease-out;
}

.book-shell.is-diving {
  animation: diveIntoBook 1.05s cubic-bezier(0.18, 0.86, 0.24, 1) both;
}

.page {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(111, 81, 45, 0.28);
  border-radius: 28px 18px 18px 28px;
  opacity: 0;
  pointer-events: none;
  transform: rotateY(48deg) translateX(32px) translateZ(-30px) scale(0.96);
  transform-origin: left center;
  transition: opacity 0.42s ease, transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.page.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: rotateY(0deg) translateX(0) translateZ(0) scale(1);
}

.turn-sheet {
  position: absolute;
  inset: 18px 14px 18px 22px;
  z-index: 15;
  border-radius: 24px 14px 14px 24px;
  pointer-events: none;
  opacity: 0;
  transform: rotateY(0deg) translateZ(38px);
  transform-origin: left center;
  background:
    linear-gradient(90deg, rgba(105, 72, 39, 0.24), transparent 18%, rgba(255, 255, 255, 0.52) 56%, rgba(147, 111, 67, 0.16)),
    url("./assets/board-paper-texture-clean.png") center / 330px 330px repeat,
    #fff0cb;
  box-shadow: 18px 22px 32px rgba(46, 28, 13, 0.24);
}

.turn-sheet.is-flipping {
  animation: pageFlip 0.74s cubic-bezier(0.16, 0.82, 0.2, 1);
}

.page-cover {
  background: var(--forest);
}

.cover-photo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 12, 10, 0.04), rgba(2, 12, 10, 0.08) 58%, rgba(2, 12, 10, 0.62)),
    url("./assets/board-cover-scene.png") center / cover no-repeat;
}

.cover-open-target {
  position: absolute;
  left: 17%;
  top: 24%;
  z-index: 7;
  width: 66%;
  height: 43%;
  border-radius: 18px;
  background: transparent;
}

.cover-text-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cover-title-card,
.cover-author-card {
  position: absolute;
  left: 50%;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(48%, 194px);
  text-align: center;
  transform: translate(-50%, -50%);
}

.cover-title-card {
  top: 34.5%;
}

.cover-author-card {
  top: 54%;
}

.book-title-cn {
  max-width: 8em;
  color: transparent;
  background: linear-gradient(102deg, #6f491f 0%, #c08a38 18%, #fff0a9 36%, #8a5a24 54%, #f8dd87 72%, #6f491f 100%);
  background-size: 230% auto;
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(255, 239, 167, 0.42)) drop-shadow(0 2px 1px rgba(67, 35, 13, 0.48));
  font-size: clamp(16px, 4.8vw, 25px);
  line-height: 1.08;
  animation: titleGoldFlow 3.8s linear infinite;
}

.book-title-en,
.author-en {
  color: #e2c86d;
  font-family: var(--gothic);
  font-size: clamp(6px, 1.65vw, 8px);
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(44, 27, 9, 0.48);
}

.author-cn {
  color: #f3d984;
  font-size: clamp(11px, 3vw, 14px);
  text-shadow: 0 1px 2px rgba(44, 27, 9, 0.56);
}

.book-belly-band {
  position: absolute;
  left: 17%;
  top: 42%;
  z-index: 4;
  width: 66%;
  height: 55px;
  border-top: 2px solid rgba(255, 230, 146, 0.74);
  border-bottom: 2px solid rgba(255, 230, 146, 0.74);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(233, 156, 182, 0.26), rgba(255, 204, 218, 0.53), rgba(217, 132, 165, 0.25));
  box-shadow: 0 0 18px rgba(246, 183, 200, 0.36);
  mix-blend-mode: screen;
}

.cover-action-hint {
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 8;
  min-height: 44px;
  margin: 0;
  padding: 11px 18px;
  border: 1px solid rgba(245, 218, 126, 0.7);
  border-radius: 999px;
  color: #fff1b6;
  background: rgba(7, 35, 29, 0.74);
  font-size: 16px;
  line-height: 20px;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.book-shell.is-unsealing .book-belly-band {
  animation: unsealBand 0.64s ease both;
}

.book-shell.is-unsealing .cover-title-card,
.book-shell.is-unsealing .cover-author-card {
  animation: liftCoverWords 0.62s ease both;
}

.page-spread {
  overflow: visible;
  border: 0;
}

.open-spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: min(74dvh, 720px);
  filter: drop-shadow(0 28px 24px rgba(17, 11, 7, 0.4));
  transform: rotateX(5deg);
  transform-style: preserve-3d;
}

.book-leaf {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(124, 90, 50, 0.32);
  background:
    linear-gradient(90deg, rgba(102, 70, 37, 0.12), transparent 11%, transparent 90%, rgba(95, 63, 35, 0.09)),
    url("./assets/board-paper-texture-clean.png") center / 330px 330px repeat,
    var(--paper);
  box-shadow: inset 0 0 26px rgba(99, 67, 34, 0.12);
}

.left-leaf {
  border-radius: 22px 5px 5px 22px;
  transform: rotateY(3deg);
  transform-origin: right center;
}

.right-leaf {
  border-radius: 5px 22px 22px 5px;
  transform: rotateY(-3deg);
  transform-origin: left center;
}

.left-leaf::after,
.right-leaf::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22px;
  pointer-events: none;
}

.left-leaf::after {
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(95, 62, 33, 0.22));
}

.right-leaf::before {
  left: 0;
  background: linear-gradient(90deg, rgba(95, 62, 33, 0.22), transparent);
}

.leaf-inner {
  position: relative;
  height: 100%;
  padding: clamp(22px, 5dvh, 44px) clamp(14px, 4vw, 26px);
}

.page-number {
  position: absolute;
  top: 14px;
  color: rgba(84, 111, 68, 0.62);
  font-family: var(--gothic);
  font-size: 13px;
}

.left-leaf .page-number {
  left: 18px;
}

.right-leaf .page-number {
  right: 18px;
}

.story-copy {
  margin: 0;
  color: var(--ink);
}

.prose-panel {
  display: grid;
  place-items: center;
}

.story-copy-large {
  max-width: 8.5em;
  font-size: clamp(19px, 5.1vw, 29px);
  line-height: 1.76;
  text-align: center;
}

.letter-panel {
  display: grid;
  align-items: center;
}

.story-copy-letter {
  font-size: clamp(13px, 3.35vw, 18px);
  line-height: 1.82;
}

.dog-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  justify-items: center;
  gap: 10px;
}

.guava-dog {
  align-self: end;
  width: min(94%, 220px);
  filter: drop-shadow(0 14px 10px rgba(60, 45, 24, 0.24));
}

.dog-question {
  max-width: 12em;
  margin: 0;
  color: #3d5e40;
  font-size: clamp(15px, 4.1vw, 21px);
  line-height: 1.46;
  text-align: center;
}

.speech-choice,
.quest-action,
.restart-button {
  min-height: 44px;
  color: #315437;
  background: #fff5d9;
  box-shadow: 0 8px 16px rgba(91, 63, 35, 0.15);
  transition: transform 160ms ease, filter 160ms ease, background 220ms ease;
}

.speech-choice {
  position: relative;
  padding: 9px 18px;
  border: 2px solid rgba(87, 121, 69, 0.48);
  border-radius: 52% 48% 48% 52%;
  font-size: 15px;
}

.speech-choice::after {
  content: "";
  position: absolute;
  right: 16%;
  bottom: -8px;
  width: 15px;
  height: 15px;
  border-right: 2px solid rgba(87, 121, 69, 0.48);
  border-bottom: 2px solid rgba(87, 121, 69, 0.48);
  background: #fff5d9;
  transform: rotate(45deg);
}

.speech-choice:active,
.quest-action:active,
.restart-button:active {
  transform: scale(0.96);
}

.swipe-hint {
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 6;
  margin: 0;
  color: rgba(54, 82, 63, 0.9);
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
}

.quest-copy-panel {
  display: grid;
  align-content: center;
  gap: 8px;
}

.quest-kicker {
  margin: 0;
  color: #79915e;
  font-family: var(--gothic);
  font-size: clamp(9px, 1.35vw, 12px);
}

.quest-title {
  margin: 0 0 2px;
  color: #34563e;
  font-size: clamp(18px, 2.7vw, 27px);
  line-height: 1.16;
}

.quest-copy {
  margin: 0;
  color: #425a47;
  font-size: clamp(12px, 1.7vw, 16px);
  line-height: 1.68;
}

.quest-action {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 7px 13px;
  border: 1px solid rgba(88, 124, 69, 0.52);
  border-radius: 999px;
  font-size: 13px;
}

.quest-action:disabled {
  color: #3e663f;
  background: #e9f0c7;
  cursor: default;
}

.action-sigil {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.52);
}

.quest-result {
  min-height: 30px;
  margin: 0;
  color: #5f7e50;
  font-size: 12px;
  line-height: 1.45;
}

.quest-visual {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.quest-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.26;
  background: url("./assets/board-paper-texture-clean.png") center / 320px 320px repeat;
  mix-blend-mode: screen;
}

.page-quest.is-awaiting-action .quest-action {
  animation: buttonNudge 0.5s ease;
}

.quest-visual-mirror {
  background:
    linear-gradient(155deg, rgba(255, 228, 168, 0.2), transparent 35%),
    linear-gradient(145deg, #2e211b, #795139 52%, #2d211d);
}

.mirror-disc {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(50%, 180px);
  aspect-ratio: 0.78;
  border: 8px solid #b6884d;
  border-radius: 48% 48% 44% 44%;
  background:
    linear-gradient(130deg, rgba(255, 244, 195, 0.52), transparent 30%),
    linear-gradient(170deg, #4c342f, #a17558 48%, #2b211f);
  box-shadow: 0 0 0 4px rgba(74, 47, 29, 0.6), 0 18px 24px rgba(30, 16, 12, 0.4), inset 0 0 24px rgba(255, 218, 148, 0.3);
  transform: translate(-50%, -50%);
  transition: filter 0.6s ease, background 0.6s ease;
}

.mirror-disc::before,
.mirror-disc::after {
  content: "";
  position: absolute;
  left: 50%;
  background: #a97a42;
  transform: translateX(-50%);
}

.mirror-disc::before {
  bottom: -28px;
  width: 18px;
  height: 32px;
}

.mirror-disc::after {
  bottom: -35px;
  width: 76px;
  height: 12px;
  border-radius: 50%;
}

.mirror-glimmer {
  position: absolute;
  inset: 14% 16%;
  border-left: 3px solid rgba(255, 235, 176, 0.64);
  border-radius: 50%;
  transform: rotate(24deg);
}

.syrup-ripple {
  position: absolute;
  left: 50%;
  top: 72%;
  border: 2px solid rgba(255, 208, 139, 0.26);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.syrup-ripple-one { width: 78%; height: 26%; }
.syrup-ripple-two { width: 58%; height: 17%; }

.traveler-mark {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 18px;
  height: 35px;
  border-radius: 48% 48% 30% 30%;
  background: rgba(240, 222, 171, 0.58);
  box-shadow: 0 -13px 0 -4px rgba(240, 222, 171, 0.62);
  transform: translate(-50%, -50%);
}

.mirror-drop {
  position: absolute;
  top: -28px;
  width: 16px;
  height: 24px;
  border-radius: 50% 50% 58% 58%;
  background: rgba(91, 58, 37, 0.82);
  animation: syrupFall 3.6s ease-in infinite;
}

.mirror-drop-one { left: 18%; }
.mirror-drop-two { right: 15%; animation-delay: -1.7s; transform: scale(0.72); }

.page-quest-mirror.is-complete .quest-visual-mirror {
  background:
    linear-gradient(155deg, rgba(255, 248, 197, 0.45), transparent 35%),
    linear-gradient(145deg, #a8d9bd, #d8f3c8 52%, #79b8ac);
}

.page-quest-mirror.is-complete .mirror-disc {
  background:
    linear-gradient(130deg, rgba(255, 255, 234, 0.72), transparent 30%),
    linear-gradient(170deg, #97c8b2, #e1f6c9 48%, #80b7a5);
  filter: drop-shadow(0 0 14px rgba(225, 255, 196, 0.76));
}

.page-quest-mirror.is-complete .syrup-ripple {
  animation: clearRipple 1.3s ease-out infinite;
}

.page-quest-mirror.is-complete .mirror-drop {
  opacity: 0;
}

.quest-visual-ice {
  background:
    linear-gradient(148deg, rgba(255, 255, 255, 0.42), transparent 31%),
    linear-gradient(165deg, #315e70, #9bc7cf 54%, #3d6975);
  transition: background 0.7s ease;
}

.ice-wind {
  position: absolute;
  left: -30%;
  width: 160%;
  height: 4px;
  border-radius: 50%;
  background: rgba(234, 255, 255, 0.58);
  filter: blur(1px);
  animation: windRush 1.35s linear infinite;
}

.ice-wind-one { top: 29%; }
.ice-wind-two { top: 64%; animation-delay: -0.58s; }

.ice-beast {
  position: absolute;
  left: 50%;
  top: 45%;
  width: min(47%, 170px);
  height: min(61%, 190px);
  border-radius: 44% 44% 22% 22%;
  background: linear-gradient(150deg, rgba(241, 255, 255, 0.8), rgba(91, 154, 170, 0.62)), #77b2bf;
  box-shadow: 0 20px 26px rgba(18, 63, 79, 0.34);
  clip-path: polygon(18% 0, 37% 14%, 50% 2%, 62% 14%, 82% 0, 75% 28%, 100% 52%, 78% 100%, 22% 100%, 0 52%, 25% 28%);
  transform: translate(-50%, -50%);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.ice-eye {
  position: absolute;
  top: 42%;
  width: 12px;
  height: 7px;
  border-radius: 50%;
  background: #efffbc;
  box-shadow: 0 0 13px #e4ff91;
}

.ice-eye-left { left: 27%; }
.ice-eye-right { right: 27%; }

.ice-shard {
  position: absolute;
  width: 17px;
  height: 76px;
  background: rgba(225, 253, 255, 0.72);
  clip-path: polygon(50% 0, 100% 82%, 48% 100%, 0 80%);
  filter: drop-shadow(0 5px 5px rgba(29, 78, 92, 0.22));
  transition: opacity 0.62s ease, transform 0.62s ease;
}

.ice-shard-one { left: 15%; top: 16%; transform: rotate(-26deg); }
.ice-shard-two { right: 14%; top: 18%; transform: rotate(24deg) scale(0.84); }
.ice-shard-three { left: 23%; bottom: 8%; transform: rotate(22deg) scale(0.7); }
.ice-shard-four { right: 22%; bottom: 8%; transform: rotate(-19deg) scale(0.62); }

.shelter-cloak {
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: 104px;
  height: 76px;
  border-radius: 58% 58% 18% 18%;
  background: rgba(106, 63, 68, 0.92);
  box-shadow: 0 12px 14px rgba(25, 45, 54, 0.28);
  transform: translateX(-50%);
  transition: box-shadow 0.62s ease;
}

.quest-dog {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 68px;
  transform: translateX(-50%);
}

.page-quest-ice.is-complete .quest-visual-ice {
  background: linear-gradient(165deg, #78b3bd, #e5f5d6 54%, #79acb1);
}

.page-quest-ice.is-complete .ice-wind,
.page-quest-ice.is-complete .ice-shard {
  opacity: 0;
}

.page-quest-ice.is-complete .ice-beast {
  opacity: 0.08;
  transform: translate(-50%, -50%) scale(0.68);
}

.page-quest-ice.is-complete .shelter-cloak {
  box-shadow: 0 0 24px rgba(255, 235, 144, 0.72);
}

.quest-visual-tea {
  background:
    linear-gradient(160deg, rgba(255, 241, 176, 0.24), transparent 34%),
    linear-gradient(165deg, #53624d, #a3a985 58%, #53674d);
  transition: background 0.7s ease;
}

.tea-tree {
  position: absolute;
  bottom: 18%;
  width: 30px;
  height: 57%;
  border-radius: 48% 48% 8px 8px;
  background: #76573b;
  box-shadow: 0 14px 12px rgba(40, 54, 33, 0.28);
  filter: grayscale(0.78) saturate(0.56);
  transition: filter 0.7s ease, transform 0.7s ease;
}

.tea-tree::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18%;
  width: 116px;
  height: 80%;
  border-radius: 48%;
  background:
    radial-gradient(ellipse at 20% 28%, #a1bc7b 0 10%, transparent 11%),
    radial-gradient(ellipse at 52% 15%, #b3cc8b 0 11%, transparent 12%),
    radial-gradient(ellipse at 78% 38%, #87a76c 0 12%, transparent 13%),
    radial-gradient(ellipse at 42% 55%, #76955e 0 18%, transparent 19%);
  transform: translateX(-50%);
}

.tea-tree-left { left: 19%; transform: scale(0.78); opacity: 0.68; }
.tea-tree-center { left: 46%; }
.tea-tree-right { right: 18%; transform: scale(0.84); opacity: 0.76; }

.spring-water {
  position: absolute;
  left: 16%;
  right: 12%;
  bottom: 9%;
  height: 28px;
  border-top: 3px solid rgba(214, 250, 222, 0.34);
  border-radius: 50%;
  box-shadow: 0 -5px 12px rgba(194, 244, 219, 0.24);
  transform: rotate(-4deg);
  transition: border-color 0.65s ease, box-shadow 0.65s ease;
}

.tower-key {
  position: absolute;
  right: 15%;
  top: 27%;
  width: 19px;
  height: 19px;
  border: 4px solid #f4d77a;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 226, 128, 0.68);
  opacity: 0;
  transform: rotate(-36deg) translateY(-18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.tower-key::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 6px;
  width: 48px;
  height: 5px;
  border-radius: 5px;
  background: #f4d77a;
  box-shadow: 24px 7px 0 -1px #f4d77a;
}

.page-quest-tea.is-complete .quest-visual-tea {
  background:
    linear-gradient(160deg, rgba(255, 246, 180, 0.48), transparent 34%),
    linear-gradient(165deg, #42674c, #bad193 58%, #486945);
}

.page-quest-tea.is-complete .tea-tree {
  filter: none;
}

.page-quest-tea.is-complete .tea-tree-left { transform: scale(0.88); }
.page-quest-tea.is-complete .tea-tree-center { transform: scale(1.08); }
.page-quest-tea.is-complete .tea-tree-right { transform: scale(0.94); }

.page-quest-tea.is-complete .spring-water {
  border-color: rgba(214, 250, 222, 0.94);
  box-shadow: 0 -5px 18px rgba(194, 244, 219, 0.68);
  animation: streamGlow 1.8s ease-in-out infinite alternate;
}

.page-quest-tea.is-complete .tower-key {
  opacity: 1;
  transform: rotate(-36deg) translateY(0);
}

.page-tree-finale {
  overflow: visible;
  border: 0;
  background: transparent;
}

.tree-stage {
  position: relative;
  width: 100%;
  height: min(78dvh, 760px);
  overflow: hidden;
  border: 1px solid rgba(255, 231, 182, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(rgba(21, 71, 57, 0.34), rgba(22, 42, 34, 0.3)),
    url("./assets/board-cover-scene.png") center / cover no-repeat;
  box-shadow: 0 26px 48px rgba(4, 20, 15, 0.34);
  perspective: 920px;
  touch-action: none;
}

.tree-aura {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 54%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 226, 133, 0.24);
  filter: blur(28px);
  transform: translate(-50%, -50%);
  animation: treeAura 3.2s ease-in-out infinite alternate;
}

.tree-model {
  position: absolute;
  inset: 0 -3% 2%;
  transform: rotateY(var(--tree-rotate, -12deg));
  transform-style: preserve-3d;
  transition: transform 80ms ease-out;
}

.tree-depth {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.tree-depth-back {
  opacity: 0.23;
  filter: blur(1.8px) saturate(0.82);
  transform: translateX(calc(var(--tree-shift, 0px) * -0.52)) translateZ(-74px) scale(1.04);
}

.tree-depth-mid {
  opacity: 0.48;
  filter: blur(0.35px) saturate(0.92);
  transform: translateX(calc(var(--tree-shift, 0px) * -0.26)) translateZ(-28px) scale(1.02);
}

.tree-depth-front {
  filter: drop-shadow(0 22px 14px rgba(39, 27, 24, 0.28));
  transform: translateX(var(--tree-shift, 0px)) translateZ(28px);
}

.ancient-leaves {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ancient-leaves span {
  position: absolute;
  width: 11px;
  height: 17px;
  border-radius: 80% 12px 80% 12px;
  background: #f4d575;
  box-shadow: 0 0 10px rgba(255, 224, 122, 0.66);
  animation: ancientLeaf 4.6s ease-in-out infinite alternate;
}

.ancient-leaves span:nth-child(1) { left: 23%; top: 28%; animation-delay: -1s; }
.ancient-leaves span:nth-child(2) { left: 31%; top: 20%; animation-delay: -2.8s; }
.ancient-leaves span:nth-child(3) { left: 39%; top: 31%; animation-delay: -0.7s; }
.ancient-leaves span:nth-child(4) { left: 47%; top: 15%; animation-delay: -3.5s; }
.ancient-leaves span:nth-child(5) { left: 55%; top: 27%; animation-delay: -1.8s; }
.ancient-leaves span:nth-child(6) { left: 64%; top: 21%; animation-delay: -4s; }
.ancient-leaves span:nth-child(7) { left: 71%; top: 32%; animation-delay: -2.2s; }
.ancient-leaves span:nth-child(8) { left: 34%; top: 44%; animation-delay: -3.1s; }
.ancient-leaves span:nth-child(9) { left: 58%; top: 43%; animation-delay: -0.2s; }
.ancient-leaves span:nth-child(10) { left: 76%; top: 45%; animation-delay: -1.5s; }

.boba-orbit {
  position: absolute;
  left: 50%;
  bottom: 4%;
  border: 2px solid rgba(255, 226, 133, 0.18);
  border-radius: 50%;
  transform: translateX(-50%);
}

.boba-orbit::before,
.boba-orbit::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5b4032;
  box-shadow: 0 0 8px rgba(255, 220, 126, 0.48);
}

.boba-orbit-one {
  width: 58%;
  height: 18%;
  animation: orbitPulse 4s ease-in-out infinite alternate;
}

.boba-orbit-one::before { left: 15%; top: 12%; }
.boba-orbit-one::after { right: 13%; bottom: 10%; }

.boba-orbit-two {
  width: 42%;
  height: 12%;
  animation: orbitPulse 3.2s -1s ease-in-out infinite alternate-reverse;
}

.boba-orbit-two::before { left: 8%; bottom: 12%; }
.boba-orbit-two::after { right: 8%; top: 6%; }

.final-blessing {
  position: absolute;
  right: clamp(18px, 3vw, 36px);
  top: 50%;
  z-index: 5;
  width: min(39%, 360px);
  padding: 18px 20px;
  color: #fff2ca;
  background: rgba(8, 42, 34, 0.72);
  border-left: 2px solid rgba(246, 215, 122, 0.66);
  box-shadow: 0 18px 30px rgba(5, 25, 20, 0.26);
  backdrop-filter: blur(11px);
  transform: translateY(-50%);
}

.final-kicker {
  margin: 0;
  color: #e4c875;
  font-family: var(--gothic);
  font-size: 12px;
}

.final-blessing h2 {
  margin: 5px 0 9px;
  color: #ffe99d;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.1;
}

.final-blessing p:not(.final-kicker) {
  margin: 0;
  color: #fff2d1;
  font-size: clamp(12px, 1.6vw, 15px);
  line-height: 1.66;
}

.final-blessing p + p {
  margin-top: 7px;
}

.restart-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
}

.restart-button span:first-child {
  font-size: 20px;
  line-height: 1;
}

.tree-gesture {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 6;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  color: #4a473d;
  background: rgba(255, 245, 220, 0.78);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
}

.controls {
  position: fixed;
  left: 50%;
  bottom: max(11px, var(--safe-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: auto 44px;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid rgba(255, 248, 213, 0.22);
  border-radius: 999px;
  background: rgba(10, 31, 26, 0.78);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.page-dots {
  display: flex;
  gap: 6px;
  padding: 0 5px;
}

.page-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 248, 213, 0.34);
  transition: width 180ms ease, background 180ms ease;
}

.page-dots span.is-active {
  width: 18px;
  border-radius: 999px;
  background: #f5d56f;
  box-shadow: 0 0 9px rgba(245, 213, 111, 0.7);
}

.music-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff5cf;
  background: rgba(255, 248, 213, 0.12);
  font-size: 23px;
  transition: background 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.music-toggle.is-playing {
  background: rgba(235, 205, 105, 0.34);
  animation: musicPulse 1.8s ease-in-out infinite alternate;
}

.music-toggle:disabled {
  opacity: 0.38;
  cursor: default;
}

.soundcloud-frame {
  position: fixed;
  left: -9999px;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.music-credit {
  position: fixed;
  right: 12px;
  bottom: max(15px, var(--safe-bottom));
  z-index: 25;
  color: rgba(255, 242, 202, 0.58);
  font-family: var(--gothic);
  font-size: 10px;
  text-decoration: none;
  transition: color 160ms ease;
}

.music-credit:hover,
.music-credit:focus-visible {
  color: #fff2ca;
}

@media (orientation: landscape) {
  body.is-book-open .app {
    padding: 10px 16px calc(58px + var(--safe-bottom));
  }

  body.is-book-open .stage {
    width: min(94vw, 1040px);
    height: calc(100dvh - 76px);
    min-height: 0;
  }

  body.is-book-open .open-spread,
  body.is-book-open .tree-stage {
    width: 100%;
    height: 100%;
  }

  body.is-book-open .leaf-inner {
    padding: 18px clamp(20px, 3.2vw, 34px);
  }

  body.is-book-open .story-copy-large {
    max-width: 12em;
    font-size: clamp(18px, 2.7vw, 29px);
    line-height: 1.68;
  }

  body.is-book-open .story-copy-letter {
    font-size: clamp(10.5px, 1.55vw, 15px);
    line-height: 1.66;
  }

  body.is-book-open .guava-dog {
    width: min(48%, 180px);
  }

  body.is-book-open .dog-panel {
    gap: 6px;
  }

  body.is-book-open .dog-question {
    max-width: 15em;
    font-size: clamp(13px, 1.9vw, 18px);
  }

  body.is-book-open .speech-choice {
    padding: 7px 17px;
    font-size: 14px;
  }

  body.is-book-open .quest-copy {
    font-size: clamp(10.5px, 1.42vw, 13px);
    line-height: 1.56;
  }

  body.is-book-open .quest-result {
    font-size: 11px;
  }
}

@media (orientation: portrait) and (max-width: 720px) {
  body.is-book-open .rotate-prompt {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 18px;
    padding: 28px;
    color: #fff2bf;
    background: rgba(5, 27, 23, 0.93);
    font-size: 18px;
    text-align: center;
    backdrop-filter: blur(14px);
  }

  .rotate-prompt p {
    margin: 0;
  }

  .rotate-phone {
    position: relative;
    display: block;
    width: 42px;
    height: 72px;
    border: 3px solid #f3d77b;
    border-radius: 9px;
    box-shadow: 0 0 18px rgba(243, 215, 123, 0.34);
    animation: turnPhone 2.4s ease-in-out infinite;
  }

  .rotate-phone::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #f3d77b;
    transform: translateX(-50%);
  }
}

@media (max-width: 390px) {
  .stage {
    min-height: 600px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@keyframes subtitleRise {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes subtitleBreathe {
  from { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22); }
  to { box-shadow: 0 16px 42px rgba(235, 195, 122, 0.2); }
}

@keyframes titleGoldFlow {
  to { background-position: 230% center; }
}

@keyframes petalDrift {
  from { translate: -7px -9px; rotate: -7deg; }
  to { translate: 14px 20px; rotate: 18deg; }
}

@keyframes diveIntoBook {
  0% { transform: scale(1); filter: blur(0); }
  54% { transform: scale(1.34); filter: blur(0.4px); }
  100% { transform: scale(1); filter: blur(0); }
}

@keyframes unsealBand {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(118%); }
}

@keyframes liftCoverWords {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -68%) scale(1.04); }
}

@keyframes pageFlip {
  0% { opacity: 0; transform: rotateY(0deg) translateZ(38px); }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; transform: rotateY(-178deg) translateZ(38px); }
}

@keyframes buttonNudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  65% { transform: translateX(6px); }
}

@keyframes questSpark {
  from { opacity: 0.9; transform: scale(0.86); }
  to { opacity: 0; transform: scale(1.06); }
}

@keyframes syrupFall {
  from { translate: 0 0; opacity: 0; }
  24% { opacity: 0.9; }
  to { translate: 0 380px; opacity: 0; }
}

@keyframes clearRipple {
  from { opacity: 0.7; transform: translate(-50%, -50%) scale(0.82); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.24); }
}

@keyframes windRush {
  from { translate: -16% 0; opacity: 0; }
  30% { opacity: 0.9; }
  to { translate: 16% 0; opacity: 0; }
}

@keyframes streamGlow {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

@keyframes treeAura {
  from { opacity: 0.58; transform: translate(-50%, -50%) scale(0.92); }
  to { opacity: 0.9; transform: translate(-50%, -50%) scale(1.06); }
}

@keyframes ancientLeaf {
  from { translate: -3px -6px; rotate: -10deg; }
  to { translate: 7px 9px; rotate: 17deg; }
}

@keyframes orbitPulse {
  from { opacity: 0.48; transform: translateX(-50%) scale(0.94); }
  to { opacity: 0.9; transform: translateX(-50%) scale(1.05); }
}

@keyframes musicPulse {
  from { box-shadow: 0 0 0 rgba(245, 213, 111, 0); }
  to { box-shadow: 0 0 16px rgba(245, 213, 111, 0.48); }
}

@keyframes turnPhone {
  0%, 18% { transform: rotate(0deg); }
  58%, 100% { transform: rotate(90deg); }
}
