/* DOTA · knoxyz — dark, clean, simpler than Dotabuff */
:root {
  --bg: #0e1116;
  --bg-2: #141922;
  --panel: #171d27;
  --panel-2: #1c2431;
  --line: #263041;
  --line-2: #33415a;
  --txt: #e7ecf3;
  --txt-2: #9fb0c3;
  --txt-3: #6b7d92;
  --accent: #4ea1ff;
  --accent-2: #38d6e6;
  --radiant: #57c98a;
  --radiant-dim: #1e3a2c;
  --dire: #e0554e;
  --dire-dim: #3a2020;
  --good: #57c98a;
  --warn: #f0a63a;
  --bad: #e0554e;
  --shadow: 0 6px 22px rgba(0, 0, 0, .35);
  --r: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --head: 'Space Grotesk', var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(900px 500px at 15% -10%, #13233a55, transparent 60%),
    radial-gradient(900px 600px at 110% 0%, #2a1a2f55, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.mono { font-family: var(--mono); }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 80px; }
header.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14, 17, 22, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent); }
.brand small { color: var(--txt-3); font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
nav.main { display: flex; gap: 4px; }
nav.main a { padding: 7px 14px; border-radius: 8px; color: var(--txt-2); font-weight: 500; }
nav.main a:hover { background: var(--panel); text-decoration: none; color: var(--txt); }
nav.main a.active { background: var(--panel-2); color: var(--txt); }
.spacer { flex: 1; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--txt); padding: 8px 14px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 8px; transition: .14s;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.primary { background: linear-gradient(135deg, #2b6fd6, #2196c9); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: transparent; }

input, select {
  font: inherit; background: var(--bg-2); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--txt-3); }

/* ---------- panels / cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.section-title { display: flex; align-items: center; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { font-size: 18px; }
.section-title .hint { color: var(--txt-3); font-size: 12.5px; }
.section-title .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

.page-head { padding: 26px 0 6px; }
.page-head h1 { font-size: 26px; }
.page-head .lede { color: var(--txt-2); margin-top: 6px; max-width: 720px; }

.grid { display: grid; gap: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat .k { color: var(--txt-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-family: var(--head); font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .v small { font-size: 13px; color: var(--txt-2); font-weight: 500; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--txt-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel-2); }
thead th:hover { color: var(--txt); }
thead th .arrow { color: var(--accent); }
tbody tr:hover { background: var(--panel-2); }
tr.avg-row { background: #101826; font-weight: 600; }
tr.avg-row td { color: var(--accent-2); border-top: 2px solid var(--line-2); }
.numcell { position: relative; }
.numcell .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); opacity: .5; border-radius: 2px; }

/* value vs average coloring */
.above { color: var(--good); }
.below { color: var(--bad); }

/* ---------- player cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pcard .hd { display: flex; gap: 12px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.pcard .hd img.av { width: 52px; height: 52px; border-radius: 10px; background: var(--bg-2); object-fit: cover; }
.pcard .hd .nm { font-family: var(--head); font-weight: 600; font-size: 16px; }
.pcard .hd .meta { color: var(--txt-3); font-size: 12px; margin-top: 2px; }
.medal { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; color: #0e1116; }
.wlbar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--dire-dim); margin: 4px 0; }
.wlbar .w { background: var(--radiant); }
.form { display: flex; gap: 3px; margin-top: 8px; }
.form .d { width: 15px; height: 15px; border-radius: 4px; font-size: 9px; display: grid; place-items: center; font-weight: 700; color: #0e1116; }
.form .d.W { background: var(--radiant); }
.form .d.L { background: var(--dire); }
.pcard .bd { padding: 12px 14px; display: grid; gap: 10px; }
.mini { display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.mini .lbl { color: var(--txt-2); }
.mini .track { height: 6px; background: var(--bg-2); border-radius: 6px; overflow: hidden; }
.mini .track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.mini .val { font-family: var(--mono); color: var(--txt); }
.heroes-row { display: flex; gap: 6px; align-items: center; }
.heroes-row img { width: 40px; height: 22px; border-radius: 4px; object-fit: cover; background: var(--bg-2); }
.pcard .ft { border-top: 1px solid var(--line); }
.pcard .ft button { width: 100%; border: none; background: transparent; color: var(--txt-2); padding: 10px; cursor: pointer; font: inherit; font-weight: 600; }
.pcard .ft button:hover { background: var(--panel-2); color: var(--txt); }

.matchlist { border-top: 1px solid var(--line); }
.matchlist .row { display: grid; grid-template-columns: 40px 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.matchlist .row:hover { background: var(--panel-2); }
.matchlist img { width: 40px; height: 22px; border-radius: 4px; object-fit: cover; }
.tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .04em; }
.tag.win { background: var(--radiant-dim); color: var(--radiant); }
.tag.loss { background: var(--dire-dim); color: var(--dire); }

/* ---------- match page ---------- */
.match-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 20px; }
.team-tag { font-family: var(--head); font-weight: 700; font-size: 20px; }
.team-tag.radiant { color: var(--radiant); }
.team-tag.dire { color: var(--dire); }
.score { font-family: var(--head); font-size: 34px; font-weight: 700; }
.result-pill { padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 13px; }
.result-pill.radiant { background: var(--radiant-dim); color: var(--radiant); }
.result-pill.dire { background: var(--dire-dim); color: var(--dire); }
.mh-meta { color: var(--txt-2); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px 16px; }

.parse-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #2a2410; border: 1px solid #5a4d1e; border-radius: var(--r); color: #f0d68a; margin: 14px 0; }

.scoreboard th.hero, .scoreboard td.hero { text-align: left; }
.scoreboard .pl { display: flex; align-items: center; gap: 9px; }
.scoreboard .pl img { width: 44px; height: 25px; border-radius: 4px; object-fit: cover; background: var(--bg-2); }
.scoreboard .pl .lv { position: absolute; }
.scoreboard .pl .nm { font-weight: 600; }
.scoreboard .pl .nm small { display: block; color: var(--txt-3); font-weight: 400; font-size: 11px; }
.items { display: flex; gap: 2px; }
.items img { width: 26px; height: 19px; border-radius: 3px; object-fit: cover; background: var(--bg-2); }
.items img.neutral { border-radius: 50%; width: 19px; }
.tbl-team-radiant thead th { background: #12241b; color: #8fddb2; }
.tbl-team-dire thead th { background: #241515; color: #ed9b96; }

.charts-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-box { padding: 16px; }
.chart-box .ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-box h3 { font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--txt-2); margin-top: 8px; }
.legend .it { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; padding: 2px 4px; border-radius: 5px; }
.legend .it.off { opacity: .35; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.metric-tabs { display: flex; gap: 4px; }
.metric-tabs button { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; color: var(--txt-2); cursor: pointer; }
.metric-tabs button.active { background: var(--panel-2); color: var(--txt); border-color: var(--accent); }
svg .grid-line { stroke: var(--line); stroke-width: 1; }
svg .axis-txt { fill: var(--txt-3); font-size: 10px; font-family: var(--mono); }
.hoverline { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: fixed; pointer-events: none; background: #0b0f15; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; z-index: 90; box-shadow: var(--shadow); max-width: 260px; }
.tip .t-h { font-weight: 700; margin-bottom: 4px; }
.tip .t-r { display: flex; justify-content: space-between; gap: 14px; }

/* ---------- map ---------- */
.map-box { padding: 16px; }
.map-layout { display: grid; grid-template-columns: minmax(0, 440px) 200px; gap: 22px; align-items: start; justify-content: center; }
.map-holder { position: relative; }
.map-holder svg { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.map-controls { display: grid; gap: 14px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; user-select: none; }
.toggle input { width: auto; }
.toggle .sw { width: 12px; height: 12px; border-radius: 3px; }
.timeline { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.timeline input[type=range] { flex: 1; accent-color: var(--accent); }
.time-label { font-family: var(--mono); font-size: 14px; min-width: 52px; text-align: center; }
.play { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.map-legend { font-size: 11.5px; color: var(--txt-2); display: grid; gap: 6px; }
.evt-feed { margin-top: 10px; max-height: 150px; overflow: auto; font-size: 12px; border-top: 1px solid var(--line); }
.evt-feed .e { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 4px 2px; border-bottom: 1px solid var(--line); }
.evt-feed .e .tm { font-family: var(--mono); color: var(--txt-3); }

/* ---------- modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(4, 7, 11, .68); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { width: min(560px, 100%); max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); }
.modal .m-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal .m-bd { padding: 18px; display: grid; gap: 14px; }
.modal .close { background: transparent; border: none; color: var(--txt-2); font-size: 22px; cursor: pointer; line-height: 1; }
.player-manage-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.player-manage-item img { width: 34px; height: 34px; border-radius: 7px; }
.player-manage-item .rm { margin-left: auto; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; }

/* ---------- misc ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--txt-2); padding: 50px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { background: var(--dire-dim); border: 1px solid #5a2a2a; color: #f0b0ac; padding: 12px 16px; border-radius: var(--r); }
.empty { text-align: center; color: var(--txt-3); padding: 40px; }
.muted { color: var(--txt-3); }
footer { color: var(--txt-3); font-size: 12px; text-align: center; padding: 30px 0 10px; border-top: 1px solid var(--line); margin-top: 50px; }

@media (max-width: 760px) {
  .map-layout { grid-template-columns: 1fr; }
  .top-in { gap: 12px; flex-wrap: wrap; }
  .page-head h1 { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
}
