/* ============================================================
   KUCH ALFAAZ, KUCH YAADEIN — Premium Digital Gift Book
   Design system via CSS variables. HTML5 + CSS3 + Vanilla JS.
   ============================================================ */

:root {
  --gold:        #e3b465;
  --gold-light:  #fbe3ae;
  --gold-deep:   #a97b2a;
  --gold-dark:   #6f4e15;
  --cream:       #f7e9d0;
  --cream-2:     #fdf7ea;
  --cream-3:     #efdcbc;
  --ink:         #4a3026;
  --ink-soft:    #7a5c47;
  --ink-faint:   #a98a6f;
  --wine:        #6a2742;
  --wine-deep:   #3c1a2b;
  --plum:        #240e18;
  --plum-dark:   #170910;
  --rose:        #c2647e;
  --crimson:     #9b3b52;
  --leather:     #4e2c22;
  --leather-dk:  #2e1a14;

  --font-serif: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-hand:  -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body:  -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --book-w:  min(88vw, 780px);
  --ease-book: cubic-bezier(.25, .74, .25, 1);
  --ease-soft: cubic-bezier(.2, .65, .25, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--plum-dark);
  color: var(--cream);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ============================================================
   SCREENS
   ============================================================ */

.screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.1s var(--ease-soft), visibility 0s linear 1.1s;
}
.screen.active { opacity: 1; visibility: visible; transition-delay: 0s; }

/* -- Gift screen backdrop ----------------------------------- */
.screen--gift {
  background:
    radial-gradient(120% 90% at 50% 118%, rgba(226,133,76,.38), transparent 60%),
    radial-gradient(90% 70% at 50% -10%, rgba(255,209,143,.22), transparent 55%),
    radial-gradient(60% 60% at 12% 85%, rgba(109,40,84,.55), transparent 60%),
    radial-gradient(60% 60% at 88% 12%, rgba(45,60,110,.35), transparent 60%),
    linear-gradient(160deg, #23101a 0%, #3a1626 42%, #4a2030 70%, #251016 100%);
}
.screen--gift::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(75% 60% at 50% 50%, transparent 40%, rgba(8,2,6,.72) 100%);
  pointer-events: none;
}

/* -- Book screen backdrop ----------------------------------- */
.screen--book {
  background:
    radial-gradient(110% 85% at 50% 125%, rgba(190,118,52,.30), transparent 62%),
    radial-gradient(80% 60% at 50% -5%, rgba(255,196,138,.14), transparent 55%),
    linear-gradient(168deg, #1d0d15 0%, #33203a 45%, #4a2a38 72%, #1d0d15 100%);
}
.screen--book::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 50% 42%, transparent 35%, rgba(6,2,4,.78) 100%);
  pointer-events: none;
  animation: breathe 9s ease-in-out infinite alternate;
}
@keyframes breathe {
  from { opacity: .7; }
  to   { opacity: 1; }
}

/* Twinkling ambient stars fill both screens */
.twinkle { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.star {
  position: absolute;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 calc(var(--s) * 3) var(--s) rgba(255,220,160,.5);
  opacity: 0;
  animation: twinkle var(--d) ease-in-out infinite;
  animation-delay: var(--dl);
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(.4); }
  50%      { opacity: .9; transform: translateY(-8px) scale(1); }
}

/* Fading floating hearts */
.floater {
  position: absolute;
  pointer-events: none;
  color: var(--rose);
  font-size: var(--f);
  opacity: 0;
  animation: floatUp var(--dur) linear infinite;
  animation-delay: var(--dl);
  text-shadow: 0 0 12px rgba(255,150,170,.6);
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { transform: translateY(12vh) rotate(0deg) scale(.6); opacity: 0; }
  12%  { opacity: .7; }
  50%  { transform: translateY(calc(-40vh + var(--drift))) translateX(var(--sway)) rotate(14deg) scale(1); opacity: .65; }
  100% { transform: translateY(-112vh) translateX(calc(var(--sway) * -1.4)) rotate(-18deg) scale(.9); opacity: 0; }
}

/* ============================================================
   GIFT BOX
   ============================================================ */

.gift-stage { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; }

.gift-scene {
  position: relative;
  width: min(300px, 64vw);
  margin-bottom: clamp(10px, 3vh, 30px);
  perspective: 900px;
}

.gift-glow {
  position: absolute;
  left: 50%; bottom: -12px;
  width: 180%; aspect-ratio: 2.2 / 1;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255,190,110,.4), rgba(255,150,70,.12) 45%, transparent 70%);
  filter: blur(14px);
  animation: glowPulse 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glowPulse {
  0%, 100% { opacity: .75; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.12); }
}

.gift-box { position: relative; animation: floaty 5.2s ease-in-out infinite; cursor: pointer; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-.4deg); }
  50%      { transform: translateY(-14px) rotate(.4deg); }
}

