:root {
  --bg1: #0f2a1d;
  --bg2: #1d0b0b;
  --card: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.15);
  --text: #fdf6ec;
  --muted: #c9bfb2;
  --red: #d7263d;
  --red-dark: #a51c2f;
  --gold: #f4c542;
  --green: #2e8b57;
}

* { box-sizing: border-box; }

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #23472f 0%, var(--bg1) 45%, var(--bg2) 100%) fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 32px 18px 60px;
}

header { text-align: center; margin-bottom: 20px; }
.santa { font-size: 64px; animation: bob 2.4s ease-in-out infinite; display: inline-block; }
h1 {
  margin: 4px 0 0;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 0 2px 0 var(--red-dark), 0 0 18px rgba(244, 197, 66, 0.35);
}
h2 { margin: 0 0 14px; font-size: 1.3rem; text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 18px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: pop 0.35s ease-out;
}
.hidden { display: none !important; }
.muted { color: var(--muted); text-align: center; font-size: 0.95rem; }
.error { color: #ff8a8a; text-align: center; min-height: 1.2em; margin: 4px 0; font-size: 0.95rem; }
.big { font-size: 56px; text-align: center; }

.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.names button { position: relative; }
.names button:last-child:nth-child(odd) { grid-column: span 2; }
.names .check {
  position: absolute; top: 4px; right: 8px; font-size: 0.75rem; opacity: 0.85;
}

button, input {
  font: inherit;
  border-radius: 12px;
}

button {
  width: 100%;
  padding: 14px 12px;
  border: 0;
  cursor: pointer;
  color: white;
  font-weight: 600;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  box-shadow: 0 4px 0 #6e1220;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #6e1220; }
button:disabled { opacity: 0.6; cursor: wait; }
button.link {
  background: none; box-shadow: none; color: var(--muted); font-weight: 400; margin-top: 6px;
}

form { display: flex; flex-direction: column; gap: 10px; }
input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--gold); }

/* ---------- regalo ---------- */
.gift {
  display: block;
  margin: 10px auto 6px;
  width: auto;
  font-size: 110px;
  line-height: 1;
  background: none;
  box-shadow: none;
  padding: 10px;
  animation: wiggle 2.5s ease-in-out infinite;
}
.gift:active { transform: none; box-shadow: none; }
.gift.shake { animation: shake 0.12s linear infinite; }
.gift.boom { animation: boom 0.45s ease-in forwards; }

.slot {
  display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 12px 0 4px;
}
.slot-label { color: var(--muted); }
.slot-name {
  font-size: 2.4rem;
  font-weight: 800;
  min-height: 1.3em;
  padding: 6px 22px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px dashed var(--border);
  text-align: center;
}
.slot-name.spin { animation: tick 0.09s linear; }
.slot-name.final {
  color: var(--gold);
  border: 2px solid var(--gold);
  box-shadow: 0 0 25px rgba(244, 197, 66, 0.5);
  animation: final 0.7s cubic-bezier(.2,1.6,.4,1);
}
.shh { text-align: center; font-size: 1.1rem; margin: 18px 0 14px; }

/* ---------- nieve y confeti ---------- */
#snow, #confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#snow { z-index: 0; }
#confetti { z-index: 10; }
.flake {
  position: absolute; top: -20px; color: white; opacity: 0.8;
  animation: fall linear infinite;
}
.confetto {
  position: absolute; top: -30px;
  animation: confetti-fall cubic-bezier(.25,.6,.5,1) forwards;
}

@keyframes fall { to { transform: translateY(110vh) translateX(30px); } }
@keyframes confetti-fall {
  to { transform: translateY(115vh) translateX(var(--dx)) rotate(var(--rot)); opacity: 0.9; }
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
@keyframes pop { from { transform: scale(0.95); opacity: 0; } }
@keyframes wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85% { transform: rotate(-10deg); }
  90% { transform: rotate(10deg); }
  95% { transform: rotate(-6deg); }
}
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-6px, 2px) rotate(-8deg); }
  50% { transform: translate(5px, -3px) rotate(7deg); }
  75% { transform: translate(-3px, 3px) rotate(-4deg); }
}
@keyframes boom {
  60% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes tick { from { transform: translateY(-40%); opacity: 0.3; } }
@keyframes final {
  0% { transform: scale(0.4) rotate(-8deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  #snow { display: none; }
}

/* ---------- admin ---------- */
table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.95rem; }
td button { padding: 6px 10px; font-size: 0.85rem; box-shadow: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.btn-green { background: linear-gradient(180deg, #3aa66c, var(--green)); box-shadow: 0 4px 0 #1b5636; }
tr.has-info td { border-bottom: 0; }
tr.info td { font-size: 0.78rem; color: var(--muted); padding-top: 0; line-height: 1.5; word-break: break-word; }
