:root {
  --abeto: #0f3b2a;
  --abeto-2: #16513a;
  --rojo: #b3202a;
  --rojo-2: #8e1820;
  --oro: #d9a441;
  --crema: #fffaf2;
  --texto: #2a211b;
  --suave: #7a6c60;
  --borde: #efe3d1;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--texto);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--abeto-2); }
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .08), transparent 40%),
    radial-gradient(circle at 90% 30%, rgba(217, 164, 65, .10), transparent 35%),
    linear-gradient(180deg, var(--abeto) 0%, var(--abeto-2) 100%);
}

/* Nieve */
.nieve { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.nieve i {
  position: absolute; top: -2rem; color: #fff; opacity: .7; font-style: normal;
  animation: caer linear infinite;
}
@keyframes caer { to { transform: translate3d(var(--deriva, 20px), 110vh, 0) rotate(180deg); } }
@media (prefers-reduced-motion: reduce) { .nieve { display: none; } }

main {
  position: relative; z-index: 1;
  max-width: 30rem; margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(2.5rem, env(safe-area-inset-bottom));
}

/* Cabecera */
.cabecera { text-align: center; color: var(--crema); padding: 1rem 0 .5rem; }
.cabecera .guirnalda { font-size: 1.4rem; letter-spacing: .4rem; }
h1 {
  font-family: var(--serif); font-weight: 700; font-size: 2.3rem; line-height: 1.05;
  margin: .35rem 0 0; letter-spacing: -.01em;
}
h1 small { display: block; font-size: 1rem; font-weight: 500; color: var(--oro); letter-spacing: .15em; text-transform: uppercase; margin-bottom: .35rem; }
.hola { text-align: center; color: var(--crema); font-size: 1.15rem; margin: .75rem 0 1.25rem; }
.hola strong { font-family: var(--serif); font-size: 1.5rem; color: #fff; }

h2 { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 .75rem; color: var(--abeto); }
h3 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); margin: 1.25rem 0 .5rem; }

.muted { color: var(--suave); font-size: .95rem; line-height: 1.45; }
#estado { color: var(--crema); text-align: center; opacity: .9; }
.pie { text-align: center; color: rgba(255, 250, 242, .75); font-size: .9rem; margin-top: 1.5rem; }

/* Tarjetas */
.card {
  background: var(--crema);
  border-radius: 20px;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  border-top: 5px solid var(--rojo);
}

/* Datos del evento */
.evento {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
  padding: 1rem .75rem; text-align: center; border-top-color: var(--oro);
}
.evento div { display: grid; gap: .15rem; }
.evento .ico { font-size: 1.5rem; }
.evento span { color: var(--suave); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.evento b { font-size: .98rem; }

/* Avisos */
.aviso {
  background: #fff3d1; color: #5c4210; border: 1px solid var(--oro);
  border-radius: 14px; padding: .85rem 1rem; line-height: 1.4;
}
.error { color: var(--rojo); }

/* Botones */
button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 14px;
  min-height: 48px; padding: .7rem 1.1rem; background: var(--rojo); color: #fff;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background .2s ease;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .6; cursor: default; }
button.secundario { background: transparent; color: var(--abeto); border: 2px solid var(--abeto); width: 100%; margin-top: 1rem; }
button.peligro { background: var(--rojo-2); width: 100%; }
button.quitar {
  background: transparent; color: var(--suave); min-height: 40px; padding: .3rem .6rem;
  font-size: .85rem; font-weight: 500;
}

/* El regalo */
.regalo {
  display: grid; justify-items: center; gap: .5rem; width: 100%;
  background: linear-gradient(160deg, #fff, #fbeee0); color: var(--abeto);
  border: 2px dashed var(--oro); border-radius: 18px; padding: 1.25rem 1rem;
}
.regalo .caja { font-size: 4.5rem; line-height: 1; animation: menear 2.6s ease-in-out infinite; }
.regalo .texto { font-family: var(--serif); font-size: 1.25rem; }
.regalo .sub { font-weight: 500; font-size: .85rem; color: var(--suave); }
@keyframes menear {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-8deg); } 82% { transform: rotate(7deg); } 89% { transform: rotate(-4deg); }
}
@media (prefers-reduced-motion: reduce) { .regalo .caja { animation: none; } }

.resultado { text-align: center; }
.giftee { margin: 0; color: var(--suave); }
.giftee strong {
  display: block; font-family: var(--serif); font-size: 2.6rem; line-height: 1.1;
  color: var(--rojo); margin-top: .25rem;
  animation: aparecer .6s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes aparecer { from { opacity: 0; transform: scale(.6) translateY(10px); } }
.resultado .lista { text-align: left; }

/* Listas de deseos */
.lista { list-style: none; padding: 0; margin: 0; }
.lista li {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .55rem 0 .55rem 1.6rem; border-bottom: 1px dashed var(--borde); position: relative;
  line-height: 1.35;
}
.lista li::before { content: '⭐'; position: absolute; left: 0; font-size: .95rem; }
.lista li span { overflow-wrap: anywhere; }

/* Formularios */
input, textarea {
  font: inherit; font-size: 16px; width: 100%; min-height: 48px; padding: .7rem .85rem;
  border: 2px solid var(--borde); border-radius: 14px; background: #fff; color: var(--texto);
}
input:focus, textarea:focus { outline: none; border-color: var(--oro); }
label { display: block; margin-bottom: 1rem; font-weight: 600; color: var(--abeto); }
label input, label textarea { margin-top: .4rem; font-weight: 400; }
label.check { display: flex; gap: .6rem; align-items: center; font-weight: 500; }
label.check input { width: 22px; min-height: 22px; height: 22px; margin: 0; accent-color: var(--rojo); }
.fila { display: flex; gap: .5rem; margin-top: 1rem; }
.fila input { flex: 1; min-width: 0; }
#form-sorteo button { width: 100%; }

details summary { cursor: pointer; font-weight: 600; color: var(--abeto); min-height: 32px; }
details[open] summary { margin-bottom: .75rem; }

/* Enlaces del sorteo */
.enlaces { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.enlaces li { display: grid; gap: .45rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--borde); }
.enlaces li:last-child { border-bottom: 0; padding-bottom: 0; }
.enlaces b { font-family: var(--serif); font-size: 1.2rem; }
.enlaces input { font-size: 14px; min-height: 40px; color: var(--suave); }

/* Participantes del sorteo (fijos) */
.etiqueta { font-weight: 600; color: var(--abeto); margin: 0 0 .5rem; }
.chips { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li {
  font-family: var(--serif); font-size: 1.1rem; padding: .45rem .95rem .45rem .8rem;
  border-radius: 999px; background: var(--abeto); color: var(--crema);
  box-shadow: inset 0 0 0 2px rgba(217, 164, 65, .55);
}
.chips li::before { content: '🎁 '; font-size: .95rem; }

/* Probar sonidos */
.probar { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.probar button.secundario { margin-top: 0; }
