:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg2: #0e1118;
  --panel: #141824;
  --panel2: #1b2130;
  --border: #262d3f;
  --text: #eef1f7;
  --muted: #9aa3b5;
  --gold: #f5b942;
  --gold2: #ffdf8e;
  --t1: #ffd75e;
  --t2: #c77dff;
  --t3: #4cc9f0;
  --t4: #80ed99;
  --t5: #9aa0ae;
  --r: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: radial-gradient(1200px 400px at 50% -100px, #171c2b 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: rgba(14, 17, 24, 0.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; text-decoration: none; height: 40px; }
.logo img { height: 40px; width: auto; }
.logo img + .logofallback { display: none; }
.logofallback { font-size: 22px; font-weight: 800; color: #fff; white-space: nowrap; }
.logofallback span { color: var(--gold); }
.modenav { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 2px; }
.mnav {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 56px; padding: 6px 8px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 700;
  border: 1px solid transparent;
}
.mnav:hover { background: var(--panel); color: #fff; }
.mnav.on { border-color: var(--gold); color: var(--gold2); background: #1d1a10; }
.mnav .cup { font-size: 24px; line-height: 32px; }
.top nav.links { display: flex; gap: 14px; }
.searchbox { margin-left: auto; position: relative; flex-shrink: 0; }
.searchbox input {
  width: 220px; padding: 9px 13px; font-size: 14px; color: #fff;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.searchbox input:focus { outline: none; border-color: var(--gold); }
.qres {
  position: absolute; right: 0; top: 44px; width: 300px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; display: none; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.qres a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  color: var(--text); text-decoration: none; font-size: 14px;
}
.qres a:hover { background: #262d40; }
.qres img { width: 28px; height: 28px; border-radius: 6px; }
.qres .pts { margin-left: auto; color: var(--muted); font-size: 12px; }
/* ---------- layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 16px 60px; }
.hero { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.hero h1 { font-size: 30px; margin: 0; }
.hero p { color: var(--muted); margin: 4px 0 0; }
h2.sec { font-size: 18px; margin: 30px 0 12px; }
.errbox {
  background: #2a1618; border: 1px solid #5c2b2e; color: #ffb4b4;
  padding: 12px 14px; border-radius: 10px; font-size: 14px;
}
/* ---------- mode icons ---------- */
.micon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #232a3d, #171c2b);
  border: 1px solid var(--border);
  font-weight: 800; font-size: 18px; color: var(--gold2);
}
.micon.big { width: 72px; height: 72px; font-size: 32px; border-radius: 16px; }
.micon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mnav .micon { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
/* ---------- leaderboard ---------- */
.lb { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.lbrow {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  text-decoration: none; color: var(--text); font-size: 15px;
  border-bottom: 1px solid var(--border); transition: background 0.12s;
}
.lbrow:last-child { border-bottom: 0; }
.lbrow:hover { background: var(--panel2); }
.lbrow .rank { width: 36px; font-weight: 800; color: var(--muted); }
.lbrow .rank.r1 { color: var(--t1); } .lbrow .rank.r2 { color: #dfe5ef; } .lbrow .rank.r3 { color: #e0a060; }
.lbrow img.head { width: 32px; height: 32px; border-radius: 7px; }
.lbrow .pts { margin-left: auto; font-weight: 700; white-space: nowrap; }
.lbrow .pts small { color: var(--muted); font-weight: 400; }
/* ---------- mode cards ---------- */
.mode-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.mode-card {
  display: flex; align-items: center; gap: 14px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--r); padding: 16px;
  text-decoration: none; color: var(--text); transition: transform 0.12s, border-color 0.12s;
}
.mode-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.mode-card h3 { margin: 0 0 3px; font-size: 17px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 13px; }
/* ---------- tier badge ---------- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 800; white-space: nowrap;
  border: 1px solid currentColor; border-radius: 6px; padding: 1px 7px;
  background: rgba(255, 255, 255, 0.03);
}
.b1 { color: var(--t1); } .b2 { color: var(--t2); } .b3 { color: var(--t3); }
.b4 { color: var(--t4); } .b5 { color: var(--t5); }
/* ---------- tier sections ---------- */
.tier-sec { margin-bottom: 26px; }
.tier-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.tier-head h2 { margin: 0; font-size: 20px; }
.tier-head span { color: var(--muted); font-size: 13px; }
.pgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.pcard {
  display: flex; align-items: center; gap: 10px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px;
  text-decoration: none; color: var(--text); transition: background 0.12s, border-color 0.12s;
}
.pcard:hover { background: var(--panel2); border-color: #3a4358; }
.pcard img.head { width: 40px; height: 40px; border-radius: 8px; }
.pcard .nm { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .sub { color: var(--muted); font-size: 12px; }
.pcard .right { margin-left: auto; text-align: right; }
/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; margin: 14px 0 20px; flex-wrap: wrap; }
.chip {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.chip:hover { color: #fff; }
.chip.on { color: #111; background: var(--gold); border-color: var(--gold); }
/* ---------- player page ---------- */
.prof {
  display: flex; gap: 18px; align-items: center; background: linear-gradient(135deg, #1a2030, var(--panel));
  border: 1px solid var(--border); border-radius: 16px; padding: 22px;
}
.prof img.head { width: 96px; height: 96px; border-radius: 14px; }
.prof h1 { margin: 0 0 4px; font-size: 26px; }
.prof .meta { color: var(--muted); font-size: 14px; }
.trow {
  display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
  font-size: 15px;
}
.trow .pts { margin-left: auto; color: var(--muted); white-space: nowrap; }
.retired {
  display: inline-block; margin-top: 8px; font-size: 13px; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 6px; padding: 2px 8px;
}
footer { text-align: center; color: #565d6c; font-size: 13px; padding: 26px 0 40px; }
@media (max-width: 720px) {
  .searchbox input { width: 130px; }
  .top { gap: 10px; padding: 10px 12px; }
  .hero h1 { font-size: 24px; }
  .prof img.head { width: 72px; height: 72px; }
}
