/* ── Clash page layout ── */
#clash-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

#clash-app header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.clash-title {
  margin-left: auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

#clash-body {
  flex: 1;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

/* ── Input section ── */
#input-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: start;
}

.team-input-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-input-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.team-input-header.our   { color: #4ade80; }
.team-input-header.enemy { color: #f87171; }

.player-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  width: 100%;
  transition: border-color .15s;
}
.player-input:focus { outline: none; border-color: var(--accent); }
.player-input::placeholder { color: var(--muted); }
.player-input.error { border-color: var(--red); }

#scout-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 40px;
}

.vs-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

#scout-btn { padding: 9px 20px; font-size: 14px; }
#scout-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Results ── */
#results-status {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

#matchups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Matchup row ── */
.matchup-row {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 12px;
  align-items: stretch;
}

.matchup-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.matchup-vs-icon { font-size: 18px; }

/* ── Player card ── */
.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;
}
.player-card.our-card   { border-left: 3px solid #4ade80; }
.player-card.enemy-card { border-right: 3px solid #f87171; }
.enemy-card { text-align: right; }

.player-card.error-card {
  opacity: .5;
  border-left-color: var(--muted);
  border-right-color: var(--muted);
}

/* Card header */
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.enemy-card .card-header { flex-direction: row-reverse; }

.player-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
}
.player-tag { color: var(--muted); font-size: 12px; font-weight: 400; }
.player-role-badge {
  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);
  white-space: nowrap;
  margin-left: auto;
}
.enemy-card .player-role-badge { margin-left: 0; margin-right: auto; }

/* Role select dropdown */
.role-select {
  appearance: none;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: .06em;
  padding: 2px 20px 2px 8px;
  cursor: pointer;
  margin-left: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7a8c'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color .15s, color .15s;
}
.role-select:hover, .role-select:focus { outline: none; border-color: var(--accent); color: var(--text); }
.role-select.role-overridden { border-color: var(--accent); color: var(--accent); }
.enemy-card .role-select { margin-left: 0; margin-right: auto; }

/* Win rate bar */
.winrate-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.enemy-card .winrate-row { flex-direction: row-reverse; }

.winrate-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.winrate-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.winrate-label {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* Key stats row */
.stats-row {
  display: flex;
  gap: 16px;
}
.enemy-card .stats-row { flex-direction: row-reverse; }

.stat-pill {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.stat-pill-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-pill-val {
  font-size: 16px;
  font-weight: 700;
}

/* Champion pool */
.champ-pool {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.enemy-card .champ-pool { align-items: flex-end; }

.champ-pool-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.champ-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.enemy-card .champ-row { flex-direction: row-reverse; }

.champ-icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.champ-icon-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.champ-name-sm { font-size: 12px; font-weight: 600; min-width: 80px; }
.champ-meta-sm { font-size: 11px; color: var(--muted); }
.champ-wr-sm   { font-size: 11px; font-weight: 700; margin-left: auto; }
.enemy-card .champ-wr-sm { margin-left: 0; margin-right: auto; }

.champ-wr-sm.wr-good { color: var(--green); }
.champ-wr-sm.wr-bad  { color: var(--red); }
.champ-wr-sm.wr-mid  { color: var(--accent); }

/* Loading skeleton */
.skeleton-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Advantage highlight */
.adv-our   { background: #0d2010 !important; border-color: #4ade8044 !important; }
.adv-enemy { background: #200d0d !important; border-color: #f8717144 !important; }

@media (max-width: 900px) {
  #input-section { grid-template-columns: 1fr; }
  #scout-middle  { flex-direction: row; padding-top: 0; }
  .matchup-row   { grid-template-columns: 1fr; }
  .matchup-vs    { display: none; }
}
