* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(ellipse at top, #16335c, #0b1a2e 70%);
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* falling snow */
.snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(3px 3px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 80px 120px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 150px 60px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 220px 160px, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 300px 90px, #fff 50%, transparent 51%);
  background-size: 320px 200px;
  opacity: .6;
  animation: snow 12s linear infinite;
}
@keyframes snow { to { background-position: 40px 600px; } }

.screen {
  position: fixed; inset: 0; z-index: 1;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
}
.screen.active { display: flex; }
.hidden { display: none !important; }

/* start + ended */
.start-card { text-align: center; max-width: 380px; width: 100%; }
.start-emoji { font-size: 92px; line-height: 1; margin-bottom: 10px; animation: bob 3s ease-in-out infinite; }
h1 { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.sub { opacity: .85; margin: 6px 0 28px; font-size: 18px; }
.btn-primary {
  width: 100%; padding: 18px; border: 0; border-radius: 18px;
  font-size: 20px; font-weight: 700; color: #fff;
  background: linear-gradient(#e0263f, #a50d23);
  box-shadow: 0 10px 30px rgba(200,16,46,.45);
  cursor: pointer;
}
.btn-primary:active { transform: scale(.98); }
.grownups { margin-top: 26px; text-align: left; background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px 16px; font-size: 14px; }
.grownups summary { cursor: pointer; font-weight: 600; opacity: .9; }
.grownups ul { margin: 10px 0 2px 18px; line-height: 1.45; opacity: .85; }
.grownups li { margin-bottom: 6px; }

/* ringing */
#screen-ringing { justify-content: space-between; padding-top: calc(env(safe-area-inset-top) + 70px); padding-bottom: calc(env(safe-area-inset-bottom) + 60px); }
.ring-top { text-align: center; }
.ring-avatar {
  width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 22px;
  background: #2a5a8c; overflow: hidden; border: 4px solid rgba(255,255,255,.25);
}
.ring-avatar svg { width: 100%; height: 100%; transform: scale(1.1) translateY(4px); }
.pulse { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); }
  100% { box-shadow: 0 0 0 30px rgba(255,255,255,0); }
}
.ring-name { font-size: 34px; font-weight: 700; }
.ring-sub { opacity: .8; margin-top: 6px; font-size: 17px; }
.ring-actions { display: flex; gap: 90px; }
.ring-action { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 15px; opacity: .95; }

.round {
  width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
}
.round svg { width: 34px; height: 34px; fill: #fff; }
.round.big { width: 78px; height: 78px; }
.round.red { background: #ff3b30; }
.round.green { background: #34c759; }
.round.glass { background: rgba(255,255,255,.22); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.round.glass.on { background: #fff; }
.round.glass.on svg { fill: #111; }
.round:active { transform: scale(.94); }
.wiggle { animation: wiggle 1.2s ease-in-out infinite; }
@keyframes wiggle { 0%,60%,100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(12deg); } 90% { transform: rotate(-8deg); } }

/* in call */
#screen-call { padding: 0; justify-content: flex-end; background: #000; }
.scene { position: absolute; inset: 0; }
.scene-svg { width: 100%; height: 100%; display: block; }
.call-top {
  position: absolute; top: calc(env(safe-area-inset-top) + 16px); left: 0; right: 0;
  text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.call-name { font-size: 22px; font-weight: 700; }
.call-timer { font-size: 15px; opacity: .9; margin-top: 2px; font-variant-numeric: tabular-nums; }

.call-controls {
  position: relative; z-index: 2; display: flex; gap: 46px; align-items: center;
  padding: 18px 30px calc(env(safe-area-inset-bottom) + 30px);
}
#btn-mute .ic-mic-off { display: none; }
#btn-mute.on .ic-mic { display: none; }
#btn-mute.on .ic-mic-off { display: block; }

.listen-badge {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 8px 14px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity .3s;
}
.listen-badge.show { opacity: 1; }
.listen-badge .dot { width: 10px; height: 10px; border-radius: 50%; background: #34c759; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

.type-form {
  position: relative; z-index: 2; display: flex; gap: 8px; width: calc(100% - 40px); max-width: 420px; margin-top: 12px;
}
.type-form input {
  flex: 1; padding: 14px 16px; border-radius: 999px; border: 0; font-size: 17px;
  background: rgba(255,255,255,.92); color: #111; user-select: text;
}
.type-form button { width: 50px; border: 0; border-radius: 50%; background: #34c759; color: #fff; font-size: 20px; }

.thinking {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  display: none; gap: 8px; background: rgba(255,255,255,.9); padding: 12px 16px; border-radius: 22px;
}
.thinking.show { display: flex; }
.thinking span { width: 10px; height: 10px; border-radius: 50%; background: #c8102e; animation: dots 1s infinite; }
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-6px); opacity: 1; } }

/* Santa animation */
.santa .head { transform-origin: 200px 500px; animation: sway 5s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
.santa .eyes { transform-box: fill-box; transform-origin: center; animation: eyeblink 4.5s infinite; }
@keyframes eyeblink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.santa .mouth { transform-box: fill-box; transform-origin: center top; transform: scaleY(.35); transition: transform .1s; }
.talking .santa .mouth { animation: talk .28s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.3); } to { transform: scaleY(1.25); } }
.talking .santa .head { animation: sway 5s ease-in-out infinite, nod .9s ease-in-out infinite; }
@keyframes nod { 50% { translate: 0 3px; } }
.fire-glow { animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 0%,100% { opacity: .85; } 40% { opacity: 1; } 70% { opacity: .7; } }
.lights circle { animation: twinkle 1.8s ease-in-out infinite; }
.lights circle:nth-child(2n) { animation-delay: .9s; }
@keyframes twinkle { 50% { opacity: .35; } }
.win-snow { animation: winsnow 6s linear infinite; }
@keyframes winsnow { from { transform: translateY(-20px); } to { transform: translateY(30px); } }

@keyframes bob { 50% { transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
  .talking .santa .mouth { animation: talk .28s ease-in-out infinite alternate !important; }
}
