:root {
  --bg-deep: #061812;
  --bg-pine: #0d2b20;
  --bg-pine-light: #164030;
  --crimson: #b81d33;
  --crimson-dark: #881224;
  --crimson-glow: rgba(210, 38, 63, 0.45);
  --gold: #f5c96b;
  --gold-deep: #c99732;
  --gold-soft: rgba(245, 201, 107, 0.22);
  --cream: #fff9ef;
  --cream-muted: #e6dac6;
  --emerald: #26a66c;
  --emerald-soft: rgba(38, 166, 108, 0.18);
  --card-bg: rgba(11, 35, 26, 0.84);
  --card-border: rgba(245, 201, 107, 0.34);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.52);
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 0%, rgba(184, 29, 51, 0.24), transparent 52%),
    radial-gradient(circle at 12% 30%, rgba(245, 201, 107, 0.12), transparent 40%),
    radial-gradient(circle at 88% 75%, rgba(38, 166, 108, 0.14), transparent 45%),
    linear-gradient(170deg, var(--bg-deep) 0%, var(--bg-pine) 52%, #081e16 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Snow canvas */
#snow-canvas,
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#snow-canvas {
  z-index: 1;
}

#confetti-canvas {
  z-index: 50;
}

/* Festive fairy lights */
.lights-garland {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  height: 36px;
  padding: 0 12px;
  overflow: hidden;
  border-top: 3px solid #163e2e;
}

.light-bulb {
  position: relative;
  width: 12px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%;
  margin-top: 6px;
  animation: twinkle 2.4s infinite ease-in-out;
}

.light-bulb::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 3px;
  width: 6px;
  height: 6px;
  background: #244a3a;
  border-radius: 2px;
}

.light-bulb:nth-child(4n + 1) {
  background: #ff4d5a;
  box-shadow: 0 0 14px #ff4d5a;
  animation-delay: 0s;
}
.light-bulb:nth-child(4n + 2) {
  background: #ffd666;
  box-shadow: 0 0 14px #ffd666;
  animation-delay: 0.6s;
}
.light-bulb:nth-child(4n + 3) {
  background: #4ce08a;
  box-shadow: 0 0 14px #4ce08a;
  animation-delay: 1.2s;
}
.light-bulb:nth-child(4n + 4) {
  background: #67c6ff;
  box-shadow: 0 0 14px #67c6ff;
  animation-delay: 1.8s;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.48;
    transform: scale(0.92);
  }
}

.page-shell {
  position: relative;
  z-index: 4;
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 18px 48px;
}

/* Top bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.08);
  border: 1px solid rgba(245, 201, 107, 0.3);
  color: var(--cream);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.nav-pill:hover {
  background: rgba(245, 201, 107, 0.18);
  border-color: var(--gold);
  transform: translateY(-1px);
}

/* Hero Banner */
.hero-banner {
  text-align: center;
  padding: 26px 22px 24px;
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(164, 22, 43, 0.92) 0%, rgba(114, 15, 31, 0.95) 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), inset 0 0 36px rgba(245, 201, 107, 0.16);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '❄️ 🎄 🎁 ⭐ 🔔';
  display: block;
  margin-top: 10px;
  font-size: 1.15rem;
  letter-spacing: 8px;
  opacity: 0.88;
}

.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(6, 24, 18, 0.55);
  border: 1px solid rgba(245, 201, 107, 0.55);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3.6vw, 2.55rem);
  font-weight: 800;
  line-height: 1.18;
  color: #fff6dc;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.02em;
}

.hero-subtitle {
  margin: 10px auto 0;
  max-width: 640px;
  color: #fde9c9;
  font-size: 0.98rem;
  line-height: 1.5;
}

/* Main Cards */
.festive-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--gold);
}

.muted-text {
  color: var(--cream-muted);
  font-size: 0.94rem;
}

/* Participant selection grid */
.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.person-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(245, 201, 107, 0.28);
  background: linear-gradient(160deg, rgba(25, 68, 51, 0.85), rgba(14, 42, 31, 0.95));
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.person-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.person-btn.is-selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(164, 22, 43, 0.86), rgba(114, 15, 31, 0.92));
  box-shadow: 0 0 0 3px rgba(245, 201, 107, 0.25);
}