.gift-base {
  position: relative;
  width: 100%;
  aspect-ratio: 1.45 / 1;
  background:
    radial-gradient(120% 90% at 25% 12%, rgba(255,235,190,.25), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.045) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #a43b58 0%, #7d2a44 45%, #592036 100%);
  border-radius: 6px;
  box-shadow:
    inset 0 2px 2px rgba(255,220,190,.18),
    inset 0 -22px 40px -18px rgba(0,0,0,.55),
    0 24px 60px -12px rgba(0,0,0,.65),
    0 60px 90px -30px rgba(0,0,0,.6),
    0 4px 10px rgba(70,20,30,.4);
}
.gift-base::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: 7px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,224,170,.7), transparent 30%, transparent 70%, rgba(180,110,50,.55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.gift-lid {
  position: absolute;
  left: -4.5%; right: -4.5%;
  top: -14%;
  aspect-ratio: 1.14 / 1;
  background:
    radial-gradient(120% 90% at 25% 10%, rgba(255,235,190,.28), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.045) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #b64a68 0%, #8a304c 50%, #63243a 100%);
  border-radius: 7px;
  box-shadow:
    inset 0 2px 2px rgba(255,220,190,.22),
    inset 0 -18px 34px -16px rgba(0,0,0,.5),
    0 -6px 16px -6px rgba(255,180,140,.25),
    0 -14px 40px -14px rgba(255,160,120,.28);
  z-index: 3;
  transform-origin: 50% 100%;
}

.ribbon-v {
  position: absolute;
  top: -16%; bottom: -3%;
  left: 50%;
  width: 15%;
  transform: translateX(-50%);
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(0,0,0,.14), transparent 28%, rgba(255,255,255,.28) 50%, transparent 72%, rgba(0,0,0,.18)),
    linear-gradient(160deg, #f2c16a, #caa04a 45%, #9c7430 100%);
  box-shadow: inset 0 0 8px rgba(90,60,10,.35), 0 0 12px rgba(255,210,130,.2);
  border-radius: 3px;
}
.ribbon-h {
  position: absolute;
  left: -4.5%; right: -4.5%;
  top: 22%;
  height: 17%;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(0,0,0,.16), transparent 40%, rgba(255,255,255,.3) 50%, transparent 60%, rgba(0,0,0,.2)),
    linear-gradient(160deg, #f2c16a, #c89c48 45%, #97702e 100%);
  box-shadow: inset 0 0 10px rgba(90,60,10,.4);
}

/* Bow */
.bow { position: absolute; top: -34%; left: 50%; transform: translateX(-50%); z-index: 5; width: 54%; }
.bow-loop {
  position: absolute;
  width: 52%;
  aspect-ratio: 1.15 / 1;
  top: 0;
  border-radius: 58% 42% 52% 48%;
  background:
    linear-gradient(145deg, rgba(255,255,255,.35), transparent 45%),
    linear-gradient(315deg, rgba(0,0,0,.2), transparent 40%),
    linear-gradient(150deg, #f6c973, #d7a74f 55%, #8f6a28);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.35));
}
.bow-loop.left  { left: -6%;  transform: rotate(-34deg); animation: swayL 4.4s ease-in-out infinite; }
.bow-loop.right { right: -6%; transform: rotate(34deg);  animation: swayR 4.4s ease-in-out infinite; }
@keyframes swayL { 0%,100% { transform: rotate(-34deg) translateY(0); } 50% { transform: rotate(-40deg) translateY(-6px); } }
@keyframes swayR { 0%,100% { transform: rotate(34deg)  translateY(0); } 50% { transform: rotate(40deg)  translateY(-6px); } }
.bow-knot {
  position: absolute;
  left: 50%; top: 34%;
  width: 34%;
  aspect-ratio: 1.35 / 1;
  transform: translateX(-50%);
  border-radius: 44%;
  background:
    radial-gradient(120% 100% at 30% 20%, rgba(255,255,255,.4), transparent 55%),
    linear-gradient(160deg, #f6c973, #b98c3e 60%, #8a6226);
  box-shadow: inset -3px -4px 8px rgba(60,40,8,.45), 0 5px 12px rgba(0,0,0,.35);
  z-index: 2;
}
.bow-tail {
  position: absolute;
  top: 46%;
  width: 30%;
  height: 46%;
  background: linear-gradient(150deg, #e9bc62, #a57c36);
  clip-path: polygon(0 0, 60% 0, 100% 100%, 55% 70%);
  opacity: .95;
}
.bow-tail.left { left: 4%;  transform: rotate(-22deg); }
.bow-tail.right{ right: 3%; transform: rotate(24deg) scaleX(-1); }

/* Open-gift particle burst */
.burst-particle {
  position: absolute;
  left: 50%; top: 42%;
  pointer-events: none;
  color: var(--gold-light);
  font-size: var(--fs);
  transform: rotate(var(--rot)) translate(var(--dist), 0) rotate(-90deg) translateY(-40px);
  opacity: 0;
  transition: opacity .18s ease-out;
}
.burst-particle.fly {
  opacity: 1;
  animation: burst var(--t) cubic-bezier(.12,.7,.3,1) forwards;
}
@keyframes burst {
  0%   { transform: rotate(var(--rot)) translate(0,0) rotate(calc(var(--rot) * -1)); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: rotate(var(--rot)) translate(var(--dist), calc(var(--dist) * -.35)) rotate(calc(var(--rot) * -1)) translateY(-60px); opacity: 0; }
}

/* Light beam rising from opened box */
.ray {
  position: absolute;
  left: 50%; bottom: 40%;
  width: 46%;
  aspect-ratio: 1 / 3.2;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255,235,180,.85), rgba(255,200,120,.25) 62%, transparent);
  filter: blur(10px);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  opacity: 0;
  pointer-events: none;
}
.ray.on { opacity: 1; transition: opacity .35s ease-in; }

/* Gift heading typography */
.gift-copy { position: relative; z-index: 3; text-align: center; }
.gift-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(24px, 6.2vw, 46px);
  letter-spacing: .5px;
  color: var(--gold-light);
  text-shadow: 0 0 24px rgba(255,210,140,.55), 0 2px 2px rgba(0,0,0,.4);
}
.gift-sub {
  font-family: var(--font-hand);
  font-size: clamp(18px, 4.4vw, 30px);
  color: var(--cream);
  margin-top: 6px;
  opacity: .92;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.gift-sub .gift-byline {
  display: block;
  font-size: .62em;
  color: var(--gold-light);
  opacity: .95;
  margin-top: 4px;
  letter-spacing: 1px;
}
.gift-orn {
  display: block;
  color: var(--gold);
  letter-spacing: 10px;
  margin-top: 10px;
  font-size: 16px;
  opacity: .8;
}

/* Open Gift button */
.btn {
  position: relative;
  z-index: 3;
  cursor: pointer;
  border: 1px solid rgba(255,220,160,.55);
  background:
    radial-gradient(120% 150% at 30% 12%, rgba(255,230,180,.28), transparent 55%),
    linear-gradient(160deg, #c99b4a, #a97b2a 55%, #7d5a1e);
  color: #2c1808;
  font-family: var(--font-serif);
  font-size: clamp(13px, 2.6vw, 17px);
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 12px 38px;
  border-radius: 999px;
  box-shadow:
    inset 0 1px 1px rgba(255,240,200,.7),
    inset 0 -6px 12px rgba(60,35,5,.35),
    0 12px 30px -8px rgba(0,0,0,.6),
    0 0 0 6px rgba(255,200,130,.08);
  transition: transform .25s ease, box-shadow .25s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 1px 1px rgba(255,240,200,.7), inset 0 -6px 12px rgba(60,35,5,.3), 0 16px 36px -8px rgba(0,0,0,.65), 0 0 0 12px rgba(255,200,130,.12); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-offset { margin-top: clamp(18px, 4vh, 34px); }

/* Gift box "opening" state classes */
.gift-box.open .gift-lid {
  animation: lidOff .9s var(--ease-book) forwards;
}
@keyframes lidOff {
  0%   { transform: translateY(0) rotate(0); }
  100% { transform: translateY(-190px) rotate(-7deg); opacity: 0; }
}
.gift-box.open .ribbon-v {
  animation: ribbonSplit .85s var(--ease-book) forwards;
}
@keyframes ribbonSplit {
  0%   { transform: translateX(-50%) rotate(0); }
  100% { transform: translateX(290%)  rotate(24deg); opacity: 0; }
}
.gift-box.open .bow { animation: bowUp .9s var(--ease-book) forwards; }
@keyframes bowUp {
  0%   { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-160%) translateY(-130px) rotate(-20deg); opacity: 0; }
}
.gift-box.open .glowFlare { opacity: 1; }
.glowFlare {
  position: absolute;
  left: 50%; top: 40%;
  width: 130%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,240,190,.95), rgba(255,190,110,.4) 40%, transparent 70%);
  filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .9s ease-in-out;
  animation: flareThrob 1.6s ease-in-out 2;
}
@keyframes flareThrob {
  0%,100% { transform: translate(-50%,-50%) scale(.9); }
  50%     { transform: translate(-50%,-50%) scale(1.18); }
}

/* ============================================================
   BOOK SCENE
   ============================================================ */

.book-scene {
  position: relative;
  z-index: 3;
  perspective: 2600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.book-floor {
  position: absolute;
  left: 50%; bottom: -14vh;
  width: 200%; aspect-ratio: 2 / 1;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(226,150,80,.34), transparent 62%);
  filter: blur(20px);
  pointer-events: none;
  animation: glowPulse 5s ease-in-out infinite;
}

.book {
  position: relative;
  width: var(--book-w);
  aspect-ratio: 1.48;
  font-size: clamp(9px, 1.6vmin, 17px);
  opacity: 0;
  transform: translateY(46px) scale(.86) rotateX(8deg);
  transition: opacity 1.1s ease, transform 1.3s var(--ease-book);
}
.book.entered {
  opacity: 1;
  transform: translateY(0) scale(1) rotateX(2deg);
}

/* Book shell (the physical binding) */
.book-shell {
  position: absolute;
  inset: 0;
  border-radius: 14px 22px 22px 14px;
  background:
    radial-gradient(140% 100% at 20% 0%, rgba(255,220,170,.10), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 2px, transparent 2px 7px),
    linear-gradient(105deg, #57301f 0%, #41231783 100%), linear-gradient(105deg, #552f20, #37190f);
  box-shadow:
    inset 0 0 0 2px rgba(219,173,99,.55),
    inset 0 0 0 5px rgba(140,90,40,.18),
    inset -30px 0 60px -30px rgba(0,0,0,.75),
    inset 30px 0 50px -30px rgba(255,190,120,.12),
    0 34px 80px -18px rgba(0,0,0,.75),
    0 8px 24px rgba(0,0,0,.5);
}
.book-shell::before {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 11px 18px 18px 11px;
  border: 1px solid rgba(219,173,99,.4);
  pointer-events: none;
}

/* Spine */
.spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: clamp(20px, 3.6vw, 30px);
  border-radius: 12px 0 0 12px;
  background:
    repeating-linear-gradient(0deg, rgba(255,210,150,.06) 0 2px, transparent 2px 6px),
    linear-gradient(90deg, #4a281a, #2c1209 60%, #1d0c06);
  box-shadow: inset -6px 0 14px rgba(0,0,0,.6), inset 1px 0 1px rgba(255,200,140,.25);
  z-index: 5;
}
.spine::after {
  content: "KUCH ALFAAZ · KUCH YAADEIN";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-family: var(--font-serif);
  font-size: .62em;
  letter-spacing: 4px;
  color: rgba(240,205,140,.75);
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}
.spine-band {
  position: absolute;
  left: -2px; width: calc(100% + 4px); height: 10px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-deep));
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.spine-band:nth-of-type(1) { top: 12%; }
.spine-band:nth-of-type(2) { bottom: 12%; }

/* Paper edges peeking top/bottom after opening */
.paper-edge {
  position: absolute;
  left: clamp(20px, 3.6vw, 30px); right: 12px;
  height: 12px;
  background: repeating-linear-gradient(0deg, var(--cream) 0 2px, var(--cream-3) 2px 4px, #dcc39c 4px 5px);
  border-radius: 2px;
  opacity: 0;
  transition: opacity .9s ease .3s;
}
.book.pages-open .paper-edge { opacity: 1; }
.paper-edge.top    { top: -5px; transform: rotate(1.4deg); }
.paper-edge.bottom { bottom: -5px; transform: rotate(-1.2deg); }

/* Pages area */
.book-pages {
  position: absolute;
  left: clamp(24px, 3.6vw + 2px, 34px);
  top: 16px; right: 14px; bottom: 16px;
  background:
    radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, var(--cream-3), var(--cream) 6%, transparent 20%, transparent 80%, var(--cream-3)),
    #f4e3c5;
  background-size: 3px 3px, 100% 100%, 100% 100%;
  border-radius: 6px 16px 16px 6px;
  box-shadow: inset 0 0 3px rgba(90,60,20,.35);
}

/* Cover overlay — the closed book */
.cover-closed {
  position: absolute;
  inset: 0;
  z-index: 80;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1.15s var(--ease-book), opacity .4s ease;
  border-radius: 6px 16px 16px 6px;
  cursor: pointer;
  background:
    radial-gradient(120% 90% at 30% 8%, rgba(255,220,170,.16), transparent 55%),
    repeating-linear-gradient(35deg, rgba(255,255,255,.018) 0 2px, transparent 2px 8px),
    linear-gradient(115deg, #5b3120, #3c1d12 60%, #331910);
  box-shadow:
    inset 0 0 0 2px rgba(219,173,99,.6),
    inset 0 0 0 6px rgba(150,96,42,.15),
    -14px 20px 40px -12px rgba(0,0,0,.55);
}
.cover-closed::after {
  content: "";
  position: absolute; inset: 7px;
  border: 1px solid rgba(219,173,99,.45);
  border-radius: 4px 12px 12px 4px;
  pointer-events: none;
}
.cover-closed.open {
  transform: rotateY(-118deg) translateZ(-30px);
  opacity: 0;
  pointer-events: none;
}

.cover-face {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6%;
  overflow: hidden;
}
.cover-face::before, .cover-face::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cover-face::before {
  width: 52%; aspect-ratio: 1;
  border: 1px solid rgba(224,178,102,.38);
  box-shadow: 0 0 40px 8px rgba(255,200,120,.10);
}
.cover-face::after {
  width: 38%; aspect-ratio: 1;
  border: 1px dashed rgba(224,178,102,.45);
  border-radius: 50%;
}

.cover-img {
  position: absolute;
  left: 50%; top: 50%;
  width: 64%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid rgba(219,173,99,.7);
  box-shadow: 0 0 0 8px rgba(90,50,20,.5), 0 0 50px rgba(255,210,140,.25);
}
.cover-img.hidden { display: none; }
.cover-img.fallback {
  display: block;
  background: radial-gradient(circle at 30% 25%, #8a4a30, #4c2416 70%);
}

.cover-kicker {
  font-family: var(--font-hand);
  color: var(--gold-light);
  font-size: 1.7em;
  letter-spacing: 2px;
  text-shadow: 0 1px 3px #000;
}
.cover-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--gold-light);
  font-size: clamp(21px, 3.2vmin, 38px);
  line-height: 1.18;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  margin-top: 6px;
  z-index: 2;
}
.cover-sub {
  font-family: var(--font-hand);
  color: var(--cream);
  font-size: clamp(17px, 2.7vmin, 28px);
  margin-top: 2px;
  opacity: .95;
  z-index: 2;
}
.cover-orn {
  margin-top: 8px;
  color: var(--gold);
  font-size: 1.1em;
  letter-spacing: 6px;
  z-index: 2;
}

/* Tap hot-zones */
.tap {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  z-index: 90;
  cursor: pointer;
  opacity: 0;
  transition: opacity .4s ease;
}
.tap.on { opacity: 1; }
.tap-next { right: 0; }
.tap-prev { left: 0; }

.tap-hint {
  position: absolute;
  z-index: 95;
  left: 50%;
  transform: translateX(-50%);
  bottom: -42px;
  font-family: var(--font-hand);
  color: rgba(247,231,200,.85);
  font-size: 1.35em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
  text-shadow: 0 1px 4px #000;
}
.tap-hint.show { opacity: 1; }
.tap-hint::before { content: "❦  "; color: var(--gold); }

/* Open Book button */
.btn-open-book {
  position: relative;
  z-index: 96;
  margin-top: clamp(26px, 5vh, 46px);
  animation: bookPulse 2.4s ease-in-out infinite;
}
@keyframes bookPulse {
  0%, 100% { box-shadow: inset 0 1px 1px rgba(255,240,200,.7), inset 0 -6px 12px rgba(60,35,5,.35), 0 12px 30px -8px rgba(0,0,0,.6), 0 0 0 6px rgba(255,200,130,.08); }
  50%      { box-shadow: inset 0 1px 1px rgba(255,240,200,.7), inset 0 -6px 12px rgba(60,35,5,.35), 0 12px 30px -8px rgba(0,0,0,.6), 0 0 0 14px rgba(255,200,130,.14); }
}

/* ============================================================
   LEAVES & 3D TURNING
   ============================================================ */

.leaf {
  position: absolute;
  left: 50%;
  top: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1.05s var(--ease-book);
  will-change: transform;
  cursor: pointer;
}
.leaf.fold {
  transform: translateX(-100%) rotateY(-180deg);
}
.leaf.turning {
  filter: drop-shadow(0 24px 18px rgba(20,8,4,.45));
  cursor: grabbing;
  transition: transform .95s cubic-bezier(.3,.7,.2,1);
}

.p-front, .p-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 4px 12px 12px 4px;
}
.p-back {
  transform: rotateY(180deg);
  border-radius: 12px 4px 4px 12px;
}

