/* Reset + primitivas compartidas por la app del participante y el panel admin. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

a { color: var(--accent); text-underline-offset: 2px; }
img, svg { max-width: 100%; display: block; }
input, button, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

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

/* ---------- botones ---------- */
.btn {
  --_bg: var(--accent);
  --_fg: var(--accent-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .8em 1.3em;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--_bg);
  color: var(--_fg);
  font-weight: 700;
  font-size: var(--step-0);
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn--block { display: flex; width: 100%; }
.btn--lg { padding: 1em 1.4em; min-height: 54px; font-size: var(--step-1); }
.btn--ghost { --_bg: transparent; --_fg: var(--text); border-color: var(--border); }
.btn--soft { --_bg: var(--surface-2); --_fg: var(--text); border-color: var(--border); }
.btn--danger { --_bg: var(--danger); --_fg: #fff; }
.btn--sage { --_bg: var(--sage); --_fg: #17251f; }
.btn--sm { padding: .5em .85em; min-height: 36px; font-size: var(--step--1); font-weight: 600; }

/* ---------- campos ---------- */
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field > label { font-weight: 700; font-size: var(--step--1); letter-spacing: .01em; }
.field .hint { font-size: var(--step--1); color: var(--text-muted); }

.input {
  width: 100%;
  padding: .8em .9em;
  min-height: 48px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.input--code {
  text-transform: uppercase;
  letter-spacing: .28em;
  font-weight: 700;
  text-align: center;
  font-size: var(--step-1);
}
.input.is-valid { border-color: var(--sage); }
.input.is-invalid { border-color: var(--danger); }

/* ---------- toggle ---------- */
.toggle {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.toggle:has(input:checked) { border-color: var(--sage); background: var(--sage-soft); }
.toggle input { margin-top: .2rem; width: 22px; height: 22px; accent-color: var(--sage); flex: none; }
.toggle .toggle__text { font-size: var(--step--1); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .28em .7em;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .02em;
}
.badge--active { background: var(--olive-soft); color: var(--olive); }
.badge--eliminated { background: var(--danger-soft); color: var(--danger); }
.badge--muted { background: var(--surface-2); color: var(--text-muted); }
.badge--gold { background: color-mix(in srgb, var(--gold) 24%, transparent); color: var(--gold); }

/* ---------- utilidades ---------- */
[hidden] { display: none !important; }
.stack > * + * { margin-top: var(--stack-gap, 1rem); }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.net-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: .45em 1em;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .01em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: .7em 1.1em;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
.toast--error { background: var(--danger); color: #fff; }

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