/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(8,10,12,0.78);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal { max-width: 440px; width: 100%; padding: 28px 28px 24px; }
.modal h3 { font-size: 24px; font-weight: 700; font-stretch: 75%; color: var(--pz-chalk); margin: 0 0 12px; }
.modal p { color: var(--pz-chalk-dim); font-size: 15px; line-height: 1.55; margin: 0 0 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions button {
  font: 600 14px/1 var(--pz-font);
  padding: 11px 18px;
  cursor: pointer;
  border: 1px solid var(--pz-line-strong);
  border-radius: var(--pz-radius);
  background: transparent;
  color: var(--pz-chalk);
  transition: background-color .15s, border-color .15s, color .15s;
}
.modal-actions button:hover { background: var(--pz-glass-3); border-color: var(--pz-chalk-faint); }
.modal-actions button.danger { color: var(--pz-danger); border-color: #6a3a30; }
.modal-actions button.danger:hover { background: rgba(255,122,89,.12); border-color: var(--pz-danger); }


/* ---------- setup: configuración avanzada ---------- */
details.adv-settings { margin-top: 18px; }
details.adv-settings > summary {
  cursor: pointer;
  color: var(--pz-chalk);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  padding: 6px 0;
  display: inline-flex; align-items: center; gap: 8px;
}
details.adv-settings > summary::-webkit-details-marker { display: none; }
details.adv-settings > summary::before {
  content: ""; width: 8px; height: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--pz-ease);
}
details.adv-settings[open] > summary::before { transform: rotate(45deg); }
.adv-settings-panel { margin-top: 14px; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.roster-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 860px) { .roster-grid { grid-template-columns: repeat(2, 1fr); } }
#configSavedMsg { font-size: 14px; color: var(--pz-jg); min-height: 20px; }

/* Scoreboard compacto: una fila por jugador, equipos frente a frente. Mismos datos, menos altura. */
.scoreboard-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 16px 24px 20px; }
@media (max-width: 900px) { .scoreboard-wrap { grid-template-columns: 1fr; } }
.scoreboard-team { container-type: inline-size; min-width: 0; }

/* columnas: identidad | nombre | KDA | CS | oro | visión+wards | daño | objetos */
.sb-team-head, .sb-player {
  display: grid;
  grid-template-columns: 62px minmax(60px, 1fr) 54px 50px 48px 46px 106px 172px;
  column-gap: 5px; align-items: center;
}
.sb-team-head { padding: 0 0 8px; border-bottom: 1px solid var(--pz-line-strong); }
.sb-team-title { grid-column: 1 / 3; font-size: 18px; font-weight: 700; font-stretch: 75%; display: flex; align-items: center; gap: 9px; }
.sb-team-title::before { content: ""; width: 11px; height: 11px; border-radius: 3px; }
.sb-blue .sb-team-title { color: var(--pz-mid); }
.sb-blue .sb-team-title::before { background: var(--pz-mid); }
.sb-red .sb-team-title { color: var(--pz-top); }
.sb-red .sb-team-title::before { background: var(--pz-top); }
.sb-cols { display: contents; }
.sb-cols span { font-size: 12px; font-weight: 600; color: var(--pz-chalk-dim); text-align: center; }
.sb-cols span:last-child { text-align: left; }

.sb-player { padding: 7px 0; border-bottom: 1px solid var(--pz-line); min-height: 52px; }
.sb-player:last-child { border-bottom: none; }
.sb-player.sb-empty { display: block; color: var(--pz-chalk-faint); font-size: 14px; padding: 14px 0; }

.sb-id { display: flex; align-items: center; gap: 4px; }
.sb-runes { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: help; flex-shrink: 0; padding: 2px; }
.sb-rune-icon { width: 20px; height: 20px; border-radius: 50%; background: var(--pz-glass); border: 1px solid var(--pz-line-strong); object-fit: contain; pointer-events: none; }
.sb-rune-icon.sb-rune-icon-sub { width: 16px; height: 16px; margin: 0; }
.sb-rune-icon.sb-rune-icon-empty { visibility: hidden; }
.sb-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-player-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-champ-name { font-weight: 400; font-size: 13px; color: var(--pz-chalk-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-c { font-size: 14px; color: var(--pz-chalk-dim); text-align: center; min-width: 0; white-space: nowrap; }
.sb-kda { color: var(--pz-chalk); font-weight: 700; font-size: 15px; }
.sb-cs { display: flex; flex-direction: column; line-height: 1.25; }
.sb-cs span { color: var(--pz-chalk); font-weight: 600; }
.sb-cs small { font-size: 12px; color: var(--pz-chalk-dim); }
.sb-gold { color: var(--pz-chalk); }
.sb-vis { display: flex; flex-direction: column; line-height: 1.3; align-items: center; }
.sb-vis span { display: inline-flex; align-items: center; color: var(--pz-chalk); }
.sb-vis .sb-stat-icon { display: inline-block; width: 12px; height: 12px; margin-right: 3px; }
.sb-dmg { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.sb-damage-val { font-size: 12.5px; color: var(--pz-chalk-dim); white-space: nowrap; }
.sb-damage-bar { height: 6px; background: var(--pz-glass-3); border-radius: 3px; position: relative; overflow: hidden; }
.sb-damage-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: #f2524a; border-radius: 3px; }
.sb-items { display: flex; gap: 3px; justify-content: flex-start; }
.sb-item { width: 22px; height: 22px; border: 1px solid var(--pz-line-strong); border-radius: 5px; background: var(--pz-glass); object-fit: cover; }
.sb-item.empty { background: transparent; border-color: var(--pz-line); opacity: .4; }
.sb-item.broken { visibility: hidden; }

/* iconos de stat: solo donde no hay cabecera de columnas */
.sb-stat-icon { display: none; width: 15px; height: 15px; margin-right: 4px; flex-shrink: 0; color: var(--pz-chalk-faint); }

.scoreboard-notes { grid-column: 1 / -1; padding: 12px 16px; background: var(--pz-glass-2); border: 1px solid var(--pz-line-strong); border-radius: 10px; }
.sb-notes-title { font-size: 14px; font-weight: 700; color: var(--pz-chalk); margin-bottom: 4px; }
.sb-notes-body { font-size: 15px; color: var(--pz-chalk-dim); line-height: 1.5; max-width: 100ch; }

/* equipo más angosto (pantallas pequeñas): dos líneas por jugador, sin cabecera, con iconos */
@container (max-width: 640px) {
  .sb-cols { display: none; }
  .sb-team-title { grid-column: 1 / -1; }
  .sb-team-head { display: block; }
  .sb-player { grid-template-columns: 70px minmax(70px, 1fr) 58px 58px 60px 50px; row-gap: 6px; padding: 8px 0; }
  .sb-dmg { grid-column: 1 / 4; grid-row: 2; }
  .sb-items { grid-column: 4 / -1; grid-row: 2; justify-content: flex-end; }
  .sb-stat-icon { display: inline-block; }
  .sb-cs { flex-direction: row; gap: 4px; align-items: baseline; justify-content: center; flex-wrap: wrap; }
}

/* ---------- barras de filtros ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 1 1 150px; }
.filter-field label { font-size: 13px; font-weight: 600; color: var(--pz-chalk-dim); }
.filter-field select,
.filter-field input {
  background-color: var(--pz-glass);
  color: var(--pz-chalk);
  border: 1px solid var(--pz-line-strong);
  border-radius: var(--pz-radius);
  padding: 10px 12px;
  font: 400 14px/1.3 var(--pz-font);
  width: 100%;
  transition: border-color .15s ease;
}
.filter-field select { padding-right: 34px; }
.filter-field input::placeholder { color: var(--pz-chalk-faint); }
.filter-field select:hover,
.filter-field input:hover { border-color: var(--pz-chalk-faint); }
.filter-field select:focus,
.filter-field input:focus { outline: none; border-color: var(--pz-focus); box-shadow: 0 0 0 1px var(--pz-focus); }

/* ---------- cabeceras de tabla ordenables ---------- */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--pz-chalk); }
th.sortable .sort-arrow { display: inline-block; width: 10px; opacity: .6; font-size: 10px; }
th.sortable.sort-active .sort-arrow { opacity: 1; color: var(--pz-adc); }

/* ---------- champion pool flat table role badge ---------- */
.role-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(201,170,113,0.14);
  color: var(--gold);
}

/* ---------- player profile (página Jugadores): país + descripción/objetivo ---------- */
.roster-grid-profile {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 860px) { .roster-grid-profile { grid-template-columns: repeat(2, 1fr); } }
.profile-player-field { display: flex; flex-direction: column; gap: 8px; }
.profile-player-field textarea { resize: vertical; min-height: 44px; }
.profile-player-field select { width: 100%; }

.checkbox-field { flex-direction: row !important; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--pz-chalk-dim); cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pz-adc); cursor: pointer; }

/* ---------- foto del jugador con respaldo ---------- */
.player-photo-wrap {
  position: relative;
  width: 44px; height: 44px; flex: 0 0 auto;
  border: 1px solid var(--pz-line-strong);
  border-radius: 10px;
  background: var(--pz-glass);
  overflow: hidden;
}
.player-photo-wrap.sm { width: 28px; height: 28px; border-radius: 7px; }
.player-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.player-photo.broken { display: none; }
.player-photo-fallback {
  display: none;
  width: 100%; height: 100%;
  align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: var(--pz-chalk-faint);
}
.player-photo.broken + .player-photo-fallback { display: flex; }

/* Tooltips rápidos del scoreboard: aparecen al instante, en español. Texto desde data-tip. */
.scoreboard-wrap [data-tip] { position: relative; cursor: help; }
.scoreboard-wrap [data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--pz-glass-3); color: var(--pz-chalk);
  border: 1px solid var(--pz-chalk-faint); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; z-index: 60; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .1s ease;
}
.scoreboard-wrap [data-tip]:hover::after { opacity: 1; visibility: visible; }
/* en los extremos del scoreboard, el tooltip se ancla al borde para no salirse de la tarjeta */
.sb-cols span:last-child[data-tip]::after, .sb-items[data-tip]::after { left: auto; right: 0; transform: none; }
.sb-cols span:first-child[data-tip]::after { left: 0; transform: none; }
/* con tooltip propio, las filas de la barra de daño no deben recortarlo */
.sb-dmg[data-tip]::after { left: 0; transform: none; }
