:root {
  --bg: #ECEFEA; --surface: #FFFFFF; --ink: #17201C; --muted: #5B6862; --line: #D3DAD4; --chip: #F2F4F0;
  --win: #1F7A3D; --loss: #C0392B; --ball: #D3DE3F; --on-ink: #FFFFFF;
  --cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* Modo oscuro: lo pide el sistema (si no se eligió "claro" con el botón) o se eligió con el botón */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #111614; --surface: #1A201D; --ink: #E6ECE8; --muted: #98A59E; --line: #2C3530; --chip: #232A26;
    --win: #3DA862; --loss: #DD5B4C; --ball: #C9D43C; --on-ink: #0E1411; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #111614; --surface: #1A201D; --ink: #E6ECE8; --muted: #98A59E; --line: #2C3530; --chip: #232A26;
    --win: #3DA862; --loss: #DD5B4C; --ball: #C9D43C; --on-ink: #0E1411; color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }

/* Ingreso */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; display: grid; gap: 14px; }
.login-card h1 { font-family: var(--cond); font-size: 32px; line-height: 1; margin: 6px 0 0; }
.login-card p { margin: 0; color: var(--muted); }
.ball-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--ball); position: relative; overflow: hidden; }
.ball-mark::before, .ball-mark::after { content: ""; position: absolute; width: 44px; height: 44px; border: 3px solid var(--surface); border-radius: 50%; }
.ball-mark::before { left: -30px; } .ball-mark::after { right: -30px; }

/* Encabezado */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px 0; max-width: 760px; margin: 0 auto; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-family: var(--cond); font-weight: 700; font-size: 30px; line-height: 1; margin: 0; }
.brand span { color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; max-width: 760px; margin: 6px auto 0; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 14px 9px; font-family: var(--cond); font-size: 19px; font-weight: 600; color: var(--muted); border-bottom: 4px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ball); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.view { display: none; }
.view.on { display: grid; gap: 14px; }

