:root {
  color-scheme: dark;
  --text: #f2f5ef;
  --mist: #b9c7cc;
  --gold: #f1cf9e;
  --line: rgba(215, 231, 228, .24);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #061020; color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, canvas:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #ffdb9d; outline-offset: 4px; }
.world { isolation: isolate; position: relative; min-height: 550px; height: 100svh; overflow: hidden; background: #071223; }
.landscape, .vignette, canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.landscape { z-index: -3; background: #071223 url("aurora.webp") center 55% / cover no-repeat; }
.vignette { z-index: -2; background: radial-gradient(ellipse at 69% 40%, transparent 15%, #04102045 57%, #030b19c4 100%), linear-gradient(90deg, #02091685, transparent 63%); }
canvas { z-index: -1; display: block; outline-offset: -4px; }
.world[data-state="open"] canvas { cursor: grab; touch-action: none; }
.world[data-state="open"] canvas:active { cursor: grabbing; }
.top { position: absolute; inset: max(24px, env(safe-area-inset-top)) clamp(22px, 4vw, 67px) auto; display: flex; justify-content: space-between; align-items: center; z-index: 2; pointer-events: none; }
.brand { display: flex; align-items: center; gap: .72rem; font-size: .9rem; font-weight: 500; letter-spacing: .24em; color: #f5e4c6; }
.brand img { padding: 6px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #0e1a2870; }
.top-actions, .scene-controls { display: flex; gap: 8px; pointer-events: auto; }
.icon-button, .spark-button, .text-button { color: var(--text); background: #0a1a2ca8; border: 1px solid var(--line); border-radius: 100px; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, border-color .2s; }
.icon-button { width: 42px; height: 42px; padding: 10px; font-size: 1.18rem; line-height: 1; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.icon-button[aria-pressed="true"], .icon-button:hover, .spark-button:hover, .text-button:hover { background: #20364b; border-color: #b1cbca91; }
.icon-button[aria-pressed="true"] { color: var(--gold); }
.greeting { position: absolute; left: clamp(24px, 6.4vw, 120px); top: 50%; width: min(44vw, 660px); transform: translateY(-49%); z-index: 1; pointer-events: none; }
.recipient { color: var(--gold); display: flex; align-items: center; gap: .65em; font-size: .9rem; letter-spacing: .17em; margin: 0 0 1.1rem; }
.recipient b { font-weight: 500; overflow-wrap: anywhere; }
.recipient span { width: clamp(16px, 2.2vw, 45px); flex: 0 0 auto; height: 1px; background: linear-gradient(90deg, #edc88f12, #edc88fb0); }
h1 { margin: 0; font-family: Baskerville, "Iowan Old Style", Georgia, serif; font-size: clamp(60px, 8.3vw, 156px); font-weight: 400; line-height: .85; letter-spacing: -.055em; color: #f6f0df; text-shadow: 0 0 38px #a5e8f124; }
h1 em { display: block; color: #e9d1ac; font-weight: 400; margin-left: -.033em; }
.wish { font-size: 1rem; line-height: 1.75; letter-spacing: .055em; color: var(--mist); margin: 1.55rem 0 1.28rem; overflow-wrap: anywhere; }
.primary { border: 1px solid #ffe3ae92; border-radius: 100px; padding: .76rem 1.28rem; display: inline-flex; align-items: center; gap: .53rem; min-height: 45px; background: #f2d4a7; color: #162131; font-size: .93rem; font-weight: 650; box-shadow: 0 4px 28px #eecf9238; transition: background .2s, transform .2s; pointer-events: auto; }
.primary:hover { background: #fff0ce; transform: translateY(-2px); }
.primary span { font-size: 1.25rem; line-height: 1; }
.opened { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1.05rem; }
.countdown { display: grid; gap: .28rem; width: max-content; padding: .61rem .82rem .58rem; border-top: 1px solid #edcf9b52; border-bottom: 1px solid #edcf9b32; }
.countdown-label { font-size: .78rem; letter-spacing: .12em; color: #c1cbce; }
.time { display: flex; align-items: baseline; gap: .28em; }
.time b { color: #f5dec0; font: 500 1.32rem / 1.05 Baskerville, Georgia, serif; font-variant-numeric: tabular-nums; }
.time span { color: #b9c7cc; font-size: .75rem; margin-right: .32rem; }
.time span:last-child { margin-right: 0; }
.today { margin: 0; color: var(--gold); }
.text-button { pointer-events: auto; font-size: .875rem; padding: .6rem .8rem; }
.scene-controls { position: absolute; z-index: 2; bottom: max(25px, env(safe-area-inset-bottom)); left: 66.5%; transform: translateX(-50%); align-items: center; }
.spark-button { color: #f7e2c0; padding: .57rem .8rem; min-height: 42px; gap: .35rem; font-size: .875rem; white-space: nowrap; }
.instructions { position: absolute; bottom: max(33px, env(safe-area-inset-bottom)); left: clamp(22px, 4vw, 67px); color: var(--mist); font-size: .86rem; letter-spacing: .04em; pointer-events: none; }
.mobile-instructions { display: none; }
.no-script { position: fixed; bottom: 30px; left: 24px; }
dialog { width: min(31rem, calc(100% - 2rem)); color: var(--text); background: #0e2036; border: 1px solid #76869c; border-radius: 20px; padding: 1.5rem; box-shadow: 0 24px 80px #0009; }
dialog::backdrop { background: #020811ae; backdrop-filter: blur(7px); }
dialog form { display: grid; gap: .7rem; }
dialog input, dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: .63rem .7rem; color: inherit; background: #08172a; }
dialog textarea { resize: vertical; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .4rem; }
.dialog-heading h2 { font-size: 1.3rem; font-weight: 600; margin: 0; color: #f5e4c6; }
dialog .primary { justify-self: start; margin-top: .25rem; }
@media (max-width: 800px) and (orientation: portrait), (max-width: 585px) {
  .world { min-height: 610px; }
  .top { inset: max(16px, env(safe-area-inset-top)) 17px auto; }
  .greeting { top: clamp(76px, 10svh, 125px); left: 5%; width: 90%; transform: none; text-align: center; }
  .recipient { justify-content: center; margin-bottom: .65rem; font-size: .85rem; }
  h1 { font-size: clamp(47px, 10.4vw, 76px); line-height: .93; }
  h1 em { display: inline; margin: 0; }
  .wish { margin: .65rem auto .72rem; max-width: 35ch; font-size: .9rem; }
  .opened { justify-content: center; gap: .5rem; }
  .countdown { padding: .3rem .5rem; text-align: left; }
  .countdown-label { font-size: .72rem; }
  .time b { font-size: 1.08rem; }
  .text-button { padding: .47rem .58rem; font-size: .8rem; }
  .scene-controls { left: 50%; bottom: max(40px, calc(env(safe-area-inset-bottom) + 25px)); }
  .instructions { bottom: max(15px, env(safe-area-inset-bottom)); left: 0; width: 100%; text-align: center; font-size: .76rem; }
  .desktop-instructions { display: none; }
  .mobile-instructions { display: inline; }
  .vignette { background: radial-gradient(ellipse at 48% 55%, transparent 25%, #0610222c 60%, #030b1977 100%); }
}
@media (max-height: 510px) and (orientation: landscape) {
  .world { min-height: 350px; }
  .top { top: 13px; }
  .greeting { left: 5%; }
  h1 { font-size: clamp(44px, 11vh, 85px); }
  .recipient { margin-bottom: .55rem; }
  .wish { margin: .55rem 0 .65rem; }
  .instructions { bottom: 17px; font-size: .76rem; }
  .scene-controls { bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
