/* ============ Fonts (self-hosted) ============ */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/cormorant-garamond-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }

/* ============ Tokens ============ */
:root {
  --bg: #0c0a10;
  --bg-2: #15111b;
  --ink: #f4ecdf;
  --ink-2: rgba(244, 236, 223, 0.66);
  --ink-3: rgba(244, 236, 223, 0.42);
  --line: rgba(244, 236, 223, 0.12);
  --surface: rgba(244, 236, 223, 0.05);
  --gold: #e9b862;
  --gold-2: #f6d595;
  --gold-ink: #1c1407;
  --danger: #ff9a8a;

  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", "Times New Roman", serif;

  --r-btn: 12px;
  --r-input: 12px;
  --r-card: 20px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #1b1422 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
button, a, [role="button"] { touch-action: manipulation; }
button, .btn { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.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;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 24px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  font-size: 15px; font-weight: 600; letter-spacing: 0.01em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); min-height: 44px; padding: 0 12px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--gold-2); }
  .btn-secondary:hover { background: rgba(244, 236, 223, 0.09); border-color: rgba(244, 236, 223, 0.2); }
  .btn-ghost:hover { color: var(--ink); }
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(12, 10, 16, 0.4);
  color: var(--ink); cursor: pointer; text-decoration: none;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: transform 120ms var(--ease-out), background-color 200ms ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: rgba(244, 236, 223, 0.08); }
}

/* ============ Mark ============ */
.diya { color: var(--gold); }
.diya .flame { fill: var(--gold); stroke: none; transform-origin: 24px 19px; animation: flicker 2.6s ease-in-out infinite; }
.diya .flame-core { fill: #fff3d6; stroke: none; transform-origin: 24px 19px; animation: flicker 1.9s ease-in-out infinite reverse; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  30% { transform: scale(0.94, 1.06) rotate(-2deg); }
  60% { transform: scale(1.04, 0.95) rotate(1.5deg); }
}

/* ============ Home ============ */
.page-home { overflow: hidden; }
.sky { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.home {
  position: relative; z-index: 1;
  min-height: 100svh;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}
.home-inner { max-width: 640px; display: grid; justify-items: center; }
.home .diya { width: 56px; height: 56px; margin-bottom: 28px; }
.home h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(48px, 9vw, 84px); line-height: 1; letter-spacing: -0.02em;
  text-wrap: balance;
}
.home p {
  margin-top: 20px; max-width: 44ch;
  color: var(--ink-2); font-size: clamp(16px, 2vw, 18px);
  text-wrap: balance;
}
.home-actions {
  margin-top: 40px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  width: min(100%, 420px);
}
.home-actions .btn { width: 100%; }
@media (max-width: 420px) { .home-actions { grid-template-columns: 1fr; } }

.reveal { animation: rise 900ms var(--ease-soft) both; }
.reveal-2 { animation-delay: 120ms; }
.reveal-3 { animation-delay: 240ms; }
.reveal-4 { animation-delay: 360ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ============ Top bar ============ */
.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.topbar .link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(12, 10, 16, 0.4);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink);
  transition: transform 120ms var(--ease-out), background-color 200ms ease;
}
.topbar .link:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .topbar .link:hover { background: rgba(244, 236, 223, 0.08); }
}

