/* golazo·26 | sistema de diseño: terminal financiera cruzada con hardware de instrumentos */

:root {
  --bg: #0A0E17;
  --panel: #111827;
  --panel-2: #0D1320;
  --line: #1F2937;
  --line-2: #2B3950;
  --text: #E5E7EB;
  --muted: #9CA3AF;
  --celeste: #75AADB;
  --celeste-tinta: #06121F;
  --azul: #2C5AA0;
  --oro: #D4AF37;
  --ambar: #F59E0B;
  --verde: #34D399;
  --rojo: #F87171;
  --cx-amarillo: #E0C04E;
  --cx-verde: #34D399;
  --cx-azul: #5B8DEF;
  --cx-violeta: #A78BFA;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radio: 6px;
  --sombra-led: 0 0 8px;
}

/* ---------- base ---------- */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

input, textarea {
  font: inherit;
}

:focus {
  outline: none;
}

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

::selection {
  background: var(--azul);
  color: var(--text);
}

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

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.oro {
  color: var(--oro);
}

.verde {
  color: var(--verde);
}

.rojo {
  color: var(--rojo);
}

.ambar {
  color: var(--ambar);
}

.celeste {
  color: var(--celeste);
}

/* ---------- header: barra de instrumentos ---------- */

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

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.marca {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--text);
  background: none;
  border: 0;
  padding: 4px 0;
}

.marca .punto {
  color: var(--celeste);
}

.header-sep {
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-height: 30px;
}

button.chip:hover {
  border-color: var(--line-2);
}

.chip-nivel .nivel-nombre {
  color: var(--text);
}

.xpbar {
  width: 64px;
  height: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.xpbar-fill {
  height: 100%;
  background: var(--celeste);
  transition: width 400ms ease-out;
}

.chip-racha .fuego {
  font-size: 13px;
}

.chip-racha.viva {
  color: var(--ambar);
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-icono {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 0;
}

.btn-icono:hover {
  border-color: var(--line-2);
  color: var(--text);
}

.btn-icono svg {
  width: 15px;
  height: 15px;
}

.header-partido {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.header-partido .countdown {
  color: var(--ambar);
  font-weight: 700;
}

.header-partido .envivo {
  color: var(--verde);
}

/* ---------- ticker ---------- */

.ticker {
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: var(--panel-2);
}

.ticker-inner {
  display: inline-flex;
  gap: 0;
  white-space: nowrap;
  padding: 6px 0;
  animation: ticker-scroll 70s linear infinite;
  will-change: transform;
}

.ticker:hover .ticker-inner {
  animation-play-state: paused;
}

.ticker-item {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 14px;
}

.ticker-item b {
  color: var(--celeste);
  font-weight: 400;
}

.ticker-sep {
  color: var(--line-2);
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- layout ---------- */

.vista {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

.vista-juego {
  max-width: 600px;
}

.vista-enter {
  animation: vista-in 220ms ease-out;
}

@keyframes vista-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- cards y módulos ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
}

.card-pad {
  padding: 16px;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}

.led-verde {
  background: var(--verde);
  box-shadow: var(--sombra-led) rgba(52, 211, 153, 0.55);
}

.led-ambar {
  background: var(--ambar);
  box-shadow: var(--sombra-led) rgba(245, 158, 11, 0.5);
}

.led-gris {
  background: var(--line-2);
}

.grid-modulos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.mod-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 108px;
  transition: border-color 150ms ease-out, transform 150ms ease-out;
}

.mod-card:hover {
  border-color: var(--line-2);
}

.mod-card:active {
  transform: translateY(1px);
}

.mod-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mod-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mod-nombre {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mod-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  flex: 1;
}

.mod-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--celeste);
  letter-spacing: 0.04em;
}

.mod-card-fiesta {
  border-color: rgba(212, 175, 55, 0.35);
}

.mod-card-fiesta:hover {
  border-color: rgba(212, 175, 55, 0.6);
}

/* ---------- card del desafío del día ---------- */

.daily-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.daily-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.daily-titulo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.daily-patas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.daily-pata {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  min-height: 64px;
  transition: border-color 150ms ease-out, transform 150ms ease-out;
}

.daily-pata:hover {
  border-color: var(--line-2);
}

.daily-pata:active {
  transform: translateY(1px);
}

.daily-pata[disabled] {
  cursor: default;
  opacity: 0.85;
}

.daily-pata .pata-nombre {
  font-size: 13px;
  font-weight: 500;
}

.daily-pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- botones ---------- */

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  color: var(--text);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 150ms ease-out, transform 120ms ease-out, background 150ms ease-out;
}

