/* ============================================================
   Amigo secreto — hoja de estilos única.
   Marca: azul navy/royal (#0052CC) + rojo (#E31937) + oro de regalo.
   Mobile first: la columna central de 560 px se ve igual de bien
   en el celular que en el computador.
   ============================================================ */

:root {
  --navy-900: #071324;
  --navy-800: #0b1e33;
  --navy-700: #10263f;
  --navy-600: #17324f;
  --navy-500: #234769;
  --blue: #0052cc;
  --blue-light: #2f6bff;
  --blue-soft: #e8f0ff;
  --red: #e31937;
  --red-dark: #b8102a;
  --gold: #e8b44c;
  --gold-light: #f6d79a;
  --paper: #ffffff;
  --ink: #0f1b2a;
  --muted: #64748b;
  --line: #e4e9f0;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 18px 44px rgba(3, 12, 24, 0.34);
  --shadow-sm: 0 6px 18px rgba(3, 12, 24, 0.16);
}

* { box-sizing: border-box; }

/* Varias clases usan display:flex/inline-flex, que le gana al atributo hidden
   del navegador. Esta regla lo arregla para toda la app. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 12% -12%, #1d4b7d 0%, transparent 62%),
    radial-gradient(760px 520px at 96% 4%, #3a1e3f 0%, transparent 58%),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 62%, #040c16 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Textura sutil para que el fondo no se vea plano */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 0;
}

h1, h2, h3, .brand-text { font-family: 'Montserrat', 'Inter', sans-serif; }

a { color: var(--blue); }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(7, 19, 36, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #fff;
}
.brand-mark { display: inline-flex; filter: drop-shadow(0 4px 10px rgba(227, 25, 55, .45)); }
.brand-text { font-weight: 800; font-size: 1.02rem; letter-spacing: -.2px; }

/* ---------- Columna principal ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, .72);
  padding: 80px 0;
  font-size: .95rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Portada ---------- */
