@font-face { font-family: "LD Sans"; src: url("../fonts/sans-700.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "LD Hand"; src: url("../fonts/hand.woff2") format("woff2"); font-weight: 300 400; font-display: swap; }
@font-face { font-family: "LD Hand"; src: url("../fonts/hand-500.woff2") format("woff2"); font-weight: 500 900; font-display: swap; }
@font-face { font-family: "LD Digits"; src: url("../fonts/digits.woff2") format("woff2"); font-weight: 600; font-display: block; }
@font-face { font-family: "LD Italic"; src: url("../fonts/italic.woff2") format("woff2"); font-style: italic; font-weight: 300 700; font-display: swap; }

:root {
  --ink: #f7ecdc;
  --ink-soft: rgb(247 236 220 / .66);
  --night: #04080f;
  --gold: #e8c27c;
  /* Every Chinese line in the film uses the letter's typeface, LXGW WenKai. */
  --hand: "LD Hand", "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", serif;
  --serif: var(--hand);
  --sans: var(--hand);
  --digits: "LD Digits", "DIN Condensed", "Arial Narrow", sans-serif;
  --italic: "LD Italic", "Cormorant Garamond", "Georgia", serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body { font: 16px/1.6 var(--sans); color: var(--ink); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.haptic-switch { position: fixed; left: -100px; top: -100px; opacity: 0; pointer-events: none; }

/* ---------- Frame ---------- */
.ambient { position: fixed; inset: 0; overflow: hidden; overflow: clip; background: var(--night); }
.ambient-layer {
  position: absolute; inset: -10%;
  background: center / cover no-repeat;
  filter: blur(48px) saturate(1.25) brightness(var(--b, .5));
  opacity: 0;
  transition: opacity 2s ease;
}
.ambient-layer.on { opacity: 1; }

.film {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(100vw, calc(100dvh * .6667));
  height: 100dvh;
  overflow: hidden;
  overflow: clip;
  background: var(--night);
  touch-action: none;
  isolation: isolate;
  container-type: size;
}
@media (min-aspect-ratio: 3/4) {
  .film { box-shadow: 0 0 120px 30px rgb(0 0 0 / .6); }
}

.camera { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.world { position: absolute; inset: 0; }
.shot { position: absolute; inset: 0; overflow: hidden; overflow: clip; contain: strict; }
.plate { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.plate > .layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.plate img { -webkit-user-drag: none; }
.night-stars { position: absolute; pointer-events: none; mix-blend-mode: screen; }
.courtyard-defocus { transition: opacity .25s linear; will-change: opacity; }

.fx, .snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.skyflash {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 70% at var(--fx, 50%) var(--fy, 25%), var(--fc, #ffd49a), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
}
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% 45%, transparent 55%, rgb(0 0 0 / .42) 100%),
    linear-gradient(transparent 70%, rgb(0 0 0 / .28));
}
.grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.curtain { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 40; }

/* ---------- Board ---------- */
.board-rig {
  --flash: 0;
  --flash-color: #ffd49a;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90%, 110cqh);
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  will-change: transform, opacity;
}
.board {
  position: relative;
  padding: 5.5% 4.5% 4.2%;
  border-radius: 2.2% / 4.2%;
  container-type: inline-size;
}
.board::after {
  /* firework light washing over the face */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 120% at 50% -30%, var(--flash-color), transparent 65%);
  mix-blend-mode: screen;
  opacity: calc(var(--flash) * .7);
}
.rivet { position: absolute; border-radius: 50%; }
.r0 { left: 1.8cqw; top: 1.8cqw; } .r1 { right: 1.8cqw; top: 1.8cqw; }
.r2 { left: 1.8cqw; bottom: 1.8cqw; } .r3 { right: 1.8cqw; bottom: 1.8cqw; }

.snowcap {
  position: absolute; left: .7%; bottom: calc(100% - .55cqw);
  width: 98.6%; height: 6cqw; z-index: 6; pointer-events: none;
}

.rows { display: grid; }
.row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.5cqw; }
.tile {
  position: relative;
  aspect-ratio: .8;
  perspective: 60cqw;
  container-type: inline-size;
  border-radius: 1.1cqw;
}
.half {
  position: absolute; left: 0; right: 0; height: 50%; overflow: hidden;
  background: linear-gradient(#1e2940, #161f31);
  backface-visibility: hidden;
}
.half.top { top: 0; border-radius: 1cqw 1cqw 0 0; transform-origin: 50% 100%; }
.half.bottom { bottom: 0; border-radius: 0 0 1cqw 1cqw; transform-origin: 50% 0; }
.half.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgb(0 0 0 / .85);
}
.half.bottom::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgb(255 255 255 / .06); z-index: 1;
}
.half span {
  position: absolute; left: 0; right: 0; height: 200%;
  display: grid; place-items: center;
  color: #f5e6c8;
}
.half.bottom span { top: -100%; }
.glyph .half span { font: 500 57cqw/1 var(--sans); padding-top: 1cqw; }
.flap { z-index: 2; }
.tile.blur .flap span { filter: blur(.5px); }
.tile.blur .half span { color: rgb(245 230 200 / .7); }

.clock {
  display: flex; justify-content: center; align-items: center; gap: 2.6cqw;
  margin-top: 3.8cqw; padding-top: 3.2cqw;
  border-top: 1px solid rgb(150 180 230 / .12);
}
.unit { display: flex; align-items: center; gap: .9cqw; }
.digit { width: 7.2cqw; aspect-ratio: .66; }
.digit .half span { font: 600 82cqw/1 var(--digits); font-variant-numeric: tabular-nums; padding-top: 2cqw; color: #f2e3c4; }
.label { font: 500 3cqw/1 var(--sans); color: rgb(220 205 175 / .62); margin-left: .5cqw; }
.lamp {
  position: absolute; right: 3.2cqw; bottom: 3.6cqw; width: 1.5cqw; height: 1.5cqw; border-radius: 50%;
  background: #4a2e10; box-shadow: inset 0 0 2px #000; transition: background .4s, box-shadow .4s;
}
.lamp.on { background: #ffb347; box-shadow: 0 0 1.2cqw 0.3cqw rgb(255 170 60 / .6), inset 0 0 2px #fff6; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.subtitle {
  position: absolute; left: 8%; right: 8%; bottom: calc(15% + var(--safe-bottom));
  margin: 0; text-align: center;
  font: 400 clamp(16px, 4.2cqw, 20px)/1.65 var(--serif);
  letter-spacing: .06em;
  color: var(--ink);
  text-shadow: 0 1px 2px rgb(0 0 0 / .45), 0 0 24px rgb(0 0 0 / .55);
  opacity: 0;
  transition: opacity 1s ease, filter 1s ease, translate 1.2s ease;
  filter: blur(6px);
  translate: 0 6px;
}
.subtitle.on { opacity: 1; filter: blur(0); translate: 0 0; }
.subtitle.top { bottom: auto; top: calc(14% + var(--safe-top)); }

.prompt {
  position: absolute; left: 50%; bottom: calc(6.5% + var(--safe-bottom));
  translate: -50% 0;
  display: flex; align-items: center; gap: 10px;
  border-radius: 999px;
  font: 500 14px/1.4 var(--sans); letter-spacing: .01em; white-space: normal; text-wrap: balance;
  color: var(--ink);
  animation: prompt-in .9s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes prompt-in { from { opacity: 0; translate: -50% 10px; filter: blur(4px); } }
.prompt.out { animation: prompt-out .5s ease both; }
@keyframes prompt-out { to { opacity: 0; translate: -50% 6px; } }
.gesture { position: relative; width: 22px; height: 22px; flex: none; }
.gesture::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: var(--ink); box-shadow: 0 0 10px rgb(255 230 190 / .7);
}
.prompt[data-gesture="down"] .gesture::before { animation: g-down 1.8s ease-in-out infinite; }
.prompt[data-gesture="left"] .gesture::before { animation: g-right 1.8s ease-in-out infinite; }
.prompt[data-gesture="tap"] .gesture::after, .prompt[data-gesture="hold"] .gesture::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--ink);
  animation: g-ring 1.8s ease-out infinite;
}
.prompt[data-gesture="hold"] .gesture::after { animation-duration: 2.4s; }
@keyframes g-down { 0%, 100% { translate: 0 -6px; opacity: 0; } 20% { opacity: 1; } 70% { translate: 0 6px; opacity: 1; } 90% { opacity: 0; } }
@keyframes g-right { 0%, 100% { translate: -7px 0; opacity: 0; } 20% { opacity: 1; } 70% { translate: 7px 0; opacity: 1; } 90% { opacity: 0; } }
@keyframes g-ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

.actions {
  position: absolute; left: 0; right: 0; bottom: calc(6% + var(--safe-bottom));
  display: flex; justify-content: center; gap: 0; flex-wrap: wrap; padding: 0 16px;
  pointer-events: auto;
}
.actions.raised { bottom: calc(6.5% + 58px + var(--safe-bottom)); }
/* Buttons read like a line of end credits: spaced words, no frame, a gold hairline that opens beneath. */
.btn {
  --track: .32em; --pad: 18px; --rule: var(--gold);
  position: relative; appearance: none; border: 0; border-radius: 0; background: none;
  padding: 14px var(--pad) 14px calc(var(--pad) + var(--track));
  font: 500 15px/1.2 var(--sans); letter-spacing: var(--track); cursor: pointer;
  color: rgb(247 236 220 / .92); text-shadow: 0 1px 2px rgb(0 0 0 / .45), 0 0 18px rgb(0 0 0 / .55);
  transition: color .4s ease;
  animation: prompt-in .9s cubic-bezier(.2, .7, .2, 1) both;
}
.btn::after {
  content: ""; position: absolute; bottom: 7px; height: 1px; left: calc(50% - 10px); right: calc(50% - 10px);
  background: linear-gradient(90deg, transparent, var(--rule), transparent); opacity: .55;
  transition: left .5s cubic-bezier(.2, .7, .2, 1), right .5s cubic-bezier(.2, .7, .2, 1), opacity .4s;
}
.btn:hover, .btn:focus-visible { color: var(--gold); }
.btn:hover::after, .btn:focus-visible::after { left: var(--pad); right: var(--pad); opacity: 1; }
.btn.quiet { color: rgb(247 236 220 / .58); }
.btn.quiet::after { opacity: .3; }
.btn:disabled { cursor: default; opacity: .55; color: rgb(247 236 220 / .92); }
.btn:disabled::after { left: calc(50% - 10px); right: calc(50% - 10px); opacity: .3; }
/* The middle dot between choices is painted, so screen readers never announce it. */
.actions .btn + .btn { background: radial-gradient(circle, rgb(232 194 124 / .6) 0 1.4px, transparent 1.9px) 0 50% / 4px 4px no-repeat; }

/* Hotspot ring placed on the plate */
.hotspot {
  position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 0; padding: 0;
  background: transparent; cursor: pointer; pointer-events: auto; z-index: 3;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 0 1px rgb(60 35 15 / .7)) drop-shadow(0 0 8px rgb(60 35 15 / .35));
}
.hotspot::before, .hotspot::after {
  content: ""; position: absolute; left: 50%; top: 50%; border-radius: 50%;
}
.hotspot::before {
  width: 12px; height: 12px; margin: -6px 0 0 -6px; background: rgb(255 246 230 / .95);
  box-shadow: 0 0 14px 4px rgb(255 220 160 / .55);
  animation: breathe 2.2s ease-in-out infinite;
}
.hotspot::after {
  width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 1.5px solid rgb(255 246 230 / .85);
  animation: g-ring 2.2s ease-out infinite;
}
@keyframes breathe { 50% { transform: scale(.75); opacity: .7; } }

