:root {
  --bg: #0b0705;
  --ink: #f5ede2;
  --ink-2: rgba(245, 237, 226, .68);
  --ink-3: rgba(245, 237, 226, .42);
  --line: rgba(255, 236, 214, .13);
  --glass: rgba(22, 13, 9, .46);
  --ember: 255 172 112;
  --tint: 150 176 196;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: max(22px, env(safe-area-inset-left));
  --top: max(20px, env(safe-area-inset-top));
  --bottom: max(18px, env(safe-area-inset-bottom));
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font: 300 14px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--ink-2); outline-offset: 4px; border-radius: 3px; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; opacity: 0; }
html.gl #scene { opacity: 1; }

/* ---------- static stand-in (no WebGL / still loading) ---------- */
.still { position: fixed; inset: 0; overflow: hidden; background:
  radial-gradient(120% 70% at 50% 110%, rgb(70 30 12 / .55), transparent 60%),
  repeating-linear-gradient(180deg, rgb(54 32 18) 0 34px, rgb(30 17 10) 34px 38px),
  #140b07; }
.still::after { content: ""; position: absolute; inset: 0; background: radial-gradient(140% 90% at 50% 70%, transparent 30%, rgb(0 0 0 / .85)); }
.still .hearth { position: absolute; left: 50%; bottom: 12%; width: min(46vw, 420px); aspect-ratio: 1.5; translate: -50% 0; border-radius: 4px 4px 0 0;
  background: radial-gradient(60% 55% at 50% 100%, rgb(255 190 110), rgb(232 98 30) 35%, rgb(90 22 6) 70%, rgb(16 8 6)); box-shadow: 0 0 0 18px rgb(58 52 48), 0 0 0 19px rgb(0 0 0 / .4); }
.still .glow { position: absolute; left: 50%; bottom: 0; width: 120vw; height: 90vh; translate: -50% 30%; background: radial-gradient(closest-side, rgb(255 140 60 / .4), transparent); animation: flick 3.2s ease-in-out infinite alternate; }
@keyframes flick { 0% { opacity: .7; } 40% { opacity: 1; } 55% { opacity: .82; } 100% { opacity: .95; } }
html.gl .still { display: none; }
.nogl-note { display: none; }
html.nogl .nogl-note { display: block; position: fixed; z-index: 5; left: 50%; top: 42%; translate: -50% 0; margin: 0; width: min(86vw, 420px); text-align: center; font: italic 400 22px/1.3 var(--serif); color: var(--ink-2); text-shadow: 0 2px 20px #000; }

.veil { display: none; }
html.gl .veil { display: block; position: fixed; inset: 0; z-index: 4; pointer-events: none; background: #050302; }
html.ready .veil { animation: unveil 2.6s var(--ease) .1s both; }
@keyframes unveil { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }

/* ---------- identity ---------- */
.id { position: fixed; z-index: 5; top: var(--top); left: var(--gutter); display: flex; align-items: center; gap: 14px; animation: in 1.6s var(--ease) .6s both; }
.mark img { width: 28px; height: 28px; display: block; filter: drop-shadow(0 0 12px rgb(255 190 140 / .28)) drop-shadow(0 2px 6px rgb(0 0 0 / .6)); }
.id h1 { margin: 0; font: 400 27px/1 var(--serif); letter-spacing: -.01em; text-shadow: 0 2px 18px rgb(0 0 0 / .7); }
.id p { margin: 6px 0 0; font: 400 10.5px/1 var(--mono); letter-spacing: .26em; color: var(--ink-2); }
.id p a { transition: color .3s; }
.id p a:hover { color: var(--ink); }

/* ---------- sound ---------- */
.sound { position: fixed; z-index: 6; top: calc(var(--top) + 2px); right: calc(var(--gutter) + 4px); display: flex; align-items: center; gap: 9px; padding: 8px 2px;
  font: 400 9.5px/1 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-3); transition: color .4s; animation: in 1.4s var(--ease) 1.6s both; }
.sound:hover, .sound[aria-pressed="true"] { color: var(--ink-2); }
.sound .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.sound .bars i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; transition: height .4s var(--ease); }
.sound[aria-pressed="true"] .bars i { animation: eq 1.1s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] .bars i:nth-child(2) { animation-duration: .8s; }
.sound[aria-pressed="true"] .bars i:nth-child(3) { animation-duration: 1.3s; }
.sound[aria-pressed="true"] .bars i:nth-child(4) { animation-duration: .95s; }
.sound .sl::after { content: " off"; color: var(--ink-3); }
.sound[aria-pressed="true"] .sl::after { content: " on"; color: rgb(var(--ember)); }
.sound.waiting .sl::after { content: " · tap anywhere"; color: rgb(var(--ember)); }
.sound.waiting { color: var(--ink); animation: beckon 2.4s ease-in-out infinite; }
.sound.waiting .bars i { animation: none !important; }
@keyframes beckon { 50% { opacity: .55; } }
@keyframes eq { from { height: 3px; } to { height: 10px; } }

/* ---------- the record deck ---------- */
.deck { position: fixed; z-index: 6; top: calc(var(--top) + 42px); right: calc(var(--gutter) + 4px); display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 4px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2); animation: in 1.4s var(--ease) 1.6s both; }
.deck button { appearance: none; border: 0; background: none; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; padding: 0; transition: color .3s, background .3s; }
.deck button:hover { color: var(--ink); }
.dk-b { width: 26px; height: 26px; border-radius: 50%; }
.dk-b:hover { background: rgb(255 240 220 / .07); }
.dk-play { width: 30px; height: 30px; border-radius: 50%; }
.dk-disc { position: relative; width: 26px; height: 26px; border-radius: 50%; background: repeating-radial-gradient(circle, #141212 0 1.2px, #232020 1.2px 2px); box-shadow: 0 2px 8px rgb(0 0 0 / .5), inset 0 0 0 1px rgb(255 255 255 / .06); }
.dk-disc::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgb(var(--ember)); }
.dk-disc::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #0b0705; }
.deck[data-state="playing"] .dk-disc { animation: spin 1.8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.dk-body { display: flex; flex-direction: column; min-width: 0; width: 150px; padding: 0 4px 0 6px; }
.dk-k { font: 400 8px/1 var(--mono); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.deck[data-state="playing"] .dk-k { color: rgb(var(--ember)); }
.dk-t { font: 400 15px/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-a { font: 300 10.5px/1.3 var(--sans); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.nogl .deck { display: none; }

/* ---------- hint + fire gauge ---------- */
.hint, .ember { position: fixed; z-index: 5; left: 50%; bottom: calc(var(--bottom) + 10px); translate: -50% 0; margin: 0; white-space: nowrap;
  font: 400 9.5px/1 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-3); text-shadow: 0 1px 10px rgb(0 0 0 / .8); pointer-events: none; }
.hint { top: calc(var(--top) + 12px); bottom: auto; width: max-content; max-width: calc(100vw - 2 * var(--gutter) - 24px); white-space: normal; text-align: center; line-height: 1.7; animation: in 1.4s var(--ease) 3.2s both; transition: opacity .9s; }
.hint.gone { opacity: 0 !important; animation: none; }
.hint .touch { display: none; }
@media (hover: none) { .hint .fine { display: none; } .hint .touch { display: inline; } }
.ember { display: flex; align-items: center; gap: 12px; opacity: 0; transition: opacity .5s; color: var(--ink-2); }
.ember.on { opacity: 1; }
.ember .eb { position: relative; width: 120px; height: 2px; border-radius: 2px; background: rgb(255 255 255 / .12); overflow: hidden; }
.ember .eb i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(.5); background: linear-gradient(90deg, rgb(255 120 50), rgb(255 214 150)); box-shadow: 0 0 10px rgb(var(--ember)); transition: transform .25s var(--ease); }

/* ---------- links ---------- */
.links { position: fixed; z-index: 5; right: calc(var(--gutter) + 4px); bottom: calc(var(--bottom) + 4px); animation: in 1.4s var(--ease) 1.4s both; }
.links ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.links a { position: relative; display: block; padding: 6px 0; font: 400 9.5px/1 var(--mono); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 1px 10px rgb(0 0 0 / .8); transition: color .3s; }
.links a::after { content: ""; position: absolute; left: 0; right: .24em; bottom: 0; height: 1px; background: rgb(var(--ember)); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease); }
.links a:hover, .links a:focus-visible, .links a.lit { color: var(--ink); }
.links a:hover::after, .links a:focus-visible::after, .links a.lit::after { transform: none; }

/* ---------- floating label ---------- */
.tip { position: fixed; z-index: 7; left: 0; top: 0; display: flex; flex-direction: column; gap: 5px; padding: 9px 13px 10px; border-radius: 10px; pointer-events: none;
  background: rgba(18, 11, 8, .55); border: 1px solid var(--line); -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 16px 40px -18px rgb(0 0 0 / .9); opacity: 0; translate: -50% 0; transition: opacity .3s var(--ease), scale .4s var(--ease); scale: .96; will-change: transform; }
.tip.on { opacity: 1; scale: 1; }
.tip .tn { font: 400 18px/1 var(--serif); white-space: nowrap; }
.tip .ts { font: 400 9.5px/1 var(--mono); letter-spacing: .18em; color: var(--ink-2); white-space: nowrap; }
.tip .ts:empty { display: none; }

/* ---------- unwrapped gift (a big kraft tag) ---------- */
.gift { position: fixed; z-index: 8; left: 0; top: 0; width: 318px; filter: drop-shadow(0 26px 40px rgb(0 0 0 / .7)) drop-shadow(0 2px 3px rgb(0 0 0 / .4));
  opacity: 0; transform: translateY(10px) rotate(-1.2deg); transition: opacity .45s var(--ease), transform .7s var(--ease); }
.gift.on { opacity: 1; transform: none; }
.gift[hidden] { display: none; }
.tag { position: relative; padding: 22px 24px 20px 50px; color: #241811;
  background: radial-gradient(120% 90% at 30% 0%, rgb(255 255 255 / .35), transparent 60%), repeating-linear-gradient(115deg, rgb(0 0 0 / .012) 0 2px, transparent 2px 5px), linear-gradient(160deg, #f4ebdc, #e6d8c1);
  clip-path: polygon(30px 0, 100% 0, 100% 100%, 30px 100%, 0 calc(100% - 30px), 0 30px);
  -webkit-mask: radial-gradient(circle at 19px 50%, transparent 6px, #000 6.6px); mask: radial-gradient(circle at 19px 50%, transparent 6px, #000 6.6px); }
.tag::before { content: ""; position: absolute; left: 13px; top: 50%; width: 12px; height: 12px; translate: 0 -50%; border-radius: 50%; box-shadow: 0 0 0 2px rgb(160 120 70 / .45); }
.g-k { margin: 0 0 10px; font: 500 9px/1 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: rgb(36 24 17 / .55); }
.g-v { margin: 0; font: 400 30px/1.05 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.g-v.long { font-size: 23px; }
.g-n { margin: 8px 0 16px; font: italic 400 15px/1.2 var(--serif); color: rgb(36 24 17 / .6); }
.g-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.g-acts a, .g-acts button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px 8px; border-radius: 999px; font: 500 9.5px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
  border: 1px solid rgb(36 24 17 / .22); color: #241811; transition: background .3s, color .3s, border-color .3s; }
.g-acts .pri { background: #241811; color: #f4ebdc; border-color: #241811; }
.g-acts a:hover, .g-acts button:hover { border-color: #241811; }
.g-acts .pri:hover { background: #3a281d; }
.g-acts .done { color: #2e6b3e; border-color: rgb(46 107 62 / .5); }
.g-x { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: rgb(36 24 17 / .55); transition: color .3s, background .3s; }
.g-x:hover { color: #241811; background: rgb(36 24 17 / .07); }

@keyframes in { from { opacity: 0; } to { opacity: 1; } }

html.nogl .links { left: 50%; right: auto; top: 54%; bottom: auto; translate: -50% 0; }
html.nogl .links ul { flex-direction: column; align-items: center; gap: 6px; }
html.nogl .links a { font: 400 26px/1.1 var(--serif); letter-spacing: 0; text-transform: none; }
html.nogl .hint, html.nogl .sound { display: none; }

@media (max-width: 760px) {
  .id h1 { font-size: 24px; }
  .deck { top: calc(var(--top) + 64px); }
  .dk-body { width: 124px; }
  .hint { top: auto; bottom: calc(var(--bottom) + 44px); letter-spacing: .2em; font-size: 9px; }
  .ember { bottom: calc(var(--bottom) + 44px); }
  .links { left: var(--gutter); right: calc(var(--gutter) + 18px); bottom: calc(var(--bottom) + 4px); }
  .links ul { justify-content: space-between; gap: 6px; }
  .links a { letter-spacing: .16em; font-size: 9px; }
  .gift { left: 50% !important; top: auto !important; bottom: calc(var(--bottom) + 8px); width: min(340px, calc(100vw - 2 * var(--gutter))); translate: -50% 0; }
}
/* short landscape screens (phones on their side): compact */
@media (max-height: 520px) and (orientation: landscape) {
  .id h1 { font-size: 22px; }
  .hint { display: none; }
  .ember { bottom: calc(var(--bottom) + 64px); }
  .deck { top: calc(var(--top) + 38px); right: calc(var(--gutter) + 18px); padding: 4px; }
  .dk-k { display: none; }
  .dk-body { width: 112px; }
  .dk-t { font-size: 13.5px; }
  .links { left: auto; right: calc(var(--gutter) + 18px); bottom: calc(var(--bottom) + 4px); }
  .links ul { flex-wrap: wrap; justify-content: flex-end; gap: 2px 14px; }
}
@media (max-width: 360px) { .links a { letter-spacing: .1em; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
html.shot .veil { display: none !important; }
html.shot *, html.shot *::before, html.shot *::after { animation-delay: 0s !important; animation-duration: 0s !important; }
