:root {
    --bg: #12161f;
    --card: #1a1f2b;
    --card-2: #20263400;
    --line: #2c3242;
    --text: #e8e2d0;
    --muted: #8c93a3;
    --gold: #d4a852;
    --gold-soft: rgba(212, 168, 82, 0.14);
    --win: #6cc28a;
    --loss: #e46a6a;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2 { margin: 0 0 12px; font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; color: var(--gold); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
p { margin: 0 0 8px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--line); background: #0e1119; }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-size: 19px; font-weight: 700; letter-spacing: 0.04em; }
.brand span { color: var(--gold); }
.top nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.lang { display: inline-flex; gap: 2px; padding-left: 14px; border-left: 1px solid var(--line); }
.lang a { padding: 0 4px; border-radius: 4px; }
.lang a.on { color: var(--gold); font-weight: 600; }

main.wrap { padding-top: 20px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 16px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 28px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    min-width: 0;
}

.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.grid-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.grid-two.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.gold { color: var(--gold); }
.up { color: var(--win); }
.down { color: var(--loss); }
.winner { color: var(--gold); font-weight: 600; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.rank { color: var(--muted); width: 36px; }
.ranking tr.top1 .rank, .ranking tr.top2 .rank, .ranking tr.top3 .rank { color: var(--gold); font-weight: 700; }

.who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.who img { border-radius: 50%; background: var(--line); flex: none; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .score { margin-left: auto; font-variant-numeric: tabular-nums; }
.result-row { display: flex; align-items: center; gap: 6px; width: 100%; flex-wrap: wrap; }
.result-row .when { margin-left: auto; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--loss); box-shadow: 0 0 0 3px rgba(228, 106, 106, 0.2); flex: none; }

.live-dot.inline { display: inline-block; vertical-align: middle; margin-right: 4px; }

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--gold);
    background: var(--gold-soft); color: var(--gold); font: inherit; font-weight: 600; cursor: pointer;
}
.button:hover { background: var(--gold); color: var(--bg); }
.button.small { padding: 2px 10px; font-size: 13px; }
.list .watch { margin-left: auto; }

.player-card { padding: 0; overflow: hidden; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.player-message {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 16px; text-align: center; color: var(--muted);
}

.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.res { font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.res.win { color: var(--win); background: rgba(108, 194, 138, 0.12); }
.res.loss { color: var(--loss); background: rgba(228, 106, 106, 0.12); }

.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-head .avatar { border-radius: 50%; border: 2px solid var(--gold); background: var(--line); }
.profile-name { flex: 1 1 200px; min-width: 0; }
.profile-name h1 { margin-bottom: 2px; overflow-wrap: anywhere; }
.stats { display: flex; gap: 22px; margin: 0; flex-wrap: wrap; }
.stats dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stats dd { margin: 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart { padding-left: 44px; }
.plot { position: relative; height: 220px; touch-action: pan-y; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .elo-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ylab { position: absolute; left: -44px; width: 36px; text-align: right; transform: translateY(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.xlabels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--muted); pointer-events: none; }
.dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--card); transform: translate(-50%, -50%); pointer-events: none; }
.tip {
    position: absolute; top: 0; transform: translateX(-50%);
    background: #0e1119; border: 1px solid var(--line); border-radius: 6px;
    padding: 4px 10px; font-size: 12px; pointer-events: none; white-space: nowrap;
    display: flex; flex-direction: column; align-items: center;
}
.tip strong { font-size: 15px; color: var(--text); }
.tip span { color: var(--muted); }
[hidden] { display: none !important; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { display: block; height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.bar-value { font-variant-numeric: tabular-nums; font-size: 13px; }
.bar-cell { width: 40%; }

.badges { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badges li { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(212, 168, 82, 0.35); cursor: default; }

.match-head h1 { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.unit { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.unit-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.kit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; margin: 0 0 4px; font-size: 13px; }
.kit div { display: flex; gap: 6px; min-width: 0; }
.kit dt { color: var(--muted); }
.kit dd { margin: 0; overflow-wrap: anywhere; }
details summary { cursor: pointer; }
details p { margin: 4px 0 0; }

@media (max-width: 820px) {
    .grid-main, .grid-two, .grid-two.even { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
    .hide-sm { display: none; }
    .card { padding: 14px; }
    .stats { gap: 16px; }
    .stats dd { font-size: 18px; }
    .top nav { gap: 12px; }
    .lang { padding-left: 10px; }
    .bars li { grid-template-columns: 88px minmax(0, 1fr) auto; }
    .plot { height: 170px; }
    .kit { grid-template-columns: minmax(0, 1fr); }
}
