:root {
  --bg: #0d0f12;
  --surface: #15181d;
  --surface-2: #1c2027;
  --line: #262b33;
  --text: #e9ecf1;
  --muted: #8a93a3;
  --accent: #ff8a1f;
  --win: #3ecf8e;
  --loss: #f0585a;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, sans-serif;
}
h1, h2, .brand-mark, .kpi b, .pts, .score { font-family: 'Russo One', Inter, sans-serif; font-weight: 400; }
h2 { font-size: 17px; margin: 0; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #171a20, var(--bg)); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 22px; margin: 0; line-height: 1.1; }
.brand p { margin: 2px 0 0; font-size: 13px; }
.brand-mark { background: var(--accent); color: #111; border-radius: 8px; padding: 8px 9px; font-size: 15px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; }
.tab {
  background: none; border: 0; color: var(--muted); font: 600 14px Inter, sans-serif;
  padding: 9px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }

main { padding-top: 20px; padding-bottom: 48px; }
.panel { display: none; }
.panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card > h2 { margin-bottom: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two > .card { margin-bottom: 0; }
.two + .card, .card + .two { margin-top: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.lead b { color: var(--accent); font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 10px 8px; text-align: right; white-space: nowrap; }
.grid th { color: var(--muted); font: 600 12px Inter, sans-serif; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.grid td { border-bottom: 1px solid var(--line); }
.grid tr:last-child td { border-bottom: 0; }
.grid th:nth-child(-n+2), .grid td:nth-child(-n+2) { text-align: left; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid.compact td, .grid.compact th { padding: 6px; }
.grid.compact input { width: 64px; }
.sortable th[data-key] { cursor: pointer; user-select: none; }
.sortable th[data-key]:hover { color: var(--text); }
.sortable th.sorted { color: var(--accent); }
.place { color: var(--muted); width: 28px; }
tr:first-child .place { color: var(--accent); }
.team-cell { display: flex; align-items: center; gap: 10px; }
.swatch { width: 4px; height: 22px; border-radius: 2px; flex: none; }
.tag { font: 700 11px Inter, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.pts { font-size: 17px; color: var(--accent); }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.sub-badge { font-size: 11px; color: var(--muted); margin-left: 6px; }

.form { display: inline-flex; gap: 3px; }
.form i { width: 18px; height: 18px; border-radius: 4px; font: 700 10px/18px Inter, sans-serif; text-align: center; font-style: normal; color: #0d0f12; }
.form .W { background: var(--win); }
.form .L { background: var(--loss); }
.form .D { background: var(--muted); }

.top5 { list-style: none; padding: 0; margin: 0; }
.top5 li { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.top5 li:last-child { border-bottom: 0; }
.top5 .who b { display: block; }
.top5 .who span { color: var(--muted); font-size: 13px; }

.match { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.recent .match { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0; }
.recent .match:last-child { border-bottom: 0; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; }
.recent .match-row { padding: 10px 0; grid-template-columns: 1fr auto 1fr; }
.recent .meta { display: none; }
.side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.side.b { justify-content: flex-end; text-align: right; }
.side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side.won span { font-weight: 700; }
.side.outsider span { color: var(--muted); }
.score { font-size: 18px; letter-spacing: .04em; }
.score .w { color: var(--win); }
.meta { display: flex; gap: 8px; align-items: center; justify-content: flex-end; color: var(--muted); font-size: 13px; min-width: 250px; }
.src { font: 700 10px Inter, sans-serif; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.src.faceit { color: #ff5500; }
.src.cybershoke { color: #4fc3f7; }
.match-detail { display: none; padding: 0 14px 14px; }
.match.open .match-detail { display: block; }
.detail-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; }
.detail-actions a { color: var(--accent); }

.teams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.team-card { border-top: 3px solid var(--c); }
.team-card ul { list-style: none; padding: 0; margin: 12px 0 0; }
.team-card li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.team-card li:last-child { border-bottom: 0; }
.team-stat { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
input, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; font: 14px Inter, sans-serif; min-width: 0; width: 100%;
}
input[type=color] { padding: 2px; height: 38px; }
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.btn { background: var(--accent); color: #111; border: 0; border-radius: 8px; padding: 10px 16px; font: 700 14px Inter, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
#manual-form .btn { margin-top: 12px; }
.link { background: none; border: 0; color: var(--accent); font: 600 13px Inter, sans-serif; cursor: pointer; padding: 0; }
.danger { background: none; border: 1px solid var(--line); color: var(--loss); border-radius: 6px; padding: 4px 10px; cursor: pointer; font: 12px Inter, sans-serif; }
.msg { margin-top: 10px; font-size: 14px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.msg.ok { border-left: 3px solid var(--win); }
.msg.err { border-left: 3px solid var(--loss); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-field select { width: auto; }
.variants { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.variant { background: var(--bg); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 7px 12px; cursor: pointer; font: 600 13px Inter, sans-serif; }
.variant small { font-weight: 400; margin-left: 6px; }
.variant.active { color: var(--text); border-color: var(--accent); }
.draft-sum { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.draft-sum b { color: var(--text); font-weight: 600; }
.draft-sum .warn { color: var(--loss); }
.draft-teams { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; }
.dteam { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.dteam-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.dteam-head h3 { margin: 0; font: 600 15px Inter, sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dteam-avg { font-family: 'Russo One', Inter, sans-serif; font-size: 20px; color: var(--accent); }
.dteam-avg small { font: 12px Inter, sans-serif; color: var(--muted); margin-left: 4px; }
.dplayers { list-style: none; padding: 0; margin: 0; }
.dplayer { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; width: calc(100% + 16px); background: none; border: 0; border-radius: 6px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dplayer:hover { background: var(--surface-2); }
.dplayer.picked { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.dplayer .nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dplayer .elo { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.dplayer .sub-badge { margin: 0; }
.lvl { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; font: 700 11px/18px Inter, sans-serif; text-align: center; }
.unmet { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.draft-note { font-size: 13px; color: var(--muted); margin-top: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pool-form { margin-top: 14px; }
.wish-player { max-width: 320px; margin: 4px 0 12px; }
.wish-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; margin-bottom: 14px; }
.wish-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wish-row .who { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.seg label { cursor: pointer; position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 3px 8px; font-size: 12px; color: var(--muted); }
.seg input:checked + span { background: var(--surface-2); color: var(--text); }
.seg input:checked + span.yes { color: var(--win); }
.seg input:checked + span.no { color: var(--loss); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.grid .wishes-cell { text-align: left; white-space: normal; min-width: 140px; font-size: 13px; }
.wishes-cell .no { color: var(--loss); }

.two + #moments-card { margin-top: 16px; }
.moments { list-style: none; padding: 0; margin: 0; }
.moments li { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.moments li:last-child { border-bottom: 0; }
.moment-score { font-family: 'Russo One', Inter, sans-serif; color: var(--accent); font-size: 18px; text-align: center; }
.moment-main { min-width: 0; }
.moment-main b { margin-right: 6px; }
.moment-main .chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.chip { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip.main { background: rgba(255, 138, 31, .16); color: var(--accent); }
.moment-meta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-moments { margin-top: 12px; }
.match-moments h3 { font: 600 13px Inter, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.match-moments .moments li { padding: 6px 0; grid-template-columns: 40px 1fr; }
.match-moments .moment-score { font-size: 15px; }
.demo-actions { align-items: center; margin-top: 4px; }
.demo-actions progress { flex: 1; height: 8px; accent-color: var(--accent); }
input[type=file] { padding: 7px 10px; }
.form-grid .wide { grid-column: span 2; }

@media (max-width: 1023px) {
  .teams { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .two, .teams, .draft-teams { grid-template-columns: 1fr; }
  .two > .card { margin-bottom: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none; }
  .grid .tag { display: none; }
  .match-row { grid-template-columns: 1fr auto 1fr; }
  .match-row .meta { grid-column: 1 / -1; justify-content: flex-start; min-width: 0; }
  .top { position: static; }
  .row { flex-wrap: wrap; }
}

.src.club { color: #ff5500; }
.src.mix { color: var(--text); margin-left: 4px; }
.ban-badge { font: 700 10px Inter, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--loss); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; margin-left: 6px; cursor: help; }
.draft-copy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.club-actions { margin-top: 8px; }
.msg li.warn { color: #ff8a65; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn:disabled { opacity: .5; cursor: default; }
.src.series { color: var(--muted); margin-left: 4px; text-transform: none; letter-spacing: 0; }
