/* Intercambio GIC IT SOX · Navidad 2026
   Mundo visual: el azul de tienda como banda de encabezado, superficies blancas
   sobre un fondo apenas azulado, y el amarillo reservado para el momento clave
   (sortear y revelar). Figtree (libre) en lugar de Bogle. */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --blue: #0071dc;
  --blue-deep: #004c91;
  --navy: #041e42;
  --yellow: #ffc220;
  --yellow-soft: #fff4d1;
  --white: #ffffff;
  --bg: #eef5fc;
  --ink: #041e42;
  --ink-2: #3a4d6b;
  --ink-3: #5c6f8c;
  --line: #d3e2f2;
  --tint: #e3effb;
  --red: #c4121a;
  --red-soft: #fdeceb;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 20px -8px rgb(4 30 66 / 0.18), 0 2px 4px -2px rgb(4 30 66 / 0.08);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Figtree", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--yellow); color: var(--navy); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.02em; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Encabezado ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--blue);
  color: var(--white);
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
  display: flex; align-items: center; gap: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg fill='%23fff' fill-opacity='.10'%3E%3Cpath d='M12 8l1.2 3.2L16.5 12l-3.3 1L12 16l-1.2-3L7.5 12l3.3-.8z'/%3E%3Cpath d='M46 38l.8 2.2 2.2.8-2.2.8L46 44l-.8-2.2-2.2-.8 2.2-.8z'/%3E%3C/g%3E%3C/svg%3E");
}
.brand { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 1.05rem; line-height: 1.2; }
.brand strong { font-weight: 800; letter-spacing: 0.01em; white-space: nowrap; }
.brand span { font-weight: 500; white-space: nowrap; }
.brand i { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); align-self: center; flex: none; }
.icon-btn {
  width: 44px; height: 44px; margin: -8px -10px -8px 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: inherit;
}
.icon-btn:hover { background: rgb(255 255 255 / 0.14); }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Navegación inferior (participante / admin) ---------- */
.tabs {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 4px;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 6px);
}
.tab {
  flex: 1; min-height: 52px; border: 0; background: none; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 0.75rem; font-weight: 600; color: var(--ink-3);
}
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--blue); }
.tab[aria-current="page"] .icon { stroke-width: 2.4; }

