:root {
  --night-1: #07142c;
  --night-2: #0d2550;
  --night-3: #18407c;
  --red: #e63946;
  --red-2: #b81d2c;
  --green: #17a35a;
  --green-2: #0d7a41;
  --gold: #ffcf5c;
  --gold-2: #f0a81c;
  --snow: #f6faff;
  --ink: #1b2238;
  --ink-2: #4c5672;
  --ink-3: #8a93ab;
  --paper: #fffdf7;
  --line: #ece6d6;
  --glass: rgba(255, 255, 255, 0.09);
  --glass-line: rgba(255, 255, 255, 0.16);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--snow);
  background: radial-gradient(120% 70% at 50% 0%, var(--night-3) 0%, var(--night-2) 45%, var(--night-1) 100%) fixed;
  background-color: var(--night-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* ---------- гирлянда ---------- */
.lights { position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 30; pointer-events: none;
  display: flex; justify-content: space-between; padding: 0 6px; }
.lights::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 26px;
  border-bottom: 2px solid #22314d; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.lights i { position: relative; width: 9px; height: 14px; margin-top: 9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: blink 2s infinite ease-in-out; }
.lights i::before { content: ""; position: absolute; top: -4px; left: 2px; width: 5px; height: 4px; background: #2c3a55; border-radius: 1px; }
.lights i:nth-child(4n+1) { background: #ff4d5e; color: #ff4d5e; }
.lights i:nth-child(4n+2) { background: #ffd34d; color: #ffd34d; animation-delay: .5s; }
.lights i:nth-child(4n+3) { background: #3ee08a; color: #3ee08a; animation-delay: 1s; }
.lights i:nth-child(4n)   { background: #57c7ff; color: #57c7ff; animation-delay: 1.5s; }
.lights i:nth-child(odd) { margin-top: 13px; }
@keyframes blink { 0%, 100% { opacity: .35; box-shadow: none; } 50% { opacity: 1; box-shadow: 0 0 10px 3px currentColor; } }

/* ---------- каркас ---------- */
.app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; min-height: 100vh;
  padding: 40px 16px calc(110px + var(--safe-b)); }
.app.no-nav { padding-bottom: calc(40px + var(--safe-b)); }

.boot { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #c9d7f2; font-weight: 700; }
.boot-ball { font-size: 64px; animation: swing 1.6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes swing { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 16px; }
.brand { font-family: "Lobster", cursive; font-size: 30px; line-height: 1; letter-spacing: .3px;
  background: linear-gradient(180deg, #fff 30%, #ffe3a3); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); }
.brand small { display: block; font-family: "Nunito", sans-serif; font-size: 12px; font-weight: 700; color: #a9bde4; -webkit-text-fill-color: #a9bde4; margin-top: 4px; letter-spacing: .5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line); font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.chip.gold { background: linear-gradient(180deg, #ffe08a, var(--gold-2)); color: #4a3200; border: none; }

h1, h2 { font-family: "Lobster", cursive; font-weight: 400; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.15; }
p { margin: 0; line-height: 1.5; }
.muted { color: #a9bde4; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- стекло и бумага ---------- */
.glass { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.paper { position: relative; background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35), 0 2px 0 rgba(255,255,255,.6) inset; }
.paper .muted { color: var(--ink-3); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 10px; }
.section-title h2 { font-size: 22px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 16px;
  padding: 15px 18px; font-weight: 900; font-size: 16px; letter-spacing: .2px; width: 100%;
  transition: transform .12s ease, filter .2s, box-shadow .2s; user-select: none; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-red { color: #fff; background: linear-gradient(180deg, #ff5a68 0%, var(--red) 45%, var(--red-2) 100%);
  box-shadow: 0 10px 24px rgba(230,57,70,.45), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-green { color: #fff; background: linear-gradient(180deg, #2fd17c, var(--green) 50%, var(--green-2));
  box-shadow: 0 10px 24px rgba(23,163,90,.4), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-gold { color: #3d2a00; background: linear-gradient(180deg, #ffe596, var(--gold) 50%, var(--gold-2));
  box-shadow: 0 10px 24px rgba(240,168,28,.4), inset 0 1px 0 rgba(255,255,255,.6); }
.btn-ghost { color: #fff; background: var(--glass); border: 1px solid var(--glass-line); }
.btn-soft { color: var(--ink); background: #f3eee0; }
.btn-danger-soft { color: var(--red-2); background: #fde8ea; }
.btn-sm { padding: 10px 14px; font-size: 14px; border-radius: 12px; width: auto; }
.btn-candy { position: relative; overflow: hidden; }
.btn-candy::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.16) 0 10px, transparent 10px 20px);
  animation: candy 1.6s linear infinite; pointer-events: none; }
@keyframes candy { to { background-position: 28px 0; } }

/* ---------- приветствие ---------- */
.hero { text-align: center; padding: 14px 6px 6px; }
.hero-santa { font-size: 92px; line-height: 1; display: inline-block; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 12px 18px rgba(0,0,0,.4)); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
.hero h1 { margin-top: 10px; }
.hero p { margin-top: 10px; color: #cfdcf5; font-size: 16px; }
.steps { display: grid; gap: 10px; margin-top: 22px; }
.step { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.step-ico { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.05)); }
.step b { display: block; font-size: 15px; }
.step span { font-size: 13px; color: #b9c9ea; }

/* ---------- мастер анкеты ---------- */
.wizard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.back { flex: none; width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--glass-line); background: var(--glass); font-size: 18px; }
.progress { flex: 1; display: flex; gap: 6px; }
.progress i { flex: 1; height: 8px; border-radius: 8px; background: rgba(255,255,255,.14); overflow: hidden; position: relative; }
.progress i.on { background: linear-gradient(90deg, var(--gold), #fff3c4); box-shadow: 0 0 10px rgba(255,207,92,.6); }
.wizard-title { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.wizard-title .big { font-size: 44px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; font-size: 14px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input { width: 100%; padding: 14px 15px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink);
  font-size: 17px; font-weight: 700; outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,207,92,.28); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.45; font-weight: 600; }
.input.bad { border-color: var(--red); box-shadow: 0 0 0 4px rgba(230,57,70,.15); }
.err { color: var(--red-2); font-size: 13px; font-weight: 800; }
.counter { text-align: right; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.lock-note { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #eef6ff; color: #23407a; font-size: 13px; font-weight: 700; }
.nick-box { display: flex; gap: 8px; }
.nick-box .input { flex: 1; }
.dice { flex: none; width: 54px; border-radius: 14px; border: none; font-size: 26px; background: linear-gradient(180deg, #ffe596, var(--gold-2)); box-shadow: 0 6px 14px rgba(240,168,28,.35); }
.dice.roll { animation: roll .5s ease; }
@keyframes roll { to { transform: rotate(360deg) scale(1.05); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px dashed #e0d5b8; background: #fff8e6; color: #6b4e00; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 800; }

/* ---------- конверт / письмо ---------- */
.letter { position: relative; background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 26px 20px 20px;
  box-shadow: 0 22px 44px rgba(0,0,0,.4); overflow: hidden; }
.letter::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--red) 0 18px, #fff 18px 30px, #1f6fd1 30px 48px, #fff 48px 60px); }
.letter .stamp { position: absolute; right: 14px; top: 18px; width: 64px; height: 74px; border-radius: 6px; display: grid; place-items: center;
  font-size: 34px; background: #fff3f3; border: 3px dashed #f3b6bd; transform: rotate(6deg); }
.letter .to { font-family: "Lobster", cursive; font-size: 15px; color: var(--red-2); }
.letter .nick { font-family: "Lobster", cursive; font-size: 30px; margin: 6px 80px 2px 0; line-height: 1.1; color: var(--ink); word-break: break-word; }
.letter .wish { margin-top: 14px; padding: 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  background: repeating-linear-gradient(180deg, transparent 0 27px, #efe6cf 27px 28px); }
.letter .real { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--ink-3); font-weight: 700; }
.letter .actions { display: flex; gap: 8px; margin-top: 14px; }
.letter .actions .btn { flex: 1; }
.seal { position: absolute; right: 16px; bottom: -18px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #ff7b86, var(--red-2)); box-shadow: 0 6px 14px rgba(184,29,44,.5); }

/* ---------- баннеры и статистика ---------- */
.banner { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); }
.banner .ico { font-size: 38px; flex: none; }
.banner b { display: block; font-size: 16px; }
.banner span { font-size: 13px; opacity: .9; }
.banner.gold { background: linear-gradient(135deg, #ffe7a1, #f6b73c); color: #3d2a00; box-shadow: 0 14px 30px rgba(240,168,28,.35); }
.banner.green { background: linear-gradient(135deg, #3fe090, #129650); color: #fff; box-shadow: 0 14px 30px rgba(23,163,90,.35); }
.banner.red { background: linear-gradient(135deg, #ff6b78, #c21f30); color: #fff; box-shadow: 0 14px 30px rgba(230,57,70,.35); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 14px 6px; }
.stat b { display: block; font-size: 26px; font-weight: 900; }
.stat span { font-size: 11px; font-weight: 800; color: #b9c9ea; text-transform: uppercase; letter-spacing: .4px; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.countdown div { text-align: center; padding: 12px 4px; border-radius: 16px; background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.04)); border: 1px solid var(--glass-line); }
.countdown b { display: block; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; color: #b9c9ea; font-weight: 800; }

/* ---------- письма участников ---------- */
.search { position: relative; }
.search input { width: 100%; padding: 13px 14px 13px 42px; border-radius: 16px; border: 1px solid var(--glass-line); background: var(--glass); color: #fff; outline: none; font-weight: 700; }
.search input::placeholder { color: #9fb2da; }
.search::before { content: "🔍"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.cards { display: grid; gap: 12px; margin-top: 12px; }
.card { position: relative; background: var(--paper); color: var(--ink); border-radius: 20px; padding: 16px; box-shadow: 0 12px 26px rgba(0,0,0,.3);
  animation: pop .35s ease both; }
.card.taken { background: #eef3f9; }
.card-head { display: flex; gap: 12px; align-items: center; }
.ava { flex: none; width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: linear-gradient(180deg, #fff1d6, #ffe1a8); }
.card.taken .ava { background: #dfe7f2; filter: grayscale(.4); }
.card-nick { font-weight: 900; font-size: 17px; line-height: 1.2; word-break: break-word; }
.badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.badge.free { background: #fff1d2; color: #8a5a00; }
.badge.taken { background: #dff5e8; color: #11713c; }
.card-wish { margin-top: 12px; font-size: 15px; line-height: 1.45; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.card-wish.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card .btn { margin-top: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.empty { text-align: center; padding: 34px 18px; }
.empty .big { font-size: 64px; display: block; margin-bottom: 8px; }
.empty p { color: #c4d3f0; margin-top: 6px; white-space: pre-line; }

/* ---------- подопечный ---------- */
.giftbox { position: relative; margin-top: 30px; background: linear-gradient(180deg, #ff5a68, var(--red-2)); border-radius: 26px; padding: 70px 20px 22px;
  box-shadow: 0 24px 50px rgba(184,29,44,.45); overflow: visible; }
.giftbox::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 34px; transform: translateX(-50%);
  background: linear-gradient(90deg, #e8a91c, var(--gold) 50%, #e8a91c); }
.giftbox .bow { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); font-size: 72px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); animation: bob 3s ease-in-out infinite; }
.giftbox .tag { position: relative; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.giftbox .tag::before { content: ""; position: absolute; top: -8px; left: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--night-1); transform: translateX(-50%); border: 3px solid var(--gold); }
.giftbox .tag .nick { font-family: "Lobster", cursive; font-size: 30px; text-align: center; margin-top: 6px; word-break: break-word; }
.giftbox .tag .wish { margin-top: 12px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.tips { display: grid; gap: 8px; margin-top: 14px; }
.tips div { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #d7e2f7; }

/* ---------- мастерская ---------- */
.adm-person { background: var(--paper); color: var(--ink); border-radius: 18px; padding: 14px; }
.adm-person .name { font-weight: 900; font-size: 16px; }
.adm-person .meta { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.adm-person .wish { font-size: 14px; color: var(--ink-2); margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.adm-person .links { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.adm-person .links div { padding: 8px 10px; border-radius: 10px; background: #f4f0e4; }
.adm-person .links div.none { background: #f2f4f8; color: var(--ink-3); }
.adm-person .tools { display: flex; gap: 8px; margin-top: 10px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; background: var(--paper); color: var(--ink); border-radius: 16px; padding: 12px; font-size: 13px; }
.pair b { display: block; font-size: 14px; }
.pair .arrow { font-size: 20px; }
.pair .gift { grid-column: 1 / -1; color: var(--ink-3); font-size: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.tabs-mini { display: flex; gap: 8px; margin-top: 8px; }
.tabs-mini button { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--glass-line); background: var(--glass); color: #cfdcf5; font-weight: 800; font-size: 13px; }
.tabs-mini button.on { background: #fff; color: var(--ink); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.bc { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }

/* ---------- нижняя навигация ---------- */
.nav { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: calc(100% - 24px); max-width: 536px;
  display: flex; gap: 4px; padding: 6px; border-radius: 24px; background: rgba(8, 20, 46, .78); border: 1px solid var(--glass-line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 16px 34px rgba(0,0,0,.45); }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; border: none; border-radius: 18px; background: transparent;
  color: #9fb2da; font-size: 11px; font-weight: 800; position: relative; }
.nav button .i { font-size: 22px; line-height: 1; transition: transform .2s; }
.nav button.on { background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.06)); color: #fff; }
.nav button.on .i { transform: translateY(-2px) scale(1.12); }
.nav .dot { position: absolute; top: 6px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #0b1d3a; }

/* ---------- шторка ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(3, 9, 24, .62); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease both; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { width: 100%; max-width: 560px; background: var(--paper); color: var(--ink); border-radius: 26px 26px 0 0; padding: 12px 18px calc(22px + var(--safe-b));
  animation: up .28s cubic-bezier(.2,.9,.3,1.2) both; max-height: 92vh; overflow-y: auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: #ddd5c0; margin: 0 auto 14px; }
.sheet h2 { color: var(--ink); text-align: center; }
.sheet .lead { text-align: center; color: var(--ink-2); margin-top: 8px; }
.sheet .big { font-size: 64px; text-align: center; line-height: 1; }
.sheet .quote { margin-top: 14px; padding: 14px; border-radius: 14px; background: #fff3d9; color: #5a4300; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.5; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- тост и праздник ---------- */
.toast { position: fixed; z-index: 60; left: 50%; top: 42px; transform: translateX(-50%); width: calc(100% - 32px); max-width: 520px;
  padding: 13px 16px; border-radius: 16px; font-weight: 800; font-size: 14px; color: #fff; text-align: center;
  background: linear-gradient(180deg, #23a866, #13804a); box-shadow: 0 14px 30px rgba(0,0,0,.35); animation: drop .3s ease both; }
.toast.bad { background: linear-gradient(180deg, #ef4b59, #b81d2c); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -14px); } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#fx span { position: absolute; top: -40px; animation: burst linear forwards; }
@keyframes burst { to { transform: translateY(115vh) rotate(var(--rot, 540deg)); opacity: .9; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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