:root {
  --red: #d42a3c;
  --red-d: #9e1626;
  --green: #1f7a4d;
  --green-d: #13502f;
  --gold: #f2c14e;
  --cream: #fbf7ef;
  --ink: #0a1630;
  --glass: rgba(255, 255, 255, 0.09);
  --glass-b: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--cream);
  background: radial-gradient(ellipse at 70% 0%, #1c3768 0%, #0e1f42 45%, #070f22 100%) fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

/* ---------- niebo ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.stars span {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  animation: twinkle var(--d, 3s) ease-in-out infinite; animation-delay: var(--delay, 0s);
}
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.moon {
  position: absolute; top: 6vh; right: 8vw; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #f3e5b5 60%, #e3cf8f);
  box-shadow: 0 0 60px 20px rgba(255, 243, 200, .25), 0 0 140px 60px rgba(255, 243, 200, .1);
}
.flyer { position: absolute; width: 34px; height: 22px; color: #04070f; opacity: .85; }
.f1 { top: 12vh; animation: fly 26s linear infinite; }
.f2 { top: 18vh; width: 24px; animation: fly 32s linear infinite 6s; }
.f3 { top: 9vh; width: 28px; animation: fly 29s linear infinite 15s; }
@keyframes fly {
  0% { transform: translate(-60px, 0); }
  25% { transform: translate(25vw, -20px); }
  50% { transform: translate(50vw, 10px); }
  75% { transform: translate(75vw, -15px); }
  100% { transform: translate(calc(100vw + 60px), 0); }
}
#snow, #confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#snow { z-index: 1; }
#confetti { z-index: 50; }

/* ---------- lampki ---------- */
.lights {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 5; pointer-events: none;
  display: flex; justify-content: space-around; padding: 0 8px;
}
.lights::before {
  content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 30px;
  border-bottom: 2px solid #1b2b1b; border-radius: 0 0 50% 50% / 0 0 14px 14px;
}
.bulb {
  position: relative; top: 12px; width: 10px; height: 16px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c); box-shadow: 0 0 10px 3px var(--c);
  animation: blink 1.6s ease-in-out infinite; animation-delay: var(--delay);
}
.bulb::before { content: ''; position: absolute; top: -4px; left: 2px; width: 6px; height: 5px; background: #2d3a2d; border-radius: 2px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; box-shadow: none; } }

/* ---------- układ ---------- */
main {
  position: relative; z-index: 2; flex: 1;
  width: 100%; max-width: 760px; margin: 0 auto; padding: 46px 16px 20px;
}
.top { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; }
h1 {
  font-family: 'Lobster', cursive; font-weight: 400; margin: 0; line-height: 1;
  font-size: clamp(30px, 8vw, 54px); color: var(--cream);
  text-shadow: 0 3px 0 var(--red-d), 0 0 24px rgba(242, 193, 78, .35);
}
h1 span { color: var(--gold); font-size: 1.15em; }
.sub { margin: 8px 0 0; font-weight: 700; opacity: .8; font-size: 15px; }
.hdr-bird { width: clamp(56px, 16vw, 100px); height: auto; flex-shrink: 0; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.hdr-crow { animation: bob 3s ease-in-out infinite; }
.hdr-heron { animation: bob 3.4s ease-in-out infinite .5s; height: clamp(70px, 20vw, 125px); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-3deg); } }