/* fold shadow near spine */
.p-front::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(80,42,18,.42), rgba(80,42,18,.12) 40%, transparent 60%);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 8;
}
.p-back::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 40%, rgba(80,42,18,.18) 70%, rgba(80,42,18,.45));
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 8;
}
.leaf.turning .p-front::before { opacity: 1; }
.leaf.fold .p-back::before     { opacity: 1; }

/* paper sheet base for every face */
.paper {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 5.5% 6% 4.5%;
  background-color: var(--cream-2);
  background-image:
    radial-gradient(rgba(110,70,30,.05) 1px, transparent 1.3px),
    radial-gradient(rgba(110,70,30,.028) 1px, transparent 1px),
    linear-gradient(115deg, transparent 60%, rgba(160,110,60,.05));
  background-size: 4px 4px, 7px 7px, 100% 100%;
}

/* decorative gold corners */
.corner {
  position: absolute;
  width: 22px; height: 22px;
  z-index: 9;
  pointer-events: none;
  opacity: .9;
}
.corner::before, .corner::after {
  content: "";
  position: absolute;
  border: 0 solid var(--gold-deep);
  width: 100%; height: 100%;
}
.corner.tl { top: 6px; left: 6px; } .corner.tl::before { border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 4px; }
.corner.tl::after { top: 3px; left: 3px; border-left-width: 1px; border-top-width: 1px; opacity: .6; }
.corner.tr { top: 6px; right: 6px; } .corner.tr::before { border-right-width: 2px; border-top-width: 2px; border-top-right-radius: 4px; }
.corner.tr::after { top: 3px; right: 3px; border-right-width: 1px; border-top-width: 1px; opacity: .6; }
.corner.bl { bottom: 6px; left: 6px; } .corner.bl::before { border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 4px; }
.corner.bl::after { bottom: 3px; left: 3px; border-left-width: 1px; border-bottom-width: 1px; opacity: .6; }
.corner.br { bottom: 6px; right: 6px; } .corner.br::before { border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 4px; }
.corner.br::after { bottom: 3px; right: 3px; border-right-width: 1px; border-bottom-width: 1px; opacity: .6; }

