/* «Тайный Дед-Мороз» — новогодняя тема. Красный/зелёный, без внешних фреймворков. */

:root {
  --red: #c0392b;
  --red-dark: #96281b;
  --green: #1e8449;
  --green-dark: #145a32;
  --gold: #f1c40f;
  --snow: #fdf8f2;
  --ink: #3e2f23;
  --muted: #7a6a58;
  --card: #ffffff;
  --line: #e8ddd0;
  --shadow: 0 4px 16px rgba(62, 47, 35, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: linear-gradient(180deg, #0b3d2e 0%, #145a32 35%, #1e8449 100%) fixed;
  color: var(--ink);
  line-height: 1.5;
}

/* --- Snowflakes ---------------------------------------------------------- */
.snowflakes {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.snowflake {
  position: absolute;
  top: -10%;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: fall linear infinite;
  animation-duration: 9s;
  filter: blur(1px);
}
.snowflake::after {
  content: "❄";
  position: absolute;
  top: 0; left: 0;
  color: #dff3f0;
  font-size: 18px;
  line-height: 1;
}
@keyframes fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .9; }
  100% { transform: translateY(105vh) translateX(-30px) rotate(320deg); opacity: .4; }
}

/* --- Header / garland ---------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, #2d0f0a, #5c1a10);
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.garland {
  height: 12px;
  background:
    repeating-radial-gradient(circle at 25% 100%, var(--gold) 0 8px, transparent 8px 30px),
    repeating-radial-gradient(circle at 75% 0%, #e74c3c 0 8px, transparent 8px 26px),
    repeating-radial-gradient(circle at 50% 100%, var(--green) 0 8px, transparent 8px 20px);
  background-color: #0a0a0a;
  opacity: .9;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.brand {
  color: var(--snow);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-star { color: var(--gold); font-size: 1.3rem; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.nav-links a {
  color: #f3e6d8;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.12); }
.nav-links a.active {
  background: var(--gold);
  color: var(--red-dark);
  font-weight: 600;
}
.inline-form { display: inline; margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: #f3e6d8;
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.link-btn:hover { background: rgba(255,255,255,.12); }

/* --- Layout -------------------------------------------------------------- */
.content {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.card h1, .card h2, .card h3 { margin-top: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.badge.collecting { background: #d5f5e3; color: var(--green-dark); }
.badge.distributed { background: #fdebd0; color: #935116; }

/* --- Hero / index --------------------------------------------------------- */
.hero { text-align: center; padding: 20px 0; }
.hero-title {
  color: var(--snow);
  text-shadow: 0 2px 8px rgba(0,0,0,.35);
  font-size: 2.2rem;
  margin: 0 0 8px;
}
.hero-sub { color: #eaf7ef; max-width: 620px; margin: 0 auto 24px; font-size: 1.05rem; }
.hero-stats {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.stat {
  background: rgba(255,255,255,.92);
  border-radius: 12px;
  padding: 12px 18px;
  min-width: 130px;
  box-shadow: var(--shadow);
}
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--red-dark); }
.stat-label { display: block; color: var(--muted); font-size: .85rem; }
.hero-cta { margin-top: 10px; }
.hero-cta .notice { display: inline-block; }

/* --- Buttons / forms ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--green);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--red); }
.btn.primary:hover { background: var(--red-dark); }
.btn.danger { background: #922b21; }
.btn.danger:hover { background: #6d1f16; }
.btn.secondary { background: #5d6d7e; }
.btn.secondary:hover { background: #475462; }
.btn.big { padding: 14px 28px; font-size: 1.1rem; }

input[type=text], input[type=password], input[type=datetime-local], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(241,196,15,.25);
}
textarea { resize: vertical; font-family: inherit; }

label { display: block; margin: 12px 0 4px; font-weight: 600; color: var(--green-dark); }

.auth-form, .wishes-form { display: flex; flex-direction: column; }
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }

/* --- Notices / messages --------------------------------------------------- */
.notice {
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  font-weight: 500;
}
.notice.ok { background: #d5f5e3; color: var(--green-dark); border: 1px solid #a9dfbf; }
.notice.err { background: #fadbd8; color: #922b21; border: 1px solid #f1948a; }

/* --- Identity / cabinet --------------------------------------------------- */
.identity {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ident-item { flex: 1 1 150px; }
.ident-label { display: block; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.ident-value { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.number.chip {
  background: #fef9e7;
  color: var(--green-dark);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 2px 10px;
  font-family: "Courier New", monospace;
  font-size: 1.05rem;
}
.divider { border: 0; border-top: 2px solid var(--line); margin: 20px 0; }
.wishes-readonly blockquote, .client-wishes blockquote {
  background: #fcf6ea;
  border-left: 4px solid var(--gold);
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
}
.counter { color: var(--muted); font-size: .85rem; }

/* --- Toggle switches ------------------------------------------------------ */
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  cursor: pointer;
  font-weight: 500;
}
.switch input { display: none; }
.switch .slider {
  flex: 0 0 46px;
  height: 26px;
  background: #cfc9c0;
  border-radius: 999px;
  position: relative;
  transition: background .2s;
}
.switch .slider::after {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch-label { font-size: .95rem; }

/* --- Client (2nd form: number vs initials) -------------------------------- */
.client-card {
  margin-top: 22px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #fdfaf4;
}
.client-ident {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--red-dark);
  margin: 8px 0;
}
.client-ident .number.chip { font-size: 1.2rem; }
.gift-form { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* --- Spinner (hx-indicator) ----------------------------------------------- */
.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(30,132,73,.2);
  border-top-color: var(--green);
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}
.spinner.active { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Admin ---------------------------------------------------------------- */
.admin .settings-card, .admin .draw-card, .admin .transfer-card, .admin .participants-card {
  margin-top: 18px;
}
.admin h2 { color: var(--green-dark); }
.limit-hint { margin-top: 10px; }
.table-scroll { overflow-x: auto; }
table.participants {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.participants th, .participants td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}
.participants th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.participants tr:hover { background: #fbf6ec; }
.yes { color: var(--green-dark); font-weight: 700; }
.no { color: #b9ac9b; }

.transfer-form select { width: auto; min-width: 220px; }

/* --- Countdown ------------------------------------------------------------ */
.countdown {
  background: #fef9e7;
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
}
.countdown-timer {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--red-dark);
  font-variant-numeric: tabular-nums;
}
.countdown-timer.expired { color: var(--muted); }
.static-deadline { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #eaf7ef;
  padding: 18px;
  background: rgba(11,61,46,.6);
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
  .nav { flex-direction: column; align-items: flex-start; }
  .hero-title { font-size: 1.6rem; }
  .card { padding: 18px; }
  .identity { flex-direction: column; }
  .btn.big { width: 100%; }
  .form-row input[type=datetime-local] { flex: 1 1 100%; }
}