.person-btn.is-done {
  background: linear-gradient(160deg, rgba(18, 44, 34, 0.72), rgba(10, 27, 21, 0.85));
  border-color: rgba(38, 166, 108, 0.42);
  opacity: 0.86;
}

.person-name {
  font-size: 1.06rem;
  font-weight: 700;
  word-break: break-word;
}

.person-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.person-status.ready {
  background: var(--gold-soft);
  color: var(--gold);
}

.person-status.done {
  background: var(--emerald-soft);
  color: #6df0b2;
}

/* Santa Stage */
.santa-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  text-align: center;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(245, 201, 107, 0.25);
}

.selected-who {
  font-size: 1.12rem;
  font-weight: 700;
}

.selected-who span {
  color: var(--gold);
}

.santa-scene {
  position: relative;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px 10px 8px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 42%, rgba(245, 201, 107, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(6, 24, 18, 0.45) 0%, rgba(18, 52, 39, 0.72) 100%);
  border: 1px solid rgba(245, 201, 107, 0.22);
}

/* Floating name falling out of sack */
.sack-drop-zone {
  position: relative;
  z-index: 4;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: -14px;
}

.rolling-tag {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 26px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffaf0, #f8e5b8);
  color: #5c101b;
  border: 3px solid var(--gold-deep);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45), 0 0 28px rgba(245, 201, 107, 0.55);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  transform-origin: bottom center;
}

.rolling-tag.is-cycling {
  animation: popFromSack 0.22s ease-in-out infinite alternate;
}

.rolling-tag.is-winner {
  background: linear-gradient(135deg, #fffdf5 0%, #ffe69a 100%);
  border: 3px solid #b81d33;
  padding: 18px 32px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 42px rgba(245, 201, 107, 0.85);
  animation: winnerDropOut 0.75s cubic-bezier(0.22, 1.35, 0.36, 1) forwards;
}

.winner-label {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9e182c;
}

.winner-budget {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  color: #165239;
  margin-top: 2px;
}

@keyframes popFromSack {
  0% {
    transform: translateY(14px) scale(0.92) rotate(-3deg);
  }
  100% {
    transform: translateY(-6px) scale(1.04) rotate(3deg);
  }
}

@keyframes winnerDropOut {
  0% {
    opacity: 0;
    transform: translateY(85px) scale(0.35) rotate(-10deg);
  }
  55% {
    opacity: 1;
    transform: translateY(-16px) scale(1.1) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

/* Santa SVG wrapper */
.santa-svg-wrap {
  position: relative;
  z-index: 3;
  width: min(300px, 84vw);
  transition: transform 0.25s ease;
}

.santa-svg-wrap.is-idle {
  animation: santaFloat 3.4s ease-in-out infinite;
}

.santa-svg-wrap.is-shaking {
  animation: santaShake 0.24s ease-in-out infinite;
}

@keyframes santaFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes santaShake {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(-5px, -3px) rotate(-2.5deg);
  }
  50% {
    transform: translate(4px, 2px) rotate(2.5deg);
  }
  75% {
    transform: translate(-4px, 1px) rotate(-1.5deg);
  }
  100% {
    transform: translate(3px, -2px) rotate(1.5deg);
  }
}

/* Sparkles during draw */
.magic-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.magic-sparkles.active {
  opacity: 1;
}

.magic-sparkles span {
  position: absolute;
  font-size: 1.35rem;
  animation: sparkleRise 1.1s ease-out infinite;
}

.magic-sparkles span:nth-child(1) { left: 26%; bottom: 130px; animation-delay: 0s; }
.magic-sparkles span:nth-child(2) { left: 42%; bottom: 145px; animation-delay: 0.2s; }
.magic-sparkles span:nth-child(3) { left: 58%; bottom: 140px; animation-delay: 0.4s; }
.magic-sparkles span:nth-child(4) { left: 72%; bottom: 125px; animation-delay: 0.15s; }
.magic-sparkles span:nth-child(5) { left: 50%; bottom: 160px; animation-delay: 0.55s; }

@keyframes sparkleRise {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.5);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-75px) scale(1.25);
  }
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #d1233d, #981428);
  color: #fff8ea;
  border: 1.5px solid rgba(245, 201, 107, 0.7);
  box-shadow: 0 10px 24px rgba(184, 29, 51, 0.45);
}

