:root {
  color-scheme: dark;
  --bg: #15171c;
  --panel: #1e2128;
  --line: #2f343f;
  --text: #e8eaef;
  --muted: #98a0af;
  --accent: #ff9a3c;
  --warn: #f2c14e;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.top, main, .foot { width: 100%; max-width: 920px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 12px; }
main { flex: 1; padding-top: 8px; padding-bottom: 24px; }

.brand { color: var(--text); text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 1.25rem; letter-spacing: 0.06em; color: var(--accent); }
.brand span { color: var(--muted); font-size: 0.9rem; }

.search { display: flex; gap: 6px; }
.search input {
  width: 220px; max-width: 60vw; padding: 7px 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.search button {
  padding: 7px 14px; background: var(--accent); color: #1a1208; border: 0; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer;
}

.muted { color: var(--muted); font-size: 0.875rem; }
.note { font-size: 1.05rem; margin: 24px 0 12px; }

.range-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 16px; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--muted); text-decoration: none;
}
.tabs a[aria-current="page"] { background: var(--panel); color: var(--text); border-color: var(--accent); font-weight: 600; }

.banner {
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--warn); border-radius: 6px; background: #2a2514; color: var(--warn);
}

.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; transition: opacity 0.2s; }
.boards.dimmed { opacity: 0.45; }
.board { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.board h2 { margin: 0 0 8px; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.board ol { list-style: none; margin: 0; padding: 0; }

.row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.row .rank { width: 1.6em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .face { width: 28px; height: 28px; flex: none; image-rendering: pixelated; border-radius: 3px; background: var(--line); }
.row .name { line-height: 28px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row span.name { color: var(--muted); }
.row a.name:hover { color: var(--accent); }
.row .leader { flex: 1; min-width: 12px; border-bottom: 1px dotted var(--line); transform: translateY(4px); }
.row .score { font-variant-numeric: tabular-nums; font-weight: 600; }
.row.nobody { color: var(--muted); padding: 8px 0; }
.updated { margin: 12px 0 0; text-align: right; }

.skeleton { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.skeleton div { height: 180px; border-radius: 8px; background: linear-gradient(90deg, var(--panel), #272b34, var(--panel)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton div { animation: none; } .boards { transition: none; } }

.back { display: inline-block; line-height: 28px; margin: 8px 0 12px; text-decoration: none; }
.player { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.skin-box { width: 220px; height: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.skin-box.flat { width: auto; height: auto; padding: 14px; }
.skin-box canvas { display: block; }
.skin-box .flat-face { width: 64px; height: 64px; image-rendering: pixelated; }
.player-info { flex: 1; min-width: 240px; }
.player-info h1 { margin: 0 0 12px; font-size: 1.8rem; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stats dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.foot { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 28px; color: var(--muted); font-size: 0.85rem; }
.foot p { margin: 4px 0; }
.foot .legal { font-size: 0.75rem; letter-spacing: 0.02em; }

@media (max-width: 640px) {
  .boards, .skeleton { grid-template-columns: 1fr; }
  .search input { width: 160px; }
}
@media (pointer: coarse) {
  .row .name, .back { line-height: 44px; }
}
