/* ==========================================================================
   Omaima — Minimal · Romantic · Cinematic
   Palette: Warm Ivory · Soft Beige · Muted Pink · Black/White · touch of Gold
   ========================================================================== */

:root {
  --ivory: #F7F0E4;
  --beige: #E8DAC6;
  --blush: #D9B8B4;
  --ink:   #171513;
  --white: #FBF8F2;
  --gold:  #B79A63;

  --ar-display: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --ar-ui:      "IBM Plex Sans Arabic", "Tajawal", system-ui, sans-serif;
  --en-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --en-ui:      "Jost", system-ui, -apple-system, sans-serif;

  --display: var(--ar-display);
  --ui: var(--ar-ui);
  --ls: 0;                         /* letter-spacing: Arabic must stay 0 to keep joins */
  --ease: cubic-bezier(.22, .7, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
html[lang="en"] { --display: var(--en-display); --ui: var(--en-ui); --ls: .08em; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #000; color: var(--white);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
img { display: block; }

/* ---------- Stages: one at a time, cross-dissolved ---------- */
.stage {
  position: fixed; inset: 0; z-index: 1; overflow: hidden;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 1s ease, visibility 0s linear 1s;
}
.stage.active {
  z-index: 2; opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity 1.1s ease .35s, visibility 0s;
}

/* ---------- Chrome: language / restart / music ---------- */
.chrome {
  position: fixed; z-index: 20;
  top: calc(var(--safe-top) + 12px); inset-inline-end: 14px;
  display: flex; align-items: center; gap: 8px;
  --chip-fg: rgba(251,248,242,.88); --chip-bg: rgba(255,255,255,.10); --chip-bd: rgba(255,255,255,.28);
  transition: color .8s ease;
}
body[data-theme="light"] .chrome {
  --chip-fg: rgba(23,21,19,.78); --chip-bg: rgba(255,255,255,.45); --chip-bd: rgba(23,21,19,.18);
}
.chip {
  height: 34px; min-width: 34px; padding: 0 12px;
  display: inline-grid; place-items: center;
  border-radius: 17px; cursor: pointer;
  color: var(--chip-fg); background: var(--chip-bg); border: 1px solid var(--chip-bd);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 400 12.5px/1 var(--ui); letter-spacing: var(--ls);
  transition: background .3s, color .8s, border-color .8s, opacity .3s;
}
.chip.icon { padding: 0; width: 34px; }
.chip:hover { background: var(--chip-bd); }
#btn-lang { font-family: var(--en-ui), var(--ar-ui); }
html[lang="en"] #btn-lang { font-family: var(--ar-ui); letter-spacing: 0; font-size: 13.5px; }
#btn-music.playing svg { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-2px) } }

button:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 3px; }

#progress {
  position: fixed; z-index: 30; top: 0; inset-inline: 0; height: 2px; pointer-events: none;
  opacity: 0; transition: opacity .8s ease;
}
body:not([data-stage="0"]) #progress { opacity: .9; }
#progress i {
  display: block; height: 100%; background: var(--gold);
  transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform 1.4s var(--ease);
}
html[dir="rtl"] #progress i { transform-origin: right; }

/* ---------- Continue button ---------- */
.next {
  position: absolute; z-index: 5;
  bottom: calc(var(--safe-bot) + 28px);
  inset-inline: 0; margin-inline: auto; width: 50px; height: 50px;
  display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 1px solid currentColor; cursor: pointer;
  opacity: 0; visibility: hidden;
  transition: opacity 1.4s ease var(--d, 4s), visibility 0s linear var(--d, 4s), background .3s;
}
.play .next { opacity: .62; visibility: visible; }
.play .next:hover { opacity: 1; background: rgba(127,127,127,.12); }

/* ==========================================================================
   0 · Lock screen
   ========================================================================== */
