:root {
  --bg-0: #0b0618;
  --bg-1: #1a0b2e;
  --bg-2: #2d1650;
  --ink: #f5f0ff;
  --ink-soft: #c9bde6;
  --ink-mute: #8f82ad;
  --gold: #f6d38a;
  --gold-deep: #d9a046;
  --card: rgba(255, 255, 255, 0.06);
  --card-line: rgba(255, 255, 255, 0.12);
  --radius: 22px;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, var(--bg-2) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  background-color: var(--bg-0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* twinkling star field */
.stars, .stars::after {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 42%, #ffe9b8 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 66%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 84%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 90%, #ffe9b8 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 35%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 75%, #fff 50%, transparent 51%);
  opacity: .55;
}
.stars::after {
  content: ""; transform: translate(4%, 7%) scale(1.1);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .15; } to { opacity: .7; } }

.page {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: 20px 16px 48px;
}

h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 12px; }
p { line-height: 1.55; color: var(--ink-soft); }
a { color: var(--gold); }

.brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--serif); color: var(--gold); font-size: 15px; letter-spacing: .12em;
  text-transform: uppercase; opacity: .9; margin: 4px 0 16px;
}
.brand::before, .brand::after { content: "✦"; font-size: 10px; }

.card {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 22px 20px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.center { text-align: center; }
.muted { color: var(--ink-mute); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0;
  font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  color: #2a1606; background: linear-gradient(180deg, #ffe3a3 0%, var(--gold-deep) 100%);
  box-shadow: 0 8px 24px rgba(217, 160, 70, .35), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.ghost {
  color: var(--ink); background: rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px var(--card-line);
}
.btn.block { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.btn-row .btn { padding: 0 12px; font-size: 15px; }

/* ---------- reveal overlay (fortune cookie) ---------- */
.reveal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; border: 0; width: 100%; color: var(--ink);
  font: inherit; cursor: pointer;
  background:
    radial-gradient(60% 40% at 50% 48%, rgba(246, 211, 138, .22) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  transition: opacity .6s ease, visibility .6s;
}
.reveal .hint-top { font-family: var(--serif); font-size: 24px; margin: 0 0 6px; color: var(--ink); }
.reveal .hint-sub { margin: 0 0 28px; color: var(--ink-soft); font-size: 15px; }
.reveal .tap {
  margin-top: 26px; font-size: 14px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.cookie { position: relative; width: min(72vw, 300px); aspect-ratio: 3 / 2; }
.cookie svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cookie .glow {
  position: absolute; inset: -30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 150, .55) 0%, transparent 60%);
  filter: blur(8px); animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.08); opacity: .75; } }
