/* Quadro de jogadores da partida (v0.220, ui/battle-roster.js). Fica no canto esquerdo do campo, abaixo do botão do inventário
   de drops. Superfície escura como o painel da unidade; a cor da vaga aparece num quadradinho e na borda esquerda da linha, e o
   nome vai escrito junto, então a cor nunca fala sozinha. */
.roster-panel {
  position: absolute;
  top: calc(var(--s-3) + 44px);
  left: var(--s-3);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  width: 248px;
  max-width: calc(100% - 24px);
  /* Deixa o canto de baixo livre para o ícone do chat e a barra de zoom. */
  max-height: calc(100% - 44px - var(--s-3) - 88px);
  font-size: var(--fs-13);
}

.roster-panel.is-collapsed {
  width: auto;
  align-self: flex-start;
}

.roster-toggle,
.roster-row,
.roster-hero {
  appearance: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.roster-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  background: rgba(22, 25, 32, 0.9);
  font-family: var(--font-display);
  font-size: var(--fs-14);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.roster-toggle:hover {
  background: var(--surface-3);
}

.roster-toggle .roster-chevron {
  margin-left: auto;
}

.roster-count,
.roster-count-pill {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-4);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0;
}

.roster-chevron {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--t-fast);
}

.roster-toggle[aria-expanded="true"] .roster-chevron,
.roster-row[aria-expanded="true"] .roster-chevron {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.roster-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  background: rgba(22, 25, 32, 0.9);
  backdrop-filter: blur(6px);
  scrollbar-width: thin;
}

.roster-panel.is-collapsed .roster-body {
  display: none;
}

.roster-list,
.roster-heroes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.roster-player + .roster-player {
  border-top: 1px solid var(--line);
}

.roster-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 40px;
  padding: var(--s-2) var(--s-3);
  border: 0;
  border-left: 3px solid var(--pc);
  background: transparent;
  transition: background var(--t-fast);
}

.roster-row:hover {
  background: var(--surface-3);
}

.roster-player.is-open > .roster-row {
  background: var(--surface-2);
}

.roster-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--pc);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.roster-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--s-1);
}

.roster-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.roster-you {
  color: var(--text-2);
  font-size: var(--fs-12);
}

.roster-away {
  flex-basis: 100%;
  color: var(--danger);
  font-size: var(--fs-12);
}

.roster-player.is-away .roster-name {
  color: var(--text-2);
}

.roster-heroes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s-1) var(--s-2) var(--s-2);
  background: var(--surface-1);
  border-left: 3px solid var(--pc);
}

.roster-hero {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-areas:
    "face name lv"
    "face evo lv";
  align-items: center;
  column-gap: var(--s-2);
  width: 100%;
  min-height: 36px;
  padding: 3px var(--s-2) 3px 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.roster-hero .hero-face {
  grid-area: face;
}

.roster-hero:hover {
  background: var(--surface-3);
}

/* Dourado é a cor de selecionado em campo (anel do herói); aqui a linha do herói aberto no painel usa o mesmo. */
.roster-hero.is-selected {
  border-color: #FFBE26;
  background: var(--surface-3);
}

.roster-hero-name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.15;
}

.roster-hero-evo {
  grid-area: evo;
  color: var(--text-2);
  font-size: var(--fs-12);
  line-height: 1.15;
}

.roster-hero-lv {
  grid-area: lv;
  color: #FFBE26;
  font-weight: 700;
  white-space: nowrap;
}

.roster-hero-max {
  color: var(--text-2);
  font-weight: 400;
}

/* Nível máximo: verde de completo no lugar do amarelo de quem ainda sobe. */
.roster-hero-lv.is-max {
  color: var(--ok);
}

.roster-empty {
  padding: var(--s-2);
  color: var(--text-2);
  font-size: var(--fs-12);
}

.roster-toggle:focus-visible,
.roster-row:focus-visible,
.roster-hero:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Celular e telas estreitas: quadro mais fino e só o botão enquanto recolhido. */
@media (max-width: 600px), (pointer: coarse) {
  .roster-panel {
    top: calc(var(--s-2) + 44px);
    left: var(--s-2);
    width: 224px;
  }

  .roster-toggle,
  .roster-row {
    min-height: 44px;
  }

  .roster-hero {
    min-height: 44px;
  }
}

@media (max-height: 500px) {
  .roster-panel {
    max-height: calc(100% - 44px - var(--s-3) - 8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .roster-chevron,
  .roster-toggle,
  .roster-row,
  .roster-hero {
    transition: none;
  }
}