/* thin inner page border */
.rule {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(169,123,42,.4);
  border-radius: 3px 9px 9px 3px;
  pointer-events: none;
  z-index: 4;
}
.rule::after {
  content: "";
  position: absolute; inset: 3px;
  border: 1px solid rgba(169,123,42,.22);
  border-radius: 2px 7px 7px 2px;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */

.page-head {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-bottom: 3.2%;
  flex: 0 0 auto;
}
.page-kicker {
  font-family: var(--font-hand);
  color: var(--crimson);
  font-size: 1.5em;
  line-height: .9;
  opacity: 0;
  transform: translateY(6px);
}
.page-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.72em;
  letter-spacing: 2.5px;
  color: var(--ink);
  text-shadow: 0 1px 0 #fff;
  margin: 4px 0 5px;
  opacity: 0;
  transform: translateY(8px);
}
.orn-divider {
  color: var(--gold-deep);
  font-size: .95em;
  letter-spacing: 7px;
  opacity: 0;
}
.orn-divider::before { content: "✦"; margin-right: 2px; }
.orn-divider::after  { content: "✦"; margin-left:  2px; }

.photo-area { position: relative; z-index: 4; flex: 1 1 auto; min-height: 0; }

/* generic framed image */
.frame {
  position: relative;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 26px -10px rgba(80,40,20,.55), 0 3px 8px rgba(80,40,20,.25);
  border: 1px solid rgba(140,95,45,.35);
}
.frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 1.1s ease .25s, transform 1.6s var(--ease-soft) .2s;
}
.frame .ph {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}

