:root {
  --pine: #0b3d2e;
  --pine-deep: #072a20;
  --holly: #b3202b;
  --holly-dark: #8d1620;
  --gold: #e8b64c;
  --gold-soft: #f5d58a;
  --snow: #fbf7ef;
  --cream: #f1e8d6;
  --ink: #1b2a24;
  --muted: #a9bdb4;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: 'Mountains of Christmas', 'Georgia', serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  color: var(--snow);
  background: radial-gradient(ellipse at top, #15594a 0%, var(--pine) 45%, var(--pine-deep) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--gold-soft); }

.snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.flake {
  position: absolute;
  top: -5vh;
  color: #fff;
  opacity: 0.8;
  animation: fall linear infinite;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  user-select: none;
}

@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(var(--drift, 20px), 110vh, 0) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .flake { animation: none; display: none; }
}

.lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  display: flex;
  justify-content: space-around;
  z-index: 2;
  pointer-events: none;
}

.lights span {
  width: 12px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  margin-top: -4px;
  animation: twinkle 2.4s ease-in-out infinite;
  box-shadow: 0 0 12px currentColor;
  background: currentColor;
}

.lights span:nth-child(4n + 1) { color: #ff4d5a; }
.lights span:nth-child(4n + 2) { color: #ffd166; animation-delay: 0.6s; }
.lights span:nth-child(4n + 3) { color: #4cc9f0; animation-delay: 1.2s; }
.lights span:nth-child(4n + 4) { color: #80ed99; animation-delay: 1.8s; }

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 16px 64px;
}

.site-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 1;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 4px 0 var(--holly-dark), 0 10px 30px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.02em;
}

.brand .x { color: var(--holly); -webkit-text-stroke: 1px var(--gold-soft); }

.tagline {
  margin: 10px 0 0;
  color: var(--cream);
  font-size: 1.05rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  padding: 24px;
}

.card + .card { margin-top: 24px; }

.card h2 {
  font-family: var(--font-display);
  color: var(--gold-soft);
  font-size: 2rem;
  margin: 0 0 6px;
}

.card .hint { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }

.year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.year-tab {
  font: inherit;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold-soft);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.year-tab:hover { transform: translateY(-2px); background: rgba(232, 182, 76, 0.15); }

.year-tab[aria-selected='true'] {
  background: var(--gold);
  color: var(--pine-deep);
  box-shadow: 0 6px 18px rgba(232, 182, 76, 0.35);
}

.draw-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.draw-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-soft);
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.25);
}

.draw-table td {
  padding: 14px 18px;
  font-size: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.draw-table tr:hover td { background: rgba(255, 255, 255, 0.04); }

.draw-table .arrow { text-align: center; color: var(--holly); font-size: 1.3rem; width: 60px; }

.draw-table .recipient { font-weight: 800; color: #fff; }

.empty { text-align: center; padding: 32px; color: var(--muted); }

.site-footer {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Buttons & forms */

.btn {
  font: inherit;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

.btn-primary { background: var(--holly); color: #fff; box-shadow: 0 8px 20px rgba(179, 32, 43, 0.4); }
.btn-gold { background: var(--gold); color: var(--pine-deep); box-shadow: 0 8px 20px rgba(232, 182, 76, 0.35); }
.btn-ghost { background: transparent; color: var(--cream); border: 2px solid var(--card-border); }
.btn-small { padding: 6px 12px; font-size: 0.9rem; border-radius: 8px; }

.input, select.input {
  font: inherit;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--snow);
  min-width: 0;
}

.input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

select.input option { color: var(--ink); }

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

.chip-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  font-weight: 700;
}

.chip button {
  font: inherit;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--holly);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.chip button:hover { background: var(--holly-dark); }

.pair-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }

.pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pair .no { color: var(--holly); font-weight: 800; text-align: center; }
.pair .seeded { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-left: 6px; }

.steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.step .num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}

.step[aria-current='step'] { color: var(--gold-soft); background: rgba(232, 182, 76, 0.12); }
.step[aria-current='step'] .num { background: var(--gold); color: var(--pine-deep); }
.step.done .num { background: #3aa66b; color: #fff; }

.panel[hidden] { display: none; }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--card-border);
}

.actions .right { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  margin: 0 0 16px;
  font-weight: 600;
}

.notice-warn { background: rgba(232, 182, 76, 0.16); border: 1px solid rgba(232, 182, 76, 0.5); color: var(--gold-soft); }
.notice-error { background: rgba(179, 32, 43, 0.2); border: 1px solid rgba(179, 32, 43, 0.6); color: #ffb3b8; }
.notice-ok { background: rgba(58, 166, 107, 0.18); border: 1px solid rgba(58, 166, 107, 0.6); color: #b7f0ce; }

.notice[hidden] { display: none; }

pre.code {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: var(--cream);
  margin: 16px 0 0;
}

.reveal td { animation: pop 0.35s ease both; }
@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .page { padding-top: 36px; }
  .card { padding: 18px; }
  .draw-table td { font-size: 1rem; padding: 12px; }
  .pair { grid-template-columns: auto auto 1fr auto; gap: 8px; font-size: 0.95rem; }
  .pair .no { font-size: 0.75rem; }
  .pair .seeded { display: block; margin-left: 0; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
