/* ================================================================
   base.css — fonts, tokens, global layers, UI components
   ================================================================ */
@font-face { font-family: 'Kuaile'; src: url(../assets/fonts/kuaile.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Wenkai'; src: url(../assets/fonts/wenkai-medium.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../assets/fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --ink: #2a1a12;
  --ink2: rgba(42, 26, 18, 0.72);
  --cream: #fff6e8;
  --pink: #ff9ec4;
  --pink2: #ff7fb0;
  --pink3: #ffd3e3;
  --rose: #f472a5;
  --gold: #ffd36b;
  --gold2: #f5b43a;
  --gold3: #fff1c4;
  --lav: #cdbdf5;
  --sky: #9cc6ff;
  --night: #1b1f86;
  --txt: #fff8ec;
  --txt2: rgba(255, 248, 236, 0.78);
  --f-cute: 'Kuaile', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --f-hand: 'Wenkai', 'Kaiti SC', 'STKaiti', 'KaiTi', 'PingFang SC', serif;
  --f-num: 'Fredoka', 'Kuaile', 'PingFang SC', sans-serif;
  --vh: 1vh;
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: #1b1f86; color: var(--txt); font-family: var(--f-hand); }
body { overflow-x: hidden; -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.6; }
/* one long film: no visible scrollbars, no rubber-band glow, no Chrome scroll-anchoring jumps while pinned scenes resize */
html { scrollbar-width: none; overscroll-behavior-y: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body { overflow-anchor: none; }
.modal-box, .lt-sheet, .wl-list, .scrollable { scrollbar-width: none; -ms-overflow-style: none; }
.modal-box::-webkit-scrollbar, .lt-sheet::-webkit-scrollbar, .wl-list::-webkit-scrollbar, .scrollable::-webkit-scrollbar { display: none; }
p, h2, h3 { text-wrap: balance; }
/* Chinese lines break between words, never in the middle of one */
#toast, .sl-lines p, .sl-al, .jr-outro p, .jr-intro, .gm-intro, .gm-after p, .lf-cap p, .ct-title, .ch-sub, .op-invite, .cr-line, .cr-thanks, .nt-intro, .lr-msg, .fu-hint, .ga-tip, .ph-tip, .cr-item b, .tt-cr b, .pet-bubble, .hp-text, .hp-title, .hp-end p, .mc-text, .jr-note span { word-break: keep-all; overflow-wrap: anywhere; }
html.no-scroll, html.no-scroll body, body.is-locked { overflow: hidden; }
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: normal; }
::selection { background: var(--pink); color: var(--ink); }

/* ---------- global layers ---------- */
#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #1d2090; }
.sky-layer { position: absolute; inset: -2px; background-size: cover; background-position: center; opacity: 0; will-change: opacity; }
.sky-layer[data-mood='night'] { background-image: url(../assets/art/sky/night-p.webp); opacity: 1; }
.sky-layer[data-mood='rose'] { background-image: url(../assets/art/sky/rose-p.webp); }
.sky-layer[data-mood='dawn'] { background-image: url(../assets/art/sky/dawn-p.webp); }
.sky-layer[data-mood='dark'] { background-image: url(../assets/art/sky/dark-p.webp); }
@media (min-aspect-ratio: 1/1) {
  .sky-layer[data-mood='night'] { background-image: url(../assets/art/sky/night-l.webp); }
  .sky-layer[data-mood='rose'] { background-image: url(../assets/art/sky/rose-l.webp); }
  .sky-layer[data-mood='dawn'] { background-image: url(../assets/art/sky/dawn-l.webp); }
  .sky-layer[data-mood='dark'] { background-image: url(../assets/art/sky/dark-l.webp); }
}
#starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#grain { position: fixed; inset: 0; z-index: 60; pointer-events: none; background: url(../assets/art/grain.webp) 0 0 / 256px; opacity: .22; }
#film { position: relative; z-index: 2; overflow-x: clip; }
/* sparkles, hearts and confetti fly above everything she is looking at — modals and the photo viewer too (only toasts and the egg overlays sit higher) */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 128; pointer-events: none; }

.chapter { position: relative; }
.stage { position: relative; width: 100%; height: calc(var(--vh) * 100); overflow: hidden; }
.wrap { width: min(100% - 32px, 560px); margin: 0 auto; }

/* ---------- typography ---------- */
.cute { font-family: var(--f-cute); }
.num { font-family: var(--f-num); font-weight: 600; font-variant-numeric: tabular-nums; }
.inked {
  text-shadow: 2.4px 0 var(--ink), -2.4px 0 var(--ink), 0 2.4px var(--ink), 0 -2.4px var(--ink),
    1.7px 1.7px var(--ink), -1.7px -1.7px var(--ink), 1.7px -1.7px var(--ink), -1.7px 1.7px var(--ink),
    0 5px 0 rgba(20, 10, 60, 0.45);
}
.inked-sm {
  text-shadow: 1.6px 0 var(--ink), -1.6px 0 var(--ink), 0 1.6px var(--ink), 0 -1.6px var(--ink),
    1.1px 1.1px var(--ink), -1.1px -1.1px var(--ink), 1.1px -1.1px var(--ink), -1.1px 1.1px var(--ink),
    0 3px 0 rgba(20, 10, 60, 0.4);
}
.glowtxt { text-shadow: 0 2px 0 rgba(20, 10, 60, 0.35), 0 0 22px rgba(20, 10, 90, 0.65); }
.kicker {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-cute); font-size: 14px; letter-spacing: .22em;
  color: var(--gold); padding: 4px 14px 4px 16px; border: 2px solid rgba(255, 211, 107, 0.75); border-radius: 999px;
  background: rgba(20, 14, 70, 0.4);
}
.kicker::before, .kicker::after { content: '✦'; font-size: 12px; letter-spacing: 0; }
.ch-title { font-family: var(--f-cute); font-size: clamp(36px, 10.5vw, 64px); line-height: 1.15; color: #fff2c4; letter-spacing: .04em; }
.ch-sub { font-size: clamp(15px, 4.2vw, 19px); color: var(--txt2); }
.ch-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ---------- crayon paper & buttons ---------- */
.paper {
  position: relative; color: var(--ink);
  background: #fff6e8 url(../assets/art/paper.webp) center / 380px;
  border: 3px solid var(--ink);
  border-radius: 20px 26px 18px 24px / 24px 18px 26px 20px;
  box-shadow: 0 5px 0 rgba(42, 26, 18, 0.3), 0 16px 34px rgba(8, 6, 40, 0.38);
}
.paper::after {
  content: ''; position: absolute; inset: -5px -3px -3px -5px; pointer-events: none;
  border: 2px solid rgba(42, 26, 18, 0.3);
  border-radius: 26px 18px 24px 20px / 18px 26px 20px 24px;
}
/* inside scrolling boxes the sketchy outline must stay inside, or it creates a scrollbar */
.modal-box.paper::after, .lt-sheet.paper::after { inset: 4px 5px 5px 4px; border-color: rgba(42, 26, 18, .18); }
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font-family: var(--f-cute); font-size: 17px; line-height: 1.2; color: var(--ink);
  background: var(--pink) url(../assets/art/strokes.webp) center / 160px;
  padding: 12px 24px; border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s, filter .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.gold { background-color: var(--gold); }
.btn.cream { background-color: #fff3df; }
.btn.lav { background-color: var(--lav); }
.btn.small { font-size: 14px; padding: 8px 16px; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); }
.btn.ghost { background: rgba(255, 255, 255, 0.12); color: var(--txt); border-color: rgba(255, 248, 236, 0.75); box-shadow: none; }
.btn[disabled] { filter: grayscale(.6) brightness(.9); pointer-events: none; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #1b1f86 url(../assets/art/sky/night-p.webp) center / cover; transition: opacity .8s; }
#loader.out { opacity: 0; pointer-events: none; }
.ld-heart { width: 74px; height: 74px; position: relative; animation: ld-beat 1.1s ease-in-out infinite; }
.ld-heart i { position: absolute; inset: 0; background: url(../assets/art/heart.webp) center / contain no-repeat; }
@keyframes ld-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }
.ld-text { font-family: var(--f-cute); font-size: 17px; color: var(--gold3); letter-spacing: .06em; }
.ld-bar { width: 180px; height: 12px; border: 2.5px solid var(--ink); border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: var(--pink); transition: width .25s; border-radius: 99px; }

/* ---------- HUD ---------- */
#music-btn, #rail, #wallet-btn, #pets { opacity: 0; pointer-events: none; transition: opacity .6s, transform .6s; }
body.hud-on #music-btn, body.hud-on #rail { opacity: 1; pointer-events: auto; }
body.hud-on.hud-min #rail { opacity: .4; }
body.hud-on.hud-min #rail:hover { opacity: 1; }
#music-btn {
  position: fixed; z-index: 90; top: calc(12px + var(--st)); right: 12px; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--ink); background: #2b2440; box-shadow: 0 3px 0 var(--ink);
}
#music-btn .vinyl { position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle, var(--pink) 0 22%, #2a1a12 23% 27%, #3c3256 28% 40%, #2b2440 41% 52%, #3c3256 53% 64%, #2b2440 65%); animation: spin 4s linear infinite; }
#music-btn .vinyl::after { content: ''; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; background: var(--ink); border-radius: 50%; }
body.is-muted #music-btn .vinyl { animation-play-state: paused; opacity: .55; }
#music-btn .mute-x { position: absolute; inset: 0; display: none; }
body.is-muted #music-btn .mute-x { display: block; }
body.is-muted #music-btn .mute-x::before { content: ''; position: absolute; left: 50%; top: 8px; bottom: 8px; width: 3.5px; margin-left: -1.75px; background: var(--pink); border-radius: 2px; transform: rotate(45deg); box-shadow: 0 0 0 1.5px var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

