/* ═══════════════════════════════════════════════════════════════════════════
   Reloj de Ajedrez · paneles de registro: Historial, Jugadores, Estadísticas y gráficas.
   Solo variables de base.css (salvo los colores fijos de las piezas blancas/negras).
   Prefijos: reg- (común), hist- (partidas), det- (detalle), jug- (jugadores), est- (estadísticas), g- (gráficas)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Común ─────────────────────────────────────────────────────────────── */
.reg-vista { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; animation: reg-entrar .3s ease both; }
@keyframes reg-entrar { from { opacity: 0; transform: translateY(8px); } }
.reg-vista .tarjeta + .tarjeta { margin-top: 0; }

.reg-cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; }
.reg-intro { min-width: 0; }
.reg-h2 { font-size: clamp(22px, 2.4vw, 28px); }
.reg-sub { margin: 4px 0 0; font-size: 14px; }
.reg-sub b { color: var(--texto); }
.reg-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reg-flechita { font-size: 11px; opacity: .7; margin-left: -2px; }

.reg-ruta { display: flex; align-items: center; gap: 6px; margin: -8px 0 0; font-size: 12px; max-width: 100%; }
.reg-ruta .icono { width: 14px; height: 14px; }
.reg-ruta:has(span:empty) { display: none; }

/* menú desplegable de exportación */
.reg-menu-envoltura { position: relative; }
.reg-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; padding: 6px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra-alta); animation: reg-menu .16s cubic-bezier(.2, .8, .2, 1) both; transform-origin: top right;
}
@keyframes reg-menu { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.reg-menu button {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 12px; text-align: left;
  border: 0; border-radius: 10px; background: none; cursor: pointer; transition: background var(--transicion);
}
.reg-menu button:hover, .reg-menu button:focus-visible { background: var(--superficie-2); outline: none; }
.reg-menu button .icono { color: var(--acento); margin-top: 2px; }
.reg-menu b { display: block; font-weight: 600; }
.reg-menu small { display: block; color: var(--texto-suave); font-size: 12.5px; }

/* filtros */
.reg-filtros { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; border-radius: var(--radio); }
.reg-filtros-fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.reg-filtros-fila2 { gap: 8px; }
.reg-buscar { flex: 1 1 260px; min-width: 200px; }
.reg-buscar .entrada { padding-left: 42px; }
.reg-lupa { position: absolute; left: 14px; color: var(--texto-tenue); pointer-events: none; }
.reg-campo-mini { position: relative; display: inline-flex; align-items: center; flex: 0 1 auto; }
.reg-campo-mini > .icono { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--texto-tenue); pointer-events: none; }
.reg-campo-mini select.entrada { padding-left: 38px; min-width: 200px; cursor: pointer; }
.reg-fechas { display: inline-flex; align-items: center; gap: 6px; padding-left: 4px; color: var(--texto-tenue); }
.reg-fechas .entrada { width: 150px; min-height: 44px; padding: 8px 10px; }
.reg-fechas .entrada::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
:root[data-tema="oscuro"] .reg-fechas .entrada::-webkit-calendar-picker-indicator,
:root[data-tema="tablero"] .reg-fechas .entrada::-webkit-calendar-picker-indicator,
:root[data-tema="lcd"] .reg-fechas .entrada::-webkit-calendar-picker-indicator,
:root[data-tema="neon"] .reg-fechas .entrada::-webkit-calendar-picker-indicator { filter: invert(1); }
.reg-chips { gap: 6px; }
.reg-chip { min-height: 36px; padding: 6px 12px; min-width: 0; font-size: 14px; }
.reg-chip small { font-size: 11.5px; padding: 0 6px; border-radius: 99px; background: var(--superficie-3); color: var(--texto-suave); }
.reg-chip.activo small { background: rgba(255, 255, 255, .22); color: inherit; }
.reg-punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--cat, var(--acento))); flex: none; }
.reg-chip.activo .reg-punto { box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); }
.reg-quitar { min-height: 36px; padding: 6px 12px; color: var(--texto-suave); }
.reg-cat { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }

/* estados vacíos */
.reg-vacio { padding: 56px 16px 64px; }
.reg-vacio h3 { color: var(--texto); font-size: 20px; margin-bottom: 8px; }
.reg-vacio p { max-width: 520px; margin: 0 auto 18px; line-height: 1.55; }
.reg-vacio-arte { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.reg-vacio-arte .pieza {
  font-size: 54px; margin: 0; opacity: 1; width: 86px; height: 86px; display: grid; place-items: center;
  border-radius: 24px; background: var(--superficie); border: 1px solid var(--borde); box-shadow: var(--sombra);
  animation: reg-flotar 3.2s ease-in-out infinite;
}
.reg-vacio-arte .pieza:first-child { color: var(--oro); transform: rotate(-6deg); }
.reg-vacio-arte .pieza:last-child { color: var(--acento); animation-delay: -1.6s; transform: rotate(6deg); }
@keyframes reg-flotar { 50% { translate: 0 -6px; } }
.reg-vacio-acciones { justify-content: center; }

/* discos de pieza (colores fijos: piezas blancas y negras) */
.pz {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  font-family: var(--fuente-piezas); font-size: 15px; line-height: 1; font-variant-emoji: text;
}
.pz-blancas { background: #f7f2e8; color: #2a2620; box-shadow: inset 0 0 0 1px #d9cfbd; }
.pz-negras { background: #1d1b19; color: #f7f2e8; box-shadow: inset 0 0 0 1px #000; }
.pz-grande { width: 52px; height: 52px; font-size: 32px; }

/* ── Historial ─────────────────────────────────────────────────────────── */
.hist-lista { display: flex; flex-direction: column; gap: 22px; }
.hist-grupo { display: flex; flex-direction: column; gap: 8px; }
.hist-dia {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; color: var(--texto-suave); padding: 8px 6px 4px; margin-top: -8px; position: sticky; top: -4px; z-index: 2; background: var(--fondo);
}
.hist-dia b { color: var(--acento); }
.hist-dia-resumen { font-weight: 500; font-size: 12.5px; }
.hist-partidas { display: flex; flex-direction: column; gap: 6px; }

.hist-partida {
  --cat: var(--acento);
  position: relative; display: grid; align-items: center; gap: 10px 18px; width: 100%; text-align: left;
  grid-template-columns: 54px minmax(200px, 1.5fr) minmax(110px, .7fr) minmax(200px, 1.3fr) 14px;
  padding: 12px 16px 12px 20px; border: 1px solid var(--borde); border-radius: var(--radio);
  background: var(--superficie); color: var(--texto); cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: transform var(--transicion), border-color var(--transicion), box-shadow var(--transicion), background var(--transicion);
  animation: hist-entrar .35s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes hist-entrar { from { opacity: 0; transform: translateY(6px); } }
.hist-partida::before {
  content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--cat); opacity: .85;
}
.hist-partida.con-fecha { grid-template-columns: 96px minmax(200px, 1.5fr) minmax(110px, .7fr) minmax(200px, 1.3fr) 14px; }
.hist-partida:hover { border-color: var(--borde-fuerte); box-shadow: var(--sombra); transform: translateY(-1px); }
.hist-partida:hover .hist-flecha { transform: translateX(3px); color: var(--acento); }
.hist-partida:active { transform: scale(.995); }
.hist-hora { font-size: 13px; color: var(--texto-suave); display: flex; flex-direction: column; line-height: 1.25; }
.hist-hora b { font-size: 12px; color: var(--texto); font-weight: 600; }
.hist-duelo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hist-jug { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14.5px; }
.hist-jug .pz { width: 20px; height: 20px; font-size: 13px; }
.hist-nombre { min-width: 0; }
.hist-jug.gana .hist-nombre { font-weight: 700; }
.hist-jug.pierde .hist-nombre { color: var(--texto-suave); }
.hist-elo { font-size: 12px; color: var(--texto-tenue); }
.hist-pts { margin-left: auto; min-width: 22px; text-align: center; font-size: 13px; border-radius: 6px; padding: 0 4px; }
.hist-pts.victoria { color: var(--exito); }
.hist-pts.derrota { color: var(--texto-tenue); }
.hist-pts.tablas { color: var(--aviso); }
.hist-res { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.hist-res .insignia { font-size: 13px; padding: 3px 10px; }
.hist-motivo { font-size: 12.5px; color: var(--texto-suave); }
.hist-motivo:first-letter { text-transform: uppercase; }
.hist-meta { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.hist-control { display: flex; align-items: center; gap: 6px; color: var(--texto-suave); }
.hist-control b { color: var(--texto); }
.hist-control .reg-punto { background: var(--cat); }
.hist-datos, .hist-torneo { display: flex; align-items: center; gap: 4px; font-size: 12.5px; }
.hist-datos .icono, .hist-torneo .icono { width: 14px; height: 14px; }
.hist-torneo { color: var(--texto-suave); }
.hist-sep { margin: 0 3px; }
.hist-flecha { font-size: 22px; color: var(--texto-tenue); transition: transform var(--transicion), color var(--transicion); }
.hist-mas { display: flex; justify-content: center; padding: 6px 0 12px; }

@media (max-width: 860px) {
  .hist-partida, .hist-partida.con-fecha { grid-template-columns: 48px 1fr auto; }
  .hist-partida.con-fecha { grid-template-columns: 84px 1fr auto; }
  .hist-meta { grid-column: 2 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .hist-flecha { display: none; }
}

/* ── Detalle de partida ────────────────────────────────────────────────── */
.modal.det-modal { width: min(1020px, 100%); }
.det { display: flex; flex-direction: column; gap: 16px; }
.det-planilla {
  border: 1px solid var(--borde); border-radius: var(--radio-l); overflow: hidden;
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie));
}
.det-planilla.det-destello { animation: det-destello 1s ease; }
@keyframes det-destello { 30% { box-shadow: 0 0 0 4px var(--acento-suave); border-color: var(--acento); } }
.det-planilla-cabeza {
  display: grid; grid-template-columns: 2fr 1.4fr .6fr .6fr 1.4fr; border-bottom: 1px dashed var(--borde-fuerte);
}
.det-planilla-cabeza > div { padding: 10px 16px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.det-planilla-cabeza > div + div { border-left: 1px solid var(--borde); }
.det-planilla-cabeza b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-etq { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--texto-tenue); }
.det-duelo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px; }
.det-lado { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 14px; border-radius: var(--radio); }
.det-negras { flex-direction: row-reverse; text-align: right; }
.det-lado.victoria { background: rgba(34, 168, 97, .09); }
.det-lado-texto { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.det-nombre { font-family: var(--fuente-titulo); font-size: 21px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-pts { font-family: var(--fuente-num); font-size: 34px; font-weight: 700; color: var(--texto-tenue); }
.det-lado.victoria .det-pts { color: var(--exito); }
.det-lado.tablas .det-pts { color: var(--aviso); }
.det-centro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.det-marcador { font-family: var(--fuente-num); font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.det-centro .insignia:first-letter { text-transform: uppercase; }
.det-centro-datos { font-size: 12.5px; }
.det-pestanas { align-self: flex-start; flex-wrap: wrap; }
.det-pestanas .pestana { display: inline-flex; align-items: center; gap: 6px; }
.det-pestanas .icono { width: 16px; height: 16px; }
.det-panel { animation: reg-entrar .25s ease both; }
.det-resumen { display: grid; gap: 16px; }
.det-grafica { border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px 8px; background: var(--superficie); }
.det-grafica h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; color: var(--texto-suave); }
.det-grafica h4 .icono { width: 18px; height: 18px; color: var(--acento); }

.det-comp { border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--superficie-2); }
.det-comp-cabeza { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.det-comp-fila { display: grid; grid-template-columns: 140px 1fr 140px; align-items: center; gap: 14px; padding: 6px 0; }
.det-comp-fila + .det-comp-fila { border-top: 1px solid var(--borde); }
.det-comp-fila > b { font-size: 16px; font-weight: 600; }
.det-comp-fila > b:last-child { text-align: right; }
.det-comp-fila > b.destaca { color: var(--exito); }
.det-comp-centro { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 13px; color: var(--texto-suave); }
.det-comp-barra { display: flex; width: 100%; height: 6px; gap: 3px; }
.det-comp-barra i { display: block; border-radius: 6px; transition: width .6s cubic-bezier(.2, .8, .2, 1); animation: det-barra .8s cubic-bezier(.2, .8, .2, 1) both; }
.det-comp-barra i:first-child { background: var(--oro); }
.det-comp-barra i:last-child { background: var(--acento); }
@keyframes det-barra { from { width: 50%; opacity: .3; } }

.det-tabla { max-height: 440px; }
.det-tabla .tabla td, .det-tabla .tabla th { padding: 8px 14px; }
.det-tabla th .pz { width: 18px; height: 18px; font-size: 12px; vertical-align: -4px; margin-right: 4px; }
.det-tabla tfoot td { border-top: 2px solid var(--borde-fuerte); background: var(--superficie-2); font-weight: 600; position: sticky; bottom: 0; }
.det-n { color: var(--texto-tenue); width: 60px; }
.det-max { color: var(--peligro); font-weight: 700; }
.det-max .insignia { font-size: 10px; padding: 0 6px; vertical-align: 1px; }
.det-apuro { color: var(--peligro); font-weight: 600; }
.det-nota { font-size: 12.5px; margin: 8px 2px 0; }
.det-vacio { padding: 40px 16px; }

.det-form { display: flex; flex-direction: column; gap: 16px; }
.det-form-rejilla { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.det-ancho2 { grid-column: span 2; }
.det-ancho-total { grid-column: 1 / -1; }
.det-form-pie { font-size: 13px; }
.det-form-pie .icono { width: 16px; height: 16px; }
.det-pie { border-top: 1px solid var(--borde); padding-top: 16px; margin-top: 0; align-items: center; }
.det-sub-boton { font-weight: 500; opacity: .8; font-size: 12px; }

@media (max-width: 760px) {
  .det-planilla-cabeza { grid-template-columns: 1fr 1fr; }
  .det-planilla-cabeza > div + div { border-left: 0; }
  .det-planilla-cabeza > div { border-top: 1px solid var(--borde); }
  .det-duelo { grid-template-columns: 1fr; }
  .det-negras { flex-direction: row; text-align: left; }
  .det-comp-fila { grid-template-columns: 90px 1fr 90px; }
  .det-form-rejilla { grid-template-columns: 1fr 1fr; }
}

/* ── Jugadores ─────────────────────────────────────────────────────────── */
.jug-ayuda { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.jug-ayuda .icono { width: 16px; height: 16px; }
.jug-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; padding-bottom: 80px; }
.jug-rejilla > .vacio { grid-column: 1 / -1; }

.jug-tarjeta {
  --color-jug: var(--acento);
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow: hidden;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-l); box-shadow: var(--sombra);
  transition: transform var(--transicion), box-shadow var(--transicion), border-color var(--transicion);
  animation: hist-entrar .4s cubic-bezier(.2, .8, .2, 1) both;
}
.jug-tarjeta::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 74px; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-jug) 16%, transparent), transparent);
}
.jug-tarjeta:hover { transform: translateY(-2px); box-shadow: var(--sombra), 0 10px 26px rgba(0, 0, 0, .08); }
.jug-tarjeta.seleccionada { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave), var(--sombra); }

