:root {
  --night: #0a1530;
  --night-2: #12224a;
  --card: rgba(255, 255, 255, 0.07);
  --card-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f6ff;
  --muted: #a9b4d6;
  --red: #e5383b;
  --red-2: #b31e2b;
  --gold: #f6c453;
  --green: #2fa86b;
  --ice: #8fd3ff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(143, 211, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(229, 56, 59, 0.16), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.45;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
header, main, footer { position: relative; z-index: 1; }

h1, h2, h3, .festive { font-family: 'Lobster', cursive; font-weight: 400; letter-spacing: .3px; }
h2 { font-size: 30px; margin: 0 0 14px; }
h3 { font-size: 22px; margin: 0 0 10px; }
a { color: var(--ice); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- гирлянда ---------- */
.garland {
  list-style: none; margin: 0; padding: 0 10px; height: 34px; display: flex; justify-content: space-between;
  overflow: hidden; position: relative;
}
.garland::before {
  content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 28px;
  border-bottom: 2px solid #2a3a63; border-radius: 50%;
}
.garland li {
  width: 12px; height: 20px; border-radius: 50%; margin-top: 12px; position: relative;
  animation: glow 1.6s infinite alternate;
}
.garland li::before {
  content: ''; position: absolute; width: 8px; height: 6px; background: #3b4a70; top: -4px; left: 2px; border-radius: 2px;
}
.garland li:nth-child(4n+1) { background: var(--red); --c: var(--red); }
.garland li:nth-child(4n+2) { background: var(--gold); --c: var(--gold); animation-delay: .4s; }
.garland li:nth-child(4n+3) { background: var(--green); --c: var(--green); animation-delay: .8s; }
.garland li:nth-child(4n)   { background: var(--ice); --c: var(--ice); animation-delay: 1.2s; }
@keyframes glow {
  from { opacity: .35; box-shadow: none; }
  to { opacity: 1; box-shadow: 0 0 14px 3px var(--c); }
}

/* ---------- шапка ---------- */
.top-inner {
  max-width: 1100px; margin: 0 auto; padding: 4px 20px 0;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 44px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.brand h1 { margin: 0; font-size: 34px; color: #fff; text-shadow: 0 2px 0 var(--red-2), 0 0 20px rgba(246, 196, 83, .35); }
.brand-sub { margin: 0; color: var(--muted); font-size: 14px; }
.me { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.me .badge-admin { font-size: 11px; background: var(--gold); color: #3a2a00; padding: 2px 8px; border-radius: 99px; }

.tabs {
  max-width: 1100px; margin: 14px auto 0; padding: 0 20px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer;
  white-space: nowrap; position: relative; transition: background .2s, transform .1s;
}
.tab:hover { background: var(--card-strong); }
.tab:active { transform: scale(.97); }
.tab.active { background: linear-gradient(180deg, var(--red), var(--red-2)); border-color: transparent; box-shadow: 0 6px 18px rgba(229,56,59,.35); }
.tab .dot {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--gold); color: #3a2a00; border-radius: 99px; font-size: 12px; display: grid; place-items: center;
}

/* ---------- основная область ---------- */
.view { max-width: 1100px; margin: 0 auto; padding: 22px 20px 40px; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.card.hero {
  background: linear-gradient(135deg, rgba(229,56,59,.28), rgba(18,34,74,.6) 55%, rgba(47,168,107,.22));
  text-align: center; padding: 28px 20px;
}

/* ---------- кнопки и формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 800; cursor: pointer;
  background: linear-gradient(180deg, var(--red), var(--red-2)); color: #fff;
  box-shadow: 0 6px 16px rgba(229,56,59,.3); transition: transform .1s, filter .2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, #ffd978, #e0a92e); color: #3a2a00; box-shadow: 0 6px 16px rgba(246,196,83,.3); }
.btn.green { background: linear-gradient(180deg, #3cc47f, #23875a); box-shadow: 0 6px 16px rgba(47,168,107,.3); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); box-shadow: none; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.big { padding: 15px 28px; font-size: 18px; border-radius: 16px; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 4px; }
.link-btn:hover { color: var(--text); }

label { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 6px; }
input[type=text], input[type=url], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(5, 12, 30, .55); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }

/* ---------- аватары ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  border: 2px solid rgba(255,255,255,.25);
}
.avatar.lg { width: 84px; height: 84px; font-size: 30px; border-width: 3px; border-color: var(--gold); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- обратный отсчёт ---------- */
.countdown { display: flex; justify-content: center; gap: 12px; margin: 14px 0 6px; flex-wrap: wrap; }
.cd-cell {
  min-width: 82px; padding: 12px 8px; border-radius: 16px; background: rgba(5,12,30,.5); border: 1px solid var(--line);
}
.cd-num { font-size: 38px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--gold); }
.cd-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(5,12,30,.45); border: 1px solid var(--line); font-size: 14px; font-weight: 700;
}

/* ---------- прогресс с санями ---------- */
.sleigh-track { position: relative; height: 56px; margin-top: 8px; }
.sleigh-track .rail {
  position: absolute; left: 0; right: 0; bottom: 10px; height: 10px; border-radius: 99px;
  background: rgba(255,255,255,.1); overflow: hidden;
}
.sleigh-track .fill { height: 100%; background: repeating-linear-gradient(45deg, var(--red) 0 10px, #fff 10px 20px); border-radius: 99px; transition: width 1s ease; }
.sleigh-track .sleigh { position: absolute; bottom: 14px; font-size: 32px; transition: left 1s ease; transform: translateX(-50%) scaleX(-1); }
.sleigh-track .house { position: absolute; right: -6px; bottom: 14px; font-size: 26px; }

/* ---------- шаги ---------- */
.steps { counter-reset: step; display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 820px) { .steps { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.step { padding: 16px; border-radius: 16px; background: rgba(5,12,30,.4); border: 1px solid var(--line); position: relative; }
.step.done { border-color: rgba(47,168,107,.6); }
.step.now { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(246,196,83,.25); }
.step .ico { font-size: 28px; }
.step b { display: block; margin: 6px 0 2px; }

/* ---------- вишлист ---------- */
.wish-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px;
  background: rgba(5,12,30,.45); border: 1px solid var(--line);
}
.wish-item + .wish-item { margin-top: 10px; }
.wish-item .prio { font-size: 22px; line-height: 1; }
.wish-item .body { flex: 1; min-width: 0; }
.wish-item .title { font-weight: 800; word-break: break-word; }
.wish-item .meta { font-size: 13px; color: var(--muted); margin-top: 4px; word-break: break-word; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .big { font-size: 46px; display: block; margin-bottom: 6px; }

.prio-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.prio-picker label { margin: 0; }
.prio-picker input { display: none; }
.prio-picker span {
  display: inline-block; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: 14px;
  background: rgba(5,12,30,.45);
}
.prio-picker input:checked + span { background: var(--gold); color: #3a2a00; border-color: var(--gold); }

/* ---------- подарок ---------- */
.gift-stage { display: grid; place-items: center; padding: 30px 0 10px; }
.gift { position: relative; width: 170px; height: 160px; cursor: pointer; animation: wiggle 2.4s ease-in-out infinite; }
.gift:hover { animation-duration: .8s; }
@keyframes wiggle { 0%,80%,100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } 95% { transform: rotate(-3deg); } }
.gift .box { position: absolute; bottom: 0; left: 10px; width: 150px; height: 110px; background: linear-gradient(180deg, var(--red), var(--red-2)); border-radius: 8px; }
.gift .lid { position: absolute; top: 22px; left: 0; width: 170px; height: 34px; background: linear-gradient(180deg, #ff5a5d, var(--red)); border-radius: 8px; transition: transform .7s cubic-bezier(.3,1.6,.6,1); z-index: 2; }
.gift .ribbon-v { position: absolute; left: 77px; bottom: 0; width: 16px; height: 138px; background: var(--gold); z-index: 3; }
.gift .ribbon-h { position: absolute; left: 0; top: 30px; width: 170px; height: 14px; background: var(--gold); z-index: 3; transition: transform .7s cubic-bezier(.3,1.6,.6,1); }
.gift .bow { position: absolute; top: 0; left: 55px; font-size: 44px; z-index: 4; line-height: 1; transition: transform .7s cubic-bezier(.3,1.6,.6,1); }
.gift.open { animation: none; }
.gift.open .lid, .gift.open .ribbon-h, .gift.open .bow { transform: translateY(-90px) rotate(-18deg); opacity: 0; transition: transform .7s, opacity .6s .3s; }
.gift.open .ribbon-v { height: 110px; }
.gift-hint { margin-top: 16px; color: var(--muted); }

.ward-card { display: flex; gap: 18px; align-items: center; }
.ward-card .name { font-family: 'Lobster', cursive; font-size: 34px; line-height: 1.1; }
.note-box { padding: 14px; border-radius: 14px; background: rgba(5,12,30,.45); border: 1px dashed var(--line); white-space: pre-wrap; word-break: break-word; }
.note-box.no { border-color: rgba(229,56,59,.5); }

.status-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.status-steps button {
  flex: 1 1 110px; border: 1px solid var(--line); background: rgba(5,12,30,.45); color: var(--text);
  padding: 12px 8px; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer;
}
.status-steps button.passed { background: rgba(47,168,107,.25); border-color: rgba(47,168,107,.5); }
.status-steps button.current { background: var(--green); border-color: var(--green); }
.status-steps .e { display: block; font-size: 24px; }

/* ---------- чат-письма ---------- */
.chat { display: flex; flex-direction: column; height: 460px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 4px 10px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; animation: fade .25s; }
.msg.theirs { align-self: flex-start; background: rgba(255,255,255,.1); border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; background: linear-gradient(180deg, var(--red), var(--red-2)); border-bottom-right-radius: 4px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 3px; }
.chat-form { display: flex; gap: 8px; }
.chat-form textarea { min-height: 46px; height: 46px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.quick button { border: 1px solid var(--line); background: rgba(5,12,30,.45); color: var(--text); border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.quick button:hover { background: var(--card-strong); }

/* ---------- ёлка ---------- */
.tree-wrap { position: relative; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 1 / 1.12; }
.tree-wrap svg { width: 100%; height: 100%; display: block; }
.ball {
  position: absolute; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%, -50%);
  border: 0; cursor: pointer; padding: 0;
  box-shadow: inset -5px -6px 0 rgba(0,0,0,.22), inset 4px 4px 0 rgba(255,255,255,.35), 0 4px 10px rgba(0,0,0,.4);
  transition: transform .2s; animation: drop .6s cubic-bezier(.3,1.5,.6,1) backwards;
}
.ball::before { content: ''; position: absolute; top: -6px; left: 11px; width: 8px; height: 6px; background: #c9ccd6; border-radius: 2px; }
.ball:hover, .ball:focus-visible { transform: translate(-50%, -50%) scale(1.25); z-index: 3; outline: none; }
.ball.mine { box-shadow: inset -5px -6px 0 rgba(0,0,0,.22), inset 4px 4px 0 rgba(255,255,255,.35), 0 0 0 3px var(--gold), 0 4px 10px rgba(0,0,0,.4); }
.ball .likes { position: absolute; bottom: -8px; right: -8px; background: #fff; color: var(--red); font-size: 10px; font-weight: 800; border-radius: 99px; padding: 0 4px; }
@keyframes drop { from { transform: translate(-50%, -250%) scale(.4); opacity: 0; } }
.tree-star { animation: twinkle 2s ease-in-out infinite; transform-origin: 280px 60px; }
@keyframes twinkle { 50% { filter: drop-shadow(0 0 18px #ffd978); transform: scale(1.08) rotate(6deg); } }
.color-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick input { display: none; }
.color-pick span { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: inset -4px -4px 0 rgba(0,0,0,.2); }
.color-pick input:checked + span { border-color: #fff; transform: scale(1.12); }

/* ---------- участники ---------- */
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.person { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: rgba(5,12,30,.45); border: 1px solid var(--line); }
.person .n { font-weight: 800; }
.person .p { font-size: 13px; color: var(--muted); }

/* ---------- угадайка и раскрытие ---------- */
.guess-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.guess-opt {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; text-align: center;
  border: 2px solid var(--line); border-radius: 14px; background: rgba(5,12,30,.45); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.guess-opt:hover { border-color: var(--ice); }
.guess-opt.picked { border-color: var(--gold); background: rgba(246,196,83,.15); }
.chain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.chain .link { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; text-align: center; font-size: 13px; font-weight: 700; animation: fade .5s backwards; }
.chain .arrow { font-size: 22px; color: var(--gold); }
.reveal-big { text-align: center; }
.reveal-big .avatar.lg { margin: 10px auto; }

/* ---------- таблица админки ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.pill { padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.pill.ok { background: rgba(47,168,107,.3); }
.pill.no { background: rgba(229,56,59,.3); }

/* ---------- тосты и модалки ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); z-index: 50;
  background: #fff; color: #14203f; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.3,1.4,.6,1); max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(3,8,22,.7); padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: min(460px, 100%); max-height: 90vh; overflow: auto; background: var(--night-2); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); animation: fade .25s; }

.fatal { max-width: 520px; margin: 60px auto; text-align: center; }
.fatal .big { font-size: 64px; }

.foot { max-width: 1100px; margin: 0 auto; padding: 10px 20px 30px; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }

/* конфетти */
.confetti { position: fixed; top: -20px; width: 10px; height: 14px; z-index: 60; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 560px) {
  .brand h1 { font-size: 26px; }
  .brand-icon { font-size: 34px; }
  .me .name { display: none; }
  .cd-cell { min-width: 64px; }
  .cd-num { font-size: 28px; }
  .ward-card { flex-direction: column; text-align: center; }
  .view { padding: 16px 16px 30px; }
  .tabs, .top-inner { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