.sound-toggle {
  position: absolute; z-index: 30; top: calc(12px + var(--safe-top)); right: 12px;
  width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; opacity: .8;
}
.sound-toggle svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle svg path:first-child { fill: var(--ink); stroke: none; }
.sound-toggle .cross { display: none; }
.sound-toggle[aria-pressed="true"] .wave { display: none; }
.sound-toggle[aria-pressed="true"] .cross { display: inline; }

/* ---------- Gate ---------- */
.gate {
  position: absolute; inset: 0; z-index: 50; overflow: hidden; overflow: clip;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  background:
    radial-gradient(65% 44% at 50% 48%, rgb(255 196 122 / .11), transparent 72%),
    radial-gradient(110% 62% at 50% 106%, rgb(42 66 108 / .34), transparent 72%),
    radial-gradient(95% 52% at 50% -10%, rgb(18 32 58 / .55), transparent 70%),
    linear-gradient(180deg, #03070e 0%, #07101e 52%, #0c1729 100%);
  text-align: center; padding: 0 10%;
  transition: opacity 1.45s cubic-bezier(.32, 0, .24, 1) .72s;
}
.gate.out { opacity: 0; pointer-events: none; }
.gate-bokeh { position: absolute; inset: 0; pointer-events: none; }
.gate-bokeh i {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--c) / .42), rgb(var(--c) / .12) 55%, transparent 72%);
  filter: blur(1.5px); opacity: 0;
  animation: bokeh var(--d) ease-in-out var(--o) infinite;
}
@keyframes bokeh {
  0% { transform: translateY(-28px) scale(.88); opacity: 0; }
  30%, 70% { opacity: .65; }
  100% { transform: translateY(64px) scale(1.04); opacity: 0; }
}
.gate-title {
  margin: 0 0 10px;
  font: 400 clamp(20px, 5.6cqw, 26px)/1.4 var(--serif);
  letter-spacing: .36em; text-indent: .36em;
  color: rgb(247 236 220 / .88);
  text-shadow: 0 0 28px rgb(255 198 122 / .28);
  transition: opacity .8s ease, transform .9s ease;
}
.gate.untie .gate-title { opacity: 0; transform: translateY(-8px); }
.gate-hint { min-height: 22px; margin: 0 0 8px; font: 400 13px/1.6 var(--serif); letter-spacing: .16em; color: rgb(247 232 208 / .72); }
.gate-button {
  appearance: none; position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 8px 18px; border: 0; border-radius: 32px;
  background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity .6s ease, transform .35s cubic-bezier(.2, .7, .2, 1);
}
.gate-button::before {
  content: ""; position: absolute; left: 50%; top: -18px; width: 210px; height: 210px; margin-left: -105px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgb(255 198 118 / .26), rgb(255 162 78 / .08) 48%, transparent 70%);
  opacity: 0; transition: opacity .8s ease, transform 1.35s cubic-bezier(.18, .82, .24, 1);
}
.gate.ready .gate-button::before { opacity: .62; animation: candle-ambient 3.6s ease-in-out infinite; }
.gate-button:disabled { opacity: .35; cursor: default; }
.gate-button:hover:not(:disabled) { transform: scale(1.03); }
.gate-button:active:not(:disabled) { transform: scale(.97); }
.gate-button:focus-visible { outline: none; }
.gate-button:focus-visible .gate-candle { filter: drop-shadow(0 10px 22px rgb(0 0 0 / .65)) drop-shadow(0 0 14px rgb(255 214 150 / .65)); }
.gate-tip {
  font: 400 14px/1 var(--hand);
  letter-spacing: .34em; text-indent: .34em; color: rgb(247 234 212 / .8);
  opacity: 0; transition: opacity .6s;
}
.gate.ready .gate-tip { opacity: 1; animation: tip-breathe 2.8s ease-in-out infinite; }
@keyframes tip-breathe { 50% { opacity: .42; } }
.gate.untie .gate-tip { animation: none; opacity: 0; transition-duration: .32s; }