.jug-marca { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; z-index: 1; }
.jug-marca input { position: absolute; opacity: 0; pointer-events: none; }
.jug-marca-caja {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  border: 2px solid var(--borde-fuerte); background: var(--superficie); color: transparent; transition: all var(--transicion);
}
.jug-marca-caja .icono { width: 16px; height: 16px; stroke-width: 3; }
.jug-marca:hover .jug-marca-caja { border-color: var(--acento); }
.jug-marca input:checked + .jug-marca-caja { background: var(--acento); border-color: var(--acento); color: #fff; animation: jug-pop .25s ease; }
.jug-marca input:focus-visible + .jug-marca-caja { outline: 3px solid var(--acento); outline-offset: 2px; }
@keyframes jug-pop { 50% { transform: scale(1.18); } }
.jug-marca-lado {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: var(--superficie); border: 1px solid var(--borde); animation: reg-menu .2s ease both;
}
.jug-marca-lado .pz { width: 18px; height: 18px; font-size: 12px; }
.btn-icono.jug-mini { width: 34px; height: 34px; }
.btn-icono.jug-mini .icono { width: 17px; height: 17px; }
.btn-icono.jug-mini.peligro:hover { color: var(--peligro); border-color: var(--peligro); }

.jug-cabeza { display: flex; align-items: center; gap: 14px; margin-top: 26px; position: relative; }
.jug-avatar {
  width: 60px; height: 60px; border-radius: 18px; flex: none; display: grid; place-items: center;
  font-size: 38px; color: var(--color-jug); font-variant-emoji: text;
  background: color-mix(in srgb, var(--color-jug) 15%, var(--superficie));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-jug) 35%, transparent);
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.jug-tarjeta:hover .jug-avatar { transform: rotate(-6deg) scale(1.05); }
.jug-identidad { min-width: 0; flex: 1; }
.jug-nombre { font-size: 18px; font-weight: 700; }
.jug-sub { margin: 2px 0 0; font-size: 13px; color: var(--texto-suave); }
.jug-elo {
  position: absolute; top: 14px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05;
}
.jug-elo .num { font-family: var(--fuente-num); font-size: 22px; font-weight: 700; }
.jug-elo small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--texto-tenue); }
.jug-resumen {
  display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; padding: 12px; border-radius: var(--radio);
  background: var(--superficie-2); border: 1px solid var(--borde);
}
.jug-resumen > div { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.jug-resumen b { font-family: var(--fuente-num); font-size: 18px; }
.jug-resumen small { font-size: 11.5px; color: var(--texto-tenue); }
.jug-racha-puntos { display: flex; gap: 5px; height: 25px; align-items: center; }
.jug-racha-punto { width: 12px; height: 12px; border-radius: 50%; background: var(--borde-fuerte); transition: transform var(--transicion); }
.jug-racha-punto:hover { transform: scale(1.35); }
.jug-racha-punto.victoria { background: var(--exito); }
.jug-racha-punto.derrota { background: var(--peligro); }
.jug-racha-punto.tablas { background: var(--aviso); }
.jug-racha-punto.vacio { background: transparent; box-shadow: inset 0 0 0 1.5px var(--borde-fuerte); padding: 0; }
.jug-pie { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-top: -4px; }
.jug-ultima { font-size: 12.5px; min-width: 0; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.jug-ultima .icono { width: 14px; height: 14px; }
.jug-botones { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.jug-botones .btn-icono { border-color: transparent; background: transparent; color: var(--texto-tenue); }
.jug-botones .btn-icono:hover { color: var(--texto); border-color: var(--borde); background: var(--superficie-2); }
.jug-ver { min-height: 34px; padding: 6px 10px; font-size: 13.5px; color: var(--acento); }
.jug-ver .icono { width: 16px; height: 16px; }

/* barra de selección para jugar */
.jug-seleccion {
  position: sticky; bottom: 14px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px 10px 16px; margin-top: -66px; border-radius: var(--radio-l);
  background: var(--vidrio); backdrop-filter: blur(14px) saturate(1.4); border: 1px solid var(--borde-fuerte);
  box-shadow: var(--sombra-alta); animation: jug-subir .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes jug-subir { from { opacity: 0; transform: translateY(16px); } }
.jug-sel-ficha { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 260px; font-size: 15px; }
.jug-sel-ficha.pendiente { opacity: .8; }

/* formulario de jugador */
.jug-form { --color-jug: var(--acento); display: flex; flex-direction: column; gap: 16px; }
.jug-form-vista { display: flex; align-items: flex-start; gap: 16px; }
.jug-avatar-grande { width: 76px; height: 76px; font-size: 50px; border-radius: 22px; transition: background .2s, color .2s; }
.jug-form-rejilla { grid-template-columns: 1fr 1fr; }
.jug-obligatorio { color: var(--peligro); }
.jug-error { color: var(--peligro); font-size: 12.5px; font-weight: 600; animation: reg-entrar .2s ease both; }
.entrada.invalida { border-color: var(--peligro); box-shadow: 0 0 0 4px rgba(229, 72, 77, .14); }
.jug-colores { gap: 6px; flex-wrap: nowrap; }
.jug-color-rapido {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--superficie); padding: 0; cursor: pointer;
  background: var(--c); box-shadow: 0 0 0 1px var(--borde-fuerte); transition: transform var(--transicion);
}
.jug-color-rapido:hover { transform: scale(1.2); }
.jug-piezas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.jug-pieza-op { cursor: pointer; }
.jug-pieza-op input { position: absolute; opacity: 0; pointer-events: none; }
.jug-pieza-op .pieza {
  display: grid; place-items: center; aspect-ratio: 1; font-size: 26px; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--superficie-2); transition: all var(--transicion);
}
.jug-pieza-op:hover .pieza { border-color: var(--color-jug); transform: translateY(-2px); }
.jug-pieza-op input:checked + .pieza {
  color: var(--color-jug); border-color: var(--color-jug);
  background: color-mix(in srgb, var(--color-jug) 15%, var(--superficie)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-jug) 25%, transparent);
}
.jug-pieza-op input:focus-visible + .pieza { outline: 3px solid var(--acento); outline-offset: 2px; }
@media (max-width: 560px) {
  .jug-piezas { grid-template-columns: repeat(6, 1fr); }
  .jug-form-rejilla { grid-template-columns: 1fr; }
}

/* ── Estadísticas ──────────────────────────────────────────────────────── */
.est-controles { gap: 10px; }
.est-cuerpo { display: flex; flex-direction: column; gap: 16px; }
.est-cuerpo > .tarjeta, .est-fila > .tarjeta { margin: 0; }
.est-fila { gap: 16px; }
.est-quitar {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; margin-left: 6px; border-radius: 99px; cursor: pointer; vertical-align: 1px;
  border: 1px solid var(--borde); background: var(--superficie); color: var(--texto-suave); font-size: 12.5px; font-weight: 600;
}
.est-quitar:hover { color: var(--texto); border-color: var(--borde-fuerte); }
.est-quitar .icono { width: 13px; height: 13px; }
.est-nota { font-size: 12.5px; font-weight: 500; }
.est-nota-grafica { font-size: 12.5px; margin: -6px 0 4px; }

.est-cifras { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.est-cifra {
  position: relative; overflow: hidden; background: var(--superficie); box-shadow: var(--sombra);
  animation: hist-entrar .4s cubic-bezier(.2, .8, .2, 1) both;
}
.est-cifra:nth-child(2) { animation-delay: 40ms; } .est-cifra:nth-child(3) { animation-delay: 80ms; }
.est-cifra:nth-child(4) { animation-delay: 120ms; } .est-cifra:nth-child(5) { animation-delay: 160ms; }
.est-cifra:nth-child(6) { animation-delay: 200ms; }
.est-cifra .valor { line-height: 1.1; }
.est-cifra > small { display: block; font-size: 12px; margin-top: 2px; }
.est-cifra.destacada { background: linear-gradient(135deg, var(--acento-suave), var(--superficie) 70%); border-color: color-mix(in srgb, var(--acento) 35%, var(--borde)); }
.est-cifra-icono {
  position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--superficie-2); color: var(--acento);
}
.est-cifra-icono .icono { width: 19px; height: 19px; }
.est-de { font-size: 16px; color: var(--texto-tenue); font-weight: 600; }

.est-colores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.est-colores > div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radio); background: var(--superficie-2); }
.est-colores .pz { width: 34px; height: 34px; font-size: 21px; }
.est-colores span { display: flex; flex-direction: column; }
.est-colores b { font-size: 20px; font-family: var(--fuente-num); }
.est-colores small { font-size: 12px; }
.est-por-color { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.est-color-cabeza { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.est-color-pct { min-width: 52px; text-align: right; }

.est-tabla-env { max-height: 560px; }
.est-tabla td { white-space: nowrap; }
.est-tabla tbody tr { animation: hist-entrar .35s ease both; }
.est-tabla tbody tr:focus-visible { outline: 2px solid var(--acento); outline-offset: -2px; }
.est-tabla th .pz { width: 18px; height: 18px; font-size: 12px; vertical-align: -4px; margin-right: 2px; }
.est-fila-activa td { background: var(--acento-suave); }
.est-fila-activa td:first-child { box-shadow: inset 3px 0 0 var(--acento); }
.est-puesto {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%;
  font-weight: 700; font-size: 13px; color: var(--texto-suave);
}
.est-puesto.p1 { background: linear-gradient(180deg, var(--oro-claro), var(--oro)); color: #3d2a00; }
.est-puesto.p2 { background: var(--superficie-3); color: var(--texto); box-shadow: inset 0 0 0 2px var(--borde-fuerte); }
.est-puesto.p3 { background: color-mix(in srgb, var(--oro) 35%, var(--superficie-3)); color: var(--texto); }
.est-jug { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 280px; }
.est-avatar {
  --color-jug: var(--texto-tenue);
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 19px;
  color: var(--color-jug); background: color-mix(in srgb, var(--color-jug) 15%, var(--superficie));
}
.est-avatar.invitado { font-family: var(--fuente); font-size: 13px; font-weight: 700; color: var(--texto-suave); background: var(--superficie-3); }
.est-g { color: var(--exito); } .est-e { color: var(--aviso); } .est-p { color: var(--peligro); }
.est-pts { font-size: 16px; }
.est-pct { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.est-pct-barra { flex: 1; height: 6px; border-radius: 6px; background: var(--superficie-3); overflow: hidden; }
.est-pct-barra i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--acento-2), var(--acento)); animation: est-llenar .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes est-llenar { from { width: 0; } }
.est-pct .num { min-width: 42px; text-align: right; font-size: 13px; }

.est-h2h-selectores { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 18px; }
.est-h2h-cambiar { width: 40px; height: 40px; }
.est-h2h-cambiar .icono { transform: rotate(90deg); width: 18px; height: 18px; }
.est-h2h-marcador { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 14px; }
.est-h2h-lado { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 17px; }
.est-h2h-lado.derecha { justify-content: flex-end; }
.est-h2h-lado .est-avatar { width: 44px; height: 44px; font-size: 28px; border-radius: 13px; }
.est-h2h-score { display: flex; align-items: center; gap: 12px; font-family: var(--fuente-num); font-size: 38px; font-weight: 800; color: var(--texto-tenue); }
.est-h2h-score .gana { color: var(--texto); }
.est-h2h-score i { font-style: normal; font-weight: 400; }
.est-h2h-nota { font-size: 13px; margin: 10px 0 12px; }
.est-h2h-lista { max-height: 420px; overflow: auto; padding: 2px; }
.est-h2h-vacio .pieza { font-size: 44px; }

/* ── Gráficas (graficas.js) ────────────────────────────────────────────── */
.grafica { margin: 0; position: relative; min-width: 0; }
.g-svg { display: block; width: 100%; height: auto; overflow: visible; }
.g-svg text { font-family: var(--fuente); font-size: 11px; fill: var(--texto-tenue); font-variant-numeric: tabular-nums; }
.g-rejilla line { stroke: var(--borde); stroke-width: 1; stroke-dasharray: 3 5; }
.g-eje { stroke: var(--borde-fuerte); stroke-width: 1; }
.g-linea { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.g-trazo { stroke-dasharray: 1; stroke-dashoffset: 1; animation: g-trazar 1.1s cubic-bezier(.45, .05, .2, 1) forwards; }
@keyframes g-trazar { to { stroke-dashoffset: 0; } }
.g-discontinua { stroke-width: 1.6; stroke-dasharray: 5 5; opacity: .8; animation: g-aparecer .6s .4s ease both; }
.g-area { opacity: 0; animation: g-aparecer .9s ease forwards; }
@keyframes g-aparecer { from { opacity: 0; } to { opacity: 1; } }
.g-punto-fijo { animation: g-aparecer .4s .9s ease both; }
.g-zona { fill: var(--texto); opacity: 0; transition: opacity .15s; }
.g-col:hover .g-zona { opacity: .045; }
.g-guia { stroke: var(--texto-tenue); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; }
.g-punto { opacity: 0; stroke: var(--superficie); stroke-width: 2; transition: opacity .12s; }
.g-col:hover .g-guia, .g-col:hover .g-punto { opacity: 1; }
.g-barra { transform-box: fill-box; transform-origin: 50% 100%; animation: g-crecer .65s cubic-bezier(.2, .8, .2, 1) both; transition: filter .15s; }
.g-col:hover .g-barra { filter: brightness(1.15) saturate(1.1); }
@keyframes g-crecer { from { transform: scaleY(0); } }

.g-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--texto-suave); margin: 0 0 8px; }
.g-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.g-leyenda i { width: 14px; height: 4px; border-radius: 4px; background: var(--c); }
.g-leyenda i.discontinua { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }

.g-vacia { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; color: var(--texto-tenue); font-size: 13.5px; border: 1px dashed var(--borde); border-radius: var(--radio); }
.g-vacia .icono { width: 28px; height: 28px; opacity: .6; }

.g-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.g-donut-svg { width: 190px; flex: none; }
.g-donut-fondo { fill: none; stroke: var(--superficie-3); stroke-width: 24; }
.g-seg { fill: none; stroke-width: 24; cursor: pointer; animation: g-donut .9s cubic-bezier(.3, .7, .2, 1) both; transition: stroke-width .2s; }
.g-seg:hover { stroke-width: 30; }
@keyframes g-donut { from { stroke-dasharray: 0 100; } }
.g-donut-valor { font-family: var(--fuente-num); font-size: 34px !important; font-weight: 800; fill: var(--texto) !important; }
.g-donut-etq { font-size: 12px !important; fill: var(--texto-suave) !important; }
.g-donut-leyenda { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.g-donut-leyenda li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; font-size: 14px; transition: background var(--transicion); }
.g-donut-leyenda li:hover { background: var(--superficie-2); }
.g-donut-leyenda i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.g-donut-leyenda small { color: var(--texto-tenue); min-width: 40px; text-align: right; }

.g-apilada { --alto: 30px; }
.g-apilada-barra { display: flex; gap: 3px; height: var(--alto); border-radius: 10px; overflow: hidden; background: var(--superficie-3); }
.g-ap-seg {
  display: grid; place-items: center; min-width: 4px; background: var(--c); color: var(--acento-texto);
  font-size: 12px; animation: g-ap .8s cubic-bezier(.2, .8, .2, 1) both; transition: filter .15s; cursor: default;
}
.g-ap-seg:hover { filter: brightness(1.12); }
.g-ap-seg b { text-shadow: 0 1px 2px rgba(0, 0, 0, .35); white-space: nowrap; }
@keyframes g-ap { from { width: 0; } }
.g-ap-leyenda { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--texto-suave); }
.g-ap-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.g-ap-leyenda i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.g-ap-leyenda b { color: var(--texto); }
.g-apilada-vacia small { display: block; margin-top: 6px; font-size: 12px; }