.hero { text-align: center; padding: 26px 0 10px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(232, 180, 76, .14);
  border: 1px solid rgba(232, 180, 76, .38);
  color: var(--gold-light);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.hero h1 {
  color: #fff;
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1.08;
  margin: 16px 0 10px;
  letter-spacing: -.02em;
}
.hero h1 em {
  display: block;
  font-style: normal;
  background: linear-gradient(100deg, var(--gold) 0%, #ffe3ab 52%, var(--red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: rgba(255, 255, 255, .74);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 auto 22px;
  max-width: 42ch;
}
.hero-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Botones ---------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .01em;
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--navy-600);
  transition: transform .14s ease, box-shadow .2s ease, filter .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  box-shadow: 0 12px 26px rgba(0, 82, 204, .42);
}
.btn-gold {
  background: linear-gradient(135deg, #d99b2f 0%, var(--gold-light) 100%);
  color: #33230a;
  box-shadow: 0 12px 26px rgba(232, 180, 76, .34);
}
.btn-red {
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  box-shadow: 0 12px 26px rgba(227, 25, 55, .38);
}
.btn-ghost {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
}
.btn-light {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.btn-sm { padding: 9px 14px; font-size: .84rem; border-radius: 11px; }
.btn-xs { padding: 6px 11px; font-size: .78rem; border-radius: 9px; font-weight: 600; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 9px; }
.btn-row > .btn { flex: 1; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  animation: rise .32s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
/* Después de la primera carga, los refrescos no deben re-animar toda la
   pantalla: se ve el parpadeo cuando guardas un deseo o llega el sorteo. */
body.no-anim .card,
body.no-anim .sheet { animation: none; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-title { font-size: 1.06rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: .85rem; margin: 4px 0 0; line-height: 1.45; }

.section-title {
  color: rgba(255, 255, 255, .62);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .7rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  margin: 26px 4px 12px;
}

/* ---------- Formularios ---------- */
.field { margin-bottom: 13px; }
.label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.input, .textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #f6f8fb;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.input::placeholder { color: #9aa8ba; }
.input:focus, .textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue-light);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, .13);
}
.input-dark {
  background: rgba(255, 255, 255, .08);
  border: 1.5px solid rgba(255, 255, 255, .16);
  color: #fff;
}
.input-dark::placeholder { color: rgba(255, 255, 255, .5); }
.input-dark:focus { background: rgba(255, 255, 255, .13); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(232, 180, 76, .16); }
textarea.textarea { min-height: 78px; resize: vertical; }

.hint { font-size: .78rem; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.hint-dark { color: rgba(255, 255, 255, .58); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .88rem;
  color: var(--ink);
  cursor: pointer;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #f6f8fb;
  margin-bottom: 10px;
}
.check input { margin-top: 2px; accent-color: var(--blue); width: 17px; height: 17px; flex: none; }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: #f1f5fa;
  border: 1.5px solid transparent;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.chip.active { background: var(--ink); color: #fff; }
.chip-removable { padding-right: 8px; }
.chip-x {
  border: 0;
  background: rgba(15, 27, 42, .12);
  color: inherit;
  border-radius: 50%;
  width: 19px; height: 19px;
  cursor: pointer;
  font-size: .74rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chip-x:hover { background: var(--red); color: #fff; }

/* ---------- Lista de deseos ---------- */
.wish {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: #f6f8fb;
  margin-bottom: 8px;
}
.wish-body { flex: 1; min-width: 0; }
.wish-title { font-weight: 600; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.wish-note { font-size: .78rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.wish-price {
  flex: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 5px 9px;
  border-radius: 9px;
  white-space: nowrap;
}
.wish-price.free { color: #8a6d1f; background: #fdf3dc; }
.wish-remove {
  border: 0; background: transparent; cursor: pointer;
  color: #b6c1d0; font-size: 1.1rem; line-height: 1; padding: 4px 2px;
}
.wish-remove:hover { color: var(--red); }

.tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.tag-gold { color: #a5761a; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  padding: 22px 10px;
  line-height: 1.5;
}
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: .95rem; }

/* ---------- Participantes ---------- */
.person {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #f6f8fb;
  margin-bottom: 8px;
}
.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .92rem;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
}
.person-name { flex: 1; font-weight: 600; font-size: .93rem; overflow-wrap: anywhere; }
.person-meta { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.person-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.dot-ok { color: #14804a; font-weight: 700; }
.dot-wait { color: #a5761a; font-weight: 700; }

.pill {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.pill-setup { background: var(--blue-soft); color: var(--blue); }
.pill-drawn { background: #fdf3dc; color: #a5761a; }
.pill-live { background: #e6f7ee; color: #14804a; }

/* ---------- Revelación ---------- */
.reveal-card {
  position: relative;
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(700px 320px at 50% -20%, rgba(232, 180, 76, .3), transparent 70%),
    linear-gradient(160deg, var(--navy-600) 0%, var(--navy-800) 55%, var(--navy-900) 100%);
  border: 1px solid rgba(232, 180, 76, .3);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}
.reveal-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 260px at 50% 120%, rgba(227, 25, 55, .32), transparent 70%);
  pointer-events: none;
}
.reveal-kicker {
  position: relative;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 700;
  margin-bottom: 12px;
}
.reveal-title {
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 6px;
}
.reveal-name {
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.9rem, 9vw, 2.7rem);
  font-weight: 800;
  color: var(--gold);
  margin: 4px 0 10px;
  letter-spacing: -.02em;
  text-shadow: 0 8px 26px rgba(232, 180, 76, .3);
}
.reveal-sub { position: relative; color: rgba(255, 255, 255, .68); font-size: .88rem; }

.blur-hide { filter: blur(13px); opacity: .55; transition: filter .35s ease, opacity .35s ease; }
.tap-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 19, 36, .55);
  border: 0;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  backdrop-filter: blur(2px);
  z-index: 3;
  gap: 8px;
  padding: 20px;
}
.tap-cover span { display: inline-flex; align-items: center; gap: 8px; }
.tap-gift { font-size: 2.6rem; animation: giftBob 1.9s ease-in-out infinite; }
@keyframes giftBob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-9px) rotate(4deg); }
}
.reveal-inner { position: relative; z-index: 1; }

/* ---------- Hoja inferior (catálogo) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 20, .6);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease both;
}
/* El atributo hidden debe ganarle al display:flex de arriba, si no el overlay
   invisible se queda interceptando todos los clics de la página. */
.sheet-backdrop[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .4);
  animation: slideUp .28s cubic-bezier(.2, .9, .3, 1) both;
  display: flex;
  flex-direction: column;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } }
.sheet-grip { width: 42px; height: 4px; border-radius: 99px; background: #d7dee8; margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1.05rem; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }

.idea {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: #f6f8fb;
  margin-bottom: 7px;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.idea:hover { border-color: rgba(47, 107, 255, .35); }
.idea-body { flex: 1; min-width: 0; }
.idea-title { display: block; font-weight: 600; font-size: .9rem; line-height: 1.35; }
.idea-meta { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.idea-add {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 22px);
  background: #0d1b2c;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 80;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Pasos ---------- */
.steps { display: grid; gap: 10px; margin-top: 8px; }
.step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  padding: 14px;
}
.step-num {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #33230a;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: .85rem;
  display: grid;
  place-items: center;
}
.step h3 { color: #fff; font-size: .94rem; margin: 1px 0 3px; }
.step p { color: rgba(255, 255, 255, .66); font-size: .84rem; margin: 0; line-height: 1.5; }

/* ---------- Tabla de parejas ---------- */
.pair {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #f6f8fb;
  margin-bottom: 8px;
  font-size: .92rem;
}
.pair-arrow { color: var(--gold); font-weight: 700; }
.pair b { font-weight: 700; }

/* ---------- Barras de progreso ---------- */
.progress {
  height: 7px;
  border-radius: 99px;
  background: #e9eef5;
  overflow: hidden;
  margin: 10px 0 6px;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  transition: width .45s cubic-bezier(.2, .9, .3, 1);
}
.progress-text { font-size: .8rem; color: var(--muted); }

/* ---------- Confeti ---------- */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

.share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.share-bar .btn { flex: 1 1 150px; }

.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }

@media (max-width: 380px) {
  .card { padding: 15px; }
  .btn { padding: 13px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