/* ============ layout variants ============ */

.layout-full .frame {
  position: absolute;
  inset: 0 0 auto 0;
  height: 58%;
  border-radius: 6px;
}
.layout-full .frame::after {
  content: "";
  position: absolute; inset: 6%;
  border: 1px solid rgba(255,245,220,.55);
  border-radius: 4px;
  box-shadow: inset 0 0 26px rgba(255,235,190,.35);
  pointer-events: none;
}

.layout-polaroid {
  position: absolute;
  top: 2%;
  left: 50%;
  width: 56%;
  transform: translateX(-50%) rotate(-4deg);
  background: #fff;
  padding: 5px 5px 12px;
  box-shadow: 0 14px 28px -12px rgba(60,30,12,.6);
  z-index: 5;
}
.layout-polaroid img {
  aspect-ratio: 4 / 4.2;
  object-fit: cover;
  width: 100%;
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 1.05s ease .25s, transform 1.5s var(--ease-soft) .2s;
}
.layout-polaroid::after {
  content: attr(data-caption);
  display: block;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.06em;
  color: #5a4634;
  padding-top: 6px;
  letter-spacing: .5px;
}

.layout-two { display: grid; grid-template-columns: 1fr 1fr; gap: 6%; align-items: center; height: 58%; }
.layout-two .frame { border-radius: 5px; height: 100%; }
.layout-two .frame:nth-child(1) { transform: rotate(-3deg) translateY(4%); }
.layout-two .frame:nth-child(2) { transform: rotate(3deg)  translateY(-4%); }
.layout-two .frame img { transition: opacity 1.1s ease .25s, transform 1.6s var(--ease-soft) .2s; }