.btn:hover {
  border-color: var(--line-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn-primario {
  background: var(--celeste);
  border-color: var(--celeste);
  color: var(--celeste-tinta);
  font-weight: 700;
}

.btn-primario:hover {
  background: #8ABAE6;
  border-color: #8ABAE6;
}

.btn-chico {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.btn-bloque {
  width: 100%;
}

.btn-peligro {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--rojo);
}

.btn-volver {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-volver:hover {
  color: var(--text);
}

/* ---------- cabecera de juego ---------- */

.juego-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.juego-titulo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.juego-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.tab {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  min-height: 36px;
}

.tab:hover {
  border-color: var(--line-2);
}

.tab.activa {
  color: var(--celeste-tinta);
  background: var(--celeste);
  border-color: var(--celeste);
  font-weight: 700;
}

/* ---------- números e indicadores ---------- */

.stat-grande {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-medio {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.fila-stats {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}

.stat-bloque {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progreso {
  height: 3px;
  background: var(--panel-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progreso-fill {
  height: 100%;
  background: var(--celeste);
  transition: width 250ms ease-out;
}

.timer-grande {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 700;
}

.timer-grande.urgente {
  color: var(--ambar);
}

/* ---------- trivia ---------- */

.pregunta {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.35;
  margin: 6px 0 16px;
  min-height: 54px;
}

.opciones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opcion {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px 14px;
  text-align: left;
  font-size: 15px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 150ms ease-out, transform 120ms ease-out;
}

.opcion:hover:not([disabled]) {
  border-color: var(--line-2);
}

.opcion:active:not([disabled]) {
  transform: translateY(1px);
}

.opcion[disabled] {
  cursor: default;
}

.opcion .tecla {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.opcion.correcta {
  border-color: var(--verde);
  background: rgba(52, 211, 153, 0.08);
}

.opcion.correcta .tecla {
  border-color: var(--verde);
  color: var(--verde);
}

.opcion.incorrecta {
  border-color: var(--rojo);
  background: rgba(248, 113, 113, 0.07);
}

.opcion.descartada {
  opacity: 0.3;
}

.dato-linea {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 2px solid var(--celeste);
  background: var(--panel-2);
  border-radius: 0 var(--radio) var(--radio) 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.comodines {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.comodin {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 9px 6px;
  min-height: 40px;
}

.comodin:hover:not([disabled]) {
  border-color: var(--line-2);
  color: var(--text);
}

.comodin[disabled] {
  opacity: 0.35;
  cursor: default;
}

.vidas {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--rojo);
}

.mult-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--oro);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 4px;
  padding: 2px 7px;
}

/* ---------- quién soy ---------- */

.qs-tablero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
}

.qs-encabezados {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 4px;
}

.qs-encabezados .label {
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-fila {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 4px;
}

.qs-nombre {
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-height: 38px;
}

.qs-celda {
  min-height: 38px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  animation: qs-revelar 250ms ease-out backwards;
}

.qs-fila .qs-celda:nth-child(2) { animation-delay: 0ms; }
.qs-fila .qs-celda:nth-child(3) { animation-delay: 80ms; }
.qs-fila .qs-celda:nth-child(4) { animation-delay: 160ms; }
.qs-fila .qs-celda:nth-child(5) { animation-delay: 240ms; }
.qs-fila .qs-celda:nth-child(6) { animation-delay: 320ms; }

@keyframes qs-revelar {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.qs-celda.exacto {
  background: rgba(52, 211, 153, 0.16);
  border-color: var(--verde);
  color: var(--verde);
}

.qs-celda.cerca {
  background: rgba(245, 158, 11, 0.13);
  border-color: var(--ambar);
  color: var(--ambar);
}

.autocompletar {
  position: relative;
}

.input-texto {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  min-height: 48px;
}

.input-texto::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.input-texto:focus {
  border-color: var(--celeste);
}

.sugerencias {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radio);
  overflow: hidden;
  z-index: 30;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}

.sugerencia {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  align-items: center;
}

.sugerencia:last-child {
  border-bottom: 0;
}

.sugerencia .pista {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.sugerencia:hover, .sugerencia.activa {
  background: var(--panel-2);
}

.ficha-jugador {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  margin-top: 12px;
}

.ficha-jugador .nombre {
  font-size: 20px;
  font-weight: 700;
}

/* ---------- top diez ---------- */

.t10-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
}

.t10-fila {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 9px 12px;
  min-height: 44px;
}

.t10-pos {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  width: 22px;
  flex: none;
  text-align: right;
}

.t10-nombre {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.t10-valor {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--celeste);
}

.t10-fila.cerrada .t10-nombre {
  color: transparent;
  background: var(--panel-2);
  border-radius: 3px;
  user-select: none;
}

.t10-fila.cerrada .t10-valor {
  visibility: hidden;
}

.t10-fila.revelada {
  animation: t10-abrir 300ms ease-out;
  border-color: var(--verde);
}

.t10-fila.perdida {
  opacity: 0.55;
}

.t10-fila.perdida .t10-nombre {
  color: var(--muted);
}

@keyframes t10-abrir {
  from { transform: translateY(3px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

.t10-input-zona {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0 14px;
  border-top: 1px solid var(--line);
}

.strikes {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--rojo);
}

.lista-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lista-opcion {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px 14px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  transition: border-color 150ms ease-out;
}

.lista-opcion:hover {
  border-color: var(--line-2);
}

.lista-opcion .titulo {
  font-weight: 500;
  font-size: 14px;
}

.lista-opcion .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.lista-opcion .meta.hecha {
  color: var(--verde);
}

/* ---------- más o menos ---------- */

.mm-tablero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.mm-carta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.mm-carta .nombre {
  font-size: 18px;
  font-weight: 700;
}

.mm-carta .detalle {
  font-size: 12px;
  color: var(--muted);
}

.mm-valor {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  font-weight: 700;
  color: var(--celeste);
  line-height: 1.1;
}

.mm-vs {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.mm-botones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mm-racha {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ambar);
  letter-spacing: 0.06em;
}

/* ---------- conexiones ---------- */

.cx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
}

.cx-carta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  min-height: 60px;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  word-break: break-word;
  transition: border-color 120ms ease-out, background 120ms ease-out, transform 120ms ease-out;
}

.cx-carta:hover:not([disabled]) {
  border-color: var(--line-2);
}

.cx-carta.sel {
  background: var(--celeste);
  border-color: var(--celeste);
  color: var(--celeste-tinta);
  font-weight: 700;
}

.cx-carta:active:not([disabled]) {
  transform: translateY(1px);
}

.cx-grupo {
  border-radius: var(--radio);
  padding: 10px 12px;
  margin-bottom: 6px;
  text-align: center;
  animation: cx-colapso 320ms ease-out;
  color: #0B0E14;
}

.cx-grupo .cx-cat {
  font-weight: 700;
  font-size: 13px;
}

.cx-grupo .cx-items {
  font-size: 12px;
  opacity: 0.85;
}

@keyframes cx-colapso {
  from { transform: scale(0.96); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

.cx-grupo-amarillo { background: var(--cx-amarillo); }
.cx-grupo-verde { background: var(--cx-verde); }
.cx-grupo-azul { background: var(--cx-azul); }
.cx-grupo-violeta { background: var(--cx-violeta); }

.cx-controles {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cx-intentos {
  display: flex;
  gap: 5px;
  align-items: center;
}

.cx-intento-punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
}

.cx-intento-punto.vivo {
  background: var(--celeste);
}

/* ---------- bingo ---------- */

.bg-codigo {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--oro);
}

.bg-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin: 14px 0;
}

.bg-celda {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  aspect-ratio: 1;
  padding: 3px;
  font-size: 9.5px;
  line-height: 1.18;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
  overflow: hidden;
  color: var(--muted);
  transition: border-color 120ms ease-out, background 150ms ease-out, color 150ms ease-out;
}

.bg-celda:hover:not([disabled]) {
  border-color: var(--line-2);
}

.bg-celda.marcada {
  background: rgba(117, 170, 219, 0.16);
  border-color: var(--celeste);
  color: var(--text);
}

.bg-celda.libre {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.45);
  color: var(--oro);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.bg-celda.en-linea {
  background: rgba(52, 211, 153, 0.16);
  border-color: var(--verde);
  color: var(--text);
}

.bg-pie {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ---------- penales ---------- */

.pn-area {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  margin: 14px 0;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.pn-area svg, .pn-area canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pn-hud {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

/* ---------- fiesta ---------- */

.fs-jugadores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.fs-jugador {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 8px 12px;
  min-height: 48px;
}

.fs-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: #0B0E14;
}

.fs-nombre {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-puntos {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 700;
  color: var(--celeste);
}

.fs-turno-pantalla {
  text-align: center;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.fs-turno-nombre {
  font-size: 28px;
  font-weight: 700;
}

.fs-podio {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.fs-podio .fs-jugador.primero {
  border-color: var(--oro);
  background: rgba(212, 175, 55, 0.07);
}

.fs-quitar {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  padding: 6px 8px;
  min-height: 36px;
}

.fs-quitar:hover {
  color: var(--rojo);
}

/* ---------- logros ---------- */

.logros-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.logro-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logro-card.activo {
  border-color: rgba(212, 175, 55, 0.5);
}

.logro-card .logro-nombre {
  font-weight: 700;
  font-size: 14px;
}

.logro-card.activo .logro-nombre {
  color: var(--oro);
}

.logro-card.bloqueado {
  opacity: 0.55;
}

.logro-card .logro-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.logro-card .logro-fecha {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- ajustes ---------- */

.ajustes-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.ajustes-fila:last-child {
  border-bottom: 0;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 150ms ease-out, background 150ms ease-out;
}

.switch[aria-checked="true"] {
  background: var(--azul);
  border-color: var(--celeste);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--celeste);
}

.textarea {
  width: 100%;
  min-height: 110px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radio);
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  max-width: 100%;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-titulo {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.toast-logro {
  border-color: var(--oro);
}

.toast-logro .toast-titulo {
  color: var(--oro);
}

.toast-error {
  border-color: var(--rojo);
}

.toast-xp {
  border-color: rgba(117, 170, 219, 0.5);
}

/* ---------- modales ---------- */

.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.78);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.modal-fondo.visible {
  opacity: 1;
}

.modal-caja {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radio);
  padding: 20px;
  width: min(100%, 420px);
  max-height: 86dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(6px);
  transition: transform 180ms ease-out;
}

.modal-fondo.visible .modal-caja {
  transform: translateY(0);
}

.modal-titulo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-titulo.oro {
  color: var(--oro);
}

.modal-cuerpo {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-acciones {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ---------- efectos ---------- */

.fx-pulso {
  animation: fx-pulso 420ms ease-out;
}

@keyframes fx-pulso {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
}

.fx-shake {
  animation: fx-shake 280ms ease-out;
}

@keyframes fx-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

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

/* ---------- home ---------- */

.home-secciones {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-resultado {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- fin de partida ---------- */

.fin-panel {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 22px 16px;
}

.fin-panel .fin-frase {
  color: var(--muted);
  font-size: 14px;
}

.fin-acciones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

/* ---------- desktop ---------- */

@media (min-width: 720px) {
  body {
    font-size: 15px;
  }

  .grid-modulos {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .header-inner {
    flex-wrap: nowrap;
    padding: 12px 20px;
  }

  .header-partido {
    width: auto;
    padding-bottom: 0;
    margin-left: 4px;
    flex: 1;
    min-width: 0;
  }

  .bg-celda {
    font-size: 11px;
  }

  .cx-carta {
    font-size: 13px;
    min-height: 68px;
  }

  .qs-celda {
    font-size: 12px;
  }
}

/* ---------- reduced motion ---------- */

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

  .ticker {
    display: none;
  }
}