.s-lock { background: #000; color: #fff; }
/* Password gate — must be passed before the original birthday sequence */
.password-screen {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center;
  padding: calc(var(--safe-top) + 24px) 22px calc(var(--safe-bot) + 24px);
  overflow-y: auto; background: radial-gradient(ellipse at 50% 30%, rgba(255,220,230,.96), rgba(247,225,224,.96) 48%, rgba(33,22,28,.97) 100%);
  color: #4c3038; text-align: center;
}
.password-card { width: min(100%, 390px); display: flex; flex-direction: column; align-items: center; }
.teddy { width: clamp(150px, 42vw, 220px); height: clamp(150px, 42vw, 220px); object-fit: contain; filter: drop-shadow(0 12px 18px rgba(93,45,59,.16)); animation: teddy-float 3.8s ease-in-out infinite; }
@keyframes teddy-float { 0%,100% { transform: translateY(0) rotate(-1deg) } 50% { transform: translateY(-8px) rotate(1deg) } }
.password-kicker { margin: 5px 0 8px; font: 500 12px/1.4 var(--en-ui); letter-spacing: .12em; color: #a66b7c; }
.password-card h1 { margin: 0; font: 700 clamp(25px, 7vw, 32px)/1.5 var(--ar-display); color: #613d49; }
.password-note { margin: 8px 0 20px; font: 400 15px/1.8 var(--ar-ui); color: #805b66; }
#password-form { width: 100%; display: grid; gap: 12px; }
#birthday-password { width: 100%; box-sizing: border-box; height: 52px; border: 1px solid rgba(157,103,122,.38); border-radius: 16px; background: rgba(255,255,255,.78); color: #573744; text-align: center; font: 500 17px/1 var(--en-ui); letter-spacing: .12em; outline: none; }
#birthday-password:focus { border-color: #b8758c; box-shadow: 0 0 0 3px rgba(184,117,140,.14); }
.password-submit { min-height: 50px; border: 0; border-radius: 16px; background: #9d6478; color: #fff9fa; font: 500 16px/1 var(--ar-ui); box-shadow: 0 8px 20px rgba(111,61,79,.2); cursor: pointer; }
.password-submit:active { transform: scale(.98); }
.password-error { min-height: 22px; margin: 0; color: #a13f54; font: 400 13px/1.6 var(--ar-ui); }
.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; }
.password-screen.unlocked { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .8s ease, visibility 0s linear .8s; }
body:not(.unlocked) .chrome { display: none; }
.s-lock .bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: 50% 50%;
  background: #000; transform: none; transition: none;
}
.s-lock.play .bg { transform: none; }
.shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgba(0,0,0,.62) 0%, rgba(0,0,0,0) 46%),
    linear-gradient(to bottom, rgba(0,0,0,.28) 0%, rgba(0,0,0,0) 22%);
}

.notif {
  position: absolute; z-index: 4;
  top: calc(var(--safe-top) + 62px); left: 50%;
  width: min(92vw, 390px);
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 22px;
  background: rgba(238,238,242,.70);
  -webkit-backdrop-filter: blur(26px) saturate(1.6); backdrop-filter: blur(26px) saturate(1.6);
  color: #111; box-shadow: 0 12px 34px rgba(0,0,0,.30), 0 0 0 .5px rgba(255,255,255,.35) inset;
  font-family: -apple-system, "SF Pro Text", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  transform: translate(-50%, -150%) scale(.94); opacity: 0;
  transition: transform .8s cubic-bezier(.2,.95,.3,1.06), opacity .5s ease;
  pointer-events: none;
}
.notif.show  { transform: translate(-50%, 0) scale(1); opacity: 1; }
.notif.leave { transform: translate(-50%, -28%) scale(.97); opacity: 0;
               transition: transform .6s cubic-bezier(.5,0,.8,.4), opacity .45s ease .05s; }
.notif.reset { transition: none !important; }
.n-icon {
  flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(180deg, #6BE673 0%, #14BF37 100%);
}
.n-body { flex: 1; min-width: 0; }
.n-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.n-head b { font-weight: 600; font-size: 15px; }
.n-head span { font-size: 13px; color: rgba(60,60,67,.6); }
#n-text { margin: 2px 0 0; font-size: 15px; line-height: 1.4; }

.gate {
  position: absolute; z-index: 3; inset-inline: 0;
  bottom: calc(var(--safe-bot) + 9vh);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  transition: opacity .7s ease;
}
.gate.leaving { opacity: 0; }
.surprise {
  margin: 0; font: 300 17px/1.4 var(--en-ui), var(--ar-ui); letter-spacing: .04em;
  opacity: 0; transform: translateY(8px);
  transition: opacity 1.5s ease, transform 1.5s var(--ease);
}
.gate.show-text .surprise { opacity: .93; transform: none; }
.heart-wrap { display: flex; align-items: center; gap: 12px; opacity: 0; transition: opacity 1.3s ease; }
.gate.show-heart .heart-wrap { opacity: 1; }
.dot {
  width: 5px; height: 5px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,.7); animation: dot 2.6s ease-in-out infinite;
}
@keyframes dot { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
.heart {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 10px;
  font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 16px rgba(0,0,0,.55));
  animation: beat 2.8s ease-in-out infinite;
  transition: transform .7s var(--ease), opacity .7s ease;
}
.heart.pressed { animation: none; transform: scale(1.9); opacity: 0; }
@keyframes beat {
  0%,100% { transform: scale(1) } 10% { transform: scale(1.1) } 20% { transform: scale(1) }
  32% { transform: scale(1.07) } 44% { transform: scale(1) }
}

/* ==========================================================================
   1 · Greeting
   ========================================================================== */
.s-greet {
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(217,184,180,.42), transparent 62%),
    radial-gradient(90% 60% at 50% 112%, rgba(232,218,198,.95), transparent 70%),
    var(--ivory);
}
.greet-grid {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(20px, 4vh, 36px);
  padding: calc(var(--safe-top) + 58px) 26px calc(var(--safe-bot) + 100px);
}
.print {
  margin: 0; padding: 9px; background: #FDFAF4;
  height: min(54vh, 560px); aspect-ratio: 736 / 981;
  box-shadow: 0 1px 2px rgba(60,40,30,.12), 0 22px 44px -14px rgba(90,60,45,.32);
  opacity: 0; filter: blur(10px); transform: scale(1.04);
  transition: opacity 1.9s ease, filter 2.1s ease, transform 2.6s var(--ease);
}
.print img { width: 100%; height: 100%; object-fit: cover; }
.play .print { opacity: 1; filter: none; transform: none; }

.greet-text { text-align: center; max-width: 520px; }
.phrase {
  margin: 0; font-family: var(--display);
  font-size: clamp(25px, 6.6vw, 38px); line-height: 1.95; text-wrap: balance;
}
html[lang="en"] .phrase { font-style: italic; font-weight: 400; line-height: 1.35; font-size: clamp(26px, 6.6vw, 40px); }
.l {
  display: block; opacity: 0; filter: blur(6px); transform: translateY(10px);
  transition: opacity 1.7s ease, filter 1.7s ease, transform 1.7s var(--ease);
}
.play .l { opacity: 1; filter: none; transform: none; }
.play .l1 { transition-delay: 1.9s; }
.play .l2 { transition-delay: 3.5s; }
.pink { color: #C58E95; }
.meta {
  margin: clamp(10px, 2vh, 18px) 0 0; display: inline-flex; align-items: center; gap: 14px;
  font: 400 13px/1 var(--ui); letter-spacing: var(--ls); color: rgba(23,21,19,.58);
  opacity: 0; transition: opacity 1.8s ease;
}
.play .meta { opacity: 1; transition-delay: 5.2s; }
.vbar { width: 1px; height: 13px; background: var(--gold); }

@media (min-width: 900px) {
  .greet-grid { flex-direction: row; gap: clamp(48px, 7vw, 110px); padding-bottom: 60px; }
  .print { height: min(70vh, 640px); }
  .greet-text { text-align: start; }
  .phrase { font-size: clamp(34px, 3.2vw, 48px); }
  .meta { margin-top: 24px; }
}

/* ==========================================================================
   2 · Photo + music
   ========================================================================== */
.s-music { background: #000; color: var(--white); }
.photo { position: absolute; inset: 0; display: grid; place-items: center; }
.photo img {
  width: 100%; height: 100%; object-fit: contain; object-position: 50% 16%;
  opacity: 0; transform: scale(1);
  transition: opacity 2.6s ease, transform 32s linear;
}
.play .photo img { opacity: 1; transform: scale(1.07); }
.veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, #000 0%, rgba(0,0,0,.88) 16%, rgba(0,0,0,0) 52%),
    linear-gradient(to bottom, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 20%);
}
@media (min-width: 760px) {
  .veil { background:
    linear-gradient(to top, #000 0%, rgba(0,0,0,.85) 14%, rgba(0,0,0,0) 44%),
    linear-gradient(to bottom, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 16%),
    linear-gradient(to right, #000 0%, transparent 24%, transparent 76%, #000 100%); }
}

.player-wrap {
  position: absolute; z-index: 4; inset-inline: 0; margin-inline: auto;
  bottom: calc(var(--safe-bot) + 104px); width: min(86vw, 360px);
  opacity: 0; transform: translateY(12px);
  transition: opacity 1.8s ease, transform 1.8s var(--ease);
}
.play .player-wrap { opacity: 1; transform: none; transition-delay: 1.8s; }
.player { display: flex; align-items: center; gap: 18px; }
.player .pbtn {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid rgba(251,248,242,.62);
  transition: background .3s, border-color .3s, transform .3s var(--ease);
}
.player .pbtn:hover { background: rgba(255,255,255,.12); border-color: var(--white); }
.player .pbtn:active { transform: scale(.95); }
.player .pbtn .i-pause { display: none; }
.player.playing .pbtn .i-pause { display: block; }
.player.playing .pbtn .i-play { display: none; }
.player .pbtn .i-play { margin-left: 2px; }
.track { flex: 1; min-width: 0; }
.song { margin: 0 0 4px; min-height: 0; font: 400 14px/1.4 var(--ui); color: rgba(251,248,242,.85); }
.song:empty { display: none; }
.bar {
  position: relative; height: 2px; margin: 14px 0 9px; cursor: pointer;
  background: rgba(251,248,242,.22); border-radius: 2px;
}
.bar::after { content: ""; position: absolute; inset: -14px 0; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--gold); border-radius: 2px; }
.bar i::after {
  content: ""; position: absolute; right: -4px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-radius: 50%; background: var(--gold);
}
.times { display: flex; justify-content: space-between; font: 300 11.5px/1 var(--en-ui); color: rgba(251,248,242,.55); letter-spacing: .06em; }
.hint {
  margin: 14px 0 0; text-align: center; font: 300 12.5px/1.4 var(--ui); letter-spacing: var(--ls);
  color: rgba(251,248,242,.6); opacity: 0; transition: opacity .6s ease;
}
.hint.on { opacity: 1; }

/* ==========================================================================
   3 · Photo + phrase
   ========================================================================== */
.s-quote {
  color: var(--ink);
  background:
    radial-gradient(100% 60% at 50% 0%, rgba(255,255,255,.7), transparent 70%),
    var(--ivory);
}
.qphoto {
  position: absolute; top: 0; inset-inline: 0; margin-inline: auto;
  width: min(100%, 760px); height: 70%; overflow: hidden;
}
.qphoto img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%;
  mix-blend-mode: normal;
  opacity: 0; filter: blur(14px); transform: scale(1.06);
  transition: opacity 2.8s ease, filter 3s ease, transform 28s linear;
}
.play .qphoto img { opacity: 1; filter: none; transform: scale(1.01); }
/* soft fade of the photo into the ivory page (bottom, and sides on wide screens) */
.qphoto::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(247,240,228,0) 72%, rgba(247,240,228,.35) 91%, #F7F0E4 100%);
}
@media (min-width: 760px) {
  .qphoto { height: 74vh; }
  .qphoto::after {
    background:
      linear-gradient(to bottom, rgba(247,240,228,0) 72%, rgba(247,240,228,.35) 91%, #F7F0E4 100%),
      linear-gradient(to right, #F7F0E4 0%, rgba(247,240,228,0) 14%, rgba(247,240,228,0) 86%, #F7F0E4 100%);
  }
}
.quote {
  position: absolute; z-index: 4; inset-inline: 0; margin: 0 auto;
  bottom: calc(var(--safe-bot) + 118px); width: min(86vw, 540px); text-align: center;
  font-family: var(--display); font-size: clamp(23px, 5.8vw, 33px); line-height: 1.9; text-wrap: balance;
  white-space: pre-line;
  opacity: 0; filter: blur(6px); transform: translateY(12px);
  transition: opacity 2s ease, filter 2s ease, transform 2s var(--ease);
}
html[lang="en"] .quote { font-style: italic; line-height: 1.4; font-size: clamp(25px, 6vw, 36px); }
.play .quote { opacity: 1; filter: none; transform: none; transition-delay: 2.4s; }
.quote.is-empty { font-size: 15px; font-style: normal; font-family: var(--ui); letter-spacing: var(--ls); color: rgba(23,21,19,.42); }
.play .quote.is-empty { opacity: 1; }

/* ==========================================================================
   4 · Letter
   ========================================================================== */
.s-letter {
  color: var(--ink);
  background:
    radial-gradient(100% 70% at 50% 0%, rgba(247,240,228,.9), transparent 70%),
    radial-gradient(80% 60% at 50% 110%, rgba(217,184,180,.35), transparent 70%),
    var(--beige);
}
.letter-wrap {
  position: absolute; inset: calc(var(--safe-top) + 58px) 0 calc(var(--safe-bot) + 104px);
  display: grid; place-items: center; padding: 0 20px;
}
.paper {
  width: min(100%, 460px); min-height: min(58vh, 460px); max-height: 100%; overflow-y: auto; scrollbar-width: none;
  padding: 38px 32px 30px; border-radius: 3px;
  background-color: #FCF8F0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .36  0 0 0 0 .25  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  box-shadow: 0 1px 1px rgba(80,55,35,.10), 0 2px 6px rgba(80,55,35,.08), 0 26px 50px -18px rgba(80,55,35,.38);
  opacity: 0; transform: translateY(34px) rotate(.9deg);
  transition: opacity 1.6s ease, transform 2s var(--ease);
}
.paper::-webkit-scrollbar { display: none; }
.play .paper { opacity: 1; transform: rotate(-.4deg); }
.letter p {
  margin: 0 0 1.15em; white-space: pre-line;
  font-family: var(--display); font-size: clamp(20px, 4.9vw, 23px); line-height: 2.05;
  opacity: 0; filter: blur(4px); transition: opacity 1.5s ease, filter 1.5s ease;
}
html[lang="en"] .letter p { font-size: clamp(21px, 5vw, 25px); line-height: 1.6; font-style: italic; }
.letter p:last-child { margin-bottom: 0; }
.play .letter p { opacity: 1; filter: none; transition-delay: min(calc(1.5s + var(--i, 0) * 1.1s), 14s); }
.letter p.is-empty { font-family: var(--ui); font-style: normal; font-size: 15px; letter-spacing: var(--ls); color: rgba(23,21,19,.42); text-align: center; }

/* ==========================================================================
   5 · Closing
   ========================================================================== */
.s-end {
  color: var(--white);
  background:
    radial-gradient(60% 42% at 50% 46%, rgba(217,184,180,.11), transparent 72%),
    #000;
}
.end-wrap {
  position: absolute; inset: 0; padding: calc(var(--safe-top) + 40px) 30px calc(var(--safe-bot) + 40px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.c {
  margin: 0; font-family: var(--display); text-wrap: balance;
  opacity: 0; filter: blur(7px); transform: translateY(10px);
  transition: opacity 2.2s ease, filter 2.2s ease, transform 2.2s var(--ease);
}
.c1 { font-size: clamp(22px, 5.6vw, 30px); line-height: 1.9; color: rgba(251,248,242,.74); max-width: 520px; }
.c2 { font-size: clamp(30px, 8vw, 50px); line-height: 1.65; max-width: 640px; }
html[lang="en"] .c { font-style: italic; }
html[lang="en"] .c1 { line-height: 1.4; font-size: clamp(24px, 5.8vw, 32px); }
html[lang="en"] .c2 { line-height: 1.3; font-size: clamp(32px, 8vw, 52px); }
.play .c { opacity: 1; filter: none; transform: none; }
.play .c1 { transition-delay: .9s; }
.play .c2 { transition-delay: 5s; }
.hair {
  display: block; height: 1px; width: 0; margin: 26px 0; background: var(--gold);
  transition: width 1.6s var(--ease);
}
.play .hair { width: 34px; transition-delay: 3.3s; }
.emo {
  margin: 28px 0 0; font-size: 30px; line-height: 1; letter-spacing: .25em; padding-inline-start: .25em;
  opacity: 0; transform: translateY(10px); transition: opacity 1.8s ease, transform 1.8s var(--ease);
}
.play .emo { opacity: 1; transform: none; transition-delay: 8.6s; }
.signoff {
  margin: 28px 0 0; font: 400 17px/1.6 var(--display); color: rgba(251,248,242,.8);
  opacity: 0; transition: opacity 1.8s ease;
}
.signoff:empty { display: none; }
.play .signoff { opacity: 1; transition-delay: 10s; }
.replay {
  margin-top: 46px; padding: 8px 4px; background: none; border: 0; border-bottom: 1px solid var(--gold);
  cursor: pointer; color: rgba(251,248,242,.7); font: 400 13px/1 var(--ui); letter-spacing: var(--ls);
  opacity: 0; visibility: hidden;
  transition: opacity 1.6s ease 11s, visibility 0s linear 11s, color .3s;
}
.play .replay { opacity: 1; visibility: visible; }
.replay:hover { color: var(--white); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .heart, .dot, #btn-music.playing svg { animation: none; }
  .s-lock .bg, .photo img, .qphoto img { transform: none !important; }
  .l, .c, .quote, .print, .paper, .letter p { filter: none !important; }
}


/* ==========================================================================
   4 · Birthday cupcake wish
   ========================================================================== */
.s-cupcake {
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 42%, #fffaf7 0%, #f8e9e7 54%, #f1ded7 100%);
}
.cupcake-wrap {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: calc(var(--safe-top) + 56px) 22px calc(var(--safe-bot) + 92px);
}
.cupcake-kicker {
  margin: 0 0 8px; color: #b47b87; font: 500 12px/1.4 var(--en-ui);
  letter-spacing: .12em; opacity: 0; transform: translateY(8px);
  transition: opacity 1s ease, transform 1s var(--ease);
}
.cupcake-title {
  margin: 0; max-width: 90vw; color: #68434b;
  font: 700 clamp(22px, 5.8vw, 31px)/1.65 var(--ar-display);
  opacity: 0; transform: translateY(10px); transition: opacity 1.2s ease .2s, transform 1.2s var(--ease) .2s;
}
.play .cupcake-kicker, .play .cupcake-title { opacity: 1; transform: none; }
.cupcake-button {
  position: relative; width: min(82vw, 390px); height: min(55vh, 470px);
  margin: 8px 0 0; padding: 0; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; transform: translateY(18px) scale(.94);
  transition: opacity 1.4s ease .35s, transform 1.4s var(--ease) .35s;
  -webkit-tap-highlight-color: transparent;
}
.play .cupcake-button { opacity: 1; transform: none; }
.cupcake-button img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(131,75,83,.16)); }
.flame-cover {
  position: absolute; top: 1%; left: 50%; width: 15%; height: 16%;
  transform: translateX(-50%); border-radius: 50%; opacity: 0;
  background: radial-gradient(ellipse, #f9e9e7 0%, #f9e9e7 58%, rgba(249,233,231,0) 76%);
  transition: opacity .25s ease;
}
.smoke { position: absolute; top: 0; left: 50%; color: #bda8a7; font-size: 36px; opacity: 0; transform: translate(-50%, 12px) scale(.5); }
.s-cupcake.blown .flame-cover { opacity: 1; }
.s-cupcake.blown .smoke { animation: smoke-puff 1.1s ease-out forwards; }
@keyframes smoke-puff { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.5) } 35% { opacity: .8 } 100% { opacity: 0; transform: translate(-50%, -28px) scale(1.35) } }
.cupcake-hint {
  margin: 0; color: #9b6c75; font: 400 14px/1.7 var(--ui);
  opacity: 0; transition: opacity .7s ease;
}
.play .cupcake-hint { opacity: .9; transition-delay: 1.1s; }
.s-cupcake.blown .cupcake-hint { color: #80505b; }
.cupcake-next { visibility: hidden !important; opacity: 0 !important; transition-delay: 0s !important; }
.s-cupcake.blown.play .cupcake-next { visibility: visible !important; opacity: .72 !important; }
@media (max-height: 680px) {
  .cupcake-button { height: min(48vh, 350px); }
  .cupcake-title { font-size: clamp(20px, 5vw, 27px); }
}


/* ==========================================================================
   5 · Video after the cupcake wish
   ========================================================================== */
.s-video {
  color: var(--white);
  background: radial-gradient(ellipse at 50% 38%, #30272b 0%, #111 58%, #000 100%);
}
.video-wrap {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  padding: calc(var(--safe-top) + 42px) 18px calc(var(--safe-bot) + 94px);
  box-sizing: border-box;
}
.video-kicker {
  margin: 0; color: #e7c5cd; font: 400 13px/1.5 var(--en-ui);
  letter-spacing: .1em; opacity: 0; transform: translateY(8px);
  transition: opacity 1s ease, transform 1s var(--ease);
}
.play .video-kicker { opacity: .9; transform: none; }
#birthday-video {
  display: block; width: min(88vw, 430px); max-height: 66vh;
  aspect-ratio: 9 / 16; object-fit: contain; border-radius: 18px;
  background: #050505; box-shadow: 0 18px 48px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity 1.2s ease .2s, transform 1.2s var(--ease) .2s;
}
.play #birthday-video { opacity: 1; transform: none; }
.video-caption {
  margin: 0; color: rgba(255,255,255,.8); font: 400 15px/1.8 var(--ar-ui);
  opacity: 0; transition: opacity 1s ease .6s;
}
.play .video-caption { opacity: 1; }
@media (max-height: 680px) {
  #birthday-video { max-height: 58vh; }
  .video-wrap { gap: 9px; }
}

/* ==========================================================================
   7 · Shared memory diary (visual foundation; Firebase setup pending)
   ========================================================================== */
.s-diary { color: #514044; background: radial-gradient(ellipse at 50% 10%, #fffdfb 0%, #f8eeeb 58%, #f1e1dc 100%); overflow-y: auto; }
.diary-shell { position: relative; width: min(100%, 680px); min-height: 100%; margin: 0 auto; padding: calc(var(--safe-top) + 52px) 20px calc(var(--safe-bot) + 46px); box-sizing: border-box; }
.diary-heading { text-align: center; margin: 0 auto 28px; }
.diary-eyebrow { margin: 0 0 8px; color: #b27d88; font: 400 12px/1.5 var(--en-ui); letter-spacing: .12em; }
.diary-heading h2 { margin: 0; color: #694751; font: 700 clamp(25px, 6vw, 34px)/1.65 var(--ar-display); }
.diary-subtitle { margin: 5px 0 0; color: #98747a; font: 400 14px/2 var(--ar-ui); }
.diary-lock, .diary-compose, .memory-list-wrap, .thank-you-box { background: rgba(255,255,255,.72); border: 1px solid rgba(164,117,126,.18); border-radius: 20px; padding: 20px; box-shadow: 0 12px 34px rgba(103,66,74,.07); margin-bottom: 17px; }
.diary-lock { max-width: 420px; margin: 0 auto; text-align: center; }
.diary-lock > p { margin: 0 0 15px; color: #825b64; }
.diary-lock form, .diary-compose form, .thank-you-box form { display: grid; gap: 10px; text-align: right; }
.diary-shell label { color: #76535b; font: 500 13px/1.7 var(--ar-ui); }
.diary-shell input:not([type=file]), .diary-shell textarea { width: 100%; box-sizing: border-box; border: 1px solid #ead8d8; border-radius: 12px; background: #fffdfc; color: #4e3b40; padding: 12px 13px; font: 400 14px/1.8 var(--ar-ui); outline: none; }
.diary-shell textarea { resize: vertical; min-height: 82px; }
.diary-shell input:focus, .diary-shell textarea:focus { border-color: #c58f9b; box-shadow: 0 0 0 3px rgba(197,143,155,.12); }
.diary-shell input[type=file] { width: 100%; color: #896a70; font: 400 12px var(--ui); }
.diary-primary, .diary-secondary { border: 0; border-radius: 999px; padding: 12px 18px; background: #956773; color: white; font: 500 14px var(--ar-ui); cursor: pointer; }
.diary-secondary { background: #eee1e1; color: #694751; }
.diary-compose h3, .memory-list-wrap h3, .thank-you-box h3, .diary-admin h3 { margin: 0 0 14px; color: #704d57; font: 700 19px/1.7 var(--ar-display); }
.diary-status, .diary-error { min-height: 1.2em; margin: 0; color: #9a6572; font: 400 12px/1.7 var(--ar-ui); }
.memory-list { display: grid; gap: 12px; }
.memory-empty { margin: 0; text-align: center; color: #a4878b; font: 400 14px/2 var(--ar-ui); }
.memory-card { padding: 15px; border-radius: 15px; background: #fffaf8; border: 1px solid #f0dfdc; }
.memory-card h4 { margin: 0 0 7px; color: #704d57; font: 700 17px/1.7 var(--ar-display); }
.memory-card p { white-space: pre-wrap; margin: 0 0 8px; color: #705c60; font: 400 14px/1.9 var(--ar-ui); }
.memory-card time { color: #ad8c91; font: 400 11px var(--en-ui); }
.memory-card .memory-edit { margin-top: 10px; border: 1px solid #d9b9bf; border-radius: 999px; background: transparent; color: #805a64; padding: 7px 14px; font: 400 12px var(--ar-ui); }
.memory-card img, .memory-card video, .memory-card audio { display: block; max-width: 100%; max-height: 300px; margin: 10px auto 0; border-radius: 12px; }
.diary-admin-trigger { position: absolute; left: 14px; bottom: calc(var(--safe-bot) + 12px); width: 34px; height: 34px; border: 1px solid rgba(149,103,115,.25); border-radius: 50%; background: rgba(255,255,255,.55); color: #9b707a; opacity: .45; }
.diary-admin { position: fixed; z-index: 20; inset: 20% 7% auto; padding: 22px; border-radius: 18px; background: #fff; box-shadow: 0 20px 70px rgba(0,0,0,.25); text-align: center; }
.diary-admin p { color: #765f64; font: 400 13px/1.9 var(--ar-ui); }
@media (max-height: 700px) { .diary-shell { padding-top: calc(var(--safe-top) + 30px); } }

.diary-open { margin-top: 18px; border: 1px solid rgba(232,198,207,.55); border-radius: 999px; background: rgba(255,255,255,.07); color: #f0dce1; padding: 11px 22px; font: 400 14px var(--ar-ui); cursor: pointer; }

/* Cloud diary cards */
.memory-card { padding: 1rem; margin: 0 0 1rem; border: 1px solid rgba(120,100,100,.2); border-radius: 14px; background: rgba(255,255,255,.72); overflow-wrap: anywhere; }
.memory-card h4 { margin: 0 0 .5rem; }
.memory-card p { white-space: pre-wrap; }
.memory-card img, .memory-card video { display:block; max-width:100%; max-height:420px; border-radius:12px; margin:.75rem 0; }
.memory-card audio { width:100%; margin:.75rem 0; }
.memory-actions { display:flex; gap:.5rem; flex-wrap:wrap; }
.memory-actions button { border:1px solid currentColor; border-radius:999px; padding:.4rem .9rem; background:transparent; cursor:pointer; }
#diary-welcome { margin:.75rem 0; }
#diary-login-log p { padding:.5rem 0; border-bottom:1px solid rgba(120,100,100,.2); }
