:root {
  --night: #12223a;
  --night-2: #1b3150;
  --paper: #fbf6ec;
  --paper-2: #f3eadb;
  --ink: #2a211c;
  --muted: #7a6a5c;
  --red: #b3302a;
  --red-dark: #8e231f;
  --green: #1f5e45;
  --gold: #d6a243;
  --line: #e5d8c3;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 16px/1.5 var(--sans); color: var(--ink);
  background: radial-gradient(ellipse at 50% -20%, #2a4a74 0%, var(--night) 55%) fixed, var(--night);
}
a { color: var(--red); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }

/* śnieg */
.snow { position: absolute; inset: 0; }
.snow i {
  position: absolute; top: -10px; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .7;
  animation: fall linear infinite;
}
@keyframes fall { to { transform: translate3d(30px, 105vh, 0); } }

.top {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 30px 16px 14px; color: #f4ead8;
}
.brand { font-family: var(--serif); font-size: 22px; color: #fff; text-decoration: none; }
.top-actions { display: flex; gap: 6px; }
.chip {
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); color: #f4ead8;
  padding: 6px 12px; border-radius: 999px; font-size: 14px; text-decoration: none; cursor: pointer;
}
.chip:hover { background: rgba(255, 255, 255, .14); }

main { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 0 16px 150px; }

.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px; margin: 0 0 18px;
}
.card.center { text-align: center; }
.lead { font-size: 17px; color: #4d4036; }
.muted { color: var(--muted); font-size: 14px; }
.hello { color: #fff; font-family: var(--serif); font-size: 30px; margin: 10px 0 6px; }
.hello-sub { color: #d9cdb8; margin: 0 0 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font: 600 16px var(--sans); padding: 13px 22px; border-radius: 999px;
  text-decoration: none; transition: transform .08s, background .15s;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: scale(.98); }
.btn.green { background: var(--green); }
.btn.green:hover { background: #174a36; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.status { display: inline-block; font-size: 14px; font-weight: 600; color: var(--green); }

/* karta Mikołaja (podsumowanie) */
.letter {
  background: var(--paper) linear-gradient(transparent 31px, var(--line) 32px) 0 6px / 100% 32px;
  border-radius: var(--radius); padding: 24px 22px; box-shadow: var(--shadow); position: relative;
}
.letter::before {
  content: "🎄"; position: absolute; right: 16px; top: -18px; font-size: 34px;
}
.letter .from { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 32px; margin: 0 0 8px; }
.letter h3 { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin: 14px 0 4px; }
.letter ul { margin: 0; padding-left: 1.1em; line-height: 32px; }
.letter ul.avoid li::marker { content: "✕  "; color: var(--muted); }
.note { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* koperta */
.envelope {
  position: relative; background: #e9d9bd; border-radius: 12px; padding: 26px 18px; text-align: center;
  border: 2px dashed #c9b28c; margin-top: 12px;
}
.envelope .seal {
  width: 54px; height: 54px; border-radius: 50%; background: var(--red); color: #fff; display: grid;
  place-items: center; font-size: 26px; margin: 0 auto 12px; box-shadow: 0 3px 0 var(--red-dark);
}
.reveal-name { font-family: var(--serif); font-size: 34px; color: var(--red); margin: 4px 0 8px; }
.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 6px; }

/* czat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 82px); max-width: 720px; margin: 0 auto;
  position: relative; z-index: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 11px 15px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.msg.santa { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 6px; }
.msg.santa::before { content: "🎅 "; }
.msg.person { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 6px; }
.msg.typing { opacity: .8; font-style: italic; }
.msg.error { align-self: center; background: #fde8e6; color: var(--red-dark); font-size: 14px; }
.chat-bar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(10, 20, 36, .7);
  backdrop-filter: blur(8px); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: none; border: 0; border-radius: 20px; padding: 11px 15px; font: 16px/1.4 var(--sans);
  max-height: 140px; min-height: 44px; background: var(--paper);
}
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; font-size: 20px;
  display: grid; place-items: center; background: var(--paper); flex: none; }
.icon-btn.send { background: var(--red); color: #fff; }
.icon-btn.rec { background: var(--red); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(179, 48, 42, .3); } }
.chat-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.linkbtn { background: none; border: 0; color: #d9cdb8; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 2px; }
.chat-summary { padding: 0 16px 24px; }

/* formularze */
input[type=text], input[type=email], input[type=number], select {
  font: 15px var(--sans); padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); min-width: 0;
}
label.inline { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 480px) {
  .hello { font-size: 26px; }
  .card { padding: 18px 16px; }
}

/* ---------- scena: niebo, księżyc, gwiazdy, sanie, wzgórza, lampki ---------- */
.scene { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  animation: twinkle ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .95; } }
.moon { position: absolute; top: 84px; right: 7vw; width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffdf2 0%, #f6e8bd 55%, #e3cf92 100%);
  box-shadow: 0 0 40px 14px rgba(255, 240, 190, .22), 0 0 140px 50px rgba(255, 240, 190, .08); }
.moon::before, .moon::after { content: ""; position: absolute; border-radius: 50%; background: rgba(200, 180, 120, .35); }
.moon::before { width: 14px; height: 14px; top: 20px; left: 38px; }
.moon::after { width: 9px; height: 9px; top: 44px; left: 22px; }

.sleigh { position: absolute; top: 15vh; left: 0; width: 230px; opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 228, 150, .85)); }
.sleigh.fly { animation: fly 15s linear forwards; }
@keyframes fly {
  0% { transform: translate(-260px, 60px) rotate(-5deg); opacity: 1; }
  25% { transform: translate(22vw, 10px) rotate(-2deg); }
  50% { transform: translate(48vw, 35px) rotate(3deg); }
  75% { transform: translate(74vw, -5px) rotate(-3deg); }
  100% { transform: translate(calc(100vw + 40px), -50px) rotate(-7deg); opacity: 1; }
}
.rudolph { animation: nose 1s ease-in-out infinite alternate; filter: drop-shadow(0 0 4px #ff4a3d); }
@keyframes nose { to { opacity: .45; } }
.sleigh-body use { animation: gallop .5s ease-in-out infinite alternate; }
.sleigh-body use:nth-of-type(2) { animation-delay: .17s; }
.sleigh-body use:nth-of-type(3) { animation-delay: .33s; }
@keyframes gallop { to { transform: translateY(-3px); } }
.spark { position: fixed; z-index: 0; width: 4px; height: 4px; border-radius: 50%; pointer-events: none;
  background: #fff0b8; box-shadow: 0 0 6px 2px rgba(255, 214, 120, .85); animation: spark 1.8s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), 46px) scale(.2); opacity: 0; } }

.hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 170px; }
.hills .window { animation: glow 3s ease-in-out infinite alternate; }
.hills .window + .window { animation-delay: 1.3s; }
@keyframes glow { to { fill: #ffb347; } }

.lights { position: absolute; top: 0; left: 0; right: 0; height: 44px; z-index: 2; pointer-events: none; overflow: hidden; }
.lights svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bulb { position: absolute; width: 10px; height: 15px; margin-left: -5px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: bulb 1.6s ease-in-out infinite alternate; }
.bulb::before { content: ""; position: absolute; top: -4px; left: 2px; width: 6px; height: 5px; background: #3b3b3b; border-radius: 2px; }
@keyframes bulb { from { opacity: .45; box-shadow: none; } to { opacity: 1; box-shadow: 0 0 10px 3px var(--c); } }

/* ---------- Mikołaj ---------- */
.hero { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.hero-text { flex: 1; min-width: 0; }
.hero .santa { width: 200px; flex: none; }
.santa { overflow: visible; animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-1deg); } }
.santa-wave { transform-box: view-box; transform-origin: 130px 122px; animation: wave .9s ease-in-out infinite alternate; }
@keyframes wave { from { transform: rotate(-14deg); } to { transform: rotate(12deg); } }
.santa-eyes { transform-box: view-box; transform-origin: 100px 81px; animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.chat-hero { display: flex; align-items: center; gap: 10px; padding: 0 16px 6px; color: #f4ead8; }
.chat-hero .santa { width: 74px; flex: none; }
.chat-hero b { font-family: var(--serif); font-size: 20px; color: #fff; display: block; }

@media (max-width: 560px) {
  .hero { flex-direction: column-reverse; text-align: center; gap: 0; }
  .hero .santa { width: 150px; }
  .moon { width: 52px; height: 52px; top: 70px; right: 5vw; }
  .sleigh { width: 170px; top: 11vh; }
  .hills { height: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  .snow, .sleigh, .spark { display: none; }
  .santa, .santa-wave, .santa-eyes, .stars i, .bulb, .rudolph, .hills .window { animation: none; }
}
