:root {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #323230;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8e85;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --good: #0ca30c;
  --bad: #e66767;
  --accent: #3987e5;
  --grid: #2c2c2a;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f3f0;
    --surface: #fcfcfb;
    --surface-2: #f0efec;
    --border: #dddcd6;
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #77766f;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --good: #0ca30c;
    --bad: #d03b3b;
    --accent: #2a78d6;
    --grid: #e6e5e0;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 6px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .04em; }
.player { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.player .name { font-weight: 600; }
.player .tag { color: var(--muted); font-weight: 400; }
.rank { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.rank img { width: 22px; height: 22px; }
.sync { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.btn { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
main { padding-top: 16px; padding-bottom: 32px; min-height: 60vh; }
.banner { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; min-width: 120px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--text-2); }
.tile .v { font-size: 26px; font-weight: 650; line-height: 1.25; margin-top: 2px; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; min-width: 0; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; }
.card h2 { font-size: 14px; margin: 0 0 10px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: 12px; color: var(--text-2); background: transparent; border: 0; padding: 3px 9px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: 600; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

.stack { display: flex; gap: 2px; height: 22px; margin: 6px 0 10px; }
.stack i { display: block; min-width: 2px; }
.stack i:first-child { border-radius: 4px 0 0 4px; } .stack i:last-child { border-radius: 0 4px 4px 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend b { color: var(--text); font-weight: 600; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.kv dd small { font-weight: 400; color: var(--muted); margin-left: 6px; }

.tablewrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--border); }
th { font-size: 11px; font-weight: 500; color: var(--muted); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th.l, td.l { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
tr.me td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.bar { display: inline-block; width: 64px; height: 6px; background: var(--surface-2); border-radius: 3px; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.agent { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.agent img { width: 24px; height: 24px; border-radius: 4px; background: var(--surface-2); flex: none; }
.agent .muted { margin-left: -6px; }
.res { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.res::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--muted); }
.res.w::before { background: var(--good); } .res.l::before { background: var(--bad); }
.pos::before { content: "+"; }

.mhead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.mhead .score { font-size: 28px; font-weight: 700; }
.back { color: var(--text-2); display: inline-block; margin-bottom: 10px; }
.rounds { display: flex; gap: 3px; flex-wrap: wrap; }
.rounds button { font: inherit; font-size: 11px; width: 34px; padding: 4px 0 3px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--text-2); cursor: pointer; line-height: 1.2; }
.rounds button b { display: block; font-size: 12px; color: var(--text); }
.rounds button.w { border-bottom: 3px solid var(--good); } .rounds button.l { border-bottom: 3px solid var(--bad); }
.rounds button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.rounds .gap { width: 10px; }
.feed { list-style: none; margin: 12px 0 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.feed li:last-child { border-bottom: 0; }
.feed .t { color: var(--muted); width: 44px; }
.feed .who { white-space: nowrap; }
.feed .mine { font-weight: 700; }
.feed .ally { color: var(--text); } .feed .enemy { color: var(--text-2); }
.pill { font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; color: var(--text-2); }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 16px rgb(0 0 0 / .25); max-width: 260px; }
.tip b { font-size: 14px; }
.foot { font-size: 11px; padding-top: 12px; padding-bottom: 24px; }

@media (max-width: 700px) {
  .top { position: static; }
  .player { order: 3; flex-basis: 100%; }
  .sync { margin-left: auto; }
  .feed li { gap: 6px 10px; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c8, .c7, .c6, .c5, .c4 { grid-column: span 12; }
}