/* Birthday candle: breathing warm ember at wick tip while waiting; tapping ignites the full flame & candlelight */
.gate-candle { display: block; width: 136px; height: 170px; overflow: visible; filter: drop-shadow(0 12px 24px rgb(0 0 0 / .68)); }
.candle-stand { transform-origin: 70px 140px; transition: transform 1.35s cubic-bezier(.22, .8, .25, 1) .55s, opacity 1.1s ease .62s; }
.candle-aura {
  transform-origin: 70px 54px; opacity: 0; transform: scale(.38);
  transition: transform 1.45s cubic-bezier(.16, .84, .24, 1), opacity .55s ease;
}
.gate.ready .candle-aura { opacity: .28; transform: scale(.46); animation: spark-aura 3s ease-in-out infinite; }
.candle-spark {
  transform-origin: 70.8px 63.8px; opacity: 0;
  filter: drop-shadow(0 0 6px rgb(255 196 102 / .95));
  transition: opacity .45s ease;
}
.gate.ready .candle-spark { opacity: .95; animation: spark-pulse 2.2s ease-in-out infinite; }
.candle-sss, .candle-pool { opacity: .06; transition: opacity .48s ease; }
.gate.ready .candle-sss, .gate.ready .candle-pool { opacity: .14; }
.candle-flame-group {
  transform-origin: 70.5px 65px;
  opacity: 0;
  transform: scale(.12, .06);
}
@keyframes spark-pulse { 0%, 100% { opacity: .62; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.32); } }
@keyframes spark-aura { 50% { opacity: .44; transform: scale(.56); } }
@keyframes candle-ambient { 50% { transform: scale(1.08); opacity: .78; } }
@keyframes candle-ignite {
  0% { opacity: 0; transform: scale(.12, .06); }
  28% { opacity: 1; transform: scale(1.12, 1.24) rotate(-1.4deg); }
  56% { opacity: 1; transform: scale(.96, 1.02) rotate(1.1deg); }
  80% { opacity: 1; transform: scale(1.03, 1.08) rotate(-.5deg); }
  100% { opacity: 1; transform: scale(1, 1.04) rotate(0deg); }
}
.gate.untie .candle-spark { animation: none; opacity: 1; }
.gate.untie .candle-sss, .gate.untie .candle-pool { opacity: 1; }
.gate.untie .candle-flame-group { animation: candle-ignite .68s cubic-bezier(.18, .86, .26, 1) forwards; }
.gate.untie .candle-aura { animation: none; opacity: 1; transform: scale(2.65); }
.gate.untie .gate-button::before { animation: none; opacity: 1; transform: scale(2.9); }
.gate.untie .candle-stand { transform: translateY(3px) scale(1.03); opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .gate-bokeh i { animation: none; opacity: .45; }
  .gate.ready .candle-aura, .gate.ready .candle-spark,
  .gate.ready .gate-button::before, .gate.ready .gate-tip { animation: none; }
  .gate.untie .candle-flame-group { animation: none; opacity: 1; transform: none; }
  .candle-stand, .candle-aura, .gate-button { transition: none; }
}

