:root {
  --night-1: #0b1e3a;
  --night-2: #14264d;
  --night-3: #2a1b3d;
  --gold: #f5c453;
  --gold-soft: rgba(245, 196, 83, .55);
  --red: #c0392b;
  --red-bright: #e74c3c;
  --green: #1e7145;
  --card: rgba(255, 255, 255, .07);
  --card-border: rgba(245, 196, 83, .25);

  --bg: var(--night-1);
  --secondary-bg: #1c2b3f;
  --text: #f2f6fb;          /* фиксировано: дизайн всегда тёмный */
  --hint: #a8bccd;
  --button: var(--red-bright);
  --button-text: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(231, 76, 60, .18), transparent 60%),
    radial-gradient(900px 400px at 10% 0%, rgba(245, 196, 83, .12), transparent 55%),
    linear-gradient(165deg, var(--night-1) 0%, var(--night-2) 45%, var(--night-3) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  padding: 16px 16px 40px;
  overflow-x: hidden;
}

/* ---------- снег ---------- */
.snowflake {
  position: fixed;
  top: -12px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  z-index: 0;
  animation-name: snow-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  opacity: .8;
}
@keyframes snow-fall {
  0%   { transform: translate3d(0, -12px, 0); }
  100% { transform: translate3d(var(--sway, 30px), 105vh, 0); }
}

/* гирлянда по верхнему краю */
#garland {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 22px;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle 5px at 15px 8px, #ffd76e 98%, transparent),
    radial-gradient(circle 5px at 55px 16px, #ff6b5e 98%, transparent),
    radial-gradient(circle 5px at 95px 8px, #7ee2a8 98%, transparent);
  background-size: 80px 22px;
  filter: drop-shadow(0 0 6px rgba(255, 215, 110, .8));
  opacity: .9;
  animation: garland-glow 2.4s ease-in-out infinite alternate;
}
@keyframes garland-glow {
  from { opacity: .55; }
  to   { opacity: 1; }
}

#app { position: relative; z-index: 2; max-width: 480px; margin: 0 auto; }

#loading {
  text-align: center;
  color: var(--hint);
  padding: 60px 0;
  font-size: 16px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- заголовки ---------- */
.app-header {
  text-align: center;
  margin: 14px 0 18px;
}
.app-header .santa { font-size: 44px; display: block; }
.app-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(180deg, #ffe9a8, var(--gold) 55%, #d99b2b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 12px rgba(245, 196, 83, .25);
  margin-top: 4px;
}

.section {
  margin: 22px 0 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section::before, .section::after {
  content: "✦";
  font-size: 10px;
  opacity: .7;
}

/* ---------- карточки ---------- */
.event-card, .admin-form {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.06);
}
.event-card { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.event-card:active { transform: scale(.985); }
.event-card .title { font-weight: 700; font-size: 16px; }
.event-card .meta { color: var(--hint); font-size: 13px; margin-top: 5px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge.open   { background: rgba(46, 134, 222, .25); color: #9ecdff; border: 1px solid rgba(46,134,222,.4); }
.badge.drawn  { background: rgba(30, 113, 69, .3);  color: #8fe3b4; border: 1px solid rgba(126, 226, 168, .4); }

/* ---------- участники ---------- */
.person {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 6px;
  border-bottom: 1px dashed rgba(245, 196, 83, .18);
}
.person:last-child { border-bottom: none; }
.person .avatar {
  display: inline-flex;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2b3f66, #1a2740);
  border: 1px solid var(--card-border);
  align-items: center; justify-content: center;
  margin-right: 10px;
  font-size: 15px;
}
.person .left { display: flex; align-items: center; }

/* ---------- кнопки ---------- */
button.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  color: #fff;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .4px;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 6px 18px rgba(192, 57, 43, .45), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .12s ease, box-shadow .12s ease;
}
button.btn:active { transform: translateY(1px) scale(.99); box-shadow: 0 3px 10px rgba(192,57,43,.4); }
button.btn:disabled { opacity: .5; cursor: default; }
button.btn.gold {
  background: linear-gradient(180deg, #ffd76e, #d99b2b);
  color: #4a2c07;
  box-shadow: 0 6px 18px rgba(217, 155, 43, .4), inset 0 1px 0 rgba(255,255,255,.5);
}
button.btn.green {
  background: linear-gradient(180deg, #27ae60, var(--green));
  box-shadow: 0 6px 18px rgba(30, 113, 69, .45), inset 0 1px 0 rgba(255,255,255,.25);
}

/* ---------- формы ---------- */
textarea, input[type=text], input[type=date], select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid rgba(245, 196, 83, .2);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 74px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select { min-height: 0; }
select option { background: #14264d; color: #f2f6fb; }
input[type=date] { min-height: 0; color-scheme: dark; }
textarea:focus, input:focus, select:focus {
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(245, 196, 83, .12);
}
.admin-form label {
  display: block;
  margin: 12px 0 5px;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: .4px;
}

/* ---------- карточка подопечного ---------- */
.gift-card {
  position: relative;
  border-radius: 20px;
  padding: 26px 20px 22px;
  text-align: center;
  margin-top: 10px;
  background:
    radial-gradient(400px 180px at 50% -30px, rgba(245, 196, 83, .22), transparent 70%),
    linear-gradient(165deg, rgba(30, 113, 69, .55), rgba(15, 55, 38, .75));
  border: 1px solid rgba(126, 226, 168, .35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 40px rgba(30, 113, 69, .25) inset;
  overflow: hidden;
}
.gift-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--gold) 0 14px, var(--red-bright) 14px 28px,
    #1e8449 28px 42px, #fff 42px 46px);
  opacity: .85;
}
.gift-card .big { font-size: 46px; animation: bounce 2.2s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.gift-card .label {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #a8dfc0;
}
.gift-card .name {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0 2px;
  background: linear-gradient(180deg, #fff, #ffe9a8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gift-card .wish {
  margin-top: 14px;
  padding: 13px;
  border-radius: 13px;
  background: rgba(0, 0, 0, .3);
  border: 1px dashed rgba(245, 196, 83, .4);
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.45;
}

/* ---------- прочее ---------- */
.countdown {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(245, 196, 83, .12);
  border: 1px solid rgba(245, 196, 83, .3);
  color: var(--gold);
  font-size: 13.5px;
  font-weight: 600;
}
.hint { color: var(--hint); font-size: 13px; margin-top: 8px; line-height: 1.5; }

.back {
  color: var(--gold);
  cursor: pointer;
  margin: 4px 0 12px;
  display: inline-block;
  font-weight: 600;
}

.error { color: #ff9b8a; margin-top: 10px; font-size: 14px; line-height: 1.5; }

.empty {
  text-align: center;
  color: var(--hint);
  padding: 24px 0;
  font-size: 14px;
}
