/* =====================================================================
   Team Builder: los 6 huecos del equipo, análisis de tipos y ventanas.
   ===================================================================== */

.bd-tb-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 2px var(--pz-3); }
.bd-tb-contador { display: flex; align-items: baseline; gap: 10px; font-family: var(--pixel); font-size: 16px; color: var(--tinta-2); }
.bd-tb-contador b { font-size: 32px; font-weight: 400; color: #fff; text-shadow: .125em .125em 0 #3f3f3f; }
.bd-tb-contador b span + span { color: var(--tinta-3); }
.tb-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.tb-huecos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; align-items: start; }

/* Hueco vacío: una ranura grande del inventario */
.tb-vacio {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 20px;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, .4);
  box-shadow: inset 2px 2px 0 #000, inset -2px -2px 0 var(--pz-4);
  color: var(--tinta-3);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}
.tb-vacio:hover, .tb-vacio:focus-visible { border-color: #fff; color: var(--tinta); outline: none; }
.tb-vacio[disabled] { cursor: progress; }
.tb-vacio[disabled]:hover { border-color: transparent; }
.tb-mas { background: var(--pz-0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23f4c430' d='M3 0h1v7H3zM0 3h7v1H0z'/%3E%3C/svg%3E") center / 24px 24px no-repeat; }
.tb-vacio-titulo { font-family: var(--pixel); font-size: 16px; color: var(--tinta); text-shadow: .125em .125em 0 #3f3f3f; }
.tb-vacio-sub { font-size: 13px; }

/* Hueco ocupado */
.tb-hueco { padding: 14px; }
.tb-cab { display: flex; align-items: flex-start; gap: 12px; }
.tb-retrato { width: 72px; height: 72px; border: 0; cursor: pointer; padding: 0; }
.tb-retrato:hover { background: #2a2326; }
.tb-retrato .tb-img, .tb-retrato .tb-fusion { width: 64px; height: 64px; }
.tb-cab-txt { min-width: 0; flex: 1; }
.tb-nombre { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
.tb-nombre h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; font-family: var(--pixel); font-size: 24px; font-weight: 400; line-height: 1.1; color: #fff; text-shadow: .125em .125em 0 #3f3f3f; }
.tb-quitar { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; margin-left: auto; border: 0; background: transparent; color: var(--tinta-3); cursor: pointer; }
.tb-quitar svg { width: 12px; height: 12px; }
.tb-quitar:hover { color: var(--rojo-claro); }
.tb-detalle { margin: 8px 0 0; color: var(--tinta-3); font-size: 13px; line-height: 1.45; }
.tb-detalle strong { color: var(--oro-claro); }
.tb-campo { display: grid; gap: 6px; margin-top: 14px; }
.tb-campo select { width: 100%; }
.tb-tag-fusion { background: var(--verde-hondo); box-shadow: inset 0 0 0 2px #2a6b38; color: var(--verde); }
.tb-movs-titulo { display: flex; justify-content: space-between; margin: 16px 0 6px; }
.tb-movs-titulo span { color: var(--tinta-3); }
.tb-movs { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tb-movs > li:not([data-picker-hueco]) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 28px 32px; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 2px var(--pz-3); }
.tb-mov-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.tb-mov-pot { font-family: var(--pixel); font-size: 16px; color: var(--tinta-2); text-align: right; }
.tb-anadir-mov {
  width: 100%; min-height: 40px; padding: 6px 10px; border: 2px dashed var(--pz-5); background: transparent; color: var(--tinta-2);
  font-family: var(--pixel); font-size: 16px; text-align: left; cursor: pointer; transition: border-color 120ms ease, color 120ms ease;
}
.tb-anadir-mov:hover { border-color: var(--oro); color: var(--oro-claro); }

/* Selector de movimientos */
.tb-picker { position: relative; }
.tb-picker-fondo { position: fixed; inset: 0; z-index: 10; border: 0; background: transparent; cursor: default; }
.tb-picker-caja { position: relative; z-index: 20; border: 2px solid #000; background: var(--pz-2); box-shadow: inset 0 0 0 2px var(--oro-oscuro), 0 16px 40px rgba(0, 0, 0, .7); }
.bd-page .tb-picker-caja input { width: 100%; border: 0; border-bottom: 2px solid var(--pz-4); }
.tb-picker-lista { max-height: 240px; margin: 0; padding: 4px 0; overflow-y: auto; list-style: none; }
.tb-opcion-mov { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 28px 56px; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; background: transparent; color: var(--tinta); text-align: left; cursor: pointer; }
.tb-opcion-mov:hover:not([disabled]) { background: rgba(255, 255, 255, .06); }
.tb-opcion-mov[disabled] { opacity: .4; cursor: default; }
.tb-mov-metodo { font-size: 11px; color: var(--tinta-3); text-align: right; }
.tb-sin { padding: 16px 12px; color: var(--tinta-3); text-align: center; font-size: 14px; }

/* Fusiones: los dos padres superpuestos */
.tb-fusion { position: relative; display: inline-block; flex: none; }
.tb-fusion-a { position: absolute; left: 0; top: 0; }
.tb-fusion-b { position: absolute; right: 0; bottom: 0; }
.tb-fusion-marca { position: absolute; right: -4px; top: -4px; padding: 0 3px 2px; background: var(--verde-hondo); box-shadow: 0 0 0 2px #000; font-family: var(--pixel); font-size: 16px; line-height: 1; color: var(--verde); }

/* Análisis */
.tb-analisis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 40px; }
.tb-analisis > section { min-width: 0; }
.tb-analisis-vacio { margin-top: 32px; }
.tb-titulo { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-family: var(--pixel); font-size: 24px; font-weight: 400; color: #fff; text-shadow: .125em .125em 0 #3f3f3f; }
.tb-titulo .mc-slot { width: 40px; height: 40px; }
.tb-titulo .mc-slot img { width: 24px; height: 24px; }
.tb-intro { margin: 0 0 14px; color: var(--tinta-2); font-size: 14px; }
.tb-tabla-caja { overflow-x: auto; }
.bd-page main .tb-tabla { min-width: 440px; border-spacing: 0 2px; text-align: center; font-size: 14px; }
.bd-page main .tb-tabla thead th { padding: 6px 4px; background: transparent; text-align: center; }
.bd-page main .tb-tabla thead th:first-child { text-align: left; }
.bd-page main .tb-tabla th img, .bd-page main .tb-tabla th .tb-fusion { width: 36px; height: 36px; margin: 0 auto; }
.bd-page main .tb-tabla tbody td { padding: 3px 4px; border: 0; }
.bd-page main .tb-tabla tbody td:first-child { text-align: left; }
.bd-page main .tb-tabla tbody tr.tb-aviso td { background: rgba(227, 38, 38, .14); }
.tb-th-debil { color: #ff9a6b !important; }
.tb-th-resiste { color: var(--verde) !important; }
.tb-mult { display: inline-block; min-width: 30px; padding: 2px 4px 4px; font-family: var(--pixel); font-size: 16px; line-height: 1; }
.tb-neutro { color: var(--pz-6); }
.tb-muy { background: #5e0a0a; color: #ffb3a8; box-shadow: inset 0 0 0 2px #8a1010; }
.tb-debil { background: #4a1d0c; color: #ffc29a; box-shadow: inset 0 0 0 2px #7a3a16; }
.tb-resiste { background: #12301a; color: #a9e6b2; box-shadow: inset 0 0 0 2px #22562f; }
.tb-resiste-mucho { background: #0b3d1a; color: #c4f5cb; box-shadow: inset 0 0 0 2px #2a7a3c; }
.tb-inmune { background: var(--pz-3); color: var(--tinta); box-shadow: inset 0 0 0 2px var(--pz-6); }
.tb-cuenta { font-family: var(--pixel); font-size: 16px; color: var(--tinta-2); white-space: nowrap; }
.tb-alerta { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; background: var(--rojo); box-shadow: 0 0 0 2px #000; font-family: var(--pixel); font-size: 16px; line-height: 1; color: #fff; vertical-align: 1px; }
.tb-cobertura { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.tb-cubre { padding: 8px; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 2px var(--pz-3); opacity: .65; }
.tb-cubre.ok { opacity: 1; background: rgba(244, 196, 48, .07); box-shadow: inset 0 0 0 2px var(--oro-oscuro); }
.tb-cubre-cab { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tb-cubre-cab b { font-family: var(--pixel); font-size: 16px; font-weight: 400; color: var(--oro-claro); }
.tb-cubre:not(.ok) .tb-cubre-cab b { color: var(--tinta-3); }
.tb-cubre-quien { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; color: var(--tinta-2); }
.tb-cubre-quien span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-cubre-quien img, .tb-cubre-quien .tb-fusion { width: 24px; height: 24px; flex: none; }
.tb-aviso-texto { margin: 12px 0 0; padding: 10px 14px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 2px var(--pz-3); color: var(--tinta-2); font-size: 14px; }
.tb-sin-golpe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb-amarillo { box-shadow: inset 0 0 0 2px var(--oro-oscuro); color: var(--oro-claro); background: rgba(244, 196, 48, .06); }
.tb-rojo { box-shadow: inset 0 0 0 2px var(--rojo-oscuro); color: var(--rojo-claro); background: rgba(227, 38, 38, .08); }
.tb-error { margin-top: 40px; font-weight: 700; }
.tb-nota { margin-top: 32px; color: var(--tinta-2); font-size: 14px; }
.tb-nota strong { color: var(--tinta); }

/* Ventanas (elegir Pokémon, importar, exportar) */
.tb-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.tb-modal-fondo { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, .72); cursor: default; animation: tb-aparece 180ms ease-out; }
.tb-ventana {
  position: relative; display: flex; flex-direction: column; width: min(640px, 100%); max-height: 85vh; padding: 18px; box-sizing: border-box;
  background: var(--pz-2); border: 2px solid #000; box-shadow: inset 2px 2px 0 var(--pz-4), inset -2px -2px 0 var(--pz-0), 0 24px 60px rgba(0, 0, 0, .7);
  animation: tb-entra 200ms var(--ease-out);
}
.tb-ventana-g { width: min(820px, 100%); }
@keyframes tb-aparece { from { opacity: 0; } }
@keyframes tb-entra { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.tb-ventana-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tb-ventana-cab h2 { margin: 0; font-family: var(--pixel); font-size: 24px; font-weight: 400; color: #fff; text-shadow: .125em .125em 0 #3f3f3f; }
.tb-total { font-family: var(--pixel); font-size: 16px; color: var(--tinta-3); }
.tb-cerrar { margin-left: auto; }
.tb-cerrar svg { width: 12px; height: 12px; }
.tb-ventana-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.tb-ventana-filtros input { flex: 1 1 240px; }
.tb-especies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 6px; margin-top: 14px; overflow-y: auto; padding-right: 4px; }
.tb-especie {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border: 2px solid transparent; background: rgba(0, 0, 0, .3);
  box-shadow: inset 0 0 0 2px var(--pz-3); color: inherit; text-align: left; cursor: pointer; transition: border-color 100ms ease;
}
.tb-especie:hover, .tb-especie:focus-visible { border-color: #fff; outline: none; }
.tb-especie .mc-slot { width: 52px; height: 52px; }
.tb-especie .mc-slot img, .tb-especie .mc-slot .tb-fusion { width: 44px; height: 44px; }
.tb-especie-txt { display: grid; gap: 4px; min-width: 0; }
.tb-especie-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--pixel); font-size: 16px; color: #fff; text-shadow: .125em .125em 0 #3f3f3f; }
.tb-lista-nota { grid-column: 1 / -1; padding: 16px; color: var(--tinta-3); text-align: center; font-size: 14px; }
.tb-ventana-cuerpo { display: flex; flex-direction: column; min-height: 0; margin-top: 12px; }
.bd-page .tb-texto { width: 100%; height: 240px; resize: none; margin-top: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.tb-boton-fin { align-self: flex-start; margin-top: 12px; }
.tb-avisos { max-height: 128px; margin: 12px 0 0; padding: 10px 14px; overflow-y: auto; list-style: none; font-size: 14px; }
.tb-botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 1100px) {
  .tb-huecos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-analisis { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tb-huecos { grid-template-columns: 1fr; }
  .tb-acciones { margin-left: 0; width: 100%; }
  .tb-especies { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-ventana { padding: 14px; max-height: 92vh; }
  .tb-movs > li:not([data-picker-hueco]) { grid-template-columns: minmax(0, 1fr) auto 28px 32px; }
  .tb-movs > li:not([data-picker-hueco]) .mc-movs-clase { display: none; }
  .tb-opcion-mov { grid-template-columns: minmax(0, 1fr) auto 28px; }
  .tb-opcion-mov .mc-movs-clase, .tb-opcion-mov .tb-mov-metodo { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-ventana, .tb-modal-fondo { animation: none; }
}