/* ---------- Door ---------- */
.door-detail { position: absolute; }
.door-detail > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.door-world {
  position: absolute;
  transform-origin: 0 0;
  perspective: 460px;
  perspective-origin: 32% 56%;
  transform-style: preserve-3d;
  pointer-events: none;
}
/* Never set filter/opacity/overflow/clip-path on .door-leaf: preserve-3d must stay unflattened! */
.door-leaf {
  position: absolute; inset: 0;
  transform-origin: 100% 50%;
  transform-style: preserve-3d;
  will-change: transform;
}
.door-face {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgb(120 92 64 / .22);
}
/* 3D leading-stile rabbet/bevel thickness: hidden inside doorframe stop when shut, revealed as door swings open */
.door-bevel {
  position: absolute; top: 0; bottom: 0; left: 0; width: 10px;
  transform-origin: 0 50%;
  transform: rotateY(-46deg);
  background: linear-gradient(90deg, #eccba0, #c49c70 55%, #8a6845);
  box-shadow: inset 1px 0 0 rgb(255 236 200 / .6);
  opacity: 0;
  pointer-events: none;
}
.door-latch-plate {
  position: absolute; left: 1px; right: 1px; top: 58.6%; height: 5.6%;
  border-radius: 2px;
  background: linear-gradient(180deg, #b88428, #ffe094 32%, #9e6a14 68%, #d49c38);
  box-shadow: inset 0 0 0 .6px rgb(70 40 5 / .6);
}
.door-shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transform: translateZ(.4px);
  background:
    radial-gradient(90% 42% at 50% 3%, rgb(16 10 5 / .62), transparent 62%),
    linear-gradient(90deg, rgb(22 13 6 / .46), rgb(18 11 5 / .18) 65%, rgb(10 6 3 / .35));
}
/* Warm interior rim-light wrapping around the leading latch stile as the door cracks open */
.door-rim {
  position: absolute; top: 0; bottom: 0; left: 0; width: 3.2%; pointer-events: none; opacity: 0;
  transform: translateZ(.8px);
  background: linear-gradient(90deg, rgb(255 214 148 / .82), rgb(255 186 105 / .28) 45%, transparent);
}
.lever-rose {
  position: absolute; display: block; pointer-events: none;
}
.lever-neck {
  position: absolute; display: block; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 46% 24%, #ffe094, #c9861e 48%, #6e3c06 86%, #452302);
  box-shadow: inset 0 1px 1px rgb(255 242 195 / .55);
}
.lever {
  position: absolute;
  transform-origin: 13.06% 49.64%;
  transform-style: preserve-3d;
  pointer-events: none;
  will-change: transform;
}
.lever-slice, .lever-face {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.lever-slice {
  filter: brightness(.68) saturate(1.08);
}
.lever-shadow {
  position: absolute; pointer-events: none;
  transform-origin: 11% 45%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 6%, rgb(46 24 8 / .44) 22%, rgb(46 24 8 / .34) 88%, transparent);
  filter: blur(3.2px);
  opacity: .32;
}
.warm-spill {
  position: absolute; pointer-events: none; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(50% 60% at 50% 40%, rgb(255 200 130 / .9), rgb(255 160 80 / .35) 45%, transparent 70%);
}

/* ---------- Room ---------- */
.window-snow { position: absolute; pointer-events: none; }
.flame, .number-candles, .entry-cake {
  position: absolute; pointer-events: none;
  transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.candle-light {
  position: absolute; pointer-events: none; mix-blend-mode: screen; opacity: 0;
  will-change: transform, opacity;
  background: radial-gradient(50% 50% at 50% 50%, rgb(255 190 110 / .55), rgb(255 150 70 / .18) 45%, transparent 72%);
}

/* ---------- Turntable ---------- */
.label-disc { position: absolute; border-radius: 50%; background: url("../assets/img/record-label.jpg") center / 100% 100%; will-change: transform; container-type: inline-size; }
.label-disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 6px rgb(0 0 0 / .35); pointer-events: none; }
.label-print {
  position: absolute; inset: 14%; border-radius: 50%; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  color: rgb(92 58 42 / .64); text-align: center;
}
.label-side { font: 600 6.5cqw/1 var(--digits); letter-spacing: .16em; opacity: .72; }
.label-song { font: 500 7cqw/1.2 var(--hand); letter-spacing: .1em; text-indent: .1em; max-width: 82%; overflow: hidden; white-space: nowrap; }
.spindle-cap { position: absolute; pointer-events: none; z-index: 2; display: block; }
.vinyl-sheen {
  position: absolute; border-radius: 50%; pointer-events: none; mix-blend-mode: screen; opacity: 0;
  background: conic-gradient(from 210deg, transparent 0 8%, rgb(255 236 210 / .14) 12%, transparent 17% 58%, rgb(255 236 210 / .1) 62%, transparent 67%);
  transition: opacity 1.5s ease;
  /* Reflections belong to the vinyl; the paper label stays matt. */
  -webkit-mask: radial-gradient(closest-side, transparent 37%, #000 39.5%);
  mask: radial-gradient(closest-side, transparent 37%, #000 39.5%);
}
/* Faint marks that turn with the record: on real vinyl the grooves look still while dust and
   hairlines sweep round under fixed highlights. Two rings carry different marks, so none spans the disc. */
.vinyl-marks { position: absolute; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; will-change: transform; }
.vinyl-marks::before, .vinyl-marks::after { content: ""; position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: screen; }
.vinyl-marks::before {
  background: conic-gradient(from 0deg,
    transparent 0 3%, rgb(255 244 228 / .05) 3.5%, transparent 4.6% 21%,
    rgb(255 244 228 / .03) 22%, transparent 24% 57.6%, rgb(255 244 228 / .04) 58.6%, transparent 60.8% 87.6%,
    rgb(255 244 228 / .028) 88.9%, transparent 90.6%);
  -webkit-mask: radial-gradient(closest-side, transparent 60%, #000 64%, #000 93%, transparent 97.5%);
  mask: radial-gradient(closest-side, transparent 60%, #000 64%, #000 93%, transparent 97.5%);
}
.vinyl-marks::after {
  background: conic-gradient(from 133deg,
    transparent 0 11%, rgb(255 244 228 / .045) 11.4%, transparent 12.3% 39%,
    rgb(255 244 228 / .03) 40.2%, transparent 42% 68%, rgb(255 244 228 / .05) 68.3%, transparent 69% 100%);
  -webkit-mask: radial-gradient(closest-side, transparent 38%, #000 41%, #000 57%, transparent 62%);
  mask: radial-gradient(closest-side, transparent 38%, #000 41%, #000 57%, transparent 62%);
}
.tonearm { position: absolute; background: url("../assets/img/tonearm.png") 0 0 / 100% 100%; transform-origin: 43.2% 19.8%; will-change: transform; filter: drop-shadow(-3px 5px 4px rgb(40 20 5 / .45)); }

/* ---------- Overlay ---------- */
.overlay { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.overlay > * { pointer-events: auto; }
/* ---------- Letter ---------- */
.letter-scene { position: absolute; inset: 0; display: grid; place-items: center; perspective: 1600px; pointer-events: none; }
.envelope {
  position: relative; width: min(88%, 436px); aspect-ratio: 1.5;
  transform: rotate(-1.4deg);
  will-change: transform, opacity;
  pointer-events: none;
}
.envelope.away {
  opacity: 0; pointer-events: none;
  transition: transform 1.45s cubic-bezier(.36, 0, .2, 1), opacity 1.1s ease .12s;
}
.env-ambient-shadow {
  position: absolute; inset: 6% 2% -11%; border-radius: 18px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(54% 52% at 50% 54%, rgb(10 4 1 / .64), rgb(14 6 2 / .32) 62%, transparent 100%),
    radial-gradient(46% 36% at 50% 48%, rgb(0 0 0 / .36), transparent 85%);
}
.env-back, .env-pocket {
  position: absolute; inset: 0; pointer-events: none;
  background-position: 0 0; background-size: 100% 100%; background-repeat: no-repeat;
}
.env-back { z-index: 1; background-image: url('../assets/img/envelope-back.webp'); }
.env-back::after {
  content: ""; position: absolute; inset: 0 2.2% 32%; pointer-events: none;
  background: linear-gradient(180deg, rgb(18 4 6 / .46), transparent 72%);
  opacity: var(--flap-throat-shade, 0);
}
.env-pocket { z-index: 4; background-image: url('../assets/img/envelope-pocket.webp'); }

/* Folded cotton letter tucked inside the envelope pocket, already carrying real handwritten ink. */
.env-letter {
  position: absolute; z-index: 3; pointer-events: none; overflow: hidden;
  border-radius: 3px;
  background-color: #fbf6ec;
  background-image:
    linear-gradient(180deg, rgb(255 255 255 / .52) 0%, transparent 18%),
    linear-gradient(0deg, rgb(128 96 62 / .15) 0%, transparent 12%),
    url('../assets/img/paper-cotton.jpg');
  background-size: 100% 100%, 100% 100%, 460px auto;
  border: 1px solid rgb(198 180 148 / .62);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .8), 0 8px 20px rgb(20 8 4 / .32);
  padding: 11% 9% 10%;
  font: 400 clamp(16px, 4.8cqw, 19.5px)/2.12em var(--hand);
  color: #31231a;
  letter-spacing: .045em;
  transform-origin: 0 0;
  will-change: transform;
}
/* Soft shadow cast by the pocket throat onto the emerging letter sheet. */
.env-letter::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, rgb(38 18 10 / var(--pocket-shade, .32)) 0%, transparent 34%);
}

.env-address {
  position: absolute; z-index: 4; left: 16%; right: 16%; bottom: 8.2%; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
  color: rgb(82 56 34 / .86); font: 500 clamp(13.5px, 3.6cqw, 17px)/1.3 var(--hand);
  letter-spacing: .24em; text-indent: .24em;
  text-shadow: 0 1px 0 rgb(255 252 245 / .65);
}
.env-recipient { opacity: .92; }
.env-address small { font: 400 9.5px/1.25 var(--sans); letter-spacing: .12em; text-indent: .12em; opacity: .54; }

/* Dynamic cast shadow of the pointed cotton flap onto the pocket below. */
.env-flap-shadow {
  position: absolute; left: 0; right: 0; top: .5%; height: 69%; z-index: 5; pointer-events: none;
  background: url('../assets/img/envelope-flap-shadow.webp') 0 0 / 100% 100% no-repeat;
  transform-origin: 50% 0; opacity: .68; will-change: transform, opacity;
}

/* Isolated 3D perspective stage for the hinged flap so z-index stacking with the letter & pocket stays exact. */
.env-flap-stage {
  position: absolute; inset: 0; z-index: 6; perspective: 1200px; pointer-events: none;
}
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 65%;
  transform-origin: 50% 0; transform-style: preserve-3d;
  pointer-events: none; will-change: transform;
}
.flap-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background-position: 0 0; background-size: 100% 100%; background-repeat: no-repeat;
}
.flap-face.front { background-image: url('../assets/img/envelope-flap-front.webp'); }
.flap-face.front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgb(255 248 232 / var(--flap-glint, 0)), rgb(48 28 12 / var(--flap-shade, 0)));
  -webkit-mask: url('../assets/img/envelope-flap-front.webp') 0 0 / 100% 100% no-repeat;
  mask: url('../assets/img/envelope-flap-front.webp') 0 0 / 100% 100% no-repeat;
}
.flap-face.back {
  transform: rotateY(180deg);
  background-image: url('../assets/img/envelope-flap-back.webp');
}
.flap-face.back::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: rgb(22 6 8 / var(--back-shade, 0));
  -webkit-mask: url('../assets/img/envelope-flap-back.webp') 0 0 / 100% 100% no-repeat;
  mask: url('../assets/img/envelope-flap-back.webp') 0 0 / 100% 100% no-repeat;
}