/* ============ Snap ============ */
.page-snap { overflow: hidden; height: 100dvh; background: #07060a; }
.snap-video {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
  /* --cam-gain is set from the live picture in snap.js so dim rooms are lifted. */
  filter: brightness(calc(var(--cam-gain, 1) * 0.92)) saturate(0.95) contrast(1.04);
  opacity: 0; transition: opacity 500ms ease, filter 400ms linear;
}
.snap-video.is-on { opacity: 1; }
.snap-shade {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(7, 6, 10, 0.4) 100%),
    linear-gradient(to bottom, rgba(7, 6, 10, 0.35), transparent 22%, transparent 78%, rgba(7, 6, 10, 0.35));
}
.snap-canvas { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
.snap-canvas.tap-mode { cursor: crosshair; }

.hand-cursor {
  position: fixed; left: 0; top: 0; z-index: 5;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 236, 223, 0.7);
  pointer-events: none; opacity: 0;
  transition: opacity 250ms ease, border-color 160ms ease, box-shadow 160ms ease, scale 160ms var(--ease-out);
  will-change: transform;
}
.hand-cursor.is-on { opacity: 1; }
.hand-cursor.is-ready {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 6px rgba(233, 184, 98, 0.16), 0 0 24px rgba(233, 184, 98, 0.45);
  scale: 0.8;
}

.snap-status {
  position: fixed; z-index: 10; left: 50%; bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  translate: -50% 0;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(12, 10, 16, 0.5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-size: 14px; font-weight: 500; color: var(--ink);
  white-space: nowrap;
  opacity: 0; transition: opacity 400ms ease;
}
.snap-status.is-on { opacity: 1; }
.snap-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); transition: background-color 200ms ease, box-shadow 200ms ease; }
.snap-status.has-hand .dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.snap-debug {
  position: fixed; z-index: 40; left: 12px; top: 72px; margin: 0;
  padding: 10px 12px; border-radius: 10px; max-width: calc(100vw - 24px);
  background: rgba(0, 0, 0, 0.65); color: #d8f5c8;
  font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; pointer-events: none;
}

.snap-intro {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding: 80px 16px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(100% 70% at 50% 20%, #1b1422 0%, #0a080d 70%);
  transition: opacity 600ms var(--ease-soft), visibility 600ms;
}
.snap-intro.is-hidden { opacity: 0; visibility: hidden; }
.intro-card { width: min(100%, 440px); text-align: center; display: grid; justify-items: center; }
.intro-card .diya { width: 44px; height: 44px; margin-bottom: 24px; }
.intro-card h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(40px, 8vw, 56px); line-height: 1.02; letter-spacing: -0.02em;
}
.intro-card p { margin-top: 14px; color: var(--ink-2); text-wrap: balance; }
.steps {
  list-style: none; margin: 32px 0 0; padding: 0;
  display: grid; gap: 14px; width: 100%; text-align: left;
}
.steps li {
  display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 14px;
  font-size: 15px; color: var(--ink);
}
.steps .step-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--gold);
}
.steps .step-icon svg { width: 18px; height: 18px; }
.intro-actions { margin-top: 32px; width: 100%; display: grid; gap: 8px; }
.intro-actions .btn-primary { width: 100%; }
.intro-note { margin-top: 18px; font-size: 13px; color: var(--ink-3); }
.intro-msg {
  margin-top: 16px; font-size: 14px; color: var(--danger);
  min-height: 0;
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(28, 20, 7, 0.25); border-top-color: var(--gold-ink);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Create ============ */
.create {
  min-height: 100svh;
  display: grid; justify-items: center; align-content: start;
  padding: calc(88px + env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom));
}
.create-inner { width: min(100%, 520px); }
.create-head { text-align: center; margin-bottom: 36px; }
.create-head .diya { width: 40px; height: 40px; margin: 0 auto 20px; }
.create-head h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(38px, 7vw, 52px); line-height: 1.04; letter-spacing: -0.02em;
}
.create-head p { margin-top: 12px; color: var(--ink-2); }

.form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; align-content: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; gap: 22px; } }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label { font-size: 14px; font-weight: 600; color: var(--ink); }
.label .opt { font-weight: 400; color: var(--ink-3); }
.count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.input {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border-radius: var(--r-input);
  border: 1px solid var(--line);
  background: rgba(244, 236, 223, 0.04);
  color: var(--ink); font: inherit; font-size: 16px;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233, 184, 98, 0.18); background: rgba(244, 236, 223, 0.06); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.field.has-error .input { border-color: var(--danger); }
