/* ── Mode toggle ── */
#mode-toggle {
  display: flex;
  gap: 6px;
}
.mode-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 22px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius);
  transition: color .15s, border-color .15s, background .15s;
}
.mode-btn:hover { color: var(--text); border-color: var(--accent); }
.mode-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: #1e1c15;
}

/* ── Team page body ── */
#team-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
}

/* ── Banner ── */
#team-banner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
}

#team-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

#team-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

.team-name-block h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.team-name-block p {
  font-size: 13px;
  color: var(--muted);
}

.team-agg-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.agg-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agg-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.agg-stat-val {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}
.agg-stat-sub { font-size: 11px; color: var(--muted); }

/* ── Player grid ── */
#team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Team player card ── */
.team-player-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .2s;
}
.team-player-card:hover { border-color: var(--accent); }

.team-card-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-player-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}
.team-player-tag { color: var(--muted); font-size: 11px; }

.team-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 2px;
  align-self: flex-start;
}

.team-winrate-bar-bg {
  height: 5px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.team-winrate-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.team-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.team-stat-mini {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.team-stat-mini-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.team-stat-mini-val { font-size: 15px; font-weight: 700; }

/* Champ pool on team card */
.team-champ-pool {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.team-champ-pool-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.team-champ-icons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.team-champ-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  position: relative;
  cursor: default;
}
.team-champ-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.team-champ-icon:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* ── Best team comp ── */
#team-comp-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.comp-slot {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.comp-role-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.comp-champ-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
}
.comp-champ-icon img { width: 100%; height: 100%; object-fit: cover; }

.comp-champ-name { font-size: 13px; font-weight: 700; }
.comp-player-name { font-size: 11px; color: var(--muted); }
.comp-wr { font-size: 12px; font-weight: 700; }

/* skeleton */
.team-card-skeleton {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 700px) {
  #team-grid { grid-template-columns: 1fr 1fr; }
  #team-comp-cards { grid-template-columns: 1fr 1fr; }
  #team-summary { grid-template-columns: 1fr; }
}