.screen { display: none; text-align: center; padding-top: 18px; }
.screen.active { display: block; animation: enter .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes enter { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
h2 { font-family: 'Lobster', cursive; font-weight: 400; font-size: clamp(28px, 6vw, 38px); margin: 6px 0; color: var(--gold); }
.hint { margin: 0 auto 18px; max-width: 460px; opacity: .85; line-height: 1.45; }
.small { font-size: 13px; opacity: .65; margin-top: 18px; line-height: 1.4; }

.card {
  background: var(--glass); border: 1px solid var(--glass-b); border-radius: 26px;
  padding: 26px 20px; max-width: 480px; margin: 0 auto;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

/* ---------- przyciski ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 13px 26px; font-weight: 800; font-size: 17px;
  color: #fff; background: linear-gradient(180deg, #e8394c, var(--red-d));
  box-shadow: 0 5px 0 #6e0d18, 0 10px 20px rgba(0,0,0,.3);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #6e0d18, 0 4px 10px rgba(0,0,0,.3); }
.btn:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }
.btn-big { font-size: 21px; padding: 16px 36px; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--cream); opacity: .75; font-weight: 700; }
.btn-ghost:active { transform: none; box-shadow: none; }
.btn-small { padding: 8px 16px; font-size: 14px; background: linear-gradient(180deg, #2a9a62, var(--green-d)); box-shadow: 0 3px 0 #0b3520; }
.actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }

/* ---------- wybór osoby ---------- */
.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .people { grid-template-columns: repeat(4, 1fr); } }
.person {
  position: relative; border: 1px solid var(--glass-b); border-radius: 22px; padding: 16px 8px 14px;
  background: var(--glass); color: var(--cream);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.4), background .2s, box-shadow .2s;
  animation: pop .5s cubic-bezier(.2,.9,.3,1.3) backwards; animation-delay: var(--delay);
}
@keyframes pop { from { opacity: 0; transform: scale(.6) translateY(20px); } }
.person:hover { transform: translateY(-5px) rotate(-1deg); background: rgba(255,255,255,.15); box-shadow: 0 12px 26px rgba(0,0,0,.3); }
.person:active { transform: scale(.96); }
.person .name { font-weight: 900; font-size: 18px; }
.person .tag { font-size: 12px; font-weight: 700; opacity: .7; min-height: 16px; }
.person.drawn { background: rgba(31, 122, 77, .22); border-color: rgba(80, 200, 130, .35); }
.person.drawn .tag { color: #9df0bf; opacity: 1; }

.avatar {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #33508a, #172a52);
  border: 3px solid var(--gold); box-shadow: 0 0 0 4px rgba(242,193,78,.18), inset 0 -6px 12px rgba(0,0,0,.3);
  overflow: hidden;
}
.avatar svg { width: 84%; height: 84%; margin-top: 8%; }
.avatar.heron svg { margin-top: 4%; }
.avatar.big { width: 104px; height: 104px; margin: -60px auto 8px; }

/* ---------- koło ---------- */
.wheel-wrap { position: relative; width: min(88vw, 430px); aspect-ratio: 1; margin: 6px auto 0; }
#wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 16px 30px rgba(0,0,0,.45)); }
#wheel text { font-family: 'Nunito', sans-serif; font-weight: 900; }
.pointer {
  position: absolute; top: -10px; left: 50%; z-index: 3; width: 44px; height: 56px; margin-left: -22px;
  transform-origin: 50% 20%;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 50%, #c48b15);
  clip-path: polygon(50% 100%, 0 28%, 18% 0, 82% 0, 100% 28%);
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.5));
}
.pointer::after { content: '★'; position: absolute; top: 4px; left: 0; right: 0; text-align: center; color: var(--red); font-size: 20px; }
.pointer.kick { animation: kick .14s ease-out; }
@keyframes kick { 0% { transform: rotate(-24deg); } 100% { transform: rotate(0); } }
.hub {
  position: absolute; left: 50%; top: 50%; width: 24%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 4px solid var(--gold); padding: 0;
  background: radial-gradient(circle at 50% 35%, #2f4c86, #10203f);
  box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 -6px 10px rgba(0,0,0,.4);
  display: grid; place-items: center; transition: transform .2s;
}
.hub:hover { transform: translate(-50%, -50%) scale(1.06); }
.hub svg { width: 80%; height: 80%; margin-top: 10%; }
.rim-bulb { animation: rimblink 1.2s ease-in-out infinite; }
.rim-bulb:nth-child(odd) { animation-delay: .6s; }
.spinning .rim-bulb { animation-duration: .25s; }
@keyframes rimblink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- wynik ---------- */
.result-card { padding-top: 22px; }
.result-birds { display: flex; align-items: flex-end; justify-content: center; gap: 4px; margin-bottom: 6px; }
.rb { height: 86px; width: auto; }
.rb-crow { animation: hop 1s ease-in-out infinite; }
.rb-heron { height: 104px; animation: hop 1s ease-in-out infinite .5s; transform: scaleX(-1); }
@keyframes hop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.rb-heron { animation-name: hop; }
.gift { font-size: 64px; animation: wiggle 1.4s ease-in-out infinite; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
@keyframes wiggle { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-10deg) scale(1.08); } 75% { transform: rotate(10deg) scale(1.08); } }
.lead { font-size: 18px; font-weight: 700; margin: 4px 0 0; opacity: .9; }
.recipient {
  font-family: 'Lobster', cursive; font-size: clamp(48px, 14vw, 72px); color: var(--gold); line-height: 1.15; margin: 4px 0 14px;
  text-shadow: 0 4px 0 var(--red-d), 0 0 30px rgba(242,193,78,.5);
}
.recipient span { display: inline-block; animation: letter .6s cubic-bezier(.2,.9,.3,1.6) backwards; }
@keyframes letter { from { opacity: 0; transform: translateY(-40px) scale(.3) rotate(-20deg); } }
.pw-box {
  background: rgba(10, 22, 48, .55); border: 2px dashed rgba(242, 193, 78, .6); border-radius: 18px;
  padding: 14px 14px 10px; margin: 8px 0 20px;
}
.pw-label { margin: 0 0 8px; font-weight: 800; color: var(--gold); }
.pw { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pw code {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: clamp(18px, 5.4vw, 24px); font-weight: 700;
  background: var(--cream); color: var(--ink); padding: 8px 14px; border-radius: 12px; user-select: all;
}
.pw-note { font-size: 13.5px; opacity: .8; line-height: 1.45; margin: 10px 0 0; }

/* ---------- logowanie ---------- */
#s-login .card { margin-top: 56px; }
#login-form { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#pw-input {
  width: 100%; max-width: 320px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--glass-b);
  background: rgba(255,255,255,.95); color: var(--ink); font: 700 18px 'Nunito', sans-serif; text-align: center; outline: none;
}
#pw-input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242,193,78,.3); }
.err { color: #ff9aa5; font-weight: 800; min-height: 22px; margin: 10px 0 0; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.loader { font-size: 64px; margin-top: 40px; animation: bob 1.2s ease-in-out infinite; }
.loader.still { margin-top: 0; animation: none; }

/* ---------- ziemia ---------- */
.ground { position: relative; z-index: 2; height: 120px; margin-top: 30px; pointer-events: none; }
.drift { position: absolute; bottom: 0; left: 0; width: 100%; height: 90px; }
.g-bird { position: absolute; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.g-crow { left: 6%; bottom: 34px; width: 74px; animation: peck 4s ease-in-out infinite; transform-origin: 50% 90%; }
.g-heron { right: 7%; bottom: 30px; width: 76px; animation: bob 4s ease-in-out infinite; }
.tree { position: absolute; left: 50%; bottom: 36px; font-size: 54px; transform: translateX(-50%); filter: drop-shadow(0 0 12px rgba(242,193,78,.4)); }
@keyframes peck { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(12deg); } 86% { transform: rotate(0); } 92% { transform: rotate(10deg); } }
@media (max-width: 480px) { .tree { display: none; } .g-crow { width: 60px; } .g-heron { width: 62px; } .moon { width: 46px; height: 46px; top: 25vh; right: 5vw; opacity: .85; } }

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

/* nazwisko + podwójny ptaszek (Wrona-Czaplak) */
.person .surname { font-size: 12px; font-weight: 700; opacity: .6; margin-top: -4px; }
.duo { display: flex; align-items: flex-end; justify-content: center; width: 92%; height: 84%; margin-top: 6%; }
.avatar .duo svg, .hub .duo svg { width: 50%; height: auto; margin: 0; }
.avatar .duo svg:last-child, .hub .duo svg:last-child { width: 46%; margin-left: -6%; }

/* kręcenie przeciąganiem */
.wheel-wrap { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.wheel-wrap.grabbing { cursor: grabbing; }
.wheel-wrap.spinning { cursor: default; }
.hub { pointer-events: none; }
#wheel-hint { font-weight: 800; color: var(--gold); }

/* ---------- listy życzeń ---------- */
.btn-gold { background: linear-gradient(180deg, #ffd77a, #d9a12a); color: #3b2405; box-shadow: 0 5px 0 #8a6512, 0 10px 20px rgba(0,0,0,.3); }
.btn-gold:active { box-shadow: 0 1px 0 #8a6512; }
.btn-outline { background: rgba(242,193,78,.08); border: 2px solid rgba(242,193,78,.6); color: var(--gold); box-shadow: none; }
.btn-outline:active { transform: scale(.97); box-shadow: none; }
.result-extra { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 0 16px; }
.wish-people { display: grid; gap: 10px; margin-bottom: 14px; }
.wish-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 16px; text-align: left;
  border: 1px solid var(--glass-b); background: var(--glass); color: var(--cream); transition: transform .15s, background .2s;
}
.wish-row:hover { transform: translateX(4px); background: rgba(255,255,255,.15); }
.wish-row .avatar { width: 46px; height: 46px; border-width: 2px; flex-shrink: 0; }
.wish-row .wn { font-weight: 900; font-size: 17px; flex: 1; }
.wish-row .wc { font-size: 13px; font-weight: 700; color: var(--gold); }
.wish-row.empty .wc { color: var(--cream); opacity: .5; }
#s-wish-view .card { margin-top: 56px; }
.wish-list { list-style: none; padding: 0; margin: 12px 0 18px; text-align: left; }
.wish-list li {
  position: relative; padding: 12px 14px 12px 44px; margin-bottom: 8px; border-radius: 14px; line-height: 1.4;
  background: rgba(255,255,255,.08); border: 1px solid var(--glass-b); word-break: break-word;
  animation: pop .45s cubic-bezier(.2,.9,.3,1.3) backwards;
}
.wish-list li::before { content: '🎁'; position: absolute; left: 13px; top: 11px; }
.wish-list a { color: var(--gold); font-weight: 800; }
#we-text {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--glass-b); resize: vertical;
  background: rgba(255,255,255,.95); color: var(--ink); font: 600 16px/1.5 'Nunito', sans-serif; outline: none;
}
#we-text:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242,193,78,.3); }