.g-tooltip {
  position: fixed; left: 0; top: 0; z-index: 400; pointer-events: none; max-width: 300px;
  padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--superficie); color: var(--texto); border: 1px solid var(--borde-fuerte); box-shadow: var(--sombra-alta);
  opacity: 0; transition: opacity .12s ease;
}
.g-tooltip.visible { opacity: 1; }
.g-tooltip b { display: block; font-weight: 700; margin-bottom: 2px; }
.g-tooltip div { display: flex; align-items: center; gap: 6px; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.g-tooltip i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .g-trazo { stroke-dasharray: none; stroke-dashoffset: 0; }
  .reg-vacio-arte .pieza { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADAPTACIÓN A CELULARES, TABLETAS Y PANTALLAS GRANDES
   (solo media queries y reglas de adaptación; la estética es la de arriba)
   ═══════════════════════════════════════════════════════════════════════════ */
.reg-cabecera, .reg-intro, .reg-filtros, .reg-filtros-fila, .hist-partida, .det, .det-panel, .est-cuerpo, .jug-rejilla { min-width: 0; }
.reg-ruta .truncar { min-width: 0; }
.jug-rejilla { grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.est-h2h-selectores .entrada { min-width: 0; }
.det-comp-fila > b { min-width: 0; overflow-wrap: anywhere; }

/* ── Pestañas del registro: barra INFERIOR tipo app en el celular ──────── */
@media (max-width: 700px) {
  #pantalla-registro { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  #pantalla-registro .barra-superior .espaciador { display: none; }
  #pantalla-registro.activa ~ .notificaciones { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  #pestanas-registro {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; overflow: visible;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    border-radius: 0; background: var(--vidrio); border-top: 1px solid var(--borde);
    -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .16);
  }
  #pestanas-registro .pestana {
    flex-direction: column; gap: 3px; min-height: 52px; padding: 5px 2px; border-radius: 14px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .1px; min-width: 0;
  }
  #pestanas-registro .pestana .icono { width: 23px; height: 23px; transition: transform var(--transicion); }
  #pestanas-registro .pestana.activa { background: var(--acento-suave); color: var(--acento); box-shadow: none; }
  #pestanas-registro .pestana.activa .icono { transform: translateY(-1px) scale(1.08); }
  html.teclado-abierto #pantalla-registro { padding-bottom: 0; }
  html.teclado-abierto #pestanas-registro { display: none; }
}