.layout-circle .frame {
  position: absolute;
  left: 50%; top: 30%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 0 9px rgba(255,255,255,.85), 0 0 0 10px rgba(169,123,42,.5), 0 18px 40px -10px rgba(60,30,12,.6);
}
.layout-circle .frame::after {
  content: "";
  position: absolute; inset: -14%;
  border-radius: 50%;
  border: 1px dashed rgba(169,123,42,.5);
  animation: slowSpin 26s linear infinite;
}
@keyframes slowSpin { to { transform: rotate(360deg); } }

.layout-overlap .photo-a {
  position: absolute;
  top: 0; left: 0;
  width: 66%; height: 66%;
  border-radius: 4px;
  z-index: 3;
}
.layout-overlap .photo-b {
  position: absolute;
  right: -8%; bottom: 2%;
  width: 60%; height: 58%;
  border-radius: 4px;
  z-index: 5;
  border: 4px solid #fff;
  box-shadow: 0 14px 30px -10px rgba(60,30,12,.6);
}

.quote-area {
  position: relative;
  z-index: 7;
  flex: 0 0 auto;
  margin-top: 3%;
  text-align: center;
}
.layout-quote-under { margin-top: 2%; }
.quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 1.05em;
  line-height: 1.5;
  letter-spacing: .2px;
  opacity: 0;
  transform: translateY(10px);
}
.qt-mark { color: var(--rose); font-family: var(--font-serif); font-size: 1.6em; line-height: .5; display: inline-block; margin-right: 5px; vertical-align: 4px; }
.note {
  font-family: var(--font-hand);
  color: var(--crimson);
  font-size: 1.45em;
  margin-top: 7px;
  line-height: 1.1;
  opacity: 0;
}
.audi {
  display: inline-block;
  font-size: 1em;
  color: var(--gold-deep);
  opacity: 0;
  margin-left: 6px;
  vertical-align: 2px;
  animation: softPulse 2.4s ease-in-out infinite;
}
@keyframes softPulse { 0%,100% { opacity: .35; transform: scale(1); } 50% { opacity: .95; transform: scale(1.15); } }

.page-num {
  position: absolute;
  bottom: 8px;
  right: 16px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: .95em;
  letter-spacing: 1px;
  color: var(--ink-faint);
  z-index: 9;
}
.page-num::before { content: "— "; }

/* ============ page entrance (reveal when displayed) ============ */
.leaf.is-now .page-kicker,
.leaf.is-now .orn-divider,
.leaf.is-now .page-title,
.leaf.is-now .quote { opacity: 1; transform: translateY(0); transition: opacity .9s ease, transform .9s var(--ease-soft); }
.leaf.is-now .page-kicker   { transition-delay: .10s; }
.leaf.is-now .page-title    { transition-delay: .22s; }
.leaf.is-now .orn-divider   { transition-delay: .34s; }
.leaf.is-now .quote         { transition-delay: .48s; }
.leaf.is-now .note          { transition-delay: .72s; opacity: 1; }

.leaf.is-now .layout-full img,
.leaf.is-now .layout-polaroid img,
.leaf.is-now .layout-two .frame img,
.leaf.is-now .layout-circle .frame img,
.leaf.is-now .layout-overlap img,
.leaf.is-now .song-img img { opacity: 1; transform: scale(1); }

