:root {
  --bg: #0a101c; --panel: #121a2b; --panel-2: #172238; --line: #1f2b44;
  --text: #e8eefc; --muted: #8a9ac0; --blue: #3d8bff; --blue-soft: rgba(61, 139, 255, .14);
  --t-HT1: #ff4d4d; --t-LT1: #ff7a3b; --t-HT2: #ffa53b; --t-LT2: #ffd23b; --t-HT3: #b6e63b;
  --t-LT3: #4fd36b; --t-HT4: #3bd1c4; --t-LT4: #3b9bff; --t-HT5: #7a7fff; --t-LT5: #9aa0a6;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--blue); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.pad { padding: 32px 0; }
main { flex: 1; padding-top: 20px; padding-bottom: 40px; }

/* header */
.top { background: rgba(10, 16, 28, .92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.top-in { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.logo { width: 24px; height: 24px; border-radius: 7px; background: var(--blue); box-shadow: 0 0 18px rgba(61, 139, 255, .45); }
.search { margin-left: auto; position: relative; width: min(280px, 55%); }
.search input { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 12px; font: inherit; outline: none; }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.suggest li a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; }
.suggest li a:hover, .suggest li a.sel { background: var(--blue-soft); color: var(--text); }
.modes { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.modes a { white-space: nowrap; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; font-size: 14px; }
.modes a:hover { color: var(--text); border-color: #2b3d63; }
.modes a.on { background: var(--blue); border-color: var(--blue); color: #06101f; }

/* headings and badges */
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.badge { display: inline-block; min-width: 38px; text-align: center; padding: 1px 8px; border-radius: 7px; font-weight: 700; font-size: 12px; letter-spacing: .3px; border: 1px solid currentColor; background: rgba(255, 255, 255, .03); }
.t-HT1 { color: var(--t-HT1); } .t-LT1 { color: var(--t-LT1); } .t-HT2 { color: var(--t-HT2); } .t-LT2 { color: var(--t-LT2); }
.t-HT3 { color: var(--t-HT3); } .t-LT3 { color: var(--t-LT3); } .t-HT4 { color: var(--t-HT4); } .t-LT4 { color: var(--t-LT4); }
.t-HT5 { color: var(--t-HT5); } .t-LT5 { color: var(--t-LT5); }
.head { width: 28px; height: 28px; border-radius: 6px; image-rendering: pixelated; background: var(--panel-2); flex: none; }
.head.big { width: 96px; height: 96px; border-radius: 14px; }
.head.sm { width: 22px; height: 22px; border-radius: 5px; }
.player { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.player span.n { overflow: hidden; text-overflow: ellipsis; }

/* overall table */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: grid; grid-template-columns: 54px minmax(150px, 1.2fr) 2fr 80px; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.hd { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; background: var(--panel-2); padding-top: 8px; padding-bottom: 8px; }
.row:not(.hd):hover { background: rgba(61, 139, 255, .06); }
.rank { font-weight: 800; color: var(--muted); }
.rank.r1 { color: #ffd23b; } .rank.r2 { color: #cdd6e6; } .rank.r3 { color: #e08a4c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.pts { text-align: right; font-weight: 700; }

/* gamemode board */
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.col h3 { margin: 0; padding: 10px 14px; font-size: 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.col ul { list-style: none; margin: 0; padding: 6px; }
.col li a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.col li a:hover { background: var(--blue-soft); color: var(--text); }
.col li .badge { margin-left: auto; min-width: 30px; font-size: 11px; padding: 0 6px; }
.col .empty { padding: 14px; color: var(--muted); font-size: 13px; }

/* profile */
.prof { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 26px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mcard a { color: var(--muted); font-size: 13px; }
.mcard .badge { margin-top: 6px; font-size: 15px; padding: 3px 12px; }
.mcard small { display: block; color: var(--muted); margin-top: 6px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hist li:last-child { border-bottom: 0; }
.hist .when { margin-left: auto; color: var(--muted); font-size: 13px; }
.arrow { color: var(--muted); }

.foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.foot a { color: var(--blue); font-weight: 600; }
.err { padding: 40px 0; text-align: center; color: var(--muted); }

@media (max-width: 900px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .board { grid-template-columns: 1fr; }
  .row { grid-template-columns: 38px 1fr 64px; }
  .row .chips { display: none; }
  .row.hd .chips { display: none; }
  .head.big { width: 72px; height: 72px; }
  .search { width: 52%; }
}
