/* ============================================================
   Notación — estilos
   ============================================================ */
:root {
  --navy: #10233f;
  --navy-2: #17304f;
  --verde: #00a651;
  --verde-osc: #008542;
  --verde-claro: #e8f7ef;
  --bg: #f2f5f9;
  --card: #ffffff;
  --borde: #dde5ee;
  --borde-suave: #eef2f7;
  --texto: #12263f;
  --texto-suave: #5d6f85;
  --peligro: #d64541;
  --radio: 14px;
  --sombra: 0 8px 26px rgba(16, 35, 63, .09);
  --sombra-suave: 0 2px 8px rgba(16, 35, 63, .06);
  --clara: #ebecd0;
  --oscura: #779556;
  --coord-clara: rgba(60, 60, 40, .55);
  --coord-oscura: rgba(255, 255, 255, .72);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body[data-tema="madera"] { --clara: #f0d9b5; --oscura: #b58863; --coord-clara: rgba(90, 60, 20, .6); --coord-oscura: rgba(255, 250, 240, .8); }
body[data-tema="azul"]   { --clara: #dfe6ec; --oscura: #8ca2ad; --coord-clara: rgba(20, 50, 70, .55); --coord-oscura: rgba(255, 255, 255, .8); }
body[data-tema="noche"]  { --clara: #9aa7b8; --oscura: #465468; --coord-clara: rgba(20, 30, 45, .6); --coord-oscura: rgba(255, 255, 255, .75); }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--fuente);
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

h1, h2, p { margin: 0; }
button { font-family: inherit; }
a { color: var(--verde-osc); }

/* ---------------- barra superior ---------------- */
.barra {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 14px rgba(16, 35, 63, .22);
}

.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca-logo {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .11);
  border-radius: 11px;
  font-size: 22px;
  line-height: 1;
}
.marca-texto h1 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.marca-texto p { font-size: 11.5px; color: rgba(255, 255, 255, .68); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.barra-acciones { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------------- botones ---------------- */
.btn {
  appearance: none;
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  transition: background .15s, border-color .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: 0 4px 12px rgba(0, 166, 81, .28); }
.btn.primario:hover { background: var(--verde-osc); }
.btn.ghost { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.btn.peligro { background: #fdecea; border-color: #f6c9c6; color: var(--peligro); }
.btn.icono { width: 42px; min-height: 42px; padding: 0; font-size: 19px; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); color: #fff; }
.btn.texto { background: none; border: none; color: var(--texto-suave); font-weight: 500; }
.btn:disabled { opacity: .45; pointer-events: none; }

.menu-envoltura { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(16, 35, 63, .2);
  padding: 6px;
  min-width: 240px;
  z-index: 50;
}
.menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px;
  padding: 11px 12px; font-size: 14px; font-weight: 500; color: var(--texto);
  cursor: pointer;
}
.menu button:hover { background: var(--verde-claro); }
.menu hr { border: 0; border-top: 1px solid var(--borde-suave); margin: 5px 8px; }

/* ---------------- layout ---------------- */
main { padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.vista { animation: aparecer .18s ease-out; }
@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- hoja de partidas ---------------- */
.barra-filtros { margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto-suave);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip b { color: var(--texto); font-weight: 700; }
.chip.activo { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.activo b { color: #fff; }

.hoja { background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.hoja-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tabla-partidas { width: 100%; border-collapse: collapse; min-width: 680px; font-size: 14px; }
.tabla-partidas thead th {
  position: sticky; top: 0;
  background: #f7f9fc;
  border-bottom: 1px solid var(--borde);
  color: var(--texto-suave);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}
.tabla-partidas td { border-bottom: 1px solid var(--borde-suave); padding: 0; vertical-align: middle; }
.tabla-partidas tr:last-child td { border-bottom: 0; }
.tabla-partidas tbody tr:hover { background: #fbfdff; }

.c-num { width: 44px; text-align: center; color: var(--texto-suave); font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 4px !important; }
.c-torneo { min-width: 150px; }
.c-ronda { width: 62px; text-align: center; }
.celda-ronda { text-align: center; font-variant-numeric: tabular-nums; }
.c-blancas, .c-negras { min-width: 140px; }
.c-res { width: 92px; }
.c-fecha { width: 132px; }
.c-movs { width: 58px; text-align: center; }
.c-acc { width: 108px; text-align: right; padding-right: 8px !important; white-space: nowrap; }

.celda {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 11px 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--texto);
  border-radius: 7px;
  min-height: 42px;
}
.celda:focus { outline: none; background: #fff; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 166, 81, .12); }
.celda::placeholder { color: #a9b6c5; }
.celda-res { font-weight: 700; text-align: center; appearance: none; padding-right: 4px; }
.celda-fecha { font-variant-numeric: tabular-nums; font-size: 13px; }

.num-movs {
  display: inline-block; min-width: 26px;
  padding: 3px 6px; border-radius: 7px;
  background: var(--verde-claro); color: var(--verde-osc);
  font-size: 12px; font-weight: 700; text-align: center;
}

.mini {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 13px;
  cursor: pointer;
  color: var(--texto);
  margin-left: 2px;
  -webkit-tap-highlight-color: transparent;
}
.mini:hover { background: var(--verde-claro); border-color: #b9e4cb; }
.mini.borrar:hover { background: #fdecea; border-color: #f6c9c6; color: var(--peligro); }

.vacio { text-align: center; color: var(--texto-suave); padding: 46px 20px; font-size: 14px; line-height: 2; }
.pie-lista { text-align: center; color: var(--texto-suave); font-size: 12.5px; margin-top: 12px; }

/* ---------------- tablero ---------------- */
.tablero-cabecera {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border-radius: var(--radio);
  box-shadow: var(--sombra-suave);
  padding: 10px 12px; margin-bottom: 12px;
}
.tablero-cabecera .btn.icono { background: #f2f5f9; color: var(--navy); border-color: var(--borde); flex: none; }
.datos-cabecera { flex: 1; min-width: 0; }
.in-torneo {
  width: 100%; border: 0; background: transparent;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--verde-osc);
  padding: 2px 0; font-family: inherit;
}
.in-torneo:focus { outline: none; }
.jugadores { display: flex; gap: 12px; flex-wrap: wrap; }
.jugador-linea { display: flex; align-items: center; gap: 6px; flex: 1 1 120px; min-width: 0; }
.jugador-linea input {
  width: 100%; border: 0; background: transparent; font-family: inherit;
  font-size: 16px; font-weight: 600; color: var(--texto); padding: 3px 0;
}
.jugador-linea input:focus { outline: none; box-shadow: 0 1px 0 var(--verde); }
.punto { width: 13px; height: 13px; border-radius: 50%; flex: none; display: inline-block; }
.punto.w { background: #fff; border: 1.5px solid #8d9bb0; }
.punto.b { background: #2b3a4d; }

.zona-juego { display: grid; grid-template-columns: minmax(300px, 1fr) 350px; gap: 16px; align-items: start; }

.tablero-zona { min-width: 0; }

.tablero {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  max-width: 620px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(16, 35, 63, .18), 0 0 0 1px rgba(16, 35, 63, .12);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: var(--clara);
}

.casilla {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.casilla.clara { background: var(--clara); }
.casilla.oscura { background: var(--oscura); }

.casilla .pieza {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .28));
  transition: transform .08s ease-out;
}
.casilla.sobre .pieza { transform: scale(1.06); }

/* marca de última jugada */
.casilla.ultimo::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255, 226, 84, .46);
  pointer-events: none;
}
body[data-tema="noche"] .casilla.ultimo::before { background: rgba(120, 200, 255, .34); }

/* pieza seleccionada */
.casilla.sel::after {
  content: '';
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 3.5px rgba(0, 166, 81, .92);
  border-radius: 2px;
  pointer-events: none;
}
/* destinos legales */
.casilla.destino::after {
  content: '';
  position: absolute;
  width: 28%; height: 28%;
  border-radius: 50%;
  background: rgba(16, 35, 63, .28);
  pointer-events: none;
}
/* captura posible: anillo */
.casilla.captura::after {
  content: '';
  position: absolute; inset: 5%;
  border-radius: 50%;
  border: 5px solid rgba(16, 35, 63, .26);
  pointer-events: none;
}
/* rey en jaque */
.casilla.jaque { box-shadow: inset 0 0 0 999px rgba(214, 69, 65, .30); }
.casilla.sobre { box-shadow: inset 0 0 0 4px rgba(0, 166, 81, .55); }

.casilla .coord {
  position: absolute; font-size: 9.5px; font-weight: 700; line-height: 1;
  pointer-events: none; opacity: .9;
}
.casilla .coord-f { right: 3px; bottom: 2px; }
.casilla .coord-r { left: 3px; top: 2px; }
.casilla.clara .coord { color: var(--coord-clara); }
.casilla.oscura .coord { color: var(--coord-oscura); }

.origen-arrastre .pieza { opacity: .28; }

.pieza-arrastre {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .4));
  will-change: left, top;
}
body.arrastrando { cursor: grabbing; }
body.arrastrando .casilla { cursor: grabbing; }

.bajo-tablero {
  display: flex; align-items: center; gap: 10px;
  max-width: 620px; margin: 10px auto 0;
  font-size: 13px;
}
.chip-turno {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--borde); border-radius: 999px;
  padding: 6px 12px; font-weight: 700; font-size: 13px; white-space: nowrap;
  box-shadow: var(--sombra-suave);
}
.chip-turno.b .punto { background: #2b3a4d; }
.mensaje-partida { flex: 1; color: var(--texto-suave); font-size: 12.5px; min-width: 0; }
.mensaje-partida.alerta { color: var(--peligro); font-weight: 700; }
.mensaje-partida.final { color: var(--verde-osc); font-weight: 700; }
/* ronda en la cabecera del tablero */
.linea-evento { display: flex; align-items: center; gap: 8px; }
.linea-evento .in-torneo { flex: 1 1 auto; min-width: 0; }
.caja-ronda {
  display: flex; align-items: center; gap: 3px; flex: none;
  background: #eef2f7; border-radius: 8px; padding: 1px 7px;
}
.caja-ronda .etq-ronda { font-size: 11px; font-weight: 800; color: var(--navy); opacity: .7; }
.caja-ronda input {
  width: 30px; border: 0; background: transparent; font-family: inherit;
  font-size: 14px; font-weight: 800; color: var(--navy); text-align: center;
  padding: 3px 0; font-variant-numeric: tabular-nums;
}
.caja-ronda input:focus { outline: none; }
.caja-ronda:focus-within { box-shadow: 0 0 0 2px var(--verde-osc) inset; }

/* resultado en la página de captura */
.resultado-mini {
  display: flex; gap: 3px; align-items: center;
  background: #eef2f7; border-radius: 9px; padding: 3px; white-space: nowrap;
}
.resultado-mini .res-b {
  border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--navy);
  padding: 4px 9px; line-height: 1.2; min-width: 36px;
}
.resultado-mini .res-b:hover { background: rgba(0, 0, 0, .07); }
.resultado-mini .res-b.activo { background: var(--navy); color: #fff; }
.resultado-mini .res-b.activo:hover { background: var(--navy); }

/* ---------------- panel de jugadas ---------------- */
.panel {
  background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 78px;
}
.panel-cabecera {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--texto-suave); font-weight: 700;
}
.contador { color: var(--verde-osc); text-transform: none; letter-spacing: 0; font-size: 12px; }

.lista-jugadas {
  height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--borde-suave); border-radius: 10px; padding: 6px;
  background: #fbfcfe;
  scrollbar-width: thin;
}
.vacio-mini { color: #97a5b6; font-size: 12.5px; text-align: center; padding: 18px 8px; line-height: 1.6; }
.fila-jugada {
  display: grid; grid-template-columns: 34px 1fr 1fr; align-items: center;
  gap: 4px; border-radius: 7px; padding: 1px 0;
}
.fila-jugada:nth-child(odd) { background: rgba(16, 35, 63, .022); }
.fila-jugada .num { color: #94a3b4; font-size: 12px; text-align: right; padding-right: 4px; font-variant-numeric: tabular-nums; }
.jugada {
  border: 0; background: none; text-align: left; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; font-weight: 600; color: var(--texto);
  padding: 6px 8px; border-radius: 6px;
}
.jugada:hover { background: #eef4fb; }
.jugada.activa { background: var(--navy); color: #fff; }
.jugada.vacia { cursor: default; }
.jugada.vacia:hover { background: none; }

.controles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ctrl { padding: 8px 0; font-size: 15px; }

/* ---------------- reloj de partida (opcional) ---------------- */
.barra-reloj {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
  background: var(--card);
  border-radius: var(--radio);
  box-shadow: var(--sombra-suave);
  padding: 8px;
  margin-bottom: 10px;
}
.barra-reloj[hidden] { display: none !important; }
.reloj-lado {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--borde);
  background: #f7f9fc;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  min-width: 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s;
}
.reloj-lado.b { align-items: flex-end; text-align: right; }
.reloj-nombre {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--texto-suave);
  font-weight: 700;
}
.reloj-tiempo {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.reloj-lado.activo { background: var(--navy); border-color: var(--navy); }
.reloj-lado.activo .reloj-nombre { color: rgba(255, 255, 255, .72); }
.reloj-lado.activo .reloj-tiempo { color: #fff; }
.reloj-lado.bajo .reloj-tiempo { color: var(--peligro); }
.reloj-lado.bajo.activo .reloj-tiempo { color: #ffb7b3; }
.reloj-lado.agotado { background: #fdecea; border-color: #f6c9c6; }
.reloj-lado.agotado .reloj-tiempo { color: var(--peligro); }
.reloj-centro { display: flex; flex-direction: column; gap: 4px; justify-content: center; align-items: center; }
.reloj-centro .btn { min-width: 44px; width: 44px; padding: 6px 0; font-size: 16px; }
.reloj-centro .mini { width: 34px; height: 24px; margin: 0; font-size: 12px; }

.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.presets button {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--texto);
}
.presets button:hover { border-color: var(--verde); }
.presets button.sel { background: var(--verde); border-color: var(--verde); color: #fff; }
.interruptor {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
  color: var(--texto);
}
.interruptor input { width: 20px; height: 20px; accent-color: var(--verde); flex: none; }

.form-san { display: flex; gap: 6px; }
.form-san input {
  flex: 1; min-width: 0;
  border: 1px solid var(--borde); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; font-family: inherit; background: #fff;
}
.form-san input:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 166, 81, .12); }
.form-san .btn { min-width: 46px; font-size: 17px; }

.acciones-partida { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.acciones-partida .btn { font-size: 12.5px; padding: 9px 6px; }

/* ---------------- modales ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(11, 24, 42, .55);
  display: grid; place-items: center;
  padding: 16px;
  animation: fundido .16s ease-out;
  overflow-y: auto;
}
@keyframes fundido { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden] { display: none !important; }

.modal-caja {
  background: #fff; border-radius: 18px; padding: 20px;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(9, 20, 35, .45);
  animation: subir .2s cubic-bezier(.2, .8, .3, 1);
  max-height: calc(100vh - 40px); overflow-y: auto;
}
@keyframes subir { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-chica { max-width: 380px; }
.modal-caja h2 { font-size: 17px; margin-bottom: 10px; }
.modal-caja p { font-size: 13.5px; color: var(--texto-suave); line-height: 1.55; margin-bottom: 12px; }
.modal-acciones { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.nota { font-size: 12.5px; color: var(--texto-suave); line-height: 1.55; }
.nota code { background: #f1f5fa; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.campos { display: flex; flex-direction: column; gap: 12px; }
.campos label, .campos .dos label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--texto-suave);
}
.campos input, .campos select, .campos textarea {
  border: 1px solid var(--borde); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; font-family: inherit; color: var(--texto);
  background: #fff; font-weight: 500; text-transform: none; letter-spacing: 0;
}
.campos input:focus, .campos select:focus, .campos textarea:focus {
  outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 166, 81, .12);
}
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

textarea {
  width: 100%; border: 1px solid var(--borde); border-radius: 12px;
  padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.45; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 166, 81, .12); }

.info-partida { font-size: 12px; color: var(--texto-suave); }

.modal-promo { max-width: 340px; text-align: center; }
.promo-opciones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 10px; }
.promo-opciones button {
  border: 1px solid var(--borde); background: #f8fafc; border-radius: 12px;
  padding: 6px; cursor: pointer;
}
.promo-opciones button:hover { border-color: var(--verde); background: var(--verde-claro); }
.promo-opciones img { width: 100%; display: block; }

.temas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tema-opcion {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--borde); background: #fff; border-radius: 12px;
  padding: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.tema-opcion:hover { border-color: var(--verde); }
.muestra { width: 34px; height: 34px; border-radius: 8px; flex: none; border: 1px solid rgba(0,0,0,.08); }
.muestra.verde { background: linear-gradient(135deg, #ebecd0 50%, #779556 50%); }
.muestra.madera { background: linear-gradient(135deg, #f0d9b5 50%, #b58863 50%); }
.muestra.azul { background: linear-gradient(135deg, #dfe6ec 50%, #8ca2ad 50%); }
.muestra.noche { background: linear-gradient(135deg, #9aa7b8 50%, #465468 50%); }

.ayuda-lista { margin: 0 0 12px; padding-left: 20px; font-size: 13.5px; line-height: 1.75; color: var(--texto); }
.ayuda-lista li { margin-bottom: 6px; }

.log { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--texto-suave); margin-top: 12px; display: grid; gap: 5px; }
.log p { margin: 0; }
.log .ok { color: var(--verde-osc); }
.log .err { color: var(--peligro); }

.bloque {
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  display: grid;
  gap: 8px;
  background: #fbfcfe;
}
.bloque h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--navy);
}
.bloque .nota { margin: 0; font-size: 12px; line-height: 1.6; }
.bloque input {
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  background: #fff;
}
.bloque input:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 166, 81, .12); }
.bloque .btn { justify-self: start; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  background: rgba(16, 35, 63, .96);
  color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; max-width: min(92vw, 460px);
  box-shadow: 0 14px 34px rgba(9, 20, 35, .4);
  opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 300; text-align: center; line-height: 1.45;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .zona-juego { grid-template-columns: 1fr; }
  .panel { position: static; }
  .lista-jugadas { height: 168px; }
  .tablero { max-width: 100%; }
  .bajo-tablero { max-width: 100%; }
}

@media (max-width: 560px) {
  main { padding: 10px 10px calc(22px + env(safe-area-inset-bottom)); }
  .barra { padding-left: 12px; padding-right: 12px; }
  .marca-texto p { display: none; }
  .btn .txt { display: none; }
  #btn-nueva { width: 42px; min-height: 42px; padding: 0; font-size: 18px; }
  .tabla-partidas { min-width: 620px; font-size: 13px; }
  .tablero-cabecera { padding: 8px 10px; gap: 8px; border-radius: 12px; }
  .jugador-linea input { font-size: 15px; }
  .jugadores { gap: 2px; }
  .jugador-linea { flex-basis: 100%; }
  .panel { padding: 10px; gap: 8px; }
  .acciones-partida .btn { font-size: 11.5px; }
  .mini { width: 30px; height: 30px; }
  .modal-caja { padding: 16px; border-radius: 16px; }
  .c-num { width: 34px; }
}

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

/* impresión rápida de la lista */
@media print {
  .barra, .barra-filtros, .c-acc, .mini, .pie-lista { display: none !important; }
  body { background: #fff; }
  .hoja { box-shadow: none; }
  .celda { border: 0; }
}
