/* Тайный Дед Мороз — новогодняя тема, mobile-first */

:root {
  --night1: #071633;
  --night2: #10306b;
  --gold: #ffd166;
  --gold2: #ffb703;
  --red: #e63946;
  --red2: #c1121f;
  --green: #2a9d8f;
  --card: #fffdf7;
  --ink: #22304a;
  --muted: #6b7794;
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Neucha", "Comic Sans MS", cursive, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, #1b4a8f55, transparent 60%),
    radial-gradient(900px 500px at 10% 110%, #143a7a55, transparent 60%),
    linear-gradient(180deg, var(--night1) 0%, var(--night2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

#snow-canvas { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#confetti-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

/* ---------- гирлянда ---------- */

.garland {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 34px;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  z-index: 5;
  pointer-events: none;
  padding-top: 4px;
}
.garland::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: #0a1f42;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.bulb {
  width: 11px; height: 15px;
  border-radius: 50% 50% 55% 55%;
  position: relative;
  margin-top: 8px;
  animation: flicker 1.8s ease-in-out infinite;
  box-shadow: 0 0 10px 2px currentColor;
}
.bulb::before {
  content: "";
  position: absolute;
  top: -9px; left: 50%;
  width: 2px; height: 9px;
  background: #0a1f42;
}
.bulb:nth-child(4n+1) { background: var(--red); color: var(--red); }
.bulb:nth-child(4n+2) { background: var(--gold); color: var(--gold); animation-delay: .45s; }
.bulb:nth-child(4n+3) { background: #4cc9f0; color: #4cc9f0; animation-delay: .9s; }
.bulb:nth-child(4n+4) { background: #57cc57; color: #57cc57; animation-delay: 1.35s; }

@keyframes flicker {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px 2px currentColor; }
  50% { opacity: .45; box-shadow: 0 0 4px 0 currentColor; }
}

/* ---------- каркас ---------- */

#app {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
  padding: 58px 14px 110px;
}

#status-line {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 4;
  text-align: center;
  padding: 8px 12px 10px;
  font-size: 14px;
  color: #cdd9f5;
  text-shadow: 0 1px 3px #000a;
  pointer-events: none;
}

h1, h2, h3 { font-family: "Marck Script", cursive; font-weight: 400; }

h1 {
  font-size: clamp(38px, 10vw, 56px);
  margin: 10px 0 4px;
  color: var(--gold);
  text-align: center;
  text-shadow: 0 2px 0 #b8860b66, 0 6px 18px #0008;
  animation: h1snow 3s ease-in-out infinite;
}
@keyframes h1snow {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

.subtitle {
  text-align: center;
  color: #e8f0ff;
  margin: 0 0 18px;
  font-size: 18px;
}

.hero-emoji {
  display: block;
  text-align: center;
  font-size: 64px;
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}

/* ---------- карточки ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 14px 0;
  box-shadow: 0 10px 30px #0007, inset 0 0 0 2px #ffffffcc;
  position: relative;
}
.card-gold { box-shadow: 0 10px 30px #0007, inset 0 0 0 3px var(--gold); }
.card h2 { margin: 0 0 10px; font-size: 27px; color: var(--red2); }
.card .hint { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

/* ---------- кнопки и поля ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 20px;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 19px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, var(--red) 0%, var(--red2) 100%);
  box-shadow: 0 5px 0 #7d0812, 0 10px 20px #0006;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #7d0812, 0 4px 10px #0006; }
.btn:disabled { filter: grayscale(.7) opacity(.6); cursor: not-allowed; }

.btn.green { background: linear-gradient(180deg, #38b000 0%, #2a8800 100%); box-shadow: 0 5px 0 #1d5e00, 0 10px 20px #0006; }
.btn.green:active { box-shadow: 0 1px 0 #1d5e00, 0 4px 10px #0006; }

.btn.blue { background: linear-gradient(180deg, #3a86ff 0%, #1d5ed6 100%); box-shadow: 0 5px 0 #123d92, 0 10px 20px #0006; }
.btn.blue:active { box-shadow: 0 1px 0 #123d92, 0 4px 10px #0006; }

.btn.gold { background: linear-gradient(180deg, var(--gold2) 0%, #e08e00 100%); color: #4a3000; box-shadow: 0 5px 0 #9c6300, 0 10px 20px #0006; }
.btn.gold:active { box-shadow: 0 1px 0 #9c6300, 0 4px 10px #0006; }

.btn.small {
  width: auto;
  min-height: 40px;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 12px;
}

input[type="text"], input[type="url"], select {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: #fff;
  border: 2px solid #d9d3c3;
  border-radius: 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--gold2); }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }

.form-row { display: flex; gap: 10px; align-items: center; }
.form-row > input, .form-row > select { flex: 1; }

.del {
  flex: none;
  width: 46px; min-height: 46px;
  border: none; border-radius: 12px;
  background: #ffe0e0; color: var(--red2);
  font-size: 20px; cursor: pointer;
  font-family: inherit;
}
.del:active { transform: scale(.93); }
.people .del { width: 40px; min-height: 40px; font-size: 16px; }

/* ---------- чипы и значки ---------- */

.chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 14px;
  background: #efe9d8;
  color: #6a5a2e;
  white-space: nowrap;
}
.chip.code {
  background: #10306b;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  border: 2px dashed var(--gold);
  user-select: all;
}
.badge { margin-left: 6px; font-size: 14px; }

/* ---------- список участников ---------- */

.people { list-style: none; margin: 8px 0 0; padding: 0; }
.people li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-bottom: 1px dashed #d9d3c3;
  font-size: 17px;
}
.people li:last-child { border-bottom: none; }
.people .name { flex: 1; }

/* ---------- вишлист ---------- */

.wl-item {
  background: #f7f2e4;
  border: 1px solid #e5dcc4;
  border-radius: 14px;
  padding: 10px 12px;
  margin: 8px 0;
}
.wl-item .wl-title { font-weight: 700; }
.wl-item .wl-meta { font-size: 14px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.wl-item a { color: #1d5ed6; }

.wl-edit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 10px 0;
}
.wl-edit input { min-height: 46px; }

.buy-row { display: flex; align-items: flex-start; gap: 10px; }
.buy-check {
  flex: none;
  width: 30px; height: 30px;
  margin-top: 2px;
  border: 2px solid var(--green);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: 17px;
  line-height: 26px;
  text-align: center;
  color: #fff;
}
.buy-check.on { background: var(--green); }
.buy-check.on::after { content: "✓"; }

/* ---------- письмо подопечного ---------- */

.letter {
  background: repeating-linear-gradient(180deg, #fffef8 0 26px, #f3ead1 26px 27px);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin: 14px 0;
  box-shadow: 0 10px 30px #0007, inset 0 0 0 3px var(--gold);
  transform: rotate(-.6deg);
}
.letter .to { font-size: 14px; color: #8a7b52; letter-spacing: 1px; text-transform: uppercase; }
.letter .who { font-family: "Marck Script", cursive; font-size: 38px; color: var(--red2); margin: 4px 0; }
.letter .secret { color: var(--muted); font-size: 15px; }

.reveal-emoji { font-size: 60px; text-align: center; animation: bob 2s ease-in-out infinite; }
.reveal-name { font-family: "Marck Script", cursive; font-size: 44px; color: var(--red2); text-align: center; margin: 6px 0; }

/* ---------- чат ---------- */

.chat-wrap { display: flex; flex-direction: column; min-height: 60vh; }
.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px 14px;
  overflow-y: auto;
}
.msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 17px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 3px 10px #0005;
  animation: msgin .25s ease;
}
@keyframes msgin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.msg .author { display: block; font-size: 13px; opacity: .65; margin-bottom: 2px; }
.msg.me { align-self: flex-end; background: #cdeffd; border-bottom-right-radius: 6px; }
.msg.other { align-self: flex-start; background: #fffdf7; border-bottom-left-radius: 6px; }
.msg.magic {
  align-self: center;
  max-width: 92%;
  background: linear-gradient(180deg, #fff8e1, #ffedb3);
  border: 2px dashed var(--gold2);
  text-align: center;
  border-radius: 14px;
}

.composer {
  position: sticky;
  bottom: 46px;
  display: flex;
  gap: 8px;
  background: #0b2050;
  padding: 10px 0;
  border-radius: 18px 18px 0 0;
}
.composer input { flex: 1; }
.composer button {
  width: 54px; min-height: 50px;
  border: none; border-radius: 14px;
  background: var(--red);
  color: #fff; font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7d0812;
}
.composer button:active { transform: translateY(3px); box-shadow: 0 1px 0 #7d0812; }

/* ---------- пасхалки ---------- */

.egg {
  position: fixed;
  z-index: 6;
  bottom: 42px;
  font-size: 30px;
  background: none;
  border: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px #0008);
  animation: bob 3.4s ease-in-out infinite;
  transition: transform .1s;
}
.egg:active { transform: scale(1.25); }
#egg-snowman { left: 10px; }
#egg-gift { right: 10px; animation-delay: .8s; }

/* ---------- тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 420px);
  background: #10306b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 16px;
  border: 2px solid var(--gold);
  box-shadow: 0 10px 26px #000a;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 95;
  text-align: center;
  font-size: 16px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- модалка (игры) ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: #04102aee;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  width: min(100%, 560px);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px 30px;
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.modal-close {
  width: 42px; height: 42px;
  border: none; border-radius: 12px;
  background: #efe9d8; font-size: 20px;
  cursor: pointer;
}

.tabs { display: flex; gap: 6px; margin: 10px 0 14px; }
.tabs button {
  flex: 1;
  min-height: 44px;
  border: 2px solid #d9d3c3;
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.tabs button.on { background: var(--gold); border-color: var(--gold2); color: #4a3000; font-weight: 700; }

.quiz-q { font-size: 19px; margin: 6px 0 12px; }
.quiz-opt {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 8px 0;
  padding: 10px 14px;
  text-align: left;
  font-family: inherit;
  font-size: 17px;
  border: 2px solid #d9d3c3;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.quiz-opt.right { background: #d8f5d0; border-color: #38b000; }
.quiz-opt.wrong { background: #ffdada; border-color: var(--red); }
.quiz-opt:disabled { cursor: default; }

.slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #f7f2e4;
  border: 2px dashed var(--gold2);
  border-radius: 16px;
  padding: 14px;
  font-size: 18px;
  margin: 10px 0;
}

.snowball-zone {
  text-align: center;
  padding: 10px 0;
}
.snowball-btn {
  width: 150px; height: 150px;
  border: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #cfe6ff 70%, #9cc3f0);
  box-shadow: 0 8px 0 #6f9cd4, 0 14px 26px #0006;
  font-size: 56px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.snowball-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #6f9cd4; }
.score-big { font-size: 42px; font-family: "Marck Script", cursive; color: var(--red2); }

/* ---------- прочее ---------- */

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.mt8 { margin-top: 8px; }
.center { text-align: center; }
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  margin-left: 6px;
  animation: flicker 1.2s infinite;
}

.divider { border: none; border-top: 2px dashed #d9d3c3; margin: 14px 0; }

.unread-pill {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  padding: 1px 9px;
  margin-left: 6px;
}

@media (min-width: 700px) {
  #app { padding-top: 66px; }
  .composer { bottom: 52px; }
}