.leaf.is-now .layout-overlap .photo-a img { transition-delay: .2s; }
.leaf.is-now .layout-overlap .photo-b img { transition-delay: .5s; }

/* ============================================================
   BACK OF PAGES (blank paper)
   ============================================================ */

.paper-back {
  position: absolute;
  inset: 0;
  background-color: var(--cream-2);
  background-image:
    radial-gradient(rgba(110,70,30,.045) 1px, transparent 1.3px);
  background-size: 5px 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-orn {
  color: rgba(169,123,42,.45);
  font-size: 2.1em;
  letter-spacing: 10px;
}
.back-num {
  position: absolute;
  bottom: 8px; left: 16px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: .9em;
  color: rgba(169,138,111,.7);
}
.back-num::before { content: "— "; }

/* ============================================================
   SONG / FINAL PAGE
   ============================================================ */

.song-page {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(190,120,60,.35), transparent 60%),
    radial-gradient(80% 60% at 15% 0%, rgba(109,40,84,.6), transparent 60%),
    linear-gradient(165deg, #2a1220, #4a2436 55%, #271019);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5%;
  overflow: hidden;
}
.song-page .corner { opacity: .85; }

.song-kicker {
  font-family: var(--font-hand);
  color: var(--gold-light);
  font-size: 1.6em;
  opacity: 0;
}
.song-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-style: italic;
  color: var(--gold-light);
  font-size: 1.65em;
  line-height: 1.15;
  margin: 4px 0 2px;
  text-shadow: 0 0 18px rgba(255,205,135,.4), 0 2px 4px #000;
  opacity: 0;
}
.song-line {
  font-family: var(--font-hand);
  color: var(--cream);
  font-size: 1.25em;
  margin: 4px 0 10px;
  opacity: 0;
}
.leaf.is-now .song-kicker { transition-delay: .1s; opacity: 1; }
.leaf.is-now .song-title  { transition-delay: .22s; opacity: 1; }
.leaf.is-now .song-line   { transition-delay: .38s; opacity: 1; }

.song-img {
  position: relative;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid rgba(227,180,101,.9);
  box-shadow: 0 0 0 6px rgba(0,0,0,.35), 0 0 46px rgba(255,200,130,.4);
  margin: 8px 0 12px;
}
.song-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.15);
  transition: opacity 1.2s ease .5s, transform 1.8s var(--ease-soft) .4s;
}
.song-img .ph { position: absolute; inset: 0; }
.song-img::after {
  content: "";
  position: absolute; inset: -16%;
  border-radius: 50%;
  border: 1px dashed rgba(251,227,174,.4);
  animation: slowSpin 22s linear infinite;
  pointer-events: none;
}
.song-page.playing .song-img {
  animation: songPulse 3.4s ease-in-out infinite;
}
@keyframes songPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(255,200,130,.35)); }
  50%      { transform: scale(1.05); filter: drop-shadow(0 0 34px rgba(255,215,150,.65)); }
}

/* ============ music player ============ */

.player {
  position: relative;
  width: 100%;
  max-width: 300px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.18)),
    rgba(30,14,22,.62);
  border: 1px solid rgba(227,180,101,.5);
  border-radius: 14px;
  padding: 12px 14px 12px;
  box-shadow: inset 0 1px 0 rgba(255,230,190,.25), 0 12px 26px -8px rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .8s ease .5s, transform .8s var(--ease-soft) .5s;
}
.leaf.is-now .player { opacity: 1; transform: translateY(0); }

.player-top { display: flex; align-items: center; gap: 10px; }

.play-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(255,235,190,.7);
  background: radial-gradient(120% 160% at 30% 18%, rgba(255,230,180,.5), transparent 55%), linear-gradient(160deg, #d8a953, #9c7330);
  color: #3a2408;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 1px rgba(255,240,200,.8), inset 0 -4px 8px rgba(60,35,5,.4), 0 6px 16px -4px rgba(0,0,0,.6);
  transition: transform .2s ease;
  text-indent: 2px;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn:active { transform: scale(.96); }
.play-btn.paused .icon-play { display: block; }
.play-btn.paused .icon-pause { display: none; }
.playing .play-btn .icon-play { display: none; }
.playing .play-btn .icon-pause { display: block; }

.eq { display: flex; align-items: center; gap: 2.5px; height: 24px; flex: 1 1 auto; overflow: hidden; }
.eq i {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-deep));
  margin-top: auto;
}
.eq.play i {
  animation: eqBar var(--d) ease-in-out infinite alternate;
}
@keyframes eqBar {
  from { transform: scaleY(1.15) translateY(1px); }
  to   { transform: scaleY(3.4) translateY(-6px); }
}

.player-mid { margin-top: 9px; }
.prog { display: flex; align-items: center; gap: 8px; font-family: var(--font-serif); font-size: .72em; color: rgba(247,231,200,.85); }
.prog-track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  border-radius: 6px;
  background: rgba(255,235,200,.18);
  overflow: hidden;
  cursor: pointer;
}
.prog-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-light));
  box-shadow: 0 0 10px rgba(255,210,140,.7);
}

.player-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.vol-wrap { display: flex; align-items: center; gap: 6px; }
.vol-icon { font-size: .85em; color: var(--gold-light); }
.vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 74px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,235,200,.22);
  outline: none;
  cursor: pointer;
}
.vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold-deep));
  border: 1px solid rgba(255,240,200,.8);
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.vol-range::-moz-range-thumb {
  width: 12px; height: 12px; border: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold-deep));
}
.replay-chip {
  display: none;
  font-family: var(--font-hand);
  font-size: 1.1em;
  color: var(--gold-light);
  background: rgba(227,180,101,.16);
  border: 1px solid rgba(227,180,101,.5);
  border-radius: 999px;
  padding: 3px 14px;
  cursor: pointer;
  margin-top: 9px;
  transition: background .3s ease;
}
.replay-chip:hover { background: rgba(227,180,101,.3); }
.replay-chip.show { display: inline-block; animation: chipIn .8s var(--ease-soft) both; }
@keyframes chipIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* end-note & the end */
.end-line {
  font-family: var(--font-hand);
  color: var(--cream);
  font-size: 1.3em;
  line-height: 1.25;
  margin-top: 12px;
  max-width: 90%;
  opacity: 0;
  transform: translateY(8px);
}
.end-line.show { transition: opacity 2.4s ease, transform 2.4s var(--ease-soft); opacity: 1; transform: translateY(0); }
.the-end {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--gold-light);
  font-size: 1.5em;
  letter-spacing: 2px;
  text-shadow: 0 0 22px rgba(255,205,140,.5);
  opacity: 0;
  transition: opacity 2.6s ease;
}
.the-end.show { opacity: 1; }

/* The End back cover (leaf back) */
.song-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(120% 100% at 50% 110%, rgba(190,120,60,.3), transparent 60%),
    radial-gradient(70% 50% at 50% 0%, rgba(109,40,84,.55), transparent 60%),
    linear-gradient(165deg, #2a1220, #3e1f30);
}
.song-back .fin {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--gold-light);
  font-size: 2.4em;
  text-shadow: 0 0 28px rgba(255,205,140,.5);
}
.song-back .fin-line {
  font-family: var(--font-hand);
  color: var(--cream);
  font-size: 1.4em;
  margin-top: 8px;
}
.song-back .fin-orn { color: var(--gold); margin-top: 12px; font-size: 1.2em; letter-spacing: 8px; }

/* Light sweep across the book */
.book-sweep {
  position: absolute;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
}
.book-sweep::before {
  content: "";
  position: absolute;
  left: -30%;
  top: -20%;
  bottom: -20%;
  width: 32%;
  background: linear-gradient(100deg, transparent, rgba(255,235,190,.13), transparent);
  transform: skewX(-14deg);
}
.book.sweeping .book-sweep { animation: sweep 4.2s ease-out infinite; opacity: 1; }
@keyframes sweep {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  42%  { opacity: .9; }
  100% { opacity: 0; }
}
.book.sweeping .book-sweep::before { animation: sweepMove 4.2s ease-out infinite; }
@keyframes sweepMove {
  0%   { transform: translateX(0) skewX(-14deg); }
  100% { transform: translateX(460%) skewX(-14deg); }
}

/* ============================================================
   TRANSITION VEIL
   ============================================================ */

.veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background:
    radial-gradient(90% 90% at 50% 50%, rgba(255,210,150,.16), transparent 70%),
    radial-gradient(120% 120% at 50% 120%, rgba(226,133,76,.26), transparent 55%),
    linear-gradient(170deg, #150710, #3a1626 48%, #1d0c14 100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, visibility 0s linear .6s;
  pointer-events: none;
}
.veil.on {
  opacity: 1;
  visibility: visible;
  transition: opacity .5s ease;
  pointer-events: all;
}
.veil::after {
  content: "✦";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10vmin;
  color: rgba(251,227,174,.5);
  animation: veilSpin 1s ease infinite alternate;
  text-shadow: 0 0 40px rgba(255,215,150,.9);
}
@keyframes veilSpin { to { transform: translate(-50%, -50%) rotate(180deg) scale(1.35); } }

.hearts-rain { position: fixed; inset: 0; pointer-events: none; z-index: 210; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */

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

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 720px) {
  :root { --book-w: min(94vw, 560px); }
  .book-pages { top: 12px; bottom: 12px; left: 12px; right: 8px; }
  .spine { width: 12px; }
  .paper-edge { left: 16px; }
  .paper { padding: 6% 6.5% 6%; }
  .book { font-size: clamp(9px, 2.2vmin, 14px); }
  .tap-hint { bottom: -34px; font-size: 1.15em; }
}

@media (max-width: 420px) {
  :root { --book-w: 96vw; }
  .book { font-size: clamp(9px, 2.4vmin, 13px); }
  .player { padding: 10px 10px; }
  .play-btn { width: 38px; height: 38px; }
}

@media (max-height: 760px) and (max-width: 720px) {
  .gift-scene { width: min(210px, 58vw); }
  .gift-title { font-size: clamp(20px, 5.4vw, 34px); }
  .gift-sub   { font-size: clamp(15px, 4vw, 23px); }
  .btn-offset { margin-top: 12px; }
  .gift-stage { gap: 4px; }
}

@media (prefers-color-scheme: light) {
  /* keep the gift cinematic regardless of OS scheme */
}