/* Team spectator: live tactical positions and full team rosters. */
#leaderboardDialog.team-spectator-dialog {
  width: min(1280px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  max-height: min(92dvh, 1000px);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  overflow: auto;
  --team-lightness: 25%;
  --team-saturation: 78%;
}
:root[data-theme='dark'] #leaderboardDialog.team-spectator-dialog { --team-lightness: 65%; --team-saturation: 95%; }
.team-spectator-dialog > .dialog-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 23px 25px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}
.team-spectator-dialog #leaderboardTitle {
  margin: 0;
  font-family: var(--font-room, var(--font-display));
  font-size: clamp(15px, 2.2vw, 21px);
  font-weight: 650;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.team-spectator-dialog .dialog-heading > button { flex-shrink: 0; }
.team-spectator { padding: 0; }
.spectator-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 11px var(--font-body);
}
.spectator-metadata-age { display: inline-block; margin-right: 14px; color: var(--muted); }
.spectator-live { display: flex; align-items: center; gap: 7px; }
.spectator-live > i { color: var(--ok); }
.spectator-live.is-stale > i { color: var(--muted); }
.spectator-search { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 24px; border-bottom: 1px solid var(--line); color: var(--accent); font-size: 12px; }
.spectator-layout { display: grid; grid-template-columns: minmax(280px, .95fr) minmax(500px, 1.45fr); }
.spectator-map-panel { min-width: 0; padding: 20px 16px 17px; border-right: 1px solid var(--line); background: var(--surface-muted); }
.spectator-map-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 13px; color: var(--muted); font: 10px var(--font-body); text-transform: uppercase; letter-spacing: 1px; }
.spectator-map-heading > span { display: inline-flex; align-items: center; gap: 7px; }
.spectator-map-heading > span > i { color: var(--accent); }
.spectator-map-heading > b { color: var(--text-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.spectator-map { position: relative; width: 100%; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--bg); }
.spectator-map > svg { display: block; width: 100%; height: 100%; }
.team-map-field { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
.team-map-grid { stroke: var(--line); stroke-width: .65; opacity: .65; }
.team-map-axis { fill: none; stroke: var(--line-strong); stroke-width: .65; stroke-dasharray: 2 7; opacity: .75; }
.team-map-pilot { color: hsl(var(--team-hue) var(--team-saturation) var(--team-lightness)); fill: currentColor; filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 40%, transparent)); }
.team-map-ship { font-family: 'SK Vanilla Ships' !important; font-size: 17px; font-weight: 400; letter-spacing: 0; }
.team-map-waiting { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.team-map-waiting > i { color: var(--accent); font-size: 30px; }
.team-map-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 14px 4px 0; }
.team-map-legend > span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.team-map-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: hsl(var(--team-hue) var(--team-saturation) var(--team-lightness)); }
.team-map-legend b { margin-left: 2px; color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.team-map-note { margin: 12px 4px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.spectator-teams { display: grid; grid-template-columns: repeat(var(--team-count), minmax(170px, 1fr)); min-width: 0; overflow-x: auto; }
.spectator-team { min-width: 0; padding: 20px 15px 14px; color: var(--text); border-left: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, hsl(var(--team-hue) 60% 50%)); }
.spectator-team:first-child { border-left: 0; }
.team-column-heading { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 30px; margin-bottom: 6px; }
.team-column-heading h3 { margin: 0; color: var(--text); font-family: var(--font-room, var(--font-display)); font-size: 19px; font-weight: 650; line-height: 1.3; letter-spacing: 1.5px; text-transform: uppercase; }
.team-join-state { font-size: 13px; }
.team-join-state.is-open { color: var(--ok); }
.team-join-state.is-locked { color: #c53b56; }
:root[data-theme='dark'] .team-join-state.is-locked { color: #ff6c87; }
.team-faction { margin: 0 0 15px; min-height: 14px; color: var(--muted); font-size: 9px; line-height: 1.4; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-metrics { margin: 12px 0 0; padding: 7px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.team-metric { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; min-height: 29px; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 62%, transparent); }
.team-metric:last-child { border-bottom: 0; }
.team-metric > span:first-child { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-family: var(--font-body); font-size: 10px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; }
.team-metric > span:first-child > i { color: var(--muted); font-size: 11px; }
.team-metric > strong { color: var(--text); font-family: var(--font-body); font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }
.team-metric:last-child > strong { color: hsl(var(--team-hue) var(--team-saturation) var(--team-lightness)); font-size: 17px; }
.team-level-meter { display: flex; gap: 3px; width: 100%; }
.team-level-meter > i { flex: 1; height: 3px; border-radius: 1px; background: var(--line); }
.team-level-meter > .filled { background: hsl(var(--team-hue) var(--team-saturation) var(--team-lightness)); }
.team-roster-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 9px; color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }
.team-roster-heading b { color: var(--text-soft); font-size: 10px; font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.team-roster { list-style: none; max-height: min(48vh, 460px); overflow-y: auto; overflow-x: hidden; scrollbar-color: var(--line-strong) transparent; margin: 0; padding: 0; }
.team-player { display: flex; align-items: center; gap: 6px; min-height: 33px; padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.team-player:last-child { border-bottom: 0; }
.team-player-name { display: flex; align-items: center; flex-wrap: nowrap; gap: 5px; flex: 1; min-width: 0; color: var(--text); font-family: var(--font-player, var(--font-body)); font-size: 10px; font-weight: 650; line-height: 1.5; }
.team-player-name > bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-player-ecp { flex-shrink: 0; color: var(--text-soft); font-size: 9px; }
.team-player-clan { display: none; }
.team-player-score { flex-shrink: 0; color: var(--text-soft); font-size: 10px; font-family: var(--font-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.team-player-ship { display: grid; place-items: center; flex-shrink: 0; width: 23px; }
.team-player-ship .player-ship-icon { width: 23px; height: 25px; color: var(--text-soft); font-size: 20px !important; }
.team-player.is-respawning .team-player-name { color: var(--muted); }
.team-player.is-respawning .team-player-ship { opacity: .5; }
.team-player.is-search-muted, .team-map-pilot.is-search-muted { opacity: .24; }
.team-roster-empty { padding: 20px 0; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; }
.team-data-waiting { padding: 45px 25px; color: var(--muted); font-size: 13px; }
.spectator-unassigned { padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.spectator-unassigned > h3 { display: flex; gap: 8px; margin: 0 0 10px; font-family: var(--font-body); font-size: 12px; font-weight: 600; color: var(--text-soft); }
.spectator-unassigned > h3 > span { color: var(--muted); font-weight: 400; }
.spectator-unassigned .team-roster { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 22px; max-height: 160px; }
.spectator-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 15px 24px; border-top: 1px solid var(--line); color: var(--muted); font: 10px var(--font-body); }
.spectator-footer > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.spectator-footer i { color: var(--accent); }
@media (max-width: 1000px) {
  .spectator-layout { grid-template-columns: minmax(230px, .8fr) minmax(460px, 1.5fr); }
  .spectator-team { padding-inline: 12px; }
  .team-column-heading h3 { font-size: 17px; letter-spacing: 1px; }
}
@media (max-width: 780px) {
  #leaderboardDialog.team-spectator-dialog { width: calc(100vw - 22px); max-width: calc(100vw - 22px); border-radius: 16px; }
  .spectator-layout { grid-template-columns: 1fr; }
  .spectator-map-panel { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .spectator-map { max-width: 440px; margin: 0 auto; }
  .spectator-map-heading, .team-map-legend, .team-map-note { max-width: 440px; margin-inline: auto; }
  .spectator-teams { grid-template-columns: repeat(var(--team-count), minmax(170px, 1fr)); }
  .team-roster { max-height: 370px; }
  .team-spectator-dialog > .dialog-heading { padding: 19px 18px; }
  .spectator-toolbar, .spectator-search, .spectator-footer { padding-inline: 18px; }
}
@media (max-width: 440px) {
  .team-spectator-dialog #leaderboardTitle { font-size: 15px; }
  .spectator-toolbar { font-size: 10px; }
  .team-column-heading h3 { font-size: 16px; }
}
