:root {
  --night: #0d2a1f;
  --night-2: #123828;
  --pine: #1d5139;
  --paper: #fbf5e9;
  --paper-2: #f3e9d4;
  --ink: #2a1d16;
  --ink-soft: #6b5a4c;
  --berry: #b3263a;
  --berry-dark: #8c1a2b;
  --gold: #e8c46a;
  --gold-soft: #f4e2b0;
  --line: #e2d4b8;
  --ok: #2f7a50;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px -18px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--paper);
  background:
    radial-gradient(1200px 600px at 50% -10%, #1f5a40 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 100%, #3a1220 0%, transparent 60%),
    var(--night);
  background-attachment: fixed;
  overflow-x: hidden;
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* ── Guirnalda de luces ─────────────────────────────── */
.lights {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between;
  margin: 0; padding: 0 8px; list-style: none;
  height: 44px; overflow: hidden;
}
.lights::before {
  content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 30px;
  border-bottom: 2px solid #0a1f16; border-radius: 50%;
}
.lights li {
  position: relative; top: 14px;
  width: 10px; height: 18px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 4px 18px 3px var(--gold);
  animation: twinkle 2.4s ease-in-out infinite;
}
.lights li::before {
  content: ""; position: absolute; top: -5px; left: 1px;
  width: 8px; height: 6px; border-radius: 2px; background: #0a1f16;
}
.lights li:nth-child(4n+1) { background: #ff5a6e; box-shadow: 0 4px 18px 3px #ff5a6e; animation-delay: .3s; }
.lights li:nth-child(4n+2) { background: #66e39b; box-shadow: 0 4px 18px 3px #66e39b; animation-delay: .9s; }
.lights li:nth-child(4n+3) { background: #7cc4ff; box-shadow: 0 4px 18px 3px #7cc4ff; animation-delay: 1.5s; }
.lights li:nth-child(n+11) { display: none; }
@media (min-width: 640px) { .lights li:nth-child(n+11) { display: block; } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; box-shadow: none; } }

/* ── Encabezado ─────────────────────────────────────── */
.hero { position: relative; z-index: 1; text-align: center; padding: 28px 16px 8px; }
.eyebrow {
  margin: 0 0 6px; font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold);
}
h1 {
  margin: 0; font-family: "Fraunces", Georgia, serif; font-weight: 700;
  font-size: clamp(44px, 11vw, 84px); line-height: .95; letter-spacing: -.02em;
  text-shadow: 0 4px 30px rgba(0,0,0,.4);
}
h1 em { font-style: italic; font-weight: 500; color: var(--gold); }
.facts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.fact {
  display: inline-flex; flex-direction: column; align-items: center;
  min-width: 140px; padding: 10px 18px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(232,196,106,.35);
  backdrop-filter: blur(4px);
}
.fact small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-soft); opacity: .85; }
.fact strong { font-family: "Fraunces", serif; font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── Contenido ──────────────────────────────────────── */
main {
  position: relative; z-index: 1;
  width: 100%; max-width: 980px; margin: 0 auto; padding: 24px 16px 48px;
  display: grid; gap: 20px; grid-template-columns: 1fr;
}
@media (min-width: 820px) {
  main.two { grid-template-columns: 1fr 1fr; align-items: start; }
  main.two .span { grid-column: 1 / -1; }
}
.loading { text-align: center; color: var(--gold-soft); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
}
/* Listón dorado en la esquina, como de regalo */
.card.ribbon::before {
  content: ""; position: absolute; top: 0; right: 24px; width: 22px; height: 58px;
  background: linear-gradient(90deg, #d9ae4f, var(--gold), #d9ae4f);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.card.ribbon > * { position: relative; }
.card h2 {
  margin: 0 0 4px; font-family: "Fraunces", serif; font-weight: 700; font-size: 26px; line-height: 1.15;
  color: var(--berry-dark);
}
.card .lede { margin: 0 0 18px; color: var(--ink-soft); }
.card.ribbon h2, .card.ribbon .lede { padding-right: 40px; }

/* ── Formularios ────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--paper-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button {
  flex: 1; border: 0; background: transparent; color: var(--ink-soft);
  font: inherit; font-weight: 500; padding: 9px 12px; border-radius: 999px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--berry); color: #fff; }

form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink); }
label .hint { font-weight: 400; color: var(--ink-soft); font-size: 13px; }
input {
  font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fffdf8;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 3px rgba(179,38,58,.15); }
.row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .row.cols-2 { grid-template-columns: 2fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--berry); color: #fff;
  box-shadow: 0 2px 0 var(--berry-dark);
  transition: transform .1s, background .15s;
}
.btn:hover { background: #c22d42; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--berry-dark); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: #fff; }
.btn.gold { background: var(--gold); color: var(--ink); box-shadow: 0 2px 0 #b88f35; }
.btn.gold:hover { background: #f0cf7c; }
.btn.small { padding: 6px 10px; font-size: 13px; font-weight: 500; }
.btn:focus-visible, .tabs button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.error { margin: 0; color: var(--berry); font-size: 14px; font-weight: 500; }
.note-box {
  margin: 0; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  background: #fff6dc; border: 1px dashed #d9b75f; color: var(--ink);
}

/* ── Lista de deseos ────────────────────────────────── */
.wishes { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.wish {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 12px; background: #fffdf8; border: 1px solid var(--line);
}
.wish .ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--paper-2); font-size: 18px;
}
.wish .ico img { width: 20px; height: 20px; }
.wish .body { min-width: 0; }
.wish a { color: var(--berry-dark); font-weight: 700; text-decoration: none; word-break: break-word; }
.wish a:hover { text-decoration: underline; }
.wish .domain { display: block; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { margin: 0 0 18px; padding: 18px; text-align: center; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--ink-soft); }

/* ── Participantes ──────────────────────────────────── */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: #fffdf8; border: 1px solid var(--line); font-weight: 500;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--pine);
}
.person.me { border-color: var(--berry); }
.person .tag { font-size: 11px; color: var(--ink-soft); }
.person button { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.person button:hover { color: var(--berry); background: var(--paper-2); }
.count { font-family: "Fraunces", serif; color: var(--berry); }

/* ── El sorteo ──────────────────────────────────────── */
.draw { text-align: center; }
.draw .card-inner { display: grid; justify-items: center; gap: 14px; }
.gift { width: 140px; height: 140px; position: relative; margin: 6px auto 4px; }
.gift .box, .gift .lid {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: var(--berry); border-radius: 6px;
}
.gift .box { bottom: 0; width: 104px; height: 82px; background: linear-gradient(90deg, var(--berry) 44%, var(--gold) 44% 56%, var(--berry) 56%); }
.gift .lid {
  bottom: 78px; width: 122px; height: 28px;
  background: linear-gradient(90deg, #cf3149 44%, var(--gold) 44% 56%, #cf3149 56%);
  transition: transform .7s cubic-bezier(.3,1.6,.5,1);
}
.gift .bow { position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); width: 64px; height: 30px; }
.gift .bow::before, .gift .bow::after {
  content: ""; position: absolute; bottom: 0; width: 30px; height: 26px; border: 7px solid var(--gold); border-radius: 50% 50% 0 50%;
}
.gift .bow::before { left: 0; transform: rotate(-20deg); }
.gift .bow::after { right: 0; transform: scaleX(-1) rotate(-20deg); }
.gift.locked { filter: saturate(.75); }
.gift.ready { animation: wiggle 2.2s ease-in-out infinite; }
.gift.open .lid, .gift.open .bow { transform: translate(-50%, -46px) rotate(-14deg); transition: transform .7s cubic-bezier(.3,1.6,.5,1); }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-5deg); } 88% { transform: rotate(5deg); } 92% { transform: rotate(-3deg); } }