/* Calibrated crimson camellia wax seal straddling the pointed flap tip & pocket apex. */
.seal-shadow {
  position: absolute; left: 50%; top: 59.2%; width: 21.5%; aspect-ratio: 1.04; translate: -50% -50%;
  z-index: 6; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgb(28 6 6 / .54) 36%, rgb(38 12 8 / .24) 64%, transparent 78%);
  will-change: transform, opacity;
}
.seal {
  position: absolute; left: 50.3%; top: 58.5%; width: 35.6%; aspect-ratio: 1.5015; translate: -50% -50%;
  z-index: 7; pointer-events: none; will-change: transform, opacity;
}
.seal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }

/* Subtle horizontal tri-fold paper crease bands that flatten away as the sheet unfolds. */
.letter-folds {
  position: absolute; inset: 0; pointer-events: none; border-radius: 4px; z-index: 2;
  opacity: var(--crease-alpha, 0);
  background:
    linear-gradient(180deg,
      transparent 32.2%,
      rgb(122 92 58 / .13) 33.1%,
      rgb(255 253 248 / .65) 33.6%,
      transparent 34.8%,
      transparent 65.5%,
      rgb(122 92 58 / .11) 66.4%,
      rgb(255 253 248 / .58) 66.9%,
      transparent 68%);
}