/* Formularios */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 16px; margin: 0; min-width: 0; display: grid; gap: 12px; }
.card legend, .card .head h3 { font-family: var(--cond); font-size: 20px; font-weight: 600; padding: 0 4px; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
input:not([type=checkbox]), select { width: 100%; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 0 11px; font-size: 16px; color: var(--ink); min-width: 0; }
input[type=date] { padding-right: 6px; }
input.nuevo { border-color: var(--ball); box-shadow: inset 0 -3px 0 var(--ball); }
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px; font-size: 14px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; min-height: 42px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; padding: 0 6px; font-size: 15px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
.campo { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.lado { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--chip); }
.lado .tit { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.lado.gana { box-shadow: inset 4px 0 0 var(--win); }
.lado.gana .tit b { color: var(--win); }

.res-out { font-size: 14px; min-height: 20px; }
.res-out .ok { color: var(--win); font-weight: 600; }
.res-out .err { color: var(--loss); }
.res-out .warn { color: var(--muted); display: block; }
.res-extra:empty { display: none; }

/* Combo de jugadores */
.combo { position: relative; }
.clist { position: relative; margin-top: 4px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 240px; overflow: auto; padding: 4px; }
.clist div { padding: 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 15px; color: var(--ink); }
.clist div small { color: var(--muted); }
.clist div.on, .clist div:hover { background: var(--chip); }
.clist div.add { color: var(--muted); font-style: italic; }

.nuevo-j { border: 1px dashed var(--ball); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.nuevo-j p { margin: 0; font-weight: 600; }

/* Botones */
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }
.btn { min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 16px; }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.danger { background: var(--loss); color: #fff; border-color: var(--loss); }
.btn.ghost { background: transparent; border-style: dashed; color: var(--muted); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.errs { color: var(--loss); margin: 0; padding-left: 18px; font-size: 14px; }
.errs:empty { display: none; }
.err { color: var(--loss); font-size: 14px; min-height: 1em; }
.banner { background: var(--ball); color: #17201C; border-radius: 12px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
.banner .link { color: #17201C; }

/* Lista de partidos */
.search { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); white-space: nowrap; }
.chk input { width: 20px; height: 20px; }
#lista { display: grid; gap: 8px; }
.match { display: grid; grid-template-columns: 5px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.match > .edge { background: var(--muted); opacity: .4; }
.match .body { padding: 10px 12px; display: grid; gap: 5px; min-width: 0; }
.mmeta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.mmeta b { color: var(--ink); }
.mside { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.mside .names { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.mside .names small { color: var(--muted); font-size: 12px; margin-right: 6px; }
.mside.won .names { font-weight: 600; }
.sets { display: flex; gap: 3px; }
.g { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; background: var(--chip); font-family: var(--cond); font-size: 18px; color: var(--muted); }
.g.won { color: var(--ink); font-weight: 700; }
.g.tb { width: 30px; font-size: 15px; }
.mfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.mfoot .id { font-size: 12px; color: var(--muted); }
.mfoot .actions { gap: 6px; }
.tag { font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.more { justify-self: center; }
.empty { color: var(--muted); text-align: center; padding: 20px 0; }

/* Estados */
.cargando { position: fixed; inset: 0; background: rgba(0,0,0,.25); display: grid; place-items: center; z-index: 80; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface); border-top-color: var(--ball); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; max-width: 90vw; }
#toast.on { opacity: 1; }
#toast.err { background: var(--loss); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); width: min(420px, calc(100vw - 32px)); padding: 18px 18px 16px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog p { margin: 0 0 16px; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.equipos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lados { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (max-width: 639px) { .lados { display: grid; gap: 8px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
.grid.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.clave-wrap { position: relative; margin-top: -10px; }
.clave-wrap input { padding-right: 92px; }
.ver-clave { -webkit-tap-highlight-color: transparent; position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 80px; border: 0; border-radius: 7px; background: var(--chip); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.login-card > label { margin-bottom: 0; }
.clist div { flex-wrap: wrap; }
.clist div small { font-size: 12.5px; }
.cnota { margin: 4px 6px 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.parecidos { display: grid; gap: 6px; }
.parecidos > span:first-child { font-size: 14px; font-weight: 600; color: var(--ink); }
.parecidos button { display: grid; gap: 1px; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--chip); cursor: pointer; }
.parecidos button b { font-size: 15px; }
.parecidos button small { font-size: 12.5px; color: var(--muted); }

/* ================= Tablero ================= */
/* Colores de gráficos: validados para daltonismo (verde/rojo se separan también por luminosidad).
   Las barras llevan siempre el récord y el % escritos al lado: el color nunca es el único dato. */
:root { --bar-w: #17652F; --bar-l: #D9624E; --grid: #E4E8E3; --vs-a: #2563B0; --vs-b: #B57A0A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar-w: #3DA862; --bar-l: #B8473A; --grid: #252D29; --vs-a: #4A8BD8; --vs-b: #B98A2A; } }
:root[data-theme="dark"] { --bar-w: #3DA862; --bar-l: #B8473A; --grid: #252D29; --vs-a: #4A8BD8; --vs-b: #B98A2A; }

body.ancho .top, body.ancho .tabs, body.ancho main { max-width: 1080px; }
#v-tablero.on { display: block; }
.t-vista { display: grid; gap: 12px; }

.t-sub { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.t-sub::-webkit-scrollbar { display: none; }
.t-sub button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-family: var(--cond); font-size: 17px; font-weight: 600; cursor: pointer; display: flex; align-items: baseline; gap: 6px; }
.t-sub button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.t-sub button:disabled { color: var(--muted); cursor: default; opacity: .7; }
.t-sub small { font-family: var(--body); font-size: 11px; font-weight: 500; }

.t-filtros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.t-filtros .t-fil:first-child { grid-column: 1 / -1; }
.t-fil select { height: 42px; }
.t-limpiar { justify-self: start; }

.t-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; min-width: 0; display: grid; gap: 10px; align-content: start; }
.t-panel > header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.t-panel h3 { font-family: var(--cond); font-size: 20px; font-weight: 600; margin: 0; }
.t-panel header small { color: var(--muted); font-size: 13px; }
.t-empty { color: var(--muted); margin: 4px 0; font-size: 14px; }
.t-nota { margin: 0; font-size: 13px; color: var(--muted); }

/* Ficha */
.t-ficha-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; }
.t-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--ball); color: #17201C; display: grid; place-items: center; font-family: var(--cond); font-weight: 700; font-size: 24px; }
.t-ficha h2 { font-family: var(--cond); font-size: 28px; line-height: 1.05; margin: 0 0 4px; }
.t-datos { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; }
.t-datos span { color: var(--muted); margin-right: 4px; }
.t-racha { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.t-notas { border-top: 1px solid var(--line); padding-top: 8px; }
.t-notas summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.t-notas p { margin: 8px 0 4px; white-space: pre-line; }
.t-notas small { color: var(--muted); font-size: 12px; }

/* Bolitas de racha: color + letra (G/P), así no depende solo del color */
.t-balls { display: inline-flex; gap: 4px; vertical-align: middle; }
.t-balls i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; color: #fff; }
.t-balls i.w { background: var(--bar-w); }
.t-balls i.l { background: var(--bar-l); }

/* Tarjetas de números */
.t-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.t-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 1px; }
.t-tile b { font-family: var(--cond); font-size: 30px; line-height: 1; font-weight: 700; }
.t-tile span { font-size: 13px; color: var(--ink); }
.t-tile small { font-size: 12px; color: var(--muted); }

/* Barras de victorias/derrotas */
.t-grid { display: grid; gap: 12px; }
.t-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.t-bars li { display: grid; grid-template-columns: minmax(70px, 30%) minmax(0, 1fr) 46px 62px; gap: 8px; align-items: center; font-size: 14px; }
.t-bars .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-bars .pc { white-space: nowrap; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.t-bars .rc { white-space: nowrap; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.t-bar { display: flex; gap: 2px; height: 14px; min-width: 40px; }
.t-bar i { display: block; min-width: 3px; }
.t-bar i:first-child { border-radius: 4px 0 0 4px; }
.t-bar i:last-child { border-radius: 0 4px 4px 0; }
.t-bar i:only-child { border-radius: 4px; }
.t-bar i.w { background: var(--bar-w); }
.t-bar i.l { background: var(--bar-l); }
.t-ley { display: inline-flex; gap: 10px; font-size: 12px; color: var(--muted); }
.t-ley i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.t-ley i.w { background: var(--bar-w); } .t-ley i.l { background: var(--bar-l); }

/* Evolución por mes */
.t-rachas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.t-rachas div { background: var(--chip); border-radius: 10px; padding: 8px 10px; display: grid; }
.t-rachas b { font-family: var(--cond); font-size: 26px; line-height: 1; }
.t-rachas span { font-size: 12px; color: var(--muted); }
.t-cols { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; border-bottom: 1px solid var(--grid); }
.t-col { flex: none; width: 44px; display: grid; grid-template-rows: auto 120px auto; justify-items: center; gap: 4px; }
.t-col .plot { width: 100%; height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.t-col .stack { width: 22px; display: flex; flex-direction: column; gap: 2px; min-height: 6px; }
.t-col .stack i { display: block; min-height: 2px; }
.t-col .stack i:first-child { border-radius: 4px 4px 0 0; }
.t-col .stack i:only-child { border-radius: 4px 4px 0 0; }
.t-col .stack i.w { background: var(--bar-w); }
.t-col .stack i.l { background: var(--bar-l); }
.t-col .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-col .m { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Tablas */
.t-tbl { overflow-x: auto; }
.t-tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t-tbl td { padding: 7px 6px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.t-tbl td:first-child { white-space: normal; min-width: 120px; }
.t-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.t-tbl .pcell { display: flex; align-items: center; gap: 6px; min-width: 110px; }
.t-tbl .pcell .t-bar { flex: 1; height: 10px; }
.t-tbl .pcell span { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.t-tbl .hm .t-balls i { width: 16px; height: 16px; font-size: 9px; }
.t-dest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.t-dest div { border-radius: 10px; padding: 8px 10px; background: var(--chip); display: grid; border-left: 4px solid var(--bar-w); }
.t-dest div.l { border-left-color: var(--bar-l); }
.t-dest span { font-size: 12px; color: var(--muted); }
.t-dest b { font-size: 15px; }
.t-dest small { font-size: 13px; color: var(--muted); }

/* Partidos del tablero */
.t-partidos { display: grid; gap: 8px; }
.match.es-w > .edge { background: var(--bar-w); opacity: 1; }
.match.es-l > .edge { background: var(--bar-l); opacity: 1; }
.t-panel .more { justify-self: center; }

@media (max-width: 420px) {
  .t-bars li { grid-template-columns: minmax(64px, 28%) minmax(0, 1fr) 42px 56px; gap: 6px; font-size: 13px; }
  .t-tbl .hm { display: none; }
}
@media (min-width: 640px) {
  .t-filtros { grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); }
  .t-filtros .t-fil:first-child { grid-column: auto; }
  .t-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .t-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-ficha-top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .t-racha { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 4px; }
}
@media (min-width: 980px) {
  .t-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .t-grid.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Encabezado: el título nunca se parte; el subtítulo baja si no entra */
.brand { flex-wrap: wrap; row-gap: 0; min-width: 0; }
.brand h1 { white-space: nowrap; }

/* Encabezado: botón de tema */
.top-acc { display: flex; align-items: center; gap: 4px; }
.tema { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }

/* Tablero: piezas de las vistas nuevas */
.t-muted { color: var(--muted); }
.t-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.t-tile-txt b { font-size: 22px; line-height: 1.1; }
.t-ley i.a { background: var(--vs-a); } .t-ley i.b { background: var(--vs-b); }
.match.es-a > .edge { background: var(--vs-a); opacity: 1; }
.match.es-b > .edge { background: var(--vs-b); opacity: 1; }
.t-dest button { text-align: left; border: 0; border-left: 4px solid var(--bar-w); border-radius: 10px; padding: 8px 10px; background: var(--chip); display: grid; cursor: pointer; color: var(--ink); }
.t-dest button.l { border-left-color: var(--bar-l); }
.t-dest button span { font-size: 12px; color: var(--muted); }
.t-dest button b { font-size: 15px; }
.t-dest button small { font-size: 13px; color: var(--muted); }
.t-link { cursor: pointer; }
.t-link:hover td, .t-link:focus td { background: var(--chip); }
.t-link td:first-child { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.t-tbl th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.t-tbl th[aria-sort] button { color: var(--ink); }
.t-minpj { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.t-minpj select { width: auto; height: 34px; padding: 0 8px; }

/* Versus */
.t-vs-elegir { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.t-swap { min-height: 42px; padding: 0 12px; font-size: 18px; }
.t-vs-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.t-vs-head .nom { font-family: var(--cond); font-size: 20px; font-weight: 600; line-height: 1.1; display: flex; align-items: center; gap: 6px; }
.t-vs-head .nom.b { justify-content: flex-end; text-align: right; }
.t-vs-head .nom i { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.t-vs-head .nom.a i { background: var(--vs-a); } .t-vs-head .nom.b i { background: var(--vs-b); }
.t-vs-head .score { font-family: var(--cond); font-size: 44px; font-weight: 700; line-height: 1; }
.t-vs-sub { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.t-tugs { display: grid; gap: 10px; }
.t-tug { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; grid-template-areas: "lab lab lab" "va bar vb"; gap: 2px 8px; align-items: center; }
.t-tug .lab { grid-area: lab; text-align: center; font-size: 13px; color: var(--muted); }
.t-tug .va { grid-area: va; font-variant-numeric: tabular-nums; }
.t-tug .vb { grid-area: vb; text-align: right; font-variant-numeric: tabular-nums; }
.t-tug .tbar { grid-area: bar; display: flex; gap: 2px; height: 12px; background: var(--chip); border-radius: 4px; }
.t-tug .tbar i { display: block; }
.t-tug .tbar i:first-child { border-radius: 4px 0 0 4px; } .t-tug .tbar i:last-child { border-radius: 0 4px 4px 0; } .t-tug .tbar i:only-child { border-radius: 4px; }
.t-tug .tbar i.a { background: var(--vs-a); } .t-tug .tbar i.b { background: var(--vs-b); }

/* Series */
.t-series { display: grid; gap: 8px; }
.t-serie { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.t-serie summary { list-style: none; display: grid; grid-template-columns: 5px minmax(0, 1fr) auto; grid-template-areas: "edge sm sc" "edge sm res"; gap: 0 12px; padding: 10px 12px 10px 0; cursor: pointer; align-items: center; }
.t-serie summary::-webkit-details-marker { display: none; }
.t-serie .edge { grid-area: edge; align-self: stretch; background: var(--muted); opacity: .4; }
.t-serie.es-w .edge { background: var(--bar-w); opacity: 1; } .t-serie.es-l .edge { background: var(--bar-l); opacity: 1; }
.t-serie .sm { grid-area: sm; display: grid; min-width: 0; padding-left: 10px; }
.t-serie .sm span { font-size: 13px; color: var(--muted); }
.t-serie .sc { grid-area: sc; font-family: var(--cond); font-size: 24px; font-weight: 700; text-align: right; }
.t-serie .res { grid-area: res; font-size: 12px; color: var(--muted); text-align: right; }
.t-serie .det { display: grid; gap: 6px; padding: 0 10px 10px; }
@media (max-width: 420px) { .t-vs-head .score { font-size: 36px; } .t-vs-head .nom { font-size: 17px; } }

/* Buscador de jugadores del tablero: la lista flota sobre el contenido */
.t-combo { position: relative; }
.t-combo input[type=text] { padding-right: 10px; }
.t-clist { position: absolute; left: 0; right: 0; top: calc(100% + 4px); margin-top: 0; max-height: 320px; }
.t-clist p.cnota { margin: 6px 8px; }
.t-vs-elegir > span:empty { width: 0; }

/* Saldo acumulado */
.t-tiles.t-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.t-saldo { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: 170px auto; gap: 4px 6px; margin-top: 4px; }
.t-saldo-y { position: relative; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-saldo-y span { position: absolute; right: 0; transform: translateY(-50%); }
.t-saldo-plot { position: relative; }
.t-saldo-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.t-saldo-plot .linea { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.t-saldo-plot .cero { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.t-saldo-plot .a-w { fill: var(--bar-w); opacity: .14; }
.t-saldo-plot .a-l { fill: var(--bar-l); opacity: .16; }
.t-sdot { position: absolute; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--surface); z-index: 2; pointer-events: none; }
.t-sdot.w { background: var(--bar-w); } .t-sdot.l { background: var(--bar-l); }
.t-sdot.max, .t-sdot.min { background: var(--surface); border: 2px solid var(--ink); }
.t-saldo-zonas { position: absolute; inset: 0; z-index: 3; }
.t-saldo-zonas i { position: absolute; top: 0; bottom: 0; cursor: crosshair; }
.t-saldo-zonas i.on { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.t-saldo-x { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.t-saldo-info { margin: 0; font-size: 13px; min-height: 1.4em; }
.t-ley i.r { border-radius: 50%; }
.t-ley i.max, .t-ley i.min { background: var(--surface); border: 2px solid var(--ink); box-sizing: border-box; }
.t-saldo-txt { margin-top: -2px; }
