:root {
  --bg: #0d0e14;
  --panel: #16171f;
  --panel-2: #1d1f29;
  --line: #2a2c38;
  --text: #ecedf3;
  --muted: #8a8ca0;
  --accent: #ff2d8a;
  --blue: #4a8bff;
  --red: #ff4d5e;
  --win: #3ddc84;
  --loss: #ff5a6a;
  --warn: #ffb547;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.win { color: var(--win); }
.loss { color: var(--loss); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.grow { flex: 1; }

/* hlavička */
.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(13, 14, 20, .92); backdrop-filter: blur(8px); z-index: 5;
}
h1, h2, h3, h4, .tab, th, .badge, .btn { font-family: Rajdhani, Inter, sans-serif; letter-spacing: .06em; }
h1 { margin: 0; font-size: 26px; display: flex; align-items: center; gap: 10px; }
h1 small { color: var(--muted); font-size: 15px; text-transform: uppercase; }
.bar { width: 4px; height: 24px; background: var(--accent); border-radius: 2px; }
nav { display: flex; gap: 4px; }
.tab { padding: 6px 14px; border-radius: 8px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 7px 14px; font-weight: 700; font-size: 14px; cursor: pointer; text-transform: uppercase;
}
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.12); }

.source { padding: 10px 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-weight: 700; font-size: 12px;
  background: var(--panel-2); text-transform: uppercase;
}
.badge-ok { background: rgba(61, 220, 132, .14); color: var(--win); }
.badge-warn { background: rgba(255, 181, 71, .14); color: var(--warn); }

main { padding: 8px 24px 48px; max-width: 1280px; margin: 0 auto; }

/* toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
input, textarea {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; font: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#q { min-width: 240px; }
#min { width: 64px; margin-left: 6px; }

/* tabulky */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { text-align: left; font-size: 13px; text-transform: uppercase; color: var(--muted); font-weight: 700; user-select: none; }
th.num { text-align: right; }
th[data-col] { cursor: pointer; }
th.sorted { color: var(--text); }
th.sorted::after { content: ' ▾'; color: var(--accent); }
th.sorted[data-dir="1"]::after { content: ' ▴'; }
tbody tr:last-child td { border-bottom: 0; }
table.players tbody tr { cursor: pointer; }
table.players tbody tr:hover { background: var(--panel-2); }

.pl { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.av { border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; }
.av-fallback { display: inline-grid; place-items: center; font-size: 12px; color: var(--muted); text-transform: uppercase; }

.wr { display: inline-flex; align-items: center; gap: 8px; }
.wr-bar { width: 70px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.wr-bar i { display: block; height: 100%; }
.wr-bar i.hi { background: var(--win); }
.wr-bar i.lo { background: var(--loss); }

.form { display: inline-flex; gap: 3px; vertical-align: middle; }
.form i { width: 9px; height: 9px; border-radius: 2px; }
.form i.w { background: var(--win); }
.form i.l { background: var(--loss); }

.opgg {
  display: inline-block; font: 700 11px Rajdhani, sans-serif; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 5px; background: #5c46e8; color: #fff;
}
.opgg:hover { color: #fff; filter: brightness(1.2); }

/* detail hráče */
.back { display: inline-block; margin: 8px 0 14px; color: var(--muted); }
.hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.hero h2 { margin: 0 0 4px; font-size: 30px; }
.kpis { display: flex; gap: 26px; margin-left: auto; flex-wrap: wrap; }
.kpis div { display: flex; flex-direction: column; align-items: center; }
.kpis b { font: 700 24px Rajdhani, sans-serif; min-height: 30px; display: flex; align-items: center; }
.kpis span { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.grid3, .grid2 { display: grid; gap: 16px; margin-bottom: 16px; }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; overflow-x: auto; }
.grid3 .card, .grid2 .card { margin-bottom: 0; }
.card h3 { margin: 0 0 10px; font-size: 16px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ''; width: 3px; height: 15px; background: var(--accent); border-radius: 2px; }
.rec { list-style: none; margin: 0; padding: 0; }
.rec li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rec li:last-child { border-bottom: 0; }
.rec li > :first-child { flex: 1; font-weight: 600; }
.hist td.names { white-space: normal; font-size: 13px; color: var(--muted); min-width: 220px; }
.hist td.names a:hover { color: var(--accent); }
.side { font: 700 12px Rajdhani, sans-serif; letter-spacing: .08em; }
.side.blue { color: var(--blue); }
.side.red { color: var(--red); }

.score { display: flex; align-items: center; justify-content: center; gap: 12px; font: 700 34px Rajdhani, sans-serif; margin: 6px 0 12px; }
.score span { font-size: 16px; color: var(--muted); }

/* zápasy */
.lobbies { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.lobby { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lobby header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lobby header b { font: 700 16px Rajdhani, sans-serif; letter-spacing: .08em; }
.lobby header .muted { margin-left: auto; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px 16px; }
.team { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 8px; }
.team h4 { margin: 0 0 2px; font-size: 14px; padding-left: 8px; border-left: 3px solid; display: flex; gap: 8px; align-items: center; }
.team.blue h4 { color: var(--blue); }
.team.red h4 { color: var(--red); }
.team.won { background: rgba(61, 220, 132, .07); }
.team.lost { opacity: .6; }
.team .pl { font-size: 14px; }
.team .pl .small { margin-left: auto; }
.tag { font-size: 11px; background: var(--win); color: #0d0e14; padding: 0 6px; border-radius: 4px; }

/* dialog */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; width: min(560px, calc(100vw - 32px)); padding: 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin: 0 0 4px; font-size: 20px; }
dialog label { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-weight: 600; font-size: 13px; }
dialog textarea { font: 12px ui-monospace, monospace; resize: vertical; }
dialog .row { display: flex; gap: 8px; margin-top: 12px; }

@media (max-width: 640px) {
  .top, .source, main { padding-left: 16px; padding-right: 16px; }
  .lobbies { grid-template-columns: 1fr; }
  .teams { grid-template-columns: 1fr; }
  .kpis { margin-left: 0; gap: 16px; }
  #q { min-width: 0; flex: 1; }
}

/* championi + W/L */
.wl { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl b { font-weight: 600; }
.pc { min-width: 42px; text-align: right; }
.champ-tag { display: inline-flex; align-items: center; gap: 8px; }
.champ { border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); flex: none; }
.champ-row { display: inline-flex; gap: 4px; vertical-align: middle; }
.rec li > .champ-tag { flex: 1; font-weight: 600; }
.wl .zero { color: var(--muted); opacity: .6; }
.rec li { align-items: center; }

/* Streamers Clash data */
.hero-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.tier { font: 700 11px Rajdhani, sans-serif; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); color: var(--muted); vertical-align: middle; }
.tier-gold { background: rgba(255, 196, 0, .15); color: #ffc400; }
.tier-silver { background: rgba(200, 210, 225, .15); color: #c8d2e1; }
.tier-bronze { background: rgba(205, 127, 50, .18); color: #e0954f; }
.tier-prized { background: rgba(255, 45, 138, .14); color: var(--accent); }
.badge-live { background: rgba(255, 77, 94, .16); color: var(--red); }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13px; }
.chip.active { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
.team-opgg { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; padding-left: 8px; }
