:root {
  --bg1: #0b1530;
  --bg2: #132a4f;
  --card: rgba(255, 255, 255, 0.07);
  --card-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --muted: #a9b6cf;
  --red: #e63946;
  --green: #2a9d8f;
  --gold: #f4c95d;
  --radius: 18px;
  --head: 'Unbounded', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background-color: var(--bg2); }
body {
  font-family: var(--body);
  color: var(--text);
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 80% -10%, #2a4a7f 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 110%, #3a1f4a 0%, transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
#app { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 16px 16px 80px; }
.loader { font-size: 64px; text-align: center; margin-top: 30vh; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(-6deg); } }

h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 5vw, 44px); }
h2 { font-size: 22px; margin-bottom: 14px; }
h3 { font-size: 16px; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--gold); }

/* --- header & nav --- */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-size: 18px; }
.brand .tree { font-size: 28px; }
.me-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; background: var(--card); border: 1px solid var(--line); padding: 4px 12px 4px 4px; border-radius: 999px; color: var(--text); font: inherit; }
.me-chip:hover { background: var(--card-strong); }
nav.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px; margin-bottom: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; scrollbar-width: none;
  position: sticky; top: 8px; z-index: 5; backdrop-filter: blur(12px);
}
nav.tabs a {
  flex: 0 0 auto; text-decoration: none; color: var(--muted); padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap;
}
nav.tabs a.active { background: linear-gradient(135deg, var(--red), #b5223a); color: #fff; box-shadow: 0 4px 16px rgba(230, 57, 70, 0.35); }

/* --- cards & layout --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(8px); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.people { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
section + section { margin-top: 26px; }

/* --- buttons & inputs --- */
.btn {
  border: 0; cursor: pointer; font: 600 14px var(--body); padding: 11px 18px; border-radius: 12px;
  background: var(--card-strong); color: var(--text); transition: transform .1s, filter .15s; display: inline-flex; gap: 6px; align-items: center;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--red), #b5223a); color: #fff; }
.btn.green { background: linear-gradient(135deg, var(--green), #1f7a6f); color: #fff; }
.btn.gold { background: linear-gradient(135deg, var(--gold), #e0a82e); color: #2b1d00; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select {
  width: 100%; font: 15px var(--body); color: var(--text); background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
select option { background: #132a4f; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 14px var(--body); padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--card-strong); color: var(--text); }

/* --- login --- */
.login { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.login .big-tree { font-size: 72px; margin-bottom: 8px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; text-align: left; }
.code-input { font-size: 28px; letter-spacing: 12px; text-align: center; font-family: var(--head); }

/* --- hero / countdown --- */
.hero { text-align: center; padding: 34px 20px; position: relative; overflow: hidden; }
.hero .garland { position: absolute; top: 0; left: 0; right: 0; height: 22px; display: flex; justify-content: space-around; }
.hero .garland span { width: 10px; height: 14px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; margin-top: 6px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.countdown { display: flex; justify-content: center; gap: 12px; margin: 22px 0 10px; flex-wrap: wrap; }
.countdown div { background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; min-width: 84px; }
.countdown b { display: block; font-family: var(--head); font-size: 34px; color: var(--gold); }
.countdown small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { text-align: center; }
.stat b { display: block; font-family: var(--head); font-size: 30px; }
.stat span { color: var(--muted); font-size: 13px; }

/* --- people --- */
.person { display: flex; gap: 14px; align-items: center; }
.person .avatar-svg { flex: 0 0 auto; border-radius: 50%; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.person .name { font-weight: 700; font-size: 16px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge.yes { background: rgba(42,157,143,.25); color: #7ee0d3; }
.badge.maybe { background: rgba(244,201,93,.2); color: var(--gold); }
.badge.no { background: rgba(230,57,70,.2); color: #ff9aa2; }
.avatar-stack { display: flex; }
.avatar-stack .avatar-svg { margin-left: -10px; border: 2px solid var(--bg2); border-radius: 50%; }
.avatar-stack .avatar-svg:first-child { margin-left: 0; }

/* --- menu --- */
.cat { margin-bottom: 20px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-head .emoji { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--card-strong); border-radius: 14px; }
.cat-head .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dish { position: relative; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.dish.free { border-style: dashed; border-color: rgba(244,201,93,.55); background: rgba(244,201,93,.06); }
.dish .title { font-weight: 700; font-size: 16px; }
.dish .cook { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dish .actions { display: flex; gap: 6px; margin-top: auto; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px; border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--card-strong); }

/* --- santa --- */
.santa-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.santa-hero .big { font-size: 64px; }
.gift-box { perspective: 900px; cursor: pointer; max-width: 420px; margin: 0 auto; }
.gift-inner { position: relative; transition: transform .8s; transform-style: preserve-3d; min-height: 300px; }
.gift-box.open .gift-inner { transform: rotateY(180deg); }
.gift-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.gift-front { background: repeating-linear-gradient(45deg, #c0392b 0 22px, #a93226 22px 44px); box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.gift-front::before, .gift-front::after { content: ''; position: absolute; background: var(--gold); }
.gift-front::before { left: 50%; top: 0; bottom: 0; width: 26px; transform: translateX(-50%); }
.gift-front::after { top: 50%; left: 0; right: 0; height: 26px; transform: translateY(-50%); }
.gift-front .label { position: relative; z-index: 1; background: #fff; color: #7b1e1e; font-family: var(--head); padding: 12px 18px; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.gift-back { transform: rotateY(180deg); background: linear-gradient(160deg, #1d3b6b, #10264a); border: 1px solid var(--line); }
.wish { white-space: pre-wrap; text-align: left; background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px; width: 100%; font-size: 14px; max-height: 140px; overflow: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card-strong); border-radius: 999px; padding: 4px 10px 4px 4px; font-size: 13px; }
.chip.ready { outline: 2px solid var(--green); }
.steps { counter-reset: s; display: grid; gap: 10px; }
.steps div { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; }
.steps div::before { content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--card-strong); font-weight: 700; font-size: 13px; }

/* --- profile --- */
.avatar-pick { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar-pick .avatar-svg { border-radius: 50%; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* --- toast --- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: #fff; color: #10264a; padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: transform .3s; z-index: 50; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: #ffe1e3; color: #8b1e2b; }

.empty { text-align: center; padding: 28px; color: var(--muted); }
.empty .e { font-size: 40px; display: block; margin-bottom: 6px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td { padding: 8px 4px; border-bottom: 1px solid var(--line); }

@media (max-width: 600px) {
  #app { padding: 10px 12px 80px; }
  .card { padding: 16px; }
  .countdown div { min-width: 68px; padding: 10px 6px; }
  .countdown b { font-size: 26px; }
  .brand span.t { display: none; }
}

/* --- роли и админ-элементы --- */
.badge.role.superadmin { background: linear-gradient(135deg, rgba(244,201,93,.35), rgba(224,168,46,.25)); color: var(--gold); }
.badge.role.admin { background: rgba(78,168,222,.22); color: #9fd3f5; }
.admin-zone { border: 1px dashed rgba(244,201,93,.5); background: rgba(244,201,93,.05); }
.person-card { display: flex; flex-direction: column; gap: 10px; }
.admin-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.admin-meta .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.admin-actions { gap: 6px; }
.hero-edit { position: absolute; top: 26px; right: 16px; font-size: 18px; }
.pin-input { font-size: 24px; letter-spacing: 10px; text-align: center; font-family: var(--head); }
.pin-input::placeholder { letter-spacing: normal; font-size: 15px; font-family: var(--body); }
[hidden] { display: none !important; }

/* --- колокольчик --- */
.bell-wrap { position: relative; }
.bell { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 19px; cursor: pointer; }
.bell:hover { background: var(--card-strong); }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font: 700 11px/20px var(--body); box-shadow: 0 0 0 2px var(--bg1); animation: pop .4s; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } }
.bell-panel { position: absolute; right: 0; top: 50px; width: min(360px, 92vw); max-height: 70vh; overflow: auto; z-index: 30; background: #14284a; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.bell-head { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bell-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
.bell-item:hover { background: var(--card); }
.bell-item.unread { background: rgba(244,201,93,.08); box-shadow: inset 3px 0 0 var(--gold); }
.bell-item small { color: var(--muted); }
.bell-empty { padding: 24px; text-align: center; color: var(--muted); }

/* --- приглашение в Санту --- */
.invite-banner { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); margin-bottom: 14px; border-color: rgba(244,201,93,.6); background: linear-gradient(135deg, rgba(230,57,70,.25), rgba(244,201,93,.12)); }
.invite-banner .big { font-size: 38px; }
.invite-card.glow { border-color: rgba(244,201,93,.6); box-shadow: 0 0 0 1px rgba(244,201,93,.25), 0 10px 40px rgba(230,57,70,.2); }

/* --- альбом --- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 2px dashed rgba(255,255,255,.25); border-radius: 16px; cursor: pointer; text-align: center; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: rgba(244,201,93,.07); }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 10px; align-items: center; font-size: 13px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.q-row.err .q-st { color: #ff9aa2; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--card); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tile:hover img, .tile:hover video { transform: scale(1.05); }
.tile .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.6); pointer-events: none; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(5,10,25,.94); display: flex; flex-direction: column; }
.lb-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.lb-body { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 12px 16px; }
.lb-body img, .lb-body video { max-width: 100%; max-height: 100%; border-radius: 10px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 30px; cursor: pointer; z-index: 1; }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }

/* --- идеи конкурсов: намеренно простой список --- */
.plain-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: 12px var(--body); margin-left: 6px; }
.link-btn:hover { color: #ff9aa2; }

@media (max-width: 600px) {
  .me-name { display: none; }
  .q-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .q-row .q-st { grid-column: 1 / -1; }
}
@media (max-width: 600px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 4px; } .tile { border-radius: 8px; } }

/* --- выбор языка --- */
.lang-select { display: inline-flex; align-items: center; gap: 4px; height: 42px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.lang-select:hover { background: var(--card-strong); }
.lang-select select { width: auto; border: 0; background: transparent; padding: 6px 4px; font-weight: 600; font-size: 14px; cursor: pointer; }
.lang-select select:focus { outline: none; }
.login-top { display: flex; justify-content: flex-end; padding-top: 6px; }
.login-top + .login { margin-top: 8vh; }
.avatar-stack { align-items: center; flex-wrap: wrap; }
.avatar-stack .more { margin-left: 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
@media (max-width: 600px) {
  .lang-select { padding: 0 2px 0 8px; }
  .lang-select select { max-width: 92px; font-size: 13px; }
}

/* --- общие траты --- */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.big { font-family: var(--head); font-size: 22px; color: var(--gold); }
.my-balance { padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,.2); font-weight: 700; }
.my-balance.plus { background: rgba(42,157,143,.18); color: #7ee0d3; }
.my-balance.minus { background: rgba(230,57,70,.16); color: #ff9aa2; }
.transfer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 12px; background: rgba(0,0,0,.18); }
.transfer .avatar-svg, .exp-row .avatar-svg, .part .avatar-svg { border-radius: 50%; flex: 0 0 auto; }
.exp-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exp-row:last-child { border-bottom: 0; }
.exp-row.settlement { align-items: center; opacity: .85; }
.exp-row details { margin-top: 4px; }
.exp-row summary { cursor: pointer; }
.shares { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.seg.wrap { flex-wrap: wrap; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.part { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0,0,0,.18); cursor: pointer; }
.part .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .pval { font-size: 13px; white-space: nowrap; }
.part-num { width: 90px !important; padding: 6px 8px; text-align: right; }
.split-hint { margin-top: 10px; font-size: 14px; color: var(--muted); }
.split-hint.ok { color: #7ee0d3; }
.split-hint.warn { color: #ffb4a2; }
.ny-now { font-size: 46px; border: 0 !important; background: none !important; }
