/* Dota Tracker — dark theme matching Dota 2 aesthetic */

:root {
  --bg: #0e1015;
  --bg2: #161a22;
  --bg3: #1e2330;
  --border: #2a3040;
  --radiant: #5ab552;
  --dire: #c23c2a;
  --gold: #e8b54a;
  --text: #d8dce4;
  --text-dim: #7a8394;
  --blue: #4a9de8;
  --red: #e85050;
  --green: #52c25a;
  --yellow: #e8c040;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { font-weight: 700; font-size: 16px; letter-spacing: 1px; color: var(--gold); }
.match-meta { color: var(--text-dim); font-size: 12px; margin-left: 16px; }
.game-clock { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-link { color: var(--blue); text-decoration: none; font-size: 13px; }
.nav-link:hover { text-decoration: underline; }

.status-dot { font-size: 12px; margin-right: 12px; }
.status-dot.connected { color: var(--green); }
.status-dot.disconnected { color: var(--red); }

/* ── Sections ────────────────────────────────────────────────────────────────── */
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.section { margin-bottom: 16px; }
.hidden { display: none !important; }

.section h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ── Draft ───────────────────────────────────────────────────────────────────── */
.prob-bar-container {
  display: flex;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.prob-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  transition: width 0.6s ease;
}
.radiant-bar { background: var(--radiant); width: 50%; }
.dire-bar    { background: var(--dire);    width: 50%; flex-direction: row-reverse; }

.draft-heroes { display: flex; gap: 20px; }
.draft-team { flex: 1; }
.draft-team h3 { font-size: 13px; margin-bottom: 8px; text-transform: uppercase; }
.hero-row { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
}
.hero-chip img { width: 24px; height: 24px; border-radius: 2px; }
.hero-chip .hero-name { font-size: 12px; }
.empty-slot { width: 36px; height: 36px; background: var(--bg3); border: 1px dashed var(--border); border-radius: 4px; }

/* ── Charts ──────────────────────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}
.chart-card h3 {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.prob-value { color: var(--radiant); font-size: 18px; font-weight: 700; margin-left: 8px; }
.gold-value { font-size: 18px; font-weight: 700; margin-left: 8px; }
.gold-pos { color: var(--radiant); }
.gold-neg { color: var(--dire); }

canvas { max-height: 180px; }

/* ── Players ─────────────────────────────────────────────────────────────────── */
.teams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .teams-grid { grid-template-columns: 1fr; } }

.team-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.radiant-header { border-left: 3px solid var(--radiant); }
.dire-header    { border-left: 3px solid var(--dire); }
.team-name { font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.team-score { font-size: 20px; font-weight: 700; }
.radiant-color { color: var(--radiant); }
.dire-color    { color: var(--dire); }

.player-row {
  display: grid;
  grid-template-columns: 28px 120px 28px 60px 60px 60px 1fr 28px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.player-row:hover { background: var(--bg3); }
.player-row.is-me { background: rgba(74, 157, 232, 0.08); }
.player-row.dead { opacity: 0.45; }

.player-hero-icon { width: 28px; height: 28px; border-radius: 3px; }
.player-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-level {
  font-size: 11px; font-weight: 700; background: var(--bg3);
  border-radius: 3px; padding: 1px 4px; text-align: center;
}
.player-kda { font-size: 12px; font-variant-numeric: tabular-nums; }
.player-nw  { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.player-gpm { font-size: 11px; color: var(--text-dim); }
.player-items { display: flex; gap: 2px; align-items: center; }
.player-items img { width: 20px; height: 15px; border-radius: 2px; }
.player-items .empty-item { width: 20px; height: 15px; background: var(--bg3); border-radius: 2px; }
.ult-icon { font-size: 14px; }

/* MVP score colour coding */
.score-high   { color: var(--green); }
.score-medium { color: var(--yellow); }
.score-low    { color: var(--red); }

/* ── MVP / Threat ────────────────────────────────────────────────────────────── */
.mvp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mvp-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mvp-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; min-width: 80px; }
#mvp-content, #threat-content {
  font-size: 14px;
  font-weight: 600;
}

/* ── Idle ────────────────────────────────────────────────────────────────────── */
.idle-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}
.idle-message { text-align: center; }
.idle-icon { font-size: 64px; margin-bottom: 16px; }
.idle-message h2 { color: var(--text); margin-bottom: 8px; }
.idle-message p  { color: var(--text-dim); line-height: 1.6; }
.conn-info { margin-top: 16px; font-size: 12px; color: var(--text-dim); }

/* ── Post-game ───────────────────────────────────────────────────────────────── */
.postgame-banner {
  text-align: center;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.postgame-banner.radiant { background: rgba(90, 181, 82, 0.15); border: 1px solid var(--radiant); }
.postgame-banner.dire    { background: rgba(194, 60, 42, 0.15); border: 1px solid var(--dire); }
#postgame-result { font-size: 28px; font-weight: 700; }
#postgame-prob   { color: var(--text-dim); margin-top: 6px; }

/* ── Events ticker ───────────────────────────────────────────────────────────── */
.events-ticker {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}
.event-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  animation: fadeIn 0.3s ease;
  max-width: 260px;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
