:root {
  --fondo: #0d1512;
  --panel: #14201b;
  --panel-2: #1a2a23;
  --linea: #25382f;
  --texto: #e8f0ea;
  --tenue: #8ea398;
  --cesped: #3ddc84;
  --ambar: #ffc247;
  --rojo: #ff6b5e;
  --azul: #6bb8ff;
  --radio: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.barra {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(13, 21, 18, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea);
}
.marca { display: flex; align-items: center; gap: 10px; }
.marca h1 { font-size: 17px; letter-spacing: .01em; }
.punto { width: 9px; height: 9px; border-radius: 50%; background: var(--tenue); }
.punto.ok { background: var(--cesped); box-shadow: 0 0 0 4px rgba(61, 220, 132, .15); }
.punto.pausa { background: var(--ambar); }
.punto.mal { background: var(--rojo); }
.barra-der { display: flex; gap: 6px; }
.chip {
  font: 12px var(--mono); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--linea);
  color: var(--tenue); white-space: nowrap;
}

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; }
.titulo-seccion { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 10px; }
.titulo-seccion:first-child { margin-top: 4px; }
.titulo-seccion h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--tenue); font-weight: 600; }
.titulo-seccion small { color: var(--tenue); font-size: 12px; }

.tarjeta { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px; margin-bottom: 10px; }
.tarjeta.alerta { border-color: var(--ambar); }
.tarjeta.acierto { border-left: 3px solid var(--cesped); }
.tarjeta.fallo { border-left: 3px solid var(--rojo); }
.vacio { text-align: center; color: var(--tenue); padding: 28px 16px; }
.vacio strong { display: block; color: var(--texto); margin-bottom: 4px; font-size: 16px; }

/* Partido */
.liga { font-size: 12px; color: var(--tenue); display: flex; justify-content: space-between; gap: 8px; }
.marcador { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 8px 0 10px; }
.equipo { font-weight: 600; overflow-wrap: anywhere; }
.equipo.der { text-align: right; }
.equipo .fav { display: inline-block; font: 10px var(--mono); color: var(--ambar); border: 1px solid var(--ambar); border-radius: 4px; padding: 0 4px; margin: 0 4px; vertical-align: 2px; }
.goles { font: 700 24px var(--mono); letter-spacing: .04em; }
.minuto { font: 12px var(--mono); color: var(--cesped); }

/* Balanza de presión: la firma visual de la app */
.balanza { margin: 6px 0 4px; }
.balanza-barra { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.balanza-barra i { display: block; height: 100%; }
.balanza-barra .l { background: var(--cesped); }
.balanza-barra .v { background: var(--azul); }
.balanza-leyenda { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--tenue); margin-top: 4px; }

.metricas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.metrica { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.metrica span { display: block; font-size: 11px; color: var(--tenue); }
.metrica b { font: 600 17px var(--mono); }
.metrica.ok b { color: var(--cesped); }
.metrica.no b { color: var(--tenue); }
.spark { width: 100%; height: 44px; margin-top: 10px; display: block; }
.spark-pie { font-size: 11px; color: var(--tenue); display: flex; justify-content: space-between; }

.estado { font: 11px var(--mono); padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.estado.pendiente { color: var(--ambar); }
.estado.acierto { color: var(--cesped); }
.estado.fallo { color: var(--rojo); }
.estado.anulada { color: var(--tenue); }
.fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.detalle { font-size: 13px; color: var(--tenue); margin-top: 6px; }
.detalle b { color: var(--texto); font-family: var(--mono); font-weight: 600; }

/* Rendimiento */
.veredicto { padding: 16px; }
.veredicto h3 { font-size: 18px; margin-bottom: 4px; }
.veredicto p { color: var(--tenue); font-size: 14px; }
.duelo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.duelo div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.duelo span { font-size: 12px; color: var(--tenue); display: block; }
.duelo b { font: 700 26px var(--mono); }
.pos { color: var(--cesped); } .neg { color: var(--rojo); }
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: right; font-weight: 600; color: var(--tenue); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; white-space: nowrap; }
td { text-align: right; padding: 8px; border-top: 1px solid var(--linea); font-family: var(--mono); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; font-family: inherit; white-space: normal; }

/* Formularios */
.campo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linea); }
.campo:first-of-type { border-top: 0; }
.campo label { flex: 1; min-width: 0; }
.campo label small { display: block; color: var(--tenue); font-size: 12px; }
input[type="number"], input[type="text"], input[type="password"] {
  background: var(--panel-2); border: 1px solid var(--linea); border-radius: 8px; padding: 8px 10px;
  width: 96px; text-align: right; font-family: var(--mono);
}
input.ancho { width: 100%; text-align: left; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--cesped); outline-offset: 2px; }
.btn {
  background: var(--cesped); color: #04130b; border: 0; border-radius: 10px; padding: 10px 14px;
  font-weight: 600; cursor: pointer; min-height: 42px;
}
.btn.sec { background: var(--panel-2); color: var(--texto); border: 1px solid var(--linea); }
.btn:disabled { opacity: .5; cursor: default; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.aviso { font-size: 13px; color: var(--ambar); margin-top: 8px; }
.nota { font-size: 13px; color: var(--tenue); margin-top: 8px; }

/* Interruptor */
.sw { position: relative; width: 46px; height: 28px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw span { position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--linea); border-radius: 999px; transition: background .15s; pointer-events: none; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--tenue); transition: transform .15s, background .15s; }
.sw input:checked + span { background: rgba(61, 220, 132, .25); border-color: var(--cesped); }
.sw input:checked + span::after { transform: translateX(18px); background: var(--cesped); }
.sw input:focus-visible + span { outline: 2px solid var(--cesped); outline-offset: 2px; }

.horas { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
.hora {
  background: var(--panel-2); border: 1px solid var(--linea); border-radius: 8px; padding: 9px 0;
  font: 13px var(--mono); color: var(--tenue); cursor: pointer; min-height: 40px;
}
.hora.on { background: rgba(61, 220, 132, .18); border-color: var(--cesped); color: var(--cesped); font-weight: 600; }
.buscar { width: 100% !important; text-align: left !important; margin-bottom: 10px; font-family: inherit !important; }
.liga-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--linea); }
.liga-fila:first-child { border-top: 0; }
.liga-fila small { color: var(--tenue); display: block; font-size: 12px; }

.medidor { height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.medidor i { display: block; height: 100%; background: var(--cesped); }
.medidor i.alto { background: var(--ambar); }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(13, 21, 18, .96); border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 8px; text-decoration: none; color: var(--tenue); font-size: 11px; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.activo { color: var(--cesped); }

#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--texto); color: var(--fondo); padding: 10px 14px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 10;
}
#toast.ver { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