/* ── Celular: cabeceras, filtros y listas ─────────────────────────────── */
@media (max-width: 700px) {
  .reg-vista { gap: 12px; }
  .reg-cabecera { align-items: stretch; gap: 10px; }
  .reg-acciones { width: 100%; }
  .reg-acciones > .btn, .reg-acciones > .reg-menu-envoltura { flex: 1 1 auto; }
  .reg-menu-envoltura > .btn { width: 100%; }
  .reg-menu { left: 0; right: auto; width: min(320px, calc(100vw - 24px)); transform-origin: top left; }
  .reg-ruta { margin: -4px 0 0; }

  .reg-filtros { padding: 12px; gap: 10px; }
  .reg-filtros-fila { gap: 8px; }
  .reg-buscar { flex: 1 1 100%; min-width: 0; }
  .reg-campo-mini { flex: 1 1 100%; min-width: 0; }
  .reg-campo-mini select.entrada { min-width: 0; width: 100%; }
  .reg-fechas { flex: 1 1 100%; min-width: 0; padding-left: 0; gap: 6px; }
  .reg-fechas .entrada { flex: 1 1 0; width: auto; min-width: 0; padding-inline: 8px; }
  .reg-fechas > .icono { display: none; }
  .jug-ayuda { flex: 1 1 100%; }
  /* categorías en una sola fila que se desliza con el dedo */
  .reg-filtros-fila2 { flex-wrap: nowrap; }
  .reg-chips {
    flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: -2px -12px; padding: 2px 12px; scroll-padding-inline: 12px; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 16px), transparent);
  }
  .reg-chips::-webkit-scrollbar { display: none; }
  .reg-chip { flex: none; min-height: 40px; }
  .reg-quitar { flex: none; padding-inline: 10px; }

  /* Historial: cada partida es una tarjeta (hora y resultado arriba, jugadores a todo el ancho) */
  .hist-lista { gap: 16px; }
  .hist-dia { padding: 6px 2px 2px; }
  .hist-partida, .hist-partida.con-fecha {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "hora res" "duelo duelo" "meta meta";
    gap: 8px 10px; padding: 11px 12px 12px 18px;
  }
  .hist-partida::before { left: 5px; top: 10px; bottom: 10px; }
  .hist-hora { grid-area: hora; flex-direction: row; align-items: baseline; gap: 6px; }
  .hist-res { grid-area: res; flex-direction: row-reverse; align-items: center; gap: 8px; }
  .hist-duelo { grid-area: duelo; gap: 6px; }
  .hist-jug { font-size: 15px; }
  .hist-meta { grid-area: meta; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; padding-top: 8px; border-top: 1px dashed var(--borde); }
  .hist-torneo { flex: 1 1 100%; min-width: 0; }
  .hist-flecha { display: none; }
  .hist-partida:hover { transform: none; }

  /* Jugadores */
  .jug-rejilla { gap: 12px; }
  .jug-tarjeta { padding: 16px; gap: 12px; }
  .jug-tarjeta:hover, .jug-tarjeta:hover .jug-avatar { transform: none; }
  .jug-ver { min-height: 44px; }
  .jug-seleccion { bottom: 10px; padding: 10px; gap: 8px; }
  .jug-sel-ficha { max-width: calc(50% - 30px); }
  .jug-seleccion > .crece { flex-basis: 100%; height: 0; }
  .jug-seleccion > .btn { flex: 1 1 auto; }
  .jug-form-vista { gap: 12px; }
  .jug-avatar-grande { width: 64px; height: 64px; font-size: 42px; }
  .jug-colores { flex-wrap: wrap; }
  .jug-color-rapido { width: 30px; height: 30px; }

  /* Estadísticas */
  .est-controles { width: 100%; }
  .est-periodos { flex: 1 1 100%; display: flex; }
  .est-periodos .pestana { flex: 1 0 auto; }
  .est-controles .reg-campo-mini { flex: 1 1 100%; }
  .est-cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .est-cifra { padding: 12px 12px 12px 14px; }
  .est-cifra .valor { font-size: clamp(22px, 7vw, 28px); padding-right: 30px; }
  .est-cifra .etiqueta { font-size: 12.5px; line-height: 1.3; }
  .est-cifra-icono { width: 30px; height: 30px; border-radius: 10px; right: 8px; top: 8px; }
  .est-cifra-icono .icono { width: 16px; height: 16px; }
  .est-colores { gap: 8px; }
  .est-colores > div { padding: 8px 10px; gap: 8px; }
  .est-colores .pz { width: 28px; height: 28px; font-size: 17px; }
  .g-donut { gap: 12px; justify-content: center; }
  .g-donut-svg { width: min(170px, 46vw); }
  .g-donut-leyenda { min-width: min(180px, 100%); }
  .est-tarjeta .tarjeta-titulo .acciones { margin-left: 0; flex-basis: 100%; }
  .est-tabla td, .est-tabla th { padding: 9px 10px; }
  .est-jug { max-width: 150px; }
  /* columna del jugador fija al deslizar la tabla de clasificación */
  .est-tabla th:nth-child(2), .est-tabla td:nth-child(2) { position: sticky; left: 0; z-index: 1; background: var(--superficie); box-shadow: 6px 0 8px -6px rgba(0, 0, 0, .35); }
  .est-tabla thead th:nth-child(2) { z-index: 3; background: var(--superficie-2); }
  .est-fila-activa td:nth-child(2) { background: color-mix(in srgb, var(--acento) 18%, var(--superficie)); }
  .est-h2h-selectores { grid-template-columns: minmax(0, 1fr); justify-items: stretch; gap: 6px; }
  .est-h2h-cambiar { justify-self: center; }
  .est-h2h-cambiar .icono { transform: none; }
  .est-h2h-marcador { gap: 8px; }
  .est-h2h-lado { font-size: 14.5px; gap: 6px; flex-direction: column; text-align: center; }
  .est-h2h-lado.derecha { flex-direction: column-reverse; }
  .est-h2h-lado b { max-width: 100%; }
  .est-h2h-score { font-size: clamp(26px, 9vw, 38px); gap: 6px; }

  /* Detalle de partida (dentro de la hoja inferior) */
  .det { gap: 12px; }
  .det-planilla-cabeza > div { padding: 8px 12px; }
  .det-planilla-cabeza b { white-space: normal; overflow-wrap: anywhere; }
  .det-planilla-cabeza > div:last-child { grid-column: 1 / -1; }
  .det-duelo { padding: 12px; gap: 6px; }
  .det-lado { padding: 8px 10px; gap: 10px; }
  .det-lado .pz-grande { width: 42px; height: 42px; font-size: 26px; }
  .det-nombre { font-size: 18px; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .det-pts { font-size: 28px; }
  .det-marcador { font-size: 26px; }
  .det-pestanas { align-self: stretch; flex-wrap: nowrap; }
  .det-pestanas .pestana { flex: 1 0 auto; padding-inline: 10px; }
  .det-comp { padding: 10px 12px; }
  .det-comp-fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
  .det-comp-fila > b { font-size: 14px; }
  .det-comp-centro { font-size: 12px; text-align: center; }
  .det-grafica { padding: 10px 10px 4px; }
  .det-tabla { max-height: none; }
  .det-tabla .tabla td, .det-tabla .tabla th { padding: 8px 5px; font-size: 13px; }
  .det-tabla .tabla th { font-size: 10.5px; letter-spacing: .2px; }
  .det-n { width: 36px; }
  .det-pie > .crece { display: none; }
  .det-pie > .btn { flex: 1 1 40%; }
  .det-pie > .btn-primario { flex-basis: 100%; order: -1; }
  .det-form-pie .btn { flex: 1 1 100%; }
}
@media (max-width: 1000px) {
  .det-nombre { white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .det-planilla-cabeza b { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 440px) {
  .det-pestanas .icono { display: none; }
  .det-pestanas .pestana { padding-inline: 8px; }
}
@media (max-width: 420px) {
  .det-form-rejilla { grid-template-columns: minmax(0, 1fr); }
  .det-ancho2 { grid-column: 1 / -1; }
  .det-sub-boton { display: none; }
}

/* ── Celular horizontal / pantallas bajas ─────────────────────────────── */
@media (max-height: 520px) and (orientation: landscape) {
  .reg-vista { gap: 10px; }
  .hist-dia { position: static; }
  .jug-seleccion { bottom: 8px; padding-block: 6px; }
  .jug-sel-ficha { max-width: 170px; }
  .det-tabla { max-height: none; }
  .modal.det-modal { width: min(1020px, 100%); }
}

/* ── Tabletas ─────────────────────────────────────────────────────────── */
@media (min-width: 701px) and (max-width: 1100px) {
  #pestanas-registro .pestana { padding-inline: 12px; }
  .reg-buscar { flex: 1 1 220px; min-width: 180px; }
  .reg-fechas .entrada { width: 140px; }
}

/* ── Pantallas grandes (PC 1920 px y más) ─────────────────────────────── */
@media (min-width: 1700px) {
  .jug-rejilla { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