.btn-gold {
  background: linear-gradient(135deg, #ffe08a, #d89f2c);
  color: #3f0e14;
  box-shadow: 0 10px 26px rgba(216, 159, 44, 0.4);
}

.btn-secondary {
  background: rgba(255, 249, 239, 0.12);
  color: var(--cream);
  border: 1px solid rgba(245, 201, 107, 0.35);
}

.btn-danger {
  background: rgba(201, 36, 59, 0.2);
  color: #ffb8c2;
  border: 1px solid rgba(255, 114, 134, 0.5);
}

.btn-primary:hover:not(:disabled),
.btn-gold:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-big-draw {
  padding: 15px 34px;
  font-size: 1.1rem;
}

.stage-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Pending list footer */
.pending-card {
  background: linear-gradient(160deg, rgba(14, 42, 31, 0.92), rgba(7, 22, 16, 0.96));
  border: 1px solid rgba(245, 201, 107, 0.32);
}

.progress-pill {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
}

.pending-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(184, 29, 51, 0.24);
  border: 1px solid rgba(245, 201, 107, 0.35);
  color: #fff3da;
  font-weight: 600;
  font-size: 0.94rem;
}

.all-done-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--emerald-soft);
  border: 1px solid rgba(38, 166, 108, 0.55);
  color: #a9ffd4;
  font-weight: 700;
  text-align: center;
}

/* Alerts & Forms (shared with Admin) */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 0.94rem;
  font-weight: 600;
}

.alert-error {
  background: rgba(196, 30, 58, 0.26);
  border: 1px solid rgba(255, 118, 138, 0.6);
  color: #ffd0d7;
}

.alert-success {
  background: rgba(38, 166, 108, 0.22);
  border: 1px solid rgba(86, 224, 158, 0.55);
  color: #bdffe0;
}

.alert-warning {
  background: rgba(245, 201, 107, 0.16);
  border: 1px solid rgba(245, 201, 107, 0.55);
  color: #ffeab3;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.festive-input,
.festive-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 201, 107, 0.35);
  background: rgba(6, 24, 18, 0.78);
  color: var(--cream);
  font-family: inherit;
  font-size: 1rem;
}

.festive-input:focus,
.festive-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 201, 107, 0.2);
}

/* Admin Layout Helpers */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.list-items {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 249, 239, 0.06);
  border: 1px solid rgba(245, 201, 107, 0.18);
  word-break: break-word;
}

button,
.nav-pill,
.person-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 249, 239, 0.06);
  border: 1px solid rgba(245, 201, 107, 0.28);
  cursor: pointer;
}

.checkbox-card input[type='checkbox'] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #d1233d;
  cursor: pointer;
}

.mini-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .light-bulb,
  .santa-svg-wrap,
  .rolling-tag,
  .magic-sparkles span {
    animation: none !important;
  }
}

@media (max-width: 600px) {
  .page-shell {
    padding: 10px 12px calc(36px + env(safe-area-inset-bottom, 0px));
  }
  .top-nav {
    gap: 8px;
  }
  .nav-pill {
    flex: 1 1 auto;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.86rem;
  }
  .hero-banner {
    padding: 20px 14px 18px;
    margin-bottom: 16px;
  }
  .hero-subtitle {
    font-size: 0.9rem;
  }
  .festive-card {
    padding: 16px 13px;
    border-radius: 18px;
    margin-bottom: 16px;
  }
  .section-heading h2 {
    font-size: 1.24rem;
  }
  .participants-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .person-btn {
    padding: 12px 11px;
    min-height: 68px;
  }
  .person-name {
    font-size: 0.98rem;
  }
  .person-status {
    font-size: 0.72rem;
    padding: 3px 8px;
  }
  .santa-scene {
    min-height: 270px;
    padding: 14px 8px 6px;
  }
  .sack-drop-zone {
    min-height: 94px;
    margin-bottom: -10px;
  }
  .rolling-tag {
    max-width: 94%;
    padding: 10px 16px;
    font-size: 1.25rem;
  }
  .rolling-tag.is-winner {
    padding: 14px 20px;
  }
  .santa-svg-wrap {
    width: min(245px, 78vw);
  }
  .btn-big-draw,
  .stage-actions .btn-secondary,
  .stage-actions .btn-gold,
  .input-row > button {
    width: 100%;
  }
  .input-row {
    flex-direction: column;
    align-items: stretch;
  }
}