.error { font-size: 13px; color: var(--danger); min-height: 0; }
.error:empty { display: none; }

.picker {
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px; display: grid; gap: 16px;
  transition: opacity 300ms ease;
}
.picker.is-muted { opacity: 0.4; }
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.picker-title { font-size: 14px; font-weight: 600; }
.picker-sub { font-size: 13px; color: var(--ink-3); }
.picker-text {
  font-family: var(--serif); font-size: 21px; line-height: 1.4; color: var(--ink);
  min-height: 5.6em;
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease;
}
.picker-text.is-swapping { opacity: 0; filter: blur(3px); transform: translateY(4px); }
.picker-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.picker-nav { display: flex; align-items: center; gap: 4px; }
.picker-pos { font-size: 13px; color: var(--ink-3); min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.picker .icon-btn { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.picker .btn-ghost { gap: 8px; }
.picker.is-muted .icon-btn, .picker.is-muted .btn-ghost { pointer-events: none; }

.form .btn-primary { width: 100%; margin-top: 6px; }

.result { text-align: center; display: grid; justify-items: center; gap: 0; }
.result .seal-mark {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; color: var(--gold-ink);
  background: radial-gradient(circle at 35% 30%, #f8dc9c, #d9a24a 60%, #b07a2b);
  margin-bottom: 24px;
}
.result .seal-mark svg { width: 30px; height: 30px; }
.result h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 6vw, 44px); line-height: 1.05; letter-spacing: -0.02em; }
.result p { margin-top: 10px; color: var(--ink-2); text-wrap: balance; }
.link-box {
  margin-top: 28px; width: 100%;
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 6px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(244, 236, 223, 0.04);
}
.link-box input {
  min-width: 0; border: 0; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 14px; padding: 0 12px; text-overflow: ellipsis;
}
.link-box input:focus { outline: none; color: var(--ink); }
.link-box .btn { min-height: 44px; padding: 0 18px; min-width: 104px; }
.result-actions { margin-top: 12px; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-actions.single { grid-template-columns: 1fr; }
.result-actions .btn { width: 100%; }
.result .btn-ghost { margin-top: 16px; }

.fade-in { animation: rise 600ms var(--ease-soft) both; }

/* ============ Wish ============ */
.page-wish { overflow-x: hidden; }
.bokeh { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bokeh span {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 196, 110, 0.5), rgba(246, 196, 110, 0) 70%);
  animation: twinkle 7s ease-in-out infinite;
}
.bokeh span:nth-child(1) { width: 220px; height: 220px; left: -60px; top: 12%; animation-delay: -1s; }
.bokeh span:nth-child(2) { width: 140px; height: 140px; right: 6%; top: 8%; animation-delay: -3s; opacity: 0.5; }
.bokeh span:nth-child(3) { width: 300px; height: 300px; right: -100px; bottom: 6%; animation-delay: -5s; }
.bokeh span:nth-child(4) { width: 120px; height: 120px; left: 12%; bottom: 10%; animation-delay: -2s; opacity: 0.6; }
.bokeh span:nth-child(5) { width: 90px; height: 90px; left: 46%; top: 4%; animation-delay: -4s; opacity: 0.4; }
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.08); }
}
.wish-sky { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1600ms ease; }
.wish-sky.is-on { opacity: 0.85; }