.cookie .whole { animation: bob 2.4s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.cookie .half { transition: transform .9s cubic-bezier(.2,.8,.2,1), opacity .9s ease; transform-box: fill-box; }
.cookie .half.left  { transform-origin: 100% 70%; }
.cookie .half.right { transform-origin: 0% 70%; }
.cookie .slip {
  position: absolute; left: 50%; top: 62%; width: 62%; padding: 7px 0;
  display: grid; place-items: center; border-radius: 3px;
  font: 600 12px var(--serif); letter-spacing: .12em; color: #8a5a1c;
  background: linear-gradient(180deg, #fffdf6, #f1e3c2);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transform: translate(-50%, -50%) scaleX(0); opacity: 0;
}
.cookie .burst {
  position: absolute; left: 50%; top: 60%; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; opacity: 0; transform: scale(.2);
  background: radial-gradient(circle, rgba(255, 246, 214, .95) 0%, rgba(255, 220, 140, .45) 35%, transparent 70%);
}
.cookie .crease { transition: opacity .3s; }
.sparks { position: absolute; left: 50%; top: 55%; width: 0; height: 0; }
.sparks i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px var(--gold); opacity: 0;
}

.reveal.is-breaking { cursor: default; }
.reveal.is-breaking .whole { animation: shake .25s linear 2; }
@keyframes shake { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.reveal.is-breaking .half.left  { transform: translate(-38%, 8%) rotate(-28deg); opacity: 0; transition-delay: .45s; }
.reveal.is-breaking .half.right { transform: translate(38%, 8%) rotate(28deg); opacity: 0; transition-delay: .45s; }
.reveal.is-breaking .crease { opacity: 0; transition-delay: .45s; }
.reveal.is-breaking .slip { animation: slip 1.2s .5s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes slip {
  0%   { opacity: 0; transform: translate(-50%, -50%) scaleX(0); }
  35%  { opacity: 1; transform: translate(-50%, -50%) scaleX(1); }
  75%  { opacity: 1; transform: translate(-50%, -120%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1.3); }
}
.reveal.is-breaking .burst { animation: burst 1.1s .45s ease-out forwards; }
@keyframes burst {
  0%   { opacity: 0; transform: scale(.2); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: scale(9); }
}
.reveal.is-breaking .sparks i { animation: spark .9s .5s ease-out forwards; }
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}
.reveal.is-breaking .tap, .reveal.is-breaking .hint-top, .reveal.is-breaking .hint-sub {
  opacity: 0; transition: opacity .3s;
}
.reveal.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.reveal.quick.is-breaking .half { transition-delay: .1s; transition-duration: .5s; }
.reveal.quick.is-breaking .slip, .reveal.quick.is-breaking .burst { animation-delay: .1s; animation-duration: .6s; }
.reveal.quick.is-breaking .crease { transition-delay: .1s; }
.reveal.quick.is-breaking .sparks i { animation-delay: .1s; }

/* ---------- video ---------- */
.player {
  position: relative; width: 100%;
  aspect-ratio: 9 / 16; max-height: 78svh; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden; background: #000;
  box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(246, 211, 138, .25);
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player .ctrl {
  position: absolute; z-index: 2; width: 46px; height: 46px; border-radius: 50%;
  border: 0; display: grid; place-items: center; font-size: 20px; cursor: pointer;
  color: #fff; background: rgba(10, 5, 20, .55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.player .sound { top: 12px; right: 12px; }
.player .replay {
  left: 50%; top: 50%; width: 76px; height: 76px; font-size: 32px;
  transform: translate(-50%, -50%); display: none;
}
.player.ended .replay { display: grid; }
.sound-hint {
  position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; border: 0; font: 600 14px var(--sans);
  color: #2a1606; background: var(--gold); display: none; cursor: pointer; white-space: nowrap;
}
.player.needs-sound .sound-hint { display: block; animation: pulse 1.6s ease-in-out infinite; }

.wish-text {
  font-family: var(--serif); font-size: 23px; line-height: 1.4; color: var(--ink);
  margin: 22px 4px 8px; text-align: center;
}
.wish-date { text-align: center; color: var(--ink-mute); font-size: 14px; margin: 0 0 18px; }
.welcome {
  text-align: center; color: var(--gold); font-family: var(--serif); font-size: 18px; margin: 0 0 14px;
}

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; padding: 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; color: var(--gold); }
.stat span { font-size: 13px; color: var(--ink-soft); }
.progress { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }

.foot { text-align: center; margin-top: 26px; font-size: 13px; color: var(--ink-mute); }

/* ---------- forms ---------- */
label { display: block; font-size: 14px; color: var(--ink-soft); margin: 18px 0 8px; }
select {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--card-line); background: rgba(0,0,0,.25); color: var(--ink);
  font: 16px var(--sans);
}
.tz-now { font-size: 14px; color: var(--ink-mute); margin-top: 8px; }

/* ---------- collection ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.tile {
  position: relative; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden;
  border: 0; padding: 0; cursor: pointer; background: #000 center / cover no-repeat;
}
.tile span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 6px;
  font: 600 11px var(--sans); color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
}
dialog.viewer {
  width: 100%; max-width: 480px; max-height: 100svh; margin: auto; padding: 16px;
  border: 0; background: transparent; color: var(--ink);
}
dialog.viewer::backdrop { background: rgba(5, 2, 12, .92); }
dialog.viewer .close { position: absolute; top: 12px; right: 12px; z-index: 5; }
.empty { text-align: center; padding: 40px 10px; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 999px; background: #fff; color: #1a0b2e;
  font: 600 14px var(--sans); opacity: 0; transition: .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- snow (per-guest / festive pages) ---------- */
.snow { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.snow i {
  position: absolute; top: -12px; left: var(--x); width: 8px; height: 8px; border-radius: 50%;
  background: #fff; opacity: .8; transform: scale(var(--s));
  animation: snowfall var(--d) linear var(--delay) infinite;
}
@keyframes snowfall {
  to { transform: translate(30px, 105vh) scale(var(--s)); }
}

.promo {
  margin: 18px 0 0; padding: 12px 16px; border-radius: 16px; text-align: center;
  font-size: 15px; color: var(--gold); background: rgba(246, 211, 138, .08);
  border: 1px solid rgba(246, 211, 138, .25);
}
.btn.gift { margin-top: 10px; }

/* ---------- host remote ---------- */
.rounds { display: grid; gap: 12px; margin-top: 18px; }
.round { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.round.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 10px 30px rgba(246, 211, 138, .15); }
.round-head { display: flex; gap: 12px; align-items: center; }
.round-head b { display: block; font-family: var(--serif); font-size: 19px; }
.round-no {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 700 17px var(--serif); color: var(--gold); border: 1px solid rgba(246, 211, 138, .5);
}
.round.on .round-no { background: var(--gold); color: #2a1606; }
.round:not(.on) .start { color: var(--ink); background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px var(--card-line); }
.grow { flex: 1; min-width: 0; }

/* ---------- company feed ---------- */
.post {
  border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden;
  border: 1px solid var(--card-line);
  background: linear-gradient(160deg, rgba(120, 80, 220, .35), rgba(40, 20, 80, .55));
}
.post-praise { background: linear-gradient(160deg, rgba(246, 211, 138, .38), rgba(120, 70, 20, .45)); border-color: rgba(246, 211, 138, .5); }
.post-hint { background: linear-gradient(160deg, rgba(190, 40, 60, .35), rgba(20, 8, 20, .75)); border-color: rgba(255, 120, 130, .35); }
.post-head { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.post-icon { font-size: 22px; }
.post-date { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--ink-mute); }
.post-media { display: block; width: 100%; margin-top: 14px; border-radius: 14px; max-height: 70svh; object-fit: cover; background: #000; }
.post-body { font-family: var(--serif); font-size: 22px; line-height: 1.4; color: var(--ink); margin: 14px 0 0; white-space: pre-line; }