.countdown { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.countdown div { min-width: 64px; padding: 8px 6px; border-radius: 10px; background: var(--night); color: var(--paper); }
.countdown b { display: block; font-family: "Fraunces", serif; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-soft); }

.reveal-name {
  margin: 0; font-family: "Fraunces", serif; font-style: italic; font-weight: 700;
  font-size: clamp(36px, 8vw, 56px); line-height: 1.05; color: var(--berry);
  animation: pop .6s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
.match-wishes { text-align: left; width: 100%; margin-top: 6px; }
.match-wishes h3 { font-family: "Fraunces", serif; font-size: 18px; margin: 8px 0 10px; color: var(--ink); }

/* ── Pie y aviso ────────────────────────────────────── */
.foot { position: relative; z-index: 1; text-align: center; padding: 0 16px 36px; color: var(--gold-soft); font-size: 14px; }
.foot button { font: inherit; color: var(--gold); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 4px; }
.toast {
  position: fixed; z-index: 10; left: 50%; bottom: 22px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--paper); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-weight: 500;
}

/* ── Botón de música ────────────────────────────────── */
.music-btn {
  position: fixed; z-index: 9; right: 16px; bottom: 16px;
  width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--gold);
  display: grid; place-items: center; cursor: pointer;
  background: var(--berry); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 4px rgba(232,196,106,.18);
  transition: transform .15s, background .15s;
}
.music-btn:hover { transform: scale(1.06); }
.music-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.music-btn svg { width: 24px; height: 24px; fill: currentColor; }
.music-btn .off { display: none; }
.music-btn[aria-pressed="true"] { background: var(--night-2); color: var(--gold-soft); }
.music-btn[aria-pressed="true"] .on { display: none; }
.music-btn[aria-pressed="true"] .off { display: block; }
.music-btn.playing:not([aria-pressed="true"]) { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 4px rgba(232,196,106,.18); } 50% { box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 9px rgba(232,196,106,.08); } }
/* Que el botón no tape el aviso ni el pie */
.toast { bottom: 80px; }
.foot { padding-bottom: 84px; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
