:root{
  --bg:#12141a; --panel:#191c24; --panel2:#1f2430; --line:#2a3040;
  --text:#e6e9f0; --dim:#8d95a8; --accent:#ffd45e; --up:#5fd97a;
  --down:#ff6b5e; --link:#7fb4ff;
}
*{box-sizing:border-box}
body{
  margin:0; background:var(--bg); color:var(--text);
  font:15px/1.5 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}
.wrap{max-width:1080px; margin:0 auto; padding:0 18px}
.hidden{display:none !important}
a{color:var(--link); text-decoration:none}
a:hover{text-decoration:underline}
code{background:var(--panel2); padding:1px 5px; border-radius:4px; font-size:12px}

header{border-bottom:1px solid var(--line); background:var(--panel); position:sticky; top:0; z-index:5}
.head{display:flex; align-items:center; gap:18px; height:58px}
.brand{font-weight:800; letter-spacing:.5px}
.brand span{color:var(--accent)}
nav{display:flex; gap:14px}
nav a{color:var(--dim); padding:4px 2px; border-bottom:2px solid transparent}
nav a.active{color:var(--text); border-bottom-color:var(--accent)}
nav a:hover{text-decoration:none; color:var(--text)}
.spacer{flex:1}
input[type=search],input[type=password],input[type=text]{
  background:var(--panel2); border:1px solid var(--line); color:var(--text);
  border-radius:7px; padding:7px 10px; outline:none; min-width:180px;
}
input:focus{border-color:var(--accent)}
button{
  background:var(--panel2); border:1px solid var(--line); color:var(--text);
  border-radius:7px; padding:7px 12px; cursor:pointer;
}
button:hover{border-color:var(--accent)}
button.ghost{color:var(--dim)}

.adminbar{background:#241f14; border-bottom:1px solid #3a3018; padding:10px 0}
.adminbar .wrap{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.hint{color:var(--dim); font-size:13px}
main{padding:22px 0 40px}
.lead{color:var(--dim); max-width:70ch}

.totals{display:flex; gap:22px; flex-wrap:wrap; margin-bottom:16px; color:var(--dim); font-size:13px}
.totals b{color:var(--text); font-size:16px; display:block}

table.grid{width:100%; border-collapse:collapse}
.grid th{
  text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.6px;
  color:var(--dim); font-weight:600; padding:8px 10px; border-bottom:1px solid var(--line);
}
.grid td{padding:9px 10px; border-bottom:1px solid #21252f}
.grid tbody tr:hover{background:var(--panel)}
.num{text-align:right}
.rank{color:var(--dim); width:46px}
.elo{font-weight:700; font-variant-numeric:tabular-nums}
.nick{font-weight:600}

.tier{
  display:inline-block; min-width:34px; text-align:center; padding:2px 8px;
  border-radius:6px; font-weight:700; font-size:12px; background:var(--panel2);
  border:1px solid var(--line); color:var(--dim);
}
.tier.t-Splus{background:#4a0f16; border-color:#a0303c; color:#ff9b9b}
.tier.t-S{background:#3b1418; border-color:#7b2630; color:#ff8a8a}
.tier.t-Aplus,.tier.t-A,.tier.t-Aminus{background:#3a3110; border-color:#7a6a1e; color:var(--accent)}
.tier.t-Bplus,.tier.t-B,.tier.t-Bminus{background:#122a3c; border-color:#22557a; color:#7fc4ff}
.tier.t-Cplus,.tier.t-C,.tier.t-Cminus{background:#1a2a1c; border-color:#2f5c35; color:#8fd79a}
.tier.t-Dplus,.tier.t-D,.tier.t-Dminus{background:#242424; border-color:#3d3d3d; color:#b0b0b0}
.tier.t-Eplus,.tier.t-E{background:#1c1a22; border-color:#332f3d; color:#8b869a}
.unplayed{opacity:.55}
.unplayed .elo{color:var(--dim)}

.flag{color:var(--accent); font-weight:700; cursor:help}
.badge{
  display:inline-block; margin-left:8px; padding:1px 7px; border-radius:5px;
  font-size:11px; background:var(--panel2); border:1px solid var(--line);
  color:var(--dim); cursor:help;
}
.badge.up{color:var(--up); border-color:#2f5c35}
.badge.down{color:var(--down); border-color:#6b2a24}
.badge.calib{color:#e0b64a; border-color:#6b5420; background:#2b2415}
.calib{color:#e0b64a; font-size:12px; cursor:help}
.subtle{color:var(--dim); font-size:13px; margin:10px 0 0}

.bandsbox{
  background:var(--panel); border:1px solid var(--line); border-radius:10px;
  padding:14px 16px; margin-bottom:18px;
}
.bandshead{display:flex; align-items:baseline; gap:12px; margin-bottom:10px; font-size:13px}
.dist{width:100%; height:168px; display:block}
.dist .distarea{fill:rgba(255,212,94,.13)}
.dist .distline{fill:none; stroke:var(--accent); stroke-width:2; stroke-linejoin:round}
.dist .bandcell{opacity:.85}
.dist .bandcell:hover{opacity:1}
.dist .banddiv{stroke:#5a6272; stroke-width:1; stroke-dasharray:3 3; opacity:.7}
.dist .bandlabel{fill:#12141a; font-size:12px; font-weight:800}
.dist .bandtick{fill:var(--dim); font-size:11px; font-variant-numeric:tabular-nums}
.glyph{
  height:1.05em; width:auto; vertical-align:-0.15em; margin:0 1px;
  image-rendering:auto;
}
.playerhead h1 .glyph{height:0.85em}
.ico{
  display:inline-block; vertical-align:middle; margin-right:8px; flex:none;
  background-size:contain; background-repeat:no-repeat; background-position:center;
}
.namecell{display:flex; align-items:center}
.guess{color:var(--dim); font-size:12px; font-style:italic; cursor:help}

.tiergroup{margin:18px 0 26px}
.tierhead{display:flex; align-items:baseline; gap:12px; margin-bottom:8px}
.tierhead h2{margin:0; font-size:18px}
.tierhead .meta{color:var(--dim); font-size:13px}
.tierrow{
  display:flex; align-items:center; gap:12px; padding:7px 10px;
  border-bottom:1px solid #21252f;
}
.tierrow:hover{background:var(--panel)}
.tierrow .nick{flex:1}
.tierrow .exact{min-width:38px; margin-right:2px}
.event .by{color:var(--dim); font-size:12px; width:110px; text-align:right}
.dim{color:var(--dim)}
.tierrow .elo{width:70px; text-align:right}

.card{background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:18px; margin-bottom:16px}
.playerhead{display:flex; align-items:center; gap:16px; flex-wrap:wrap}
.playerhead h1{margin:0; font-size:26px}
.pb{color:var(--dim); font-size:12px; font-family:ui-monospace,monospace}
.statline{display:flex; gap:26px; flex-wrap:wrap; margin-top:14px}
.statline div{color:var(--dim); font-size:13px}
.statline b{display:block; color:var(--text); font-size:19px; font-variant-numeric:tabular-nums}

.chart{width:100%; height:200px; display:block}
.chart .line{fill:none; stroke:var(--accent); stroke-width:2}
.chart .area{fill:rgba(255,212,94,.10)}
.chart .base{stroke:#39404f; stroke-width:1; stroke-dasharray:4 4}
.chart text{fill:var(--dim); font-size:11px}

.events{max-height:420px; overflow:auto}
.event{display:flex; gap:12px; padding:6px 0; border-bottom:1px solid #21252f; font-size:14px}
.event .when{color:var(--dim); width:120px; flex:none; font-size:12px}
.event .what{flex:1}
.event .d{width:64px; text-align:right; font-variant-numeric:tabular-nums; font-weight:600}
.up{color:var(--up)} .down{color:var(--down)}

.suggest{background:#241f14; border:1px solid #3a3018; border-radius:8px; padding:10px 14px; margin-top:12px}
.tierpick{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px}
.tierpick button{padding:4px 10px; font-size:13px}
.tierpick button.on{border-color:var(--accent); color:var(--accent)}

footer{color:var(--dim); font-size:12px; padding-bottom:30px}
.empty{color:var(--dim); padding:24px 0}

/* --- онлайн и чат --- */
.ocount{
  display:none; margin-left:6px; padding:0 6px; border-radius:9px;
  font-size:11px; font-weight:700; background:#1d3a24; color:var(--up);
  border:1px solid #2f5c35; vertical-align:1px;
}
.ocount.live{display:inline-block}

.servers{display:flex; flex-direction:column; gap:12px; margin-bottom:16px}
.server{background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:14px 16px}
.serverhead{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.serverhead .dot{
  width:8px; height:8px; border-radius:50%; background:var(--up); flex:none;
  box-shadow:0 0 0 3px rgba(95,217,122,.15);
}
.serverhead .sname{font-size:15px}
.serverhead .meta{color:var(--dim); font-size:13px}
.serverhead .count{
  margin-left:auto; font-variant-numeric:tabular-nums; font-weight:700;
  color:var(--dim);
}
.server.off{opacity:.5}
.server.off .dot{background:#4a5060; box-shadow:none}

.chips{display:flex; flex-wrap:wrap; gap:8px; margin-top:12px}
.chip{
  display:flex; align-items:center; gap:6px; padding:4px 10px 4px 6px;
  background:var(--panel2); border:1px solid var(--line); border-radius:20px;
}
.chip .ico{margin-right:0}
.chip .nick{font-weight:600; font-size:14px}
.chip .tier{min-width:0; padding:1px 6px; font-size:11px}
.chipelo{color:var(--dim); font-size:12px; font-variant-numeric:tabular-nums}
.chip.watching{opacity:.55}
.chips .empty{padding:2px 0; font-size:13px}

.chathead{display:flex; align-items:center; gap:14px; margin-bottom:10px}
.chathead h2{margin:0; font-size:18px}
.chatfilter{display:flex; gap:6px; flex-wrap:wrap}
.chatfilter button{padding:2px 9px; font-size:12px; color:var(--dim)}
.chatfilter button.on{border-color:var(--accent); color:var(--accent)}
.chatbox{max-height:50vh; overflow:auto; overflow-wrap:anywhere}
.msg{display:flex; gap:9px; align-items:baseline; padding:3px 0; font-size:14px}
.msg .when{color:var(--dim); font-size:11px; flex:none; font-variant-numeric:tabular-nums}
.msg .srvtag{
  flex:none; font-size:11px; color:var(--dim); background:var(--panel2);
  border:1px solid var(--line); border-radius:5px; padding:0 5px;
}
.msg .who{font-weight:600; flex:none; max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.msg .who::after{content:':'; color:var(--dim)}
.msg .text{flex:1}
