:root {
  --bg: #07060a;
  --bg2: #120c12;
  --ink: #f3ece0;
  --muted: #a99f93;
  --gold: #e8c46a;
  --gold2: #b8912f;
  --red: #c8102e;
  --panel: rgba(22, 16, 22, .78);
  --line: rgba(232, 196, 106, .22);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(200, 16, 46, .28), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(232, 196, 106, .10), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 1; opacity: .07;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 33%{transform:translate(-3%,2%)} 66%{transform:translate(2%,-3%)} 100%{transform:translate(0,0)} }

#root { position: relative; z-index: 2; max-width: 860px; margin: 0 auto; padding: 24px 16px 80px; }
.view[hidden], [hidden] { display: none !important; }

h1, h2, .brand, .countdown b, .kicker, #card { font-family: Cinzel, Georgia, serif; }
h2 { font-size: 1.35rem; letter-spacing: .04em; margin: 0 0 .6rem; color: var(--gold); }
.kicker { text-transform: uppercase; letter-spacing: .35em; font-size: .72rem; color: var(--muted); margin: 0 0 .6rem; }
.muted { color: var(--muted); }

.poster { text-align: center; padding: 9vh 0 4vh; }
.title {
  margin: 0; font-weight: 900; line-height: .9;
  font-size: clamp(3rem, 13vw, 7.5rem); letter-spacing: .06em;
  background: linear-gradient(180deg, #fff6dc 0%, var(--gold) 45%, var(--gold2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(232, 196, 106, .25));
}
.title span { display: block; font-size: .42em; letter-spacing: .6em; margin-top: .3em; padding-left: .6em; }
.tagline { font-style: italic; color: var(--muted); margin-top: 1.2rem; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; margin: 22px 0; backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.panel.narrow { max-width: 420px; margin: 0 auto; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 14px 0 0; }
input, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  background: rgba(0, 0, 0, .45); color: var(--ink); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px; font: inherit; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 196, 106, .18); }
.btn {
  appearance: none; border: 0; cursor: pointer; font: 600 1rem Inter, sans-serif;
  padding: 12px 20px; border-radius: 999px; margin-top: 18px;
}
.btn.gold { background: linear-gradient(180deg, #f5d98a, var(--gold2)); color: #1a1206; }
.btn.gold:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.error { color: #ff7d8c; min-height: 1.2em; margin: 10px 0 0; font-size: .9rem; }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.saved { color: #8fd19e; font-size: .9rem; margin-top: 18px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.brand { letter-spacing: .25em; color: var(--ink); }
.brand b { color: var(--gold); }

.hero { text-align: center; padding: 8vh 0 3vh; }
.countdown { display: flex; justify-content: center; gap: clamp(8px, 3vw, 22px); }
.countdown div { min-width: 0; flex: 0 1 120px; }
.countdown b {
  display: block; font-weight: 700; font-size: clamp(2.2rem, 11vw, 5rem); line-height: 1;
  color: var(--ink); text-shadow: 0 0 30px rgba(200, 16, 46, .6), 0 0 2px #fff;
  font-variant-numeric: tabular-nums;
}
.countdown span { display: block; margin-top: 6px; font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); margin: 1.2rem 0 0; }

.btn.play {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 28px;
  background: var(--red); color: #fff; padding: 14px 26px 14px 18px; font-size: 1.05rem;
  box-shadow: 0 0 0 0 rgba(200, 16, 46, .7); animation: pulse 2.4s infinite;
}
.btn.play .tri { width: 0; height: 0; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(200, 16, 46, .6) } 70% { box-shadow: 0 0 0 22px rgba(200, 16, 46, 0) } 100% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0) } }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.rules div { border-top: 1px solid var(--line); padding-top: 12px; }
.rules b { display: block; font-family: Cinzel, serif; color: var(--gold); letter-spacing: .05em; }
.rules span { color: var(--muted); font-size: .88rem; }
@media (max-width: 640px) { .rules { grid-template-columns: 1fr; } }

.dl { margin: 12px 0 0; }
.dl dt { font-family: Cinzel, serif; color: var(--gold); letter-spacing: .06em; margin-top: 14px; font-size: .95rem; }
.dl dd { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reveal h2 { font-size: clamp(1.4rem, 5vw, 2rem); color: var(--ink); }
.glow { color: var(--gold); text-shadow: 0 0 24px rgba(232, 196, 106, .55); }

/* ---------------- CINEMA ---------------- */
#cinema { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; overflow: hidden; }
#cinema .bar { flex: 0 0 11vh; background: #000; z-index: 3; }
#cinema .stage {
  flex: 1; position: relative; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(120, 10, 30, .35), transparent 70%), #030203;
}
#cinema .stage::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, .85)); pointer-events: none; }
#card { position: relative; z-index: 2; text-align: center; padding: 0 6vw; max-width: 1100px; }
#card .line { font-weight: 500; font-size: clamp(1.4rem, 4.6vw, 3rem); letter-spacing: .08em; color: #efe6d6; text-shadow: 0 0 20px rgba(0, 0, 0, .8); }
#card .big {
  font-weight: 900; font-size: clamp(2.6rem, 12vw, 9rem); letter-spacing: .08em; line-height: 1;
  background: linear-gradient(180deg, #fff8e2, var(--gold) 50%, #8a6a20);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 40px rgba(232, 196, 106, .45));
}
#card .small { font-family: Inter, sans-serif; font-size: clamp(.8rem, 2.2vw, 1.05rem); letter-spacing: .4em; text-transform: uppercase; color: var(--muted); margin-top: 1.2em; }
#card .wish { font-family: Inter, sans-serif; font-size: clamp(1rem, 3vw, 1.6rem); line-height: 1.5; color: #f3ece0; max-width: 900px; white-space: pre-wrap; overflow-wrap: anywhere; }
#card .label { font-size: clamp(.8rem, 2vw, 1rem); letter-spacing: .5em; color: var(--gold); margin-bottom: 1em; }

.anim-in { animation: cardIn 1.1s cubic-bezier(.2, .7, .1, 1) both; }
.anim-slam { animation: slam .55s cubic-bezier(.2, 1.4, .3, 1) both; }
.anim-out { animation: cardOut .6s ease both; }
@keyframes cardIn { from { opacity: 0; transform: scale(1.12); filter: blur(12px); letter-spacing: .3em; } to { opacity: 1; transform: none; filter: none; } }
@keyframes slam { from { opacity: 0; transform: scale(2.6); filter: blur(20px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes cardOut { to { opacity: 0; transform: scale(.96); filter: blur(6px); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
.flash.on { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 0%,100%{transform:none} 20%{transform:translate(-6px,3px)} 40%{transform:translate(5px,-4px)} 60%{transform:translate(-3px,2px)} 80%{transform:translate(2px,-1px)} }
.skip { position: absolute; right: 16px; bottom: 3vh; z-index: 5; color: #777; font-size: .85rem; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .grain, .btn.play { animation: none; }
}
#card .big.mid { font-size: clamp(2rem, 9vw, 6rem); }
#card .big.mt { margin-top: .4em; }
