/* Regalitos — estilos base (glass oscuro, mobile-first) */
:root {
  --bg: #0b0813;
  --ink: #f6f3ff;
  --muted: #d2caeb;
  --faint: #c2b9dc;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.09);
  --accent: #c9a6ff;
  --accent-2: #ffb4a2;
  --accent-3: #8ff0d0;
  --ok: #8ff0d0;
  --warn: #ffd28a;
  --danger: #ff9b9b;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

/* el atributo hidden pierde contra display:grid/flex de los componentes */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.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;
}

/* ---------- fondo ---------- */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { background: #6d3bd6; top: -18vmax; left: -10vmax; }
.b2 { background: #b23a67; bottom: -22vmax; right: -12vmax; animation-delay: -8s; }
.b3 { background: #1f7f74; top: 32vh; left: 48vw; width: 30vmax; height: 30vmax; animation-delay: -16s; opacity: .35; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmax, -3vmax, 0) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
}

/* ---------- estructura ---------- */
.topbar, .shell, .foot { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 5vw, 48px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 18px;
}
.brand svg { color: var(--accent); }
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.ghost-link:hover { color: var(--ink); border-color: var(--line); }

.shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: clamp(8px, 2vw, 24px) clamp(16px, 5vw, 48px) 64px;
  display: grid;
  gap: clamp(18px, 3vw, 28px);
}

/* ---------- hero ---------- */
.hero { padding: clamp(12px, 4vw, 40px) 0 8px; max-width: 720px; }
.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 680;
}
.shine {
  background: linear-gradient(92deg, var(--accent) 0%, var(--accent-2) 45%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 18px);
  max-width: 56ch;
}

/* ---------- tarjetas ---------- */
.glass {
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
}
.card { padding: clamp(18px, 3vw, 28px); }
.card h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.card-head { display: grid; gap: 16px; margin-bottom: 20px; }

/* ---------- modo ---------- */
.mode-switch { display: grid; gap: 10px; }
@media (min-width: 640px) { .mode-switch { grid-template-columns: 1fr 1fr; } }
.mode-pill {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: grid;
  gap: 4px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.mode-pill:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.mode-pill strong { font-size: 15px; font-weight: 620; }
.mode-pill span { font-size: 13px; color: var(--muted); }
.mode-pill.is-active {
  border-color: color-mix(in oklab, var(--accent) 60%, transparent);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 22%, transparent);
}