.scene {
  position: relative; z-index: 1;
  min-height: 100svh;
  overflow: clip;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
.stage { position: relative; width: var(--F); height: var(--F); flex: none; }
.stage-wrap { animation: rise 1100ms var(--ease-soft) both; animation-delay: 150ms; }

/* Envelope parts share the same box, moved together with `translate` */
.env-part {
  position: absolute;
  left: calc((var(--F) - var(--E)) / 2);
  top: calc((var(--F) - var(--E)) / 2 + var(--oy));
  width: var(--E); height: var(--E);
}
.env-back {
  z-index: 1; border-radius: calc(var(--E) * 0.02);
  background: linear-gradient(180deg, #4a0f19, #6a1724 60%, #5a121e);
  box-shadow: 0 calc(var(--E) * 0.06) calc(var(--E) * 0.12) rgba(0, 0, 0, 0.45);
}
.env-front { z-index: 4; filter: drop-shadow(0 -1px 2px rgba(0, 0, 0, 0.35)); }
.env-front .pocket {
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  border-radius: calc(var(--E) * 0.02);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(180deg, #8c2434, #7a1d2c 70%, #6b1826);
}
.env-front .pocket::after {
  content: ""; position: absolute; inset: 0; opacity: 0.18; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.env-front .folds { position: absolute; inset: 0; width: 100%; height: 100%; }
.env-front .to {
  position: absolute; left: 0; right: 0; top: 70%;
  text-align: center; color: var(--gold-2);
  font-family: var(--serif); font-weight: 500;
  font-size: calc(var(--E) * 0.068); line-height: 1.2;
  padding: 0 12%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.env-front .to small {
  display: block; font-family: var(--sans); font-size: 0.42em; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase; color: rgba(246, 213, 149, 0.7);
  margin-bottom: 0.5em;
}

.env-flap {
  z-index: 5; height: calc(var(--E) * 0.54);
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transform: perspective(calc(var(--E) * 3)) rotateX(0deg);
}
.flap-face {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.flap-front { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.flap-front .tri, .flap-back .tri { position: absolute; inset: 0; }
.flap-front .tri {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    linear-gradient(180deg, #9a2a3b, #852233 80%);
}
.flap-face .shade { position: absolute; inset: 0; background: #000; opacity: 0; }
.flap-back .shade { opacity: 0.45; }
.flap-back { transform: rotateX(180deg); }
.flap-back .tri {
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background-color: #f1e2c2;
  background-image:
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.5), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cg fill='none' stroke='%23c4923f' stroke-width='.8' opacity='.7'%3E%3Ccircle cx='18' cy='18' r='7'/%3E%3Cpath d='M18 4c3 5 3 9 0 14-3-5-3-9 0-14zM18 32c3-5 3-9 0-14-3 5-3 9 0 14zM4 18c5-3 9-3 14 0-5 3-9 3-14 0zM32 18c-5-3-9-3-14 0 5 3 9 3 14 0z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, calc(var(--E) * 0.12) calc(var(--E) * 0.12);
}

.seal {
  position: absolute; z-index: 6;
  left: calc(var(--F) / 2 - var(--E) * 0.1);
  top: calc((var(--F) - var(--E)) / 2 + var(--oy) + var(--E) * 0.44);
  width: calc(var(--E) * 0.2); height: calc(var(--E) * 0.2);
  border-radius: 50%;
  display: grid; place-items: center;
  color: rgba(80, 48, 10, 0.85);
  background: radial-gradient(circle at 35% 30%, #fbe3a8, #e0ab52 55%, #a8721f 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 0 0 calc(var(--E) * 0.012) rgba(255, 240, 200, 0.35), inset 0 -2px 6px rgba(90, 50, 0, 0.35);
}
.seal svg { width: 52%; height: 52%; }
.seal .flame, .seal .flame-core { animation: none; }

.env-button {
  position: absolute; z-index: 8;
  left: calc((var(--F) - var(--E)) / 2);
  top: calc((var(--F) - var(--E)) / 2 + var(--oy));
  width: var(--E); height: var(--E);
  border: 0; background: transparent; cursor: pointer; border-radius: 4px;
}
.env-button[disabled] { cursor: default; }

.card {
  position: absolute; left: 0; top: 0; z-index: 3;
  width: var(--F); height: var(--F);
  font-size: calc(var(--F) / 23);
  border-radius: calc(var(--F) * 0.012);
  background-color: #f8f1e4;
  background-image:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(140% 120% at 50% 50%, transparent 60%, rgba(160, 110, 40, 0.14) 100%);
  color: #2a1d12;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1.4em 3em rgba(0, 0, 0, 0.35);
  transform-origin: 50% 50%;
  overflow: hidden;
}
.card::before, .card::after {
  content: ""; position: absolute; pointer-events: none; border: 1px solid rgba(184, 132, 52, 0.55);
}
.card::before { inset: 0.8em; }
.card::after { inset: 1.05em; border-color: rgba(184, 132, 52, 0.3); }
.card-inner {
  position: absolute; inset: 1.8em;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.card .diya { width: 2.1em; height: 2.1em; color: #b8842f; }
.card .diya .flame { fill: #d99a3a; }
.card .diya .flame-core { fill: #fff0c8; }
.card .eyebrow {
  margin-top: 0.7em;
  font-family: var(--sans); font-size: 0.56em; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; color: #a87628;
  padding-left: 0.3em;
}
.card .dear {
  margin-top: 0.75em;
  font-family: var(--serif); font-weight: 600; font-size: 1.5em; line-height: 1.15;
  letter-spacing: -0.01em; max-width: 100%;
  overflow-wrap: anywhere;
}
.card .msg {
  margin-top: 0.55em; max-width: 21em;
  font-family: var(--serif); font-weight: 500; font-size: 1.04em; line-height: 1.42;
  color: #3d2c1c;
  white-space: pre-line; overflow-wrap: anywhere;
}
.card .msg.is-short { font-size: 1.2em; }
.card .msg.is-long { font-size: 0.9em; line-height: 1.38; }
.card .msg.is-xlong { font-size: 0.8em; line-height: 1.36; }
.card .sign { margin-top: 0.9em; display: grid; gap: 0.1em; }
.card .sign span { font-family: var(--sans); font-size: 0.56em; letter-spacing: 0.24em; text-transform: uppercase; color: #8d6a43; padding-left: 0.24em; }
.card .sign strong { font-family: var(--serif); font-weight: 600; font-size: 1.3em; line-height: 1.15; overflow-wrap: anywhere; }
.card .line { opacity: 0; }
.card.is-open .line { animation: rise 900ms var(--ease-soft) both; }
.card.is-open .line:nth-child(2) { animation-delay: 120ms; }
.card.is-open .line:nth-child(3) { animation-delay: 260ms; }
.card.is-open .line:nth-child(4) { animation-delay: 420ms; }
.card.is-open .line:nth-child(5) { animation-delay: 620ms; }

.tap-hint {
  margin-top: calc(var(--F) * 0.08);
  font-size: 14px; color: var(--ink-2); letter-spacing: 0.02em;
  animation: breathe 2.8s ease-in-out infinite;
  transition: opacity 300ms ease;
}
.tap-hint.is-gone { opacity: 0 !important; animation: none; }
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.cta {
  margin-top: calc(var(--F) * 0.04);
  text-align: center; max-width: 420px;
  display: grid; justify-items: center; gap: 16px;
  opacity: 0; visibility: hidden;
}
.cta.is-on { visibility: visible; animation: rise 900ms var(--ease-soft) both; }
.cta p { color: var(--ink-2); font-size: 15px; text-wrap: balance; }

.broken { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.broken h1 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.1; }
.broken p { margin: 12px auto 28px; color: var(--ink-2); max-width: 36ch; }

/* ============ Accessibility ============ */
@media (prefers-reduced-motion: reduce) {
  .diya .flame, .diya .flame-core, .bokeh span, .tap-hint { animation: none; }
  .reveal, .stage-wrap, .fade-in { animation-duration: 1ms; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar .link, .icon-btn, .snap-status { background: #15111b; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(244, 236, 223, 0.4); --ink-2: rgba(244, 236, 223, 0.85); }
}
