:root {
  --night: #0b1530;
  --night-2: #13224a;
  --cranberry: #c8323f;
  --cranberry-d: #9e1f2c;
  --gold: #f2c66d;
  --cream: #fff6e6;
  --pine: #1f6b4f;
  --ink: #1d2233;
  --muted: #8b93ad;
  --card: #fffaf1;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --banner-h: 30px; /* test banner; set to 0px when removing it */
  --safe-t: calc(env(safe-area-inset-top, 0px) + var(--banner-h));
}
.test-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; min-height: calc(var(--banner-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0; display: flex; align-items: center; justify-content: center; text-align: center; background: #ffd400; color: #1d1600; font-weight: 800; font-size: 13px; line-height: 1.2; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1200px 700px at 50% -10%, #2b3f7a 0%, transparent 60%),
    radial-gradient(900px 500px at 50% 120%, #14304a 0%, transparent 60%),
    var(--night);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 .4em; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.screen { display: none; position: relative; z-index: 1; min-height: 100dvh; }
.screen.active { display: flex; }

/* Home */
#home { flex-direction: column; align-items: center; justify-content: space-between; gap: 10px; padding: calc(14px + var(--safe-t)) 20px calc(14px + var(--safe-b)); overflow: hidden; }
#home > :not(.scene) { position: relative; z-index: 1; }

/* Scenery: aurora, moon, sleigh, snowy hills */
.scene { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.aurora { position: absolute; width: 140%; height: 46%; left: -20%; top: -12%; filter: blur(46px); opacity: .55; mix-blend-mode: screen; border-radius: 50%; }
.aurora.a1 { background: radial-gradient(60% 45% at 35% 60%, #2fe0a6 0%, transparent 70%), radial-gradient(40% 40% at 75% 45%, #4f8cff 0%, transparent 70%); animation: drift 14s ease-in-out infinite alternate; }
.aurora.a2 { top: -4%; opacity: .4; background: radial-gradient(45% 40% at 60% 55%, #b46bff 0%, transparent 70%), radial-gradient(35% 35% at 20% 40%, #3fd1ff 0%, transparent 70%); animation: drift 18s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translateX(-6%) skewX(-6deg); } to { transform: translateX(6%) skewX(6deg); } }
.moon { position: absolute; top: calc(64px + var(--safe-t)); right: 9%; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #fffbe9, #f4e3b0 70%); box-shadow: 0 0 40px 12px rgba(255,240,200,.28), 0 0 120px 40px rgba(255,240,200,.12); }
.sleigh { position: absolute; top: calc(78px + var(--safe-t)); left: -30%; font-size: 22px; letter-spacing: -6px; filter: brightness(0) drop-shadow(0 0 1px rgba(255,255,255,.25)); opacity: .85; white-space: nowrap; transform: scaleX(-1); animation: fly 22s linear infinite; animation-delay: 3s; }
@keyframes fly { 0% { left: -30%; top: calc(110px + var(--safe-t)); } 55% { left: 115%; top: calc(58px + var(--safe-t)); } 100% { left: 115%; top: calc(58px + var(--safe-t)); } }
.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 30vh; min-height: 160px; }
.hill-back { fill: #1b2c57; }
.hill-front { fill: #e9f0ff; }
.pines-back path { fill: #12234a; }
.pines-front path { fill: #0f3a32; }
.cottage .roof { fill: #f4f7ff; } .cottage .wall { fill: #5a2a2a; } .cottage .chimney { fill: #4a2222; }
.cottage .win { fill: #ffd36b; filter: drop-shadow(0 0 3px #ffcc55); animation: flicker 4s ease-in-out infinite; }
@keyframes flicker { 50% { opacity: .75; } }

.topbar { width: 100%; max-width: 520px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; gap: 8px; align-items: center; font-family: "Fraunces", serif; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; color: var(--gold); }
.star { font-size: 16px; }
.online { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; color: #d6ffe9; background: rgba(47,154,111,.22); border: 1px solid rgba(95,220,160,.35); padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(6px); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #45e39a; box-shadow: 0 0 0 0 rgba(69,227,154,.7); animation: pulse-g 1.8s infinite; }
@keyframes pulse-g { 70% { box-shadow: 0 0 0 8px rgba(69,227,154,0); } 100% { box-shadow: 0 0 0 0 rgba(69,227,154,0); } }

.hero { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 440px; width: 100%; }
.hero h1 { font-size: clamp(28px, 7.4vw, 42px); line-height: 1.05; margin-top: 18px; text-shadow: 0 2px 18px rgba(0,0,0,.45); }
.sub { color: #d8dcef; font-size: 17px; margin: 0 0 20px; }
.tiny { color: var(--muted); font-size: 13px; min-height: 1.2em; margin-top: 14px; }

/* Incoming-call card with Santa's real avatar */
.callcard { position: relative; height: min(36dvh, 380px); aspect-ratio: 4 / 5; max-width: 100%; }
.callcard-rings { position: absolute; inset: 0; pointer-events: none; }
.callcard-rings span { position: absolute; inset: 0; border-radius: 34px; border: 2px solid rgba(242,198,109,.55); animation: ring-out 2.6s ease-out infinite; }
.callcard-rings span + span { animation-delay: 1.3s; }
@keyframes ring-out { from { transform: scale(1); opacity: .9; } to { transform: scale(1.14); opacity: 0; } }
.callcard-frame { position: relative; width: 100%; height: 100%; border-radius: 30px; overflow: hidden; background: linear-gradient(160deg, #3a1d1d, #120a14); border: 3px solid var(--gold); box-shadow: 0 0 0 6px rgba(242,198,109,.14), 0 24px 60px rgba(0,0,0,.55), 0 0 60px rgba(255,170,80,.25); animation: card-float 5s ease-in-out infinite; }
@keyframes card-float { 50% { transform: translateY(-6px); } }
.callcard-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 64% 40%; transform: scale(1.12); transform-origin: 64% 40%; }
.callcard-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 22%, transparent 55%, rgba(8,6,16,.88) 100%); }
/* Workshop loop (Santa checking his list) over Santa's photo; the photo shows when video can't play */
.callcard-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; background: #2a1414; }
.callcard .n-santa { display: none; }
.callcard.novideo .callcard-video, .callcard.novideo .n-workshop { display: none; }
.callcard.novideo .n-santa { display: flex; }
.callcard-fallback { display: none; position: absolute; inset: 0; place-items: center; font-size: 110px; }
.callcard.noimg .callcard-img { display: none; }
.callcard.noimg .callcard-fallback { display: grid; }
.chip { position: absolute; z-index: 1; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .02em; color: #fff; background: rgba(0,0,0,.45); padding: 5px 10px; border-radius: 999px; backdrop-filter: blur(6px); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff4d5e; animation: pulse 1.6s infinite; }
.callcard-name { position: absolute; z-index: 1; left: 0; right: 0; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.callcard-name strong { font-family: "Fraunces", serif; font-size: 26px; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.callcard-name span { font-size: 13px; font-weight: 700; color: #f3e2c0; }

.btn { border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 800; font-size: 16px; color: #fff; background: var(--cranberry); box-shadow: 0 6px 0 var(--cranberry-d); transition: transform .08s, box-shadow .08s, opacity .2s; }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--cranberry-d); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.btn-ghost:active { box-shadow: inset 0 0 0 2px currentColor; }
.btn-call { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 24px; padding: 20px 46px; overflow: hidden; background: linear-gradient(180deg, #38b27f, var(--pine)); box-shadow: 0 7px 0 #134634, 0 18px 40px rgba(31,107,79,.5), 0 0 0 6px rgba(69,227,154,.12); animation: nudge 2.4s ease-in-out infinite; }
.btn-call::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-call:disabled { animation: none; }
.btn-call:disabled::after { display: none; }
.btn-call:active { box-shadow: 0 3px 0 #134634; }
.phone { width: 26px; height: 26px; fill: currentColor; flex: none; }
@keyframes nudge { 0%, 85%, 100% { transform: none; } 88% { transform: rotate(-3deg); } 92% { transform: rotate(3deg); } 96% { transform: rotate(-2deg); } }
.home-foot { display: flex; gap: 10px; }
.home-foot .link-btn { color: #e9eefc; text-decoration: none; font-weight: 800; font-size: 14px; padding: 8px 16px; border-radius: 999px; background: rgba(11,21,48,.72); box-shadow: 0 4px 14px rgba(0,0,0,.25); backdrop-filter: blur(6px); }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.small { font-size: 13px; }

/* Modal + cards */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5,10,25,.7); backdrop-filter: blur(4px); padding: 20px; }
.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.card + .card { margin-top: 16px; }
.card h2, .card h3 { color: var(--ink); }
.card p { margin: .3em 0 .8em; }
.gate-q { font-family: "Fraunces", serif; font-size: 30px; font-weight: 800; text-align: center; }
.card input, .card textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 14px; border: 2px solid #e6dcc8; background: #fff; color: var(--ink); margin-top: 6px; }
.card input:focus, .card textarea:focus { outline: none; border-color: var(--gold); }
.card label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.err { color: var(--cranberry); font-weight: 700; min-height: 1em; margin: 8px 0 0; }
.muted { color: #6b7290; font-weight: 500; }
.saved { color: var(--pine); font-weight: 800; margin-left: 10px; }

/* Parent */
#parent { justify-content: center; padding: calc(20px + var(--safe-t)) 16px calc(30px + var(--safe-b)); }
.panel { width: 100%; max-width: 460px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head .link-btn { color: var(--gold); font-weight: 800; text-decoration: none; font-size: 17px; }
.balance-big { font-family: "Fraunces", serif; font-size: 34px; font-weight: 800; margin: 0; }
.packs { display: grid; gap: 10px; margin: 14px 0; }
.pack { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid #eadfca; background: #fff; color: var(--ink); }
.pack:hover { border-color: var(--gold); }
.pack b { display: block; font-size: 17px; }
.pack small { color: #6b7290; }
.pack .price { font-family: "Fraunces", serif; font-weight: 800; font-size: 22px; color: var(--cranberry); white-space: nowrap; }
.pack .badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--cranberry-d); background: #f6ead2; padding: 3px 8px; border-radius: 999px; margin-bottom: 4px; }
.pack.featured { border-color: var(--gold); background: #fffbf1; box-shadow: 0 0 0 3px rgba(242,198,109,.35); }
.pack.featured .badge { background: var(--gold); color: var(--ink); }
.pack:disabled { opacity: .55; cursor: default; }

/* Share card */
.share-card { background: linear-gradient(160deg, #fff8e7, #ffefd2); border: 2px solid #f2d79a; }
.share-kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--cranberry-d); margin: 0 0 4px !important; }
.btn-share { display: inline-flex; align-items: center; gap: 10px; background: linear-gradient(180deg, #38b27f, var(--pine)); box-shadow: 0 6px 0 #134634; }
.btn-share:active { box-shadow: 0 3px 0 #134634; }
.btn-share svg { width: 20px; height: 20px; fill: currentColor; }
.share-alt { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip-btn { border: 2px solid #e6d3a8; background: #fff; color: var(--ink); font-weight: 800; font-size: 14px; padding: 7px 14px; border-radius: 999px; }
.share-status { font-weight: 800; color: var(--pine); min-height: 1.2em; margin: 12px 0 0 !important; }
.share-status.warn { color: var(--cranberry-d); }
.after-share { margin-top: 14px; color: var(--gold); }

/* Launch promo */
.promo-banner { display: flex; align-items: center; gap: 12px; text-align: left; margin: -6px 0 22px; padding: 12px 18px 12px 14px; border: 2px solid rgba(242,198,109,.7); border-radius: 18px; background: linear-gradient(180deg, rgba(242,198,109,.22), rgba(242,198,109,.1)); color: var(--cream); backdrop-filter: blur(6px); box-shadow: 0 0 0 0 rgba(242,198,109,.5); animation: promo-pulse 2.4s ease-out infinite; max-width: 360px; }
.promo-gift { font-size: 28px; }
.promo-text b { display: block; font-size: 15px; color: #fff3d6; }
.promo-left { display: block; font-size: 13px; font-weight: 700; color: #f2c66d; margin-top: 2px; }
.promo-left .promoLeft { font-weight: 900; }
@keyframes promo-pulse { 70% { box-shadow: 0 0 0 12px rgba(242,198,109,0); } 100% { box-shadow: 0 0 0 0 rgba(242,198,109,0); } }
.promo-meter { height: 10px; border-radius: 999px; background: #f1e2bf; overflow: hidden; margin: 2px 0 14px; }
.promo-meter span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cranberry), var(--gold)); transition: width .6s ease; }
.tips { padding-left: 20px; margin: 0 0 10px; }
.tips li { margin-bottom: 6px; }
code { background: #f1e8d6; padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* Waiting + after */
#waiting, #after { align-items: center; justify-content: center; text-align: center; padding: 24px; }
.wait-wrap { max-width: 400px; display: flex; flex-direction: column; align-items: center; }
.elf { font-size: 90px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-4deg); } }
.queue-pos { display: flex; flex-direction: column; align-items: center; font-family: "Fraunces", serif; font-size: 72px; font-weight: 800; color: var(--gold); line-height: 1; margin: 10px 0 14px; }
.queue-pos small { font-family: "Nunito", sans-serif; font-size: 15px; color: var(--muted); font-weight: 700; }
#waiting .btn-ghost { margin-top: 18px; color: var(--muted); }

/* Call */
#call { background: #000; overflow: hidden; }
#santaVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#selfView { position: absolute; right: 14px; top: calc(60px + var(--safe-t)); width: 28vw; max-width: 150px; aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255,255,255,.7); transform: scaleX(-1); box-shadow: 0 8px 24px rgba(0,0,0,.5); background: #111; }
.call-top { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; right: 14px; display: flex; align-items: center; gap: 8px; font-weight: 800; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 0 0 rgba(255,77,94,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255,77,94,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,94,0); } }
.timer { margin-left: auto; background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.timer.low { background: var(--cranberry); }
.call-controls { position: absolute; bottom: calc(26px + var(--safe-b)); left: 0; right: 0; display: flex; justify-content: center; gap: 22px; }
.round { width: 62px; height: 62px; border-radius: 50%; border: 0; font-size: 24px; background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(8px); }
.round.off { background: rgba(255,255,255,.85); }
.round.end { background: #e5323f; width: 72px; height: 72px; font-size: 28px; font-weight: 800; }
.connecting { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(circle at 50% 40%, #233a78, var(--night)); font-family: "Fraunces", serif; font-size: 22px; font-weight: 600; }
.ring { width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--gold); position: relative; }
.ring::before, .ring::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--gold); animation: ripple 1.8s ease-out infinite; }
.ring::after { animation-delay: .9s; }
@keyframes ripple { to { transform: scale(1.8); opacity: 0; } }
.tap-sound { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; }
.tap-sound { border: 0; border-radius: 999px; padding: 16px 26px; font-weight: 800; font-size: 18px; background: var(--gold); color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 30; font-weight: 700; max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