/* ---------- formularios ---------- */
.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 550; }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(10, 7, 20, 0.55);
  transition: border-color .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, textarea:focus {
  border-color: color-mix(in oklab, var(--accent) 70%, transparent);
  background: rgba(10, 7, 20, 0.75);
  outline: none;
}
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea { resize: vertical; min-height: 74px; }
.hint { margin: 0; font-size: 13px; color: var(--faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s;
  text-decoration: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: rgba(255, 255, 255, 0.12); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(100deg, #b98cff, #ff9f86 90%);
  border: none;
  color: #1a0f2b;
  box-shadow: 0 10px 30px rgba(185, 140, 255, .28);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(100deg, #c7a2ff, #ffb09a 90%); }
.btn-sm { min-height: 44px; padding: 7px 14px; font-size: 14px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); }
.btn-danger { border-color: color-mix(in oklab, var(--danger) 45%, transparent); color: var(--danger); background: transparent; }

.banner {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid color-mix(in oklab, var(--danger) 45%, transparent);
  background: color-mix(in oklab, var(--danger) 14%, transparent);
  color: #ffd9d9;
}

/* ---------- cómo funciona ---------- */
.how { display: grid; gap: 14px; margin-top: 8px; }
@media (min-width: 760px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how article {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.how h3 { margin: 10px 0 6px; font-size: 16px; }
.how p { margin: 0; color: var(--muted); font-size: 14px; }
.step { font-size: 12px; letter-spacing: .18em; color: var(--accent); }

.foot {
  padding: 28px clamp(16px, 5vw, 48px) calc(40px + env(safe-area-inset-bottom, 0px));
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.foot p { margin: 0; }
.foot a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.foot a:hover, .foot a:focus-visible {
  color: var(--accent);
  text-decoration-style: solid;
  text-decoration-color: var(--accent);
}
.heart { color: var(--accent-2); margin: 0 2px; }
.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;
}

/* ---------- sala ---------- */
.room-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}
.room-head > * { min-width: 0; max-width: 100%; }
.room-title { display: grid; gap: 6px; min-width: 0; }
.room-title h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.02em; }
.room-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
}
.badge.accent { color: #e8dcff; border-color: color-mix(in oklab, var(--accent) 45%, transparent); background: color-mix(in oklab, var(--accent) 14%, transparent); }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  color: var(--ink);
}
.section { display: grid; gap: 14px; }
.section, .split, .gift, .owner-block, .card, .mail-layout > * { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head > * { min-width: 0; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.section-head p { margin: 0; color: var(--faint); font-size: 13px; }

.avatar {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 12px; font-weight: 650;
  background: linear-gradient(140deg, #8b5cf6, #ec4899);
  color: #160b24;
}
.avatar.lg { width: 48px; height: 48px; flex-basis: 48px; font-size: 15px; }
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}
.person > :last-child { min-width: 0; }
.person-name { font-weight: 560; }
.person-sub { color: var(--faint); font-size: 12px; }

.owner-block { display: grid; gap: 10px; }
.owner-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

.gift-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .gift-grid { grid-template-columns: 1fr 1fr; } }
.gift {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
}
.gift.is-claimed { border-color: color-mix(in oklab, var(--ok) 35%, transparent); background: color-mix(in oklab, var(--ok) 8%, transparent); }
.gift-top { display: flex; gap: 12px; align-items: flex-start; }
.gift-thumb {
  width: 56px; height: 56px; flex: 0 0 56px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
}
.gift-title { margin: 0; font-size: 15px; font-weight: 600; }
.gift-notes { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.gift-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.claimed-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); }

.empty {
  padding: 22px;
  text-align: center;
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ---------- amigo secreto ---------- */
.split { display: grid; gap: 18px; }
@media (min-width: 900px) { .split { grid-template-columns: 1.15fr .85fr; align-items: start; } }
.wish-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wish-row:last-child { border-bottom: none; }
.wish-row .num { color: var(--faint); font-size: 13px; min-width: 20px; padding-top: 2px; }
.wish-row .body { flex: 1; min-width: 0; }
.wish-row a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 13px; }

.reveal {
  padding: clamp(20px, 4vw, 34px);
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(201, 166, 255, .22), transparent 60%),
    radial-gradient(120% 120% at 90% 100%, rgba(255, 180, 162, .18), transparent 55%),
    linear-gradient(160deg, var(--glass-2), var(--glass));
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line));
}
.reveal h2 { margin: 0; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.reveal .who { font-size: clamp(28px, 5vw, 42px); letter-spacing: -0.02em; font-weight: 680; }
.reveal .hint { max-width: 46ch; }

details.assignments { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: rgba(255,255,255,.03); }
details.assignments summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--muted); font-size: 14px; }
.assign-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.assign-row > * { min-width: 0; }
.assign-row:last-child { border-bottom: none; }
.assign-row .arrow { color: var(--faint); }

/* ---------- toast ---------- */
.toasts {
  position: fixed;
  inset-inline: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 14, 34, .92);
  border: 1px solid var(--line-strong);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: rise .22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- bandeja ---------- */
.mail-layout { display: grid; gap: 18px; }
@media (min-width: 860px) { .mail-layout { grid-template-columns: 340px 1fr; align-items: start; } }
.mail-list { display: grid; gap: 8px; }
.mail-item {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  display: grid;
  gap: 3px;
}
.mail-item:hover { border-color: var(--line-strong); }
.mail-item.is-active { border-color: color-mix(in oklab, var(--accent) 55%, transparent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.mail-subject { font-weight: 560; font-size: 14px; }
.mail-to { color: var(--faint); font-size: 12px; }
.mail-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font);
  font-size: 14.5px;
  color: #e6dffa;
  margin: 0;
  line-height: 1.6;
}

/* ---------- código de acceso ---------- */
.hint-inline { color: var(--faint); font-weight: 400; font-size: 12px; }
.code-dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #171223;
  color: var(--ink);
  padding: 26px 24px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.code-dialog::backdrop { background: rgba(6, 4, 12, .72); backdrop-filter: blur(6px); }
.code-dialog h2 { margin: 0 0 10px; font-size: 19px; letter-spacing: -0.01em; }
.code-dialog .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.access-code {
  display: block;
  margin: 18px 0 0;
  padding: 16px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(22px, 6vw, 30px);
  letter-spacing: .18em;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, .05);
  color: var(--ink);
  user-select: all;
}
.access-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}
.access-card summary::-webkit-details-marker { display: none; }
.access-card summary::after { content: '＋'; float: right; color: var(--faint); }
.access-card[open] summary::after { content: '−'; }
.access-card > * + * { margin-top: 10px; }
.access-card h3 { margin: 18px 0 0; font-size: 15px; }
.host-code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.host-code-row:first-child { border-top: 0; }

/* ---------- motivos del sorteo ---------- */
.draw-blockers {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}
.draw-blockers li::marker { color: var(--warn); }