/* ---------- Página ---------- */
.page { flex: 1 0 auto; width: 100%; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 20px; max-width: 520px; margin: 0 auto; }
.page-title { font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.lead { color: var(--ink-2); font-size: 1rem; max-width: 34ch; }
.section-title { font-size: 1.125rem; font-weight: 800; margin-top: 8px; }
.muted { color: var(--ink-3); }

.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Elegir nombre ---------- */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.person {
  width: 100%; min-height: 72px; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--white); border: 1.5px solid transparent; border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease-out), border-color 0.2s;
}
.person:hover { border-color: var(--blue); }
.person:active { transform: scale(0.98); }
.person .who { flex: 1; display: flex; flex-direction: column; }
.person .name { font-weight: 800; font-size: 1.125rem; }
.person .state { font-size: 0.875rem; color: var(--ink-3); }
.person .chev { color: var(--blue); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem;
  background: var(--tint); color: var(--blue-deep);
}
.avatar.on { background: var(--blue); color: var(--white); }
.avatar.off { background: transparent; border: 2px dashed #9db6d3; color: var(--ink-3); }
.avatar.sm { width: 36px; height: 36px; font-size: 0.9rem; }

/* ---------- PIN ---------- */
.pin-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding-top: 12px; }
.pin-head .avatar { width: 64px; height: 64px; font-size: 1.5rem; }
.pin-field { position: relative; display: flex; justify-content: center; gap: 12px; }
.pin-field input {
  position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px;
  caret-color: transparent;
}
.pin-cell {
  width: 60px; height: 72px; border-radius: 14px;
  background: var(--white); border: 2px solid var(--line);
  display: grid; place-items: center;
  font-size: 2rem; font-weight: 800;
  transition: border-color 0.15s, transform 0.2s var(--ease-out);
}
.pin-cell.filled::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--navy); }
.pin-cell.current { border-color: var(--blue); box-shadow: 0 0 0 4px rgb(0 113 220 / 0.15); }
.pin-field.error .pin-cell { border-color: var(--red); }
.pin-field.shake { animation: shake 0.4s var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.hint { text-align: center; font-size: 0.9375rem; color: var(--ink-2); min-height: 1.5em; }
.hint.error { color: var(--red); font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 800; font-size: 1rem;
  background: var(--blue); color: var(--white);
  transition: background 0.15s, transform 0.2s var(--ease-out), opacity 0.15s;
}
.btn:hover { background: var(--blue-deep); }
.btn:active { transform: scale(0.97); }
.btn:disabled { background: #b7c8dc; color: var(--white); cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.gold { background: var(--yellow); color: var(--navy); }
.btn.gold:hover { background: #f5b400; }
.btn.ghost { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #a10e15; }
.btn.gold:disabled, .btn.danger:disabled { background: #b7c8dc; color: var(--white); }
.btn.is-loading { opacity: 0.7; pointer-events: none; }
.link { background: none; border: 0; padding: 8px; color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Evento ---------- */
.event {
  background: var(--navy); color: var(--white);
  border-radius: var(--radius); padding: 20px;
  display: grid; gap: 14px;
  position: relative; overflow: hidden;
}
.event::after { /* listón amarillo */
  content: ""; position: absolute; top: 0; bottom: 0; right: 28px; width: 14px; background: var(--yellow);
}
.event .count { font-size: 1.875rem; font-weight: 800; line-height: 1.1; padding-right: 48px; }
.event dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding-right: 48px; }
.event dt { color: #a9c3e6; font-size: 0.875rem; }
.event dd { margin: 0; font-weight: 600; }

/* ---------- Sala de espera ---------- */
.lobby { padding: 8px 0; }
.lobby-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 18px 6px; }
.lobby-head h2 { font-size: 1.125rem; font-weight: 800; }
.lobby-head span { font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.meter { margin: 4px 18px 10px; height: 8px; border-radius: 99px; background: var(--tint); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width 0.6s var(--ease-out); }
.lobby ul { list-style: none; margin: 0; padding: 0; }
.lobby li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.lobby li + li { border-top: 1px solid var(--line); }
.lobby .n { flex: 1; font-weight: 600; }
.lobby .s { font-size: 0.875rem; color: var(--ink-3); }
.lobby .s.ok { color: var(--blue-deep); font-weight: 700; }

.row-link {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; width: 100%;
  border: 0; text-align: left; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.row-link .t { flex: 1; display: flex; flex-direction: column; }
.row-link strong { font-weight: 800; }
.row-link small { color: var(--ink-3); font-size: 0.875rem; }
.row-link .badge-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--yellow-soft); color: var(--navy); display: grid; place-items: center; }

/* ---------- Regalo / revelación ---------- */
.gift {
  position: relative; border-radius: 22px; overflow: hidden;
  background: var(--white); box-shadow: var(--shadow);
  aspect-ratio: 4 / 3.3;
  display: grid; place-items: center; text-align: center;
}
.gift .inside { padding: 24px; display: grid; gap: 6px; justify-items: center; }
.gift .inside small { font-size: 0.9375rem; color: var(--ink-2); font-weight: 600; }
.gift .inside strong { font-size: clamp(2.5rem, 13vw, 3.5rem); font-weight: 900; line-height: 1; letter-spacing: -0.03em; color: var(--navy); }
.gift canvas, .gift .wrap { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.wrap {
  background:
    linear-gradient(90deg, transparent calc(50% - 16px), var(--yellow) calc(50% - 16px), var(--yellow) calc(50% + 16px), transparent calc(50% + 16px)),
    repeating-linear-gradient(135deg, var(--blue) 0 22px, #0a66c2 22px 44px);
  display: grid; place-items: end center; padding-bottom: 22px;
}
.wrap::before { /* moño */
  content: ""; position: absolute; top: 18px; left: 50%; width: 92px; height: 48px; transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 48'%3E%3Cg fill='%23ffc220' stroke='%23e0a500' stroke-width='2'%3E%3Cpath d='M46 26C34 6 8 2 6 16s24 14 40 10z'/%3E%3Cpath d='M46 26C58 6 84 2 86 16s-24 14-40 10z'/%3E%3Ccircle cx='46' cy='26' r='8'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.wrap span {
  background: var(--white); color: var(--navy); font-weight: 800; font-size: 0.9375rem;
  padding: 8px 16px; border-radius: 99px; box-shadow: var(--shadow);
}
.gift-cta { display: grid; gap: 8px; text-align: center; }
.gift-cta h2 { font-size: 1.5rem; font-weight: 800; }

.wish {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  display: grid; gap: 8px;
}
.wish h3 { font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.wish p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); line-height: 1.55; }
.wish p.empty { color: var(--ink-3); font-style: italic; }

/* ---------- Lista de deseos ---------- */
.field { display: grid; gap: 8px; }
.field label { font-weight: 800; }
textarea {
  width: 100%; min-height: 220px; resize: vertical;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--white);
  font-size: 1rem; line-height: 1.55; caret-color: var(--blue);
}
textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgb(0 113 220 / 0.15); }
textarea::placeholder { color: #6f809b; }
.field-foot { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--ink-3); }
.counter { font-variant-numeric: tabular-nums; font-weight: 700; }
.counter.near { color: #8a5a00; }
.saved { color: var(--blue-deep); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

input[type="text"] {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--white); font-size: 16px;
}
input[type="text"]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgb(0 113 220 / 0.15); }

/* ---------- Admin ---------- */
.status { padding: 4px 0; }
.status table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.status th { font-size: 0.75rem; font-weight: 700; color: var(--ink-3); text-align: center; padding: 10px 6px 6px; }
.status th:first-child { text-align: left; padding-left: 18px; }
.status td { padding: 10px 6px; border-top: 1px solid var(--line); text-align: center; }
.status td:first-child { text-align: left; padding-left: 18px; font-weight: 700; }
.status td:last-child, .status th:last-child { padding-right: 14px; }
.dot-ok { color: var(--blue); }
.dot-no { color: #b0bfd2; }
.mini-btn {
  min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--line);
  background: var(--white); font-size: 0.8125rem; font-weight: 700; color: var(--ink-2);
}
@media (hover: hover) { .mini-btn:hover { border-color: var(--red); color: var(--red); } }
.draw-box { padding: 20px; display: grid; gap: 12px; }
.draw-box p { color: var(--ink-2); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.inline-form .btn { min-height: 48px; padding: 0 18px; }
.danger-zone { border: 1.5px solid #f2c5c3; background: var(--red-soft); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.danger-zone h3 { color: var(--red); font-size: 1rem; font-weight: 800; }
.danger-zone p { color: #6b2a27; font-size: 0.9375rem; }

/* ---------- Avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%) translateY(12px); opacity: 0;
  background: var(--navy); color: var(--white); font-weight: 600;
  padding: 12px 18px; border-radius: 99px; box-shadow: var(--shadow);
  transition: opacity 0.25s, transform 0.35s var(--ease-out); pointer-events: none;
  width: max-content; max-width: calc(100vw - 40px); text-align: center; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sheet-backdrop { position: fixed; inset: 0; background: rgb(4 30 66 / 0.4); z-index: 30; display: grid; align-items: end; }
.sheet { background: var(--white); border-radius: 22px 22px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px); display: grid; gap: 8px; }
.sheet .who-line { color: var(--ink-3); font-size: 0.875rem; padding-bottom: 6px; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; width: 100vw; height: 100dvh; }

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