#rail { position: fixed; z-index: 85; right: 6px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 9px; padding: 8px 4px; }
.rail-dot { position: relative; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.rail-dot i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 248, 236, 0.45); transition: all .3s; box-shadow: 0 0 0 1.5px rgba(42, 26, 18, .4); }
.rail-dot.on i { width: 12px; height: 12px; background: var(--gold); box-shadow: 0 0 10px rgba(255, 211, 107, .9), 0 0 0 2px var(--ink); }
.rail-dot span { position: absolute; right: 24px; white-space: nowrap; font-family: var(--f-cute); font-size: 13px; color: var(--txt); background: rgba(30, 20, 70, .78); padding: 2px 8px; border-radius: 8px; opacity: 0; transform: translateX(6px); transition: all .25s; pointer-events: none; }
.rail-dot.on span { opacity: .0; }
#rail:hover .rail-dot span, .rail-dot:focus span { opacity: 1; transform: none; }
@media (max-width: 600px) { #rail { right: 2px; gap: 7px; } .rail-dot { width: 14px; height: 16px; } .rail-dot i { width: 5px; height: 5px; } .rail-dot.on i { width: 9px; height: 9px; } }
@media (max-height: 640px) { #rail { gap: 4px; padding: 4px; } .rail-dot { height: 15px; } }
@media (max-height: 460px) { #rail { gap: 1px; } .rail-dot { height: 13px; } }

#wallet-btn {
  position: fixed; z-index: 90; right: 12px; bottom: calc(14px + var(--sb)); display: flex; align-items: center; gap: 6px;
  padding: 7px 14px 7px 10px; border: 3px solid var(--ink); border-radius: 999px; background: var(--gold) url(../assets/art/strokes.webp) center / 160px;
  color: var(--ink); font-family: var(--f-cute); font-size: 14px; box-shadow: 0 3px 0 var(--ink); transform: translateY(80px);
}
body.hud-on #wallet-btn.show { opacity: 1; pointer-events: auto; transform: none; }
#wallet-btn .wb-icon { width: 22px; height: 16px; border: 2.5px solid var(--ink); border-radius: 4px; background: var(--pink); position: relative; }
#wallet-btn .wb-icon::after { content: ''; position: absolute; top: 2px; bottom: 2px; left: 6px; border-left: 2px dashed var(--ink); }
#wallet-btn b { min-width: 20px; height: 20px; border-radius: 10px; background: var(--ink); color: var(--gold); font-family: var(--f-num); font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
#wallet-btn.bump { animation: bump .5s var(--ease-pop); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

#toast {
  position: fixed; z-index: 150; left: 50%; top: calc(16px + var(--st)); width: max-content; max-width: min(420px, calc(100vw - 132px));
  padding: 8px 16px; border: 2.5px solid var(--ink); border-radius: 16px; line-height: 1.45;
  background: var(--cream); color: var(--ink); font-family: var(--f-cute); font-size: 15px; box-shadow: 0 4px 0 rgba(42, 26, 18, .35);
  text-align: center; pointer-events: none;
  opacity: 0; visibility: hidden; transform: translate(-50%, -24px) scale(.96);
  transition: transform .45s var(--ease-pop), opacity .3s, visibility 0s linear .45s;
}
#toast.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: transform .45s var(--ease-pop), opacity .25s, visibility 0s; }

/* ---------- pets ---------- */
#pets { position: fixed; z-index: 88; left: 4px; bottom: calc(4px + var(--sb)); display: flex; align-items: flex-end; width: 150px; height: 92px; transform: translateY(30px); }
#pets.on { opacity: 1; transform: none; }
/* only the two of them catch taps — the empty space around them never blocks a button underneath */
#pets.on .puppet, #pets.on .pet-whisper { pointer-events: auto; }
#pets.dim .puppet, #pets.dim .pet-whisper, body.hud-min #pets .puppet, body.hud-min #pets .pet-whisper, body.hud-nopets #pets .puppet, body.hud-nopets #pets .pet-whisper { pointer-events: none; }
#pets.dim { opacity: 0 !important; pointer-events: none !important; }
#pets .puppet { width: 76px; height: 76px; flex: none; }
#pets .puppet.cat { margin-left: -16px; }
@media (min-width: 900px) { #pets { width: 210px; height: 120px; } #pets .puppet { width: 104px; height: 104px; } }
/* speech bubble sits to the right of the cat, with a little tail pointing at her */
.pet-bubble {
  position: absolute; left: 140px; bottom: 16px; max-width: min(220px, calc(100vw - 210px)); width: max-content; padding: 7px 12px;
  font-family: var(--f-cute); font-size: 14px; line-height: 1.45; border-width: 2.5px; border-radius: 16px 18px 18px 6px;
  opacity: 0; transform: translateX(-8px) scale(.9); transform-origin: 0 100%; transition: all .35s var(--ease-pop); pointer-events: none;
}
.pet-bubble::before { content: ''; position: absolute; left: -10px; bottom: 8px; width: 12px; height: 12px; background: inherit; border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); border-radius: 0 0 0 3px; }
@media (min-width: 900px) { .pet-bubble { left: 196px; bottom: 26px; font-size: 15px; max-width: 280px; } }
.pet-bubble::after { display: none; }
.pet-bubble.on { opacity: 1; transform: none; }
.pet-whisper {
  position: absolute; left: 132px; bottom: 6px; font-family: var(--f-cute); font-size: 12px; line-height: 1.5; color: var(--ink); background: var(--pink3);
  border: 2px solid var(--ink); border-radius: 10px 10px 10px 2px; padding: 0 7px; box-shadow: 0 2px 0 var(--ink); white-space: nowrap; transition: opacity .25s;
}
#pets.talking .pet-whisper { opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .pet-whisper { left: 186px; bottom: 10px; font-size: 13px; } }
/* chapters that need the whole screen: pets and the wallet step aside */
body.hud-min #pets, body.hud-min #wallet-btn, body.hud-nopets #pets { opacity: 0 !important; pointer-events: none !important; }

/* puppet rig */
.puppet { position: relative; cursor: pointer; }
.puppet img, .puppet .pp-head { position: absolute; inset: 0; width: 100%; height: 100%; }
.pp-inner { position: absolute; inset: 0; transform-origin: 50% 94%; animation: pp-breathe 2.8s ease-in-out infinite; }
.pp-head { transform-origin: 50% 60%; animation: pp-tilt 6s ease-in-out infinite; }
.dog .pp-tail { transform-origin: 66% 79%; animation: pp-wag .42s ease-in-out infinite alternate; }
.cat .pp-tail { transform-origin: 34% 81%; animation: pp-swish 1.8s ease-in-out infinite alternate; }
.pp-eyesC, .pp-mouthO { opacity: 0; }
.pp-eyes { animation: pp-blink 4.6s infinite; }
.pp-eyesC { animation: pp-blinkC 4.6s infinite; }
.cat .pp-eyes, .cat .pp-eyesC { animation-delay: -1.7s; }
.cat .pp-inner { animation-delay: -1.2s; }
@keyframes pp-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
@keyframes pp-tilt { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-6deg); } 88% { transform: rotate(4deg); } }
@keyframes pp-wag { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
@keyframes pp-swish { from { transform: rotate(-7deg); } to { transform: rotate(9deg); } }
@keyframes pp-blink { 0%, 92%, 100% { opacity: 1; } 94%, 97% { opacity: 0; } }
@keyframes pp-blinkC { 0%, 92%, 100% { opacity: 0; } 94%, 97% { opacity: 1; } }
.walk .pp-inner, .puppet.walk .pp-inner { animation: pp-hop .34s ease-in-out infinite alternate; }
.walk .pp-legL, .puppet.walk .pp-legL { transform-origin: 44% 76%; animation: pp-leg .34s ease-in-out infinite alternate; }
.walk .pp-legR, .puppet.walk .pp-legR { transform-origin: 56% 76%; animation: pp-leg .34s ease-in-out infinite alternate-reverse; }
.walk .cat .pp-inner { animation-delay: -.17s; }
@keyframes pp-hop { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-6%) rotate(2deg); } }
@keyframes pp-leg { from { transform: translateY(0); } to { transform: translateY(-7%); } }
.puppet.happy .pp-mouth { opacity: 0; }
.puppet.happy .pp-mouthO { opacity: 1; }
.puppet.happy .pp-inner { animation: pp-jump .55s var(--ease-pop); }
.puppet.happy .pp-eyes { animation: none; opacity: 0; }
.puppet.happy .pp-eyesC { animation: none; opacity: 1; }
@keyframes pp-jump { 0% { transform: translateY(0) scale(1.06, .9); } 40% { transform: translateY(-26%) scale(.95, 1.06); } 70% { transform: translateY(0) scale(1.05, .94); } 100% { transform: none; } }
.sleep .pp-eyes, .puppet.sleep .pp-eyes { animation: none; opacity: 0; }
.sleep .pp-eyesC, .puppet.sleep .pp-eyesC { animation: none; opacity: 1; }
.sleep .pp-inner, .puppet.sleep .pp-inner { animation-duration: 4.4s; }
.sleep .pp-tail, .puppet.sleep .pp-tail { animation-duration: 3s; }
.zzz { position: absolute; right: -2px; top: -6px; font-family: var(--f-num); font-weight: 700; color: var(--gold3); font-size: 16px; animation: zzz 2.6s ease-in-out infinite; pointer-events: none; text-shadow: 0 0 6px rgba(20, 10, 60, .6); }
.zzz:nth-child(2) { animation-delay: -1.3s; right: -14px; font-size: 12px; }
@keyframes zzz { 0% { transform: translate(0, 0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(12px, -26px); opacity: 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-back { position: absolute; inset: 0; background: rgba(14, 10, 46, 0.72); opacity: 0; transition: opacity .35s; }
.modal-box { position: relative; width: min(100%, 460px); max-height: calc(var(--vh) * 100 - 36px); overflow: auto; padding: 26px 20px 22px; opacity: 0; transform: translateY(26px) scale(.94); transition: all .4s var(--ease-pop); }
.modal.on .modal-back { opacity: 1; }
.modal.on .modal-box { opacity: 1; transform: none; }
.modal-x { position: absolute; top: 6px; right: 8px; width: 38px; height: 38px; font-size: 28px; line-height: 1; color: var(--ink2); font-family: var(--f-num); z-index: 3; }
.modal-box:not(.paper) .modal-x { color: var(--txt); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 125; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .3s; }
.lightbox.on { opacity: 1; }
.lb-back { position: absolute; inset: 0; background: rgba(12, 8, 40, 0.9); }
.lb-frame { position: relative; width: min(94vw, 560px); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-media { position: relative; width: 100%; display: flex; justify-content: center; }
.lb-media.from-r { transform: translateX(40px); opacity: 0; }
.lb-media.from-l { transform: translateX(-40px); opacity: 0; }
.lb-media.in { transform: none; opacity: 1; transition: transform .35s ease-out, opacity .35s; }
.lb-media img, .lb-media video { max-width: 100%; max-height: calc(var(--vh) * 62); border: 4px solid #fff6e8; border-radius: 10px; box-shadow: 0 0 0 3px var(--ink), 0 18px 40px rgba(0, 0, 0, .5); background: #000; }
.lb-meta { width: 100%; padding: 12px 16px 14px; transform: rotate(-.6deg); }
.lb-date { font-family: var(--f-num); font-size: 13px; color: var(--rose); letter-spacing: .08em; }
.lb-title { font-family: var(--f-cute); font-size: 19px; }
.lb-story { font-size: 15.5px; color: var(--ink2); }
.lb-x { position: absolute; top: calc(10px + var(--st)); right: 12px; width: 44px; height: 44px; font-size: 32px; color: var(--txt); font-family: var(--f-num); z-index: 2; }
.lb-prev, .lb-next { position: absolute; top: 40%; width: 44px; height: 64px; font-size: 44px; color: rgba(255, 248, 236, .8); font-family: var(--f-num); z-index: 2; }
.lb-prev { left: 2px; } .lb-next { right: 2px; }
.lb-count { position: absolute; bottom: calc(14px + var(--sb)); left: 0; right: 0; text-align: center; font-family: var(--f-num); color: var(--txt2); font-size: 13px; }
.scratch-cv { position: absolute; border-radius: 8px; touch-action: none; cursor: crosshair; }
.scratch-tip, .dev-tip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-family: var(--f-cute); font-size: 13px; color: var(--ink); background: var(--gold3); padding: 4px 12px; border-radius: 99px; border: 2px solid var(--ink); white-space: nowrap; pointer-events: none; transition: opacity .3s; }
.dev-tip { pointer-events: auto; }
img.developing { transition: none; }

/* ---------- tickets / wallet / reward ---------- */
.ticket {
  position: relative; width: 100%; max-width: 380px; margin: 0 auto; padding: 16px 92px 14px 20px; color: var(--ink); text-align: left;
  background: linear-gradient(135deg, #ffd3e3, #ff9ec4); border: 3px solid var(--ink); border-radius: 18px;
}
.ticket::before { content: '礼物券'; position: absolute; right: 0; top: 0; bottom: 0; width: 80px; border-left: 2.5px dashed rgba(42, 26, 18, .55); display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; text-orientation: upright; font-family: var(--f-cute); font-size: 20px; letter-spacing: .3em; background: rgba(255, 255, 255, .28); border-radius: 0 15px 15px 0; }
.tk-no { font-family: var(--f-num); font-size: 12px; letter-spacing: .1em; opacity: .7; }
.tk-title { font-family: var(--f-cute); font-size: 22px; line-height: 1.3; margin: 2px 0 4px; }
.tk-desc { font-size: 14.5px; line-height: 1.5; }
.tk-foot { margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; opacity: .72; }
.ticket.ghost { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .55) 0 10px, rgba(255, 255, 255, .35) 10px 20px); border-style: dashed; opacity: .8; }
.m-reward .modal-box { background: none; box-shadow: none; text-align: center; overflow: visible; }
.reward { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rw-kicker { font-family: var(--f-cute); font-size: 22px; color: var(--gold3); }
.rw-slot { position: relative; width: 100%; padding-top: 10px; overflow: hidden; }
.rw-slot::before { content: ''; position: absolute; left: 6%; right: 6%; top: 0; height: 12px; border-radius: 8px; background: #2a1a12; box-shadow: 0 2px 0 rgba(255, 255, 255, .2) inset; }
.rw-print { animation: print 1.1s cubic-bezier(.2, .8, .3, 1) both .15s; }
@keyframes print { from { transform: translateY(-110%); } to { transform: none; } }
.wallet { text-align: center; }
.wl-title { font-family: var(--f-cute); font-size: 24px; }
.wl-sub { font-size: 14px; color: var(--ink2); margin: 4px 0 14px; }
.wl-list { display: flex; flex-direction: column; gap: 14px; max-height: calc(var(--vh) * 64); overflow: auto; padding: 4px 2px 8px; }
.wl-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.saveimg { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.saveimg img { width: 100%; border-radius: 10px; border: 3px solid var(--ink); }
.si-tip { font-family: var(--f-cute); font-size: 15px; }
.m-save .modal-box { width: min(100%, 520px); }

/* ---------- whisper + eggs ---------- */
.whisper { text-align: center; }
.whisper h3 { font-family: var(--f-cute); font-size: 22px; }
.wh-sub { font-size: 14px; color: var(--ink2); margin: 2px 0 14px; }
.wh-row { display: flex; gap: 8px; }
.wh-in { flex: 1; min-width: 0; font: 16px var(--f-hand); padding: 10px 14px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffdf8; color: var(--ink); outline: none; }
.wh-in:focus { box-shadow: 0 0 0 3px var(--pink3); }
.wh-reply { min-height: 26px; margin-top: 12px; font-family: var(--f-cute); color: var(--rose); }
.egg-big { position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 20px; }
.egg-big span { font-family: var(--f-cute); font-size: clamp(30px, 9vw, 56px); color: #fff2c4; text-align: center; transform: scale(.4); opacity: 0; transition: all .6s var(--ease-pop);
  text-shadow: 2.4px 0 var(--ink), -2.4px 0 var(--ink), 0 2.4px var(--ink), 0 -2.4px var(--ink), 1.7px 1.7px var(--ink), -1.7px -1.7px var(--ink), 1.7px -1.7px var(--ink), -1.7px 1.7px var(--ink), 0 6px 0 rgba(20, 10, 60, .5), 0 0 40px rgba(255, 150, 200, .8); }
.egg-big.on span { transform: none; opacity: 1; }
.egg-match { position: fixed; z-index: 131; left: 0; right: 0; top: 33%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 34px 20px 32px; pointer-events: none;
  background: radial-gradient(ellipse 62% 50% at 50% 50%, rgba(8, 12, 46, .9) 45%, rgba(8, 12, 46, .55) 72%, rgba(8, 12, 46, 0) 100%); opacity: 0; transform: scaleX(.2); transition: opacity .4s, transform .5s var(--ease-pop); }
.egg-match::before, .egg-match::after { content: ''; position: absolute; left: 12%; right: 12%; height: 2px; background: linear-gradient(90deg, transparent, #f6d488, transparent); }
.egg-match::before { top: 24px; } .egg-match::after { bottom: 22px; }
.egg-match.on { opacity: 1; transform: none; }
.egg-match b { font-weight: normal; font-size: clamp(34px, 10vw, 54px); letter-spacing: .12em; background: linear-gradient(180deg, #fff7d6, #f2c45a 60%, #d9962c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(60, 30, 0, .6)); }
.egg-match span { font-size: 20px; color: #fff; }
.egg-match i { font-style: normal; font-family: var(--f-num); font-size: 12px; letter-spacing: .14em; color: rgba(246, 212, 136, .85); }
.egg-runner { position: fixed; z-index: 131; left: 0; bottom: calc(90px + var(--sb)); pointer-events: none; animation: er-go 4s linear forwards; }
.egg-runner.run { animation-duration: 2.8s; }
@keyframes er-go { from { transform: translateX(-90px); } to { transform: translateX(calc(100vw + 20px)); } }
.er-body { width: 66px; height: 66px; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 0 0 3px #fff6e8, 0 6px 14px rgba(8, 6, 40, .45); background: #f3d9c0; animation: er-hop .66s ease-in-out infinite; }
.egg-runner.run .er-body { animation-duration: .34s; }
.er-body img { width: 100%; height: 100%; object-fit: cover; }
@keyframes er-hop { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-34px) rotate(6deg); } }
.er-say { position: absolute; left: 54px; top: -30px; font-size: 15px; color: var(--ink); background: #fff6e8; border: 2.5px solid var(--ink); border-radius: 12px 12px 12px 3px; padding: 1px 9px; white-space: nowrap; }
.egg-night { position: fixed; inset: 0; z-index: 79; pointer-events: none; background: radial-gradient(ellipse at 50% 30%, rgba(10, 8, 40, .55), rgba(4, 3, 20, .82)); opacity: 0; transition: opacity 1.4s ease; }
.egg-night.on { opacity: 1; }
.en-moon { position: absolute; left: 50%; top: 16%; width: 110px; height: 110px; margin-left: -55px; background: url(../assets/art/moon.webp) center / contain no-repeat; filter: drop-shadow(0 0 30px rgba(255, 230, 160, .7)); transform: translateY(60px); opacity: 0; transition: transform 2.4s ease, opacity 2s ease; }
.egg-night.on .en-moon { transform: none; opacity: 1; }
.puppet.roll .pp-inner { animation: pp-roll 1.2s var(--ease-pop); }
@keyframes pp-roll { 0% { transform: rotate(0); } 50% { transform: rotate(-200deg) translateY(-20%); } 100% { transform: rotate(-360deg); } }

/* ---------- lyrics (once her voice in the song has come up) ---------- */
/* they sit just above the two pets; where the pets step aside, they come down to the bottom */
#lyric { position: fixed; z-index: 70; left: 0; right: 0; bottom: calc(108px + var(--sb)); height: 0; pointer-events: none; transition: bottom 1s cubic-bezier(.3, .7, .2, 1); }
body.hud-min #lyric, body.hud-nopets #lyric { bottom: calc(28px + var(--sb)); }
@media (min-width: 900px) { #lyric, body.hud-min #lyric, body.hud-nopets #lyric { bottom: calc(34px + var(--sb)); } }
/* 「快乐的日子」 has its little timeline near the bottom: the lyrics go underneath it */
body[data-ch='ch-happy'] #lyric { bottom: calc(5px + var(--sb)); }
@media (max-height: 720px) { body[data-ch='ch-happy'] .ly-en { font-size: 13.5px; } body[data-ch='ch-happy'] .ly-zh { font-size: 13px; } }
#lyric::before { content: ''; position: absolute; left: 50%; bottom: -34px; width: min(640px, 100vw); height: 128px; transform: translateX(-50%); background: radial-gradient(ellipse 50% 50% at 50% 62%, rgba(8, 6, 30, .5), rgba(8, 6, 30, 0)); opacity: 0; transition: opacity 1.4s ease; }
#lyric.on::before { opacity: 1; }
.ly-line { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0 26px; text-align: center; opacity: 0; transform: translateY(10px); filter: blur(3px); transition: opacity .8s ease, transform 1s cubic-bezier(.2, .7, .2, 1), filter .8s ease; }
.ly-line.in { opacity: 1; transform: none; filter: none; }
.ly-line.out { opacity: 0; transform: translateY(-12px); filter: blur(3px); transition-duration: .6s; }
.ly-en { max-width: 26em; font-family: var(--f-num); font-weight: 500; font-size: 15px; line-height: 1.35; letter-spacing: .02em; color: #fff8ec; text-shadow: 0 1px 10px rgba(0, 0, 0, .65), 0 0 2px rgba(0, 0, 0, .45); }
.ly-zh { font-size: 14.5px; line-height: 1.45; letter-spacing: .06em; color: var(--pink3); text-shadow: 0 1px 10px rgba(0, 0, 0, .65), 0 0 2px rgba(0, 0, 0, .45); }
.ly-en:empty, .ly-zh:empty { display: none; }
/* the little 「词」 switch under the music button (appears with the lyrics) */
#lyric-btn {
  position: fixed; z-index: 90; top: calc(66px + var(--st)); right: 17px; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--ink); background: var(--cream); color: var(--ink);
  font-family: var(--f-cute); font-size: 16px; line-height: 1; box-shadow: 0 2.5px 0 var(--ink);
  opacity: 0; pointer-events: none; transform: scale(.6); transition: opacity .7s ease, transform .7s var(--ease-pop), background .35s, color .35s;
}
body.hud-on #lyric-btn.show { opacity: 1; pointer-events: auto; transform: none; }
#lyric-btn.off { background: #2b2440; color: rgba(255, 248, 236, .5); }
#lyric-btn.off span { text-decoration: line-through; text-decoration-color: var(--pink); text-decoration-thickness: 2px; }

/* ---------- reveal helpers ---------- */
.rv { opacity: 0; transform: translateY(26px); }
.placeholder-note { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--gold3); opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .pp-inner, .pp-tail, .pp-head { animation: none !important; }
}

[hidden] { display: none !important; }
