: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; }

.online-count { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--win); flex: none; }

.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; }
.copy { white-space: nowrap; }
h2 .copy, .unit-head .copy { margin-left: auto; }
.unit-head .copy { padding: 0 8px; font-size: 12px; align-self: center; }
.copy.done, .copy.done:hover { border-color: var(--win); background: rgba(108, 194, 138, 0.12); color: var(--win); }
.copy-hint { margin-bottom: 0; }

.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; }

.patch h3 { font-size: 14px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; margin: 22px 0 6px; scroll-margin-top: 12px; }
.patch-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.changes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.changes > li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.changes ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.changes ul li { margin: 2px 0; overflow-wrap: anywhere; }
.changes .why { margin: 8px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.changes .why span { color: var(--gold); font-weight: 600; margin-right: 4px; }
.change-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kind { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.kind.buff { color: var(--win); background: rgba(108, 194, 138, 0.12); }
.kind.nerf { color: var(--loss); background: rgba(228, 106, 106, 0.12); }
.kind.ban { color: var(--bg); background: var(--loss); }
.kind.change { color: var(--gold); background: var(--gold-soft); }

/* Class guide */
.class-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.class-grid-title { margin-top: 22px; }
.class-tile {
    display: flex; gap: 12px; align-items: center; height: 100%;
    border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 8px 8px;
    background: linear-gradient(135deg, rgba(212, 168, 82, 0.06), transparent 60%);
    transition: border-color 0.15s, transform 0.15s;
}
.class-tile:hover { border-color: var(--gold); color: inherit; transform: translateY(-1px); }
.class-tile:hover strong { color: var(--gold); }
.class-tile img { width: 56px; height: 77px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #0e1119; flex: none; }
.class-tile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.class-tile-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.class-hero { display: flex; gap: 22px; align-items: flex-start; background: linear-gradient(120deg, rgba(212, 168, 82, 0.10), var(--card) 45%); }
.hero-portraits { display: flex; gap: 10px; flex: none; }
.hero-portraits figure { margin: 0; text-align: center; }
.hero-portraits img { display: block; width: 141px; height: 195px; border-radius: 10px; border: 2px solid rgba(212, 168, 82, 0.55); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); background: #0e1119; }
.hero-portraits figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hero-info { flex: 1; min-width: 0; }
.hero-info h1 { font-size: 28px; margin-bottom: 0; }
.hero-sub { margin: 0; }
.badges li.plain { background: transparent; color: var(--text); border-color: var(--line); }
.badges li.plain a:hover { color: var(--gold); }
.guide-h { font-size: 13px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 8px; }
.guide-h.first { margin-top: 0; }
.stat-tiles { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.stat-tiles li { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: rgba(0, 0, 0, 0.18); display: flex; flex-direction: column; min-width: 0; }
.stat-tiles span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-tiles strong { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide-kit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.guide-changes { margin-top: 16px; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 12px; background: rgba(0, 0, 0, 0.15); }
.guide-changes ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); white-space: nowrap; }
.chip.faint { color: var(--muted); border-style: dashed; }
.chip.gold-chip { color: var(--gold); border-color: rgba(212, 168, 82, 0.35); background: var(--gold-soft); }
.chip.el { font-weight: 600; border-color: currentColor; background: transparent; }
.el-fire { color: #ef8354; }
.el-ice { color: #7fd0f0; }
.el-lightning { color: #f0d55a; }
.el-wind { color: #8fd18a; }
.el-earth { color: #c9a273; }
.el-water { color: #6f9cf0; }
.el-holy { color: #f3ebc4; }
.el-dark { color: #b48ae8; }
.abilities { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.ability { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; background: rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; scroll-margin-top: 12px; }
.ability:hover { border-color: rgba(212, 168, 82, 0.45); }
.ability:target { border-color: var(--gold); }
.ability p { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.ability .effect { color: var(--gold); background: var(--gold-soft); border-left: 2px solid var(--gold); border-radius: 0 6px 6px 0; padding: 5px 9px; font-size: 13px; }
.ability .chips { margin-top: auto; padding-top: 10px; }
.class-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.class-pager a { display: flex; flex-direction: column; gap: 2px; }
.class-pager a.next { text-align: right; }
.class-pager a:hover { border-color: var(--gold); }
.jp { font-size: 12px; font-weight: 600; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Equipment */
.equip-search { width: 100%; max-width: 360px; margin-top: 4px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit; }
.equip-search:focus { outline: none; border-color: var(--gold); }
.equip-type { scroll-margin-top: 12px; }
.equip-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin-bottom: 12px; }
.equip-who .chips { margin: 0; }
.chip a:hover { color: var(--gold); }
[hidden] { display: none !important; }

@media (max-width: 820px) {
    .class-hero { flex-direction: column; }
    .stat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .guide-kit { grid-template-columns: minmax(0, 1fr); }
    .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-row { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; row-gap: 6px; }
    .top nav { gap: 12px; flex-wrap: wrap; row-gap: 4px; }
    .lang { padding-left: 10px; }
    .bars li { grid-template-columns: 88px minmax(0, 1fr) auto; }
    .plot { height: 170px; }
    .kit { grid-template-columns: minmax(0, 1fr); }
    .changes { grid-template-columns: minmax(0, 1fr); }
    .abilities { grid-template-columns: minmax(0, 1fr); }
    .class-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-portraits img { width: 94px; height: 130px; }
    .hero-info h1 { font-size: 24px; }
}
