/* Sorteo GTA VI · Sala Pelícano — /bases y /backstage. Mismos tokens que pelicano.nuzelab.com. */

@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-400.woff2?v=3dlZVWDDVyXg') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-500.woff2?v=c5PRq6wAnt4N') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('/fonts/switzer-600.woff2?v=1kl8Jk2_cK5R') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geistmono-var.woff2?v=Xz1q1g8p1stw') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #212121;
  --bg-deep: #181818;
  --card: #2a2a2a;
  --txt: #fbf9f6;
  --txt-2: #d9d9d9;
  --muted: #b8b4ad;
  --line: rgba(251, 249, 246, 0.12);
  --rosa: #fe54a4;
  --melocoton: #fdcb76;
  --violeta: #8d4abb;
  --sans: 'Switzer', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  color-scheme: dark;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg-deep); }
body {
  background: var(--bg-deep);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--rosa); outline-offset: 2px; }
::selection { background: var(--rosa); color: #181818; }
[hidden] { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.03em; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 6px; border: 1px solid var(--line); background: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; text-decoration: none;
  color: var(--txt);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { background: rgba(251, 249, 246, 0.08); }
.btn-solid { background: var(--txt); border-color: transparent; color: #161616; }
.btn-solid:hover { background: #fff; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-danger { color: #ff8e8e; border-color: rgba(255, 110, 113, 0.35); }
.btn-danger.sure { background: #ff6e71; border-color: transparent; color: #181818; }

.top {
  display: flex; align-items: center; gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left));
}
.top .home { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -8px; border-radius: 6px; }
.top .home img { display: block; }
.top form { margin-left: auto; }

/* ---------- /bases ---------- */

.legal-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px max(20px, env(safe-area-inset-right)) max(72px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  color: var(--txt-2);
  /* Un dato largo y sin espacios (un enlace, un correo) se parte antes que salirse de la pantalla. */
  overflow-wrap: break-word;
}
.legal-body h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.08; font-weight: 600; letter-spacing: -0.02em; color: var(--txt); margin-bottom: 20px; text-wrap: balance; }
.legal-body h2 { font-size: 18px; line-height: 1.25; font-weight: 600; color: var(--txt); margin: 36px 0 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.legal-body h3 { font-size: 16px; font-weight: 600; color: var(--txt); margin: 22px 0 8px; }
.legal-body p { margin-bottom: 12px; }
.legal-body ul, .legal-body ol { margin: 0 0 12px 1.25em; }
.legal-body li { margin-bottom: 6px; }
.legal-body strong { font-weight: 600; color: var(--txt); }
.legal-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(251, 249, 246, 0.4); overflow-wrap: anywhere; }
.legal-body a:hover { text-decoration-color: var(--txt); }
mark.pend { background: rgba(253, 203, 118, 0.16); color: var(--melocoton); border-radius: 4px; padding: 1px 6px; font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.01em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

.oops { min-height: 70svh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; color: var(--txt-2); }
.oops .mono { color: var(--muted); }

/* ---------- /backstage ---------- */

.bs { background: var(--bg); }
.bs .top { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2; }

.login { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 28px; padding: 24px; }
.login form { display: grid; gap: 10px; width: min(320px, 82vw); }
.login label { color: var(--muted); }
.login .err { color: #ff8e8e; font-size: 14px; }

.bs input[type='password'], .bs input[type='url'], .bs input[type='search'], .bs input[type='text'], .bs input[type='datetime-local'], .bs textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 6px;
  font-size: 16px;
}
.bs input[type='datetime-local'] { font-family: var(--mono); font-size: 15px; }
.bs textarea { display: block; line-height: 1.45; resize: none; overflow-y: auto; }
.bs input::placeholder { color: #8a867f; }
.bs input:focus-visible, .bs textarea:focus-visible { outline-offset: 0; }

.panel { max-width: 1320px; margin: 0 auto; padding: 20px max(20px, env(safe-area-inset-right)) 96px max(20px, env(safe-area-inset-left)); display: grid; gap: 14px; }
.card, .tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: grid; gap: 10px; min-width: 0; align-content: start; }
.card h2, .tile h2 { color: var(--muted); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card h2 .ext { margin-left: auto; color: var(--txt); text-underline-offset: 3px; }
.card h2 #ins-n { color: var(--txt); }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.big { font-size: clamp(30px, 4vw, 44px); line-height: 1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sub, .count { color: var(--txt-2); font-size: 14px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.count { min-height: 19px; }
.warn-txt { color: var(--melocoton); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1 1 200px; min-width: 0; }
.row > .count { flex: 1 1 200px; }
.help { color: var(--muted); font-size: 13px; line-height: 1.4; flex: 1 1 260px; }

.switch {
  display: inline-flex; align-items: center; gap: 12px; justify-self: start;
  min-height: 48px; padding: 0 16px 0 7px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-deep);
}
.switch .knob { width: 56px; height: 32px; border-radius: 999px; background: #3a3a3a; position: relative; transition: background 0.25s ease; flex: none; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--txt); transition: transform 0.3s var(--ease); }
.switch[aria-checked='true'] .knob { background: linear-gradient(90deg, #ff7666, #fe54a4 55%, #8d4abb); }
.switch[aria-checked='true'] .knob::after { transform: translateX(24px); }
.switch-txt { font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; min-width: 7ch; text-align: left; }

.bar { height: 8px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ff7666, #fe54a4 55%, #8d4abb); transition: width 0.4s var(--ease); }

.card-table { padding-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 4px -18px 0; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; text-align: right; }
td.n, td.d { color: var(--txt-2); font-family: var(--mono); font-size: 12px; }
td.name { white-space: normal; min-width: 150px; overflow-wrap: anywhere; }
td.yes { color: #7fe0b4; }
td.no { color: var(--muted); }
td a { text-underline-offset: 3px; }
td .btn { min-height: 36px; padding: 0 12px; font-size: 11px; }
/* Borrar siempre a la vista, aunque la tabla no quepa y se arrastre de lado. */
th:last-child, td.act { position: sticky; right: 0; background: var(--card); }
.empty { padding: 28px 18px; color: var(--muted); font-size: 14px; }
.more-row { padding: 12px 0 16px; }
.more-row:empty { display: none; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-state { grid-column: 1 / -1; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .panel { padding-top: 14px; gap: 10px; }
  .tiles, .grid2 { gap: 10px; }
  .card, .tile { padding: 14px; }
  .table-wrap { margin: 4px -14px 0; overflow: visible; }
  /* En el móvil cada inscripción es una ficha: todas las columnas, sin arrastrar de lado. */
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  td, td:first-child, td:last-child { padding: 0; border: 0; white-space: normal; text-align: left; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: baseline; overflow-wrap: anywhere; font-size: 14px; }
  td::before { content: attr(data-l); font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
  td.n, td.d { font-size: 13px; }
  td.name { min-width: 0; font-weight: 500; }
  td.act { grid-template-columns: minmax(0, 1fr); margin-top: 6px; position: static; }
  .card-table .row > input { flex-basis: 100%; }
  td.act::before { content: none; }
  td.act .btn { justify-self: start; min-height: 40px; }
}

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--txt); color: #161616; border-radius: 6px; padding: 10px 16px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.3s var(--ease); z-index: 5; max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #ff6e71; }

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