:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #6b6b73;
  --line: #e6e4df;
  --accent: #e1306c;
  --up: #11845b;
  --down: #c2410c;
  --chip: #ecebe6;
  --bar: #18181b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f11;
    --surface: #18181b;
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --line: #2a2a2f;
    --accent: #ff5c93;
    --up: #34d399;
    --down: #fb923c;
    --chip: #232328;
    --bar: #e4e4e7;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", sans-serif;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

.top { position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-top: 20px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.updated { margin: 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; padding-top: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 12px 10px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

main { padding-top: 16px; padding-bottom: 64px; }
.note { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 32px 0 6px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: grid; grid-template-columns: 34px 52px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.rank { text-align: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.move { display: block; font-size: 11px; font-weight: 700; line-height: 1.2; }
.move.up { color: var(--up); }
.move.down { color: var(--down); }
.move.new { color: var(--accent); }
.move.same { color: var(--muted); font-weight: 500; }
.art { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; position: relative; background: var(--chip); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play {
  position: absolute; inset: 0; border: 0; cursor: pointer; color: #fff; font-size: 18px;
  background: rgb(0 0 0 / 0.35); opacity: 0; transition: opacity .15s;
}
.art:hover .play, .play:focus-visible, .play.on { opacity: 1; }
.meta { min-width: 0; }
.title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.extra { color: var(--muted); font-size: 12px; }
.links { display: flex; gap: 6px; }
.links a {
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.links a:hover { border-color: var(--ink); }

.more { display: block; margin: 14px auto 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chips button { border: 0; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.card .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .hint { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
td code { word-break: break-word; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.bar { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bar i { display: block; width: 100%; max-width: 22px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar i.failed { background: var(--down); }
.bar span { font-size: 10px; color: var(--muted); white-space: nowrap; }

.api-doc pre { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; overflow-x: auto; margin: 10px 0; }

@media (max-width: 560px) {
  .row { grid-template-columns: 28px 46px 1fr; }
  .art { width: 46px; height: 46px; }
  .links { grid-column: 3; }
}