.letter {
  position: absolute; inset: calc(50px + var(--safe-top)) 5% calc(5% + var(--safe-bottom));
  background-color: #fbf6ec;
  background-image:
    linear-gradient(180deg, #fbf6ec 0%, rgb(251 246 236 / 0) 26px),
    linear-gradient(0deg, #faf3e6 0%, rgb(250 243 230 / 0) 28px),
    radial-gradient(140% 60% at 50% 0, rgb(255 255 255 / .6), transparent),
    url('../assets/img/paper-cotton.jpg');
  background-attachment: scroll, scroll, local, local;
  background-size: 100% 26px, 100% 28px, auto, 460px auto;
  background-position: top, bottom, center, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  border-radius: 4px;
  border: 1px solid rgb(198 180 148 / .55);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .75), 0 30px 60px rgb(0 0 0 / .5), 0 2px 6px rgb(0 0 0 / .2);
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  -webkit-user-select: text; user-select: text;
  padding: 11% 9% 10%;
  font: 400 clamp(16px, 4.8cqw, 19.5px)/2.12em var(--hand);
  color: #31231a;
  letter-spacing: .045em;
  transform-origin: 50% 65%;
  opacity: 0;
  outline: none;
  scrollbar-width: none;
}
.letter::-webkit-scrollbar { display: none; }
.letter p { margin: 0; line-height: 2.12em; text-indent: 2em; }
.letter p + p:not(.closing):not(.sign):not(.date) { margin-top: .38em; }
.letter p.greeting, .letter p.closing, .letter p.sign, .letter p.date { text-indent: 0; }
.letter p.greeting { margin-bottom: .45em; font-weight: 500; }
.letter p.sign, .letter p.date { text-align: right; }
.letter p.date { color: #7a6250; font-size: .9em; }
.letter .reveal { opacity: 0; translate: 0 7px; transition: opacity .95s cubic-bezier(.22,.78,.24,1), translate .95s cubic-bezier(.22,.78,.24,1); }
.letter .reveal.on { opacity: 1; translate: 0 0; }
/* Each character soaks into the paper: a soft bloom of ink that settles into a crisp stroke. */
.letter.writing .ink { opacity: 0; }
.letter.writing .ink.on { animation: ink-in 1.1s cubic-bezier(.2, .7, .25, 1) both; }
@keyframes ink-in {
  from { opacity: 0; text-shadow: 0 0 .45em currentColor; }
  35% { opacity: .8; }
  to { opacity: 1; text-shadow: 0 0 0 transparent; }
}
.letter-actions { display: flex; justify-content: center; margin-top: 2em; }
.letter-actions .btn { --rule: #94733f; color: #4a3528; text-shadow: none; }
.letter-actions .btn:hover, .letter-actions .btn:focus-visible { color: #8a5a2b; }

/* ---------- Finale ---------- */
.finale {
  position: absolute; inset: 0; overflow: hidden; overflow: clip; pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent 4%, #000 22%, #000 80%, transparent 96%);
  mask-image: linear-gradient(transparent 4%, #000 22%, #000 80%, transparent 96%);
}
.finale-title {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center; margin: 0;
  font: 600 clamp(30px, 10cqw, 46px)/1.35 var(--serif); letter-spacing: .24em; text-indent: .24em;
  text-shadow: 0 0 30px rgb(0 0 0 / .5);
  opacity: 0; transition: opacity 2.4s ease, filter 2.4s ease; filter: blur(10px);
}
.finale-title small { display: block; margin-top: .5em; font: italic 400 clamp(15px, 4.6cqw, 20px)/1 var(--italic); letter-spacing: .1em; color: var(--gold); }
.finale-title.on { opacity: 1; filter: blur(0); }
.roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; will-change: transform; }
/* Film credit crawl: roles right-aligned against names on a shared centre line; lead billing first and larger. */
.roll { --role: 13px; --name: 16px; }
.roll .credit-block { padding: 0 5%; }
.roll .credit-block + .credit-block { margin-top: 5.5em; }
.roll .credit-block:first-child { --role: 14px; --name: 19px; }
.roll h3 {
  display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 1.5em;
  font: 500 18px/1.2 var(--hand); letter-spacing: .3em; text-indent: .3em; color: var(--gold);
}
.roll h3::before, .roll h3::after { content: ""; width: 22px; height: 1px; background: rgb(232 194 124 / .45); }
.roll dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); column-gap: 1.1em; row-gap: .95em; align-items: baseline; max-width: 380px; margin: 0 auto; }
.roll dt { margin: 0; text-align: right; font: 400 var(--role)/1.5 var(--hand); letter-spacing: .14em; color: var(--ink-soft); }
.roll dd { margin: 0; text-align: left; font: 400 var(--name)/1.5 var(--hand); letter-spacing: .06em; color: var(--ink); white-space: pre-line; text-wrap: balance; }
.roll .line { margin: .55em 0 0; font: 400 18px/1.8 var(--hand); letter-spacing: .14em; color: rgb(247 236 220 / .78); }
.roll h3 + .line { margin-top: 0; }
.roll .end { margin-top: max(7em, 42cqh); padding: 0 8%; }
.roll .end p { white-space: pre-line; margin: .35em 0 0; font: 400 14px/1.8 var(--hand); letter-spacing: .14em; color: var(--ink-soft); }
.roll .line, .roll .end p { text-wrap: balance; }
.roll .end p.last { margin-top: 1.5em; font-size: 20px; line-height: 1.6; letter-spacing: .12em; color: var(--gold); }
.roll .end .photo {
  display: block; width: min(100%, 340px, 48cqh); aspect-ratio: 3 / 2; height: auto; object-fit: cover; margin: 1.6em auto 0;
  border-radius: 6px; box-shadow: 0 0 0 1px rgb(232 194 124 / .28), 0 14px 40px rgb(0 0 0 / .45);
}
.roll .date { margin-top: 1.3em; font: italic 400 13px/1 var(--italic); letter-spacing: .2em; color: var(--ink-soft); }
.credits-egg {
  position: absolute; left: 0; right: 0; top: 68%; margin: 0; text-align: center;
  font: 400 15px/1.6 var(--hand); letter-spacing: .3em; text-indent: .3em; color: rgb(247 236 220 / .82);
  opacity: 0; transform: translateY(8px); transition: opacity 1s ease, transform 1s ease;
}
.credits-egg.on { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .hotspot::after, .gesture::before, .gesture::after { animation: none !important; }
}

/* Machined edges and axle hardware belong to the existing live split-flap model. */
.board {
  border: 1px solid rgb(167 182 201 / .38);
  background:
    linear-gradient(115deg, rgb(216 227 241 / .09), transparent 28%, rgb(0 0 0 / .16) 78%),
    repeating-linear-gradient(0deg, rgb(197 210 225 / .012) 0 1px, transparent 1px 3px),
    linear-gradient(#293442, #17212f 38%, #101925);
  box-shadow:
    inset 0 1px 0 rgb(233 241 252 / .3),
    inset 1px 0 0 rgb(204 220 240 / .1),
    inset 0 -2px 3px rgb(0 0 0 / .8),
    0 0 0 1px #050a11,
    0 0 0 2px rgb(128 149 177 / .24),
    0 3px 0 #121b28, 0 6px 0 #070c14,
    0 9px 8px rgb(0 0 0 / .42), 0 30px 50px rgb(0 0 0 / .6);
}
.board::before {
  content: ""; position: absolute; inset: 1% .75%; border-radius: inherit; pointer-events: none;
  border: 1px solid rgb(146 164 188 / .24);
  box-shadow: inset 0 1px 0 rgb(230 239 251 / .13), inset 0 -2px 3px rgb(0 0 0 / .6), 0 0 0 1px rgb(0 0 0 / .65);
}
.rows {
  padding: .65cqw; gap: 2cqw; border-radius: 1.6cqw;
  background: linear-gradient(#040810, #0a101a);
  box-shadow: inset 0 3px 6px rgb(0 0 0 / .85), inset 1px 0 2px #000, 0 1px 0 rgb(188 206 231 / .2), 0 -1px 0 rgb(0 0 0 / .8);
}
.tile { background: #060a11; box-shadow: 0 3px 2px rgb(0 0 0 / .8), 0 0 0 1px #03060b, inset 0 1px 0 rgb(255 255 255 / .1); }
.half { border-inline: 1px solid rgb(155 174 197 / .1); }
.half.top {
  background: linear-gradient(140deg, #2c384a, #202c3e 50%, #182233);
  box-shadow: inset 0 1px 0 rgb(215 229 249 / .18), inset 0 -1px 0 #050910;
}
.half.bottom {
  background: linear-gradient(150deg, #151f2d, #202c3e 86%, #182231);
  box-shadow: inset 0 1px 2px #050910, inset 0 -2px 0 rgb(136 155 181 / .15), inset -1px 0 0 rgb(0 0 0 / .25);
}
.half span { text-shadow: 0 1px 1px rgb(0 0 0 / .55); }
.rivet {
  width: 1.35cqw; height: 1.35cqw;
  background: radial-gradient(circle at 35% 25%, #bdc9d7, #758397 40%, #344155 72%, #172130);
  box-shadow: 0 0 0 1px rgb(0 0 0 / .7), 0 1px 2px #000, inset 0 1px 0 rgb(233 242 255 / .35);
}
.rivet::after { content: ""; position: absolute; inset: 45% 24%; background: rgb(14 23 37 / .6); transform: rotate(-32deg); box-shadow: 0 1px 0 rgb(231 240 250 / .25); }
.clock { border-top-color: rgb(160 181 208 / .14); box-shadow: 0 -1px 0 rgb(0 0 0 / .35); }
.hinge {
  position: absolute; top: calc(50% - .45cqw); width: .65cqw; height: .9cqw; min-width: 2px; min-height: 3px; z-index: 4;
  background: linear-gradient(90deg, #0a111b, #8290a2 35%, #3b495d 65%, #101825);
  border-radius: .2cqw; box-shadow: 0 1px 1px #000, inset 0 1px 0 rgb(225 235 249 / .24);
}
.hinge-left { left: 0; } .hinge-right { right: 0; }

/* A web glass material: the scene stays visible behind a thin highlight and a soft lens edge. */
.prompt {
  --glass-x: 28%; --glass-y: 0%;
  background: radial-gradient(110% 100% at var(--glass-x) var(--glass-y), rgb(255 255 255 / .22), transparent 65%), rgb(210 224 240 / .09);
  border: 1px solid rgb(255 255 255 / .32);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .48), inset 1px 0 0 rgb(255 255 255 / .15), inset 0 -1px 0 rgb(255 255 255 / .12), 0 5px 18px rgb(0 0 0 / .13);
  -webkit-backdrop-filter: blur(20px) saturate(1.5) brightness(1.08);
  backdrop-filter: blur(20px) saturate(1.5) brightness(1.08);
  color: #fffaf2; text-shadow: 0 1px 5px rgb(0 0 0 / .35);
  font-family: var(--sans); font-weight: 500; letter-spacing: .01em;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.prompt { max-width: calc(100% - 40px); width: max-content; padding: 12px 22px; justify-content: center; cursor: pointer; }
.prompt .gesture { width: 16px; height: 16px; }
.prompt .gesture::before { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff4df; box-shadow: 0 0 8px rgb(255 224 170 / .85); }
.prompt:hover { border-color: rgb(255 255 255 / .6); }
.prompt:focus-visible, .btn:focus-visible, .sound-toggle:focus-visible { outline: 2px solid #fff1cf; outline-offset: 4px; }
.btn:focus-visible { outline: 1px solid rgb(232 194 124 / .7); outline-offset: 0; }
@supports not (backdrop-filter: blur(1px)) {
  .prompt { background: rgb(36 44 56 / .82); }
}
@media (prefers-reduced-transparency: reduce) {
  .prompt { background: #303b4b; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .prompt, .btn, .sound-toggle { transition: none; }
}

.letter .closing { margin-top: 1.4em; text-wrap: balance; }
.letter .sign { margin-top: 1.5em; }
/* The keep button is the letter's only call to action: a wax-red ink pill that breathes once it is ready. */
.letter-actions .letter-keep {
  --track: .24em; --pad: 30px;
  min-height: 46px; padding-top: 12px; padding-bottom: 12px;
  font-size: 16px; font-weight: 500; color: #fbf3e4;
  background: linear-gradient(180deg, #9a3b2e, #7d2a20);
  border: 1px solid #6a2219; border-radius: 999px;
  box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 6px 16px -6px rgb(90 30 20 / .55);
  transition: color .3s ease, transform .2s ease, box-shadow .3s ease, opacity .4s ease;
}
.letter-actions .letter-keep::after { display: none; }
.letter-actions .letter-keep:hover, .letter-actions .letter-keep:focus-visible { color: #fff; box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 8px 20px -6px rgb(90 30 20 / .7); }
.letter-actions .letter-keep:active { transform: scale(.97); }
.letter-actions .letter-keep:not(:disabled) { animation: prompt-in .9s cubic-bezier(.2, .7, .2, 1) both, keep-breathe 2.6s ease-in-out 1s infinite; }
.letter-actions .letter-keep:disabled { opacity: .35; color: #fbf3e4; }
@keyframes keep-breathe {
  0%, 100% { box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 6px 16px -6px rgb(90 30 20 / .55), 0 0 0 0 rgb(154 59 46 / .35); }
  50% { box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 6px 16px -6px rgb(90 30 20 / .55), 0 0 0 8px rgb(154 59 46 / 0); }
}
@media (prefers-reduced-motion: reduce) { .letter-actions .letter-keep:not(:disabled) { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .envelope { transition-duration: .12s !important; transition-delay: 0s !important; }
}
