:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1b1b22; --muted: #6b6b76; --line: #dedcd4; --accent: #e8a400; --accent-ink: #1b1b22;
  --bad: #c62828; --bad-bg: #fde8e6; --warn: #a85600; --warn-bg: #fff0e0; --ok: #2e7d32; --ok-bg: #e5f3e6; --focus: #2a63ff;
  --section: #ecebe5; --hit: #fff3b8; --ev: #2a63ff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15151a; --panel: #1e1e25; --ink: #ecebe6; --muted: #9a9aa5; --line: #34343e; --accent: #ffc41c; --accent-ink: #15151a;
    --bad: #ff7a70; --bad-bg: #3b1f1d; --warn: #ffb067; --warn-bg: #3d2a18; --ok: #7bd389; --ok-bg: #1d3320; --focus: #7aa2ff;
    --section: #26262e; --hit: #4a4220; --ev: #8fb0ff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
code, pre { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; text-decoration: underline; }
input, select, textarea { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

header.top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 700; text-decoration: none; }
header.top nav { display: flex; gap: 12px; flex: 1; }
header.top nav a { text-decoration: none; color: var(--muted); }
header.top nav a[aria-current] { color: var(--ink); font-weight: 600; }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }
main.wide { max-width: none; }
main.narrow { max-width: 420px; margin-top: 10vh; }
main.narrow-wide { max-width: 760px; }
h1 { font-size: 20px; margin: 4px 0 8px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--bad); }
.empty { padding: 24px; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }
.crumbs { margin: 0; color: var(--muted); }
.login, .upload { display: grid; gap: 12px; }
.login label, .upload label { display: grid; gap: 4px; font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1 1 240px; }
.table { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--section); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-weight: 700; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: 1px;
  background: var(--section); color: var(--muted); }
.badge.crash { background: var(--bad-bg); color: var(--bad); }
.badge.cut-off { background: var(--warn-bg); color: var(--warn); }
.badge.quit { background: var(--ok-bg); color: var(--ok); }

.report section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px 12px; margin: 12px 0; }
.report section.hints { border-color: var(--accent); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stack { margin: 0; padding-left: 28px; }
.stack li { overflow-wrap: anywhere; }
.stack li.game { font-weight: 700; }
.stack .mod { color: var(--muted); }
details.msg { border-top: 1px solid var(--line); padding: 6px 0; }
details.msg summary { cursor: pointer; overflow-wrap: anywhere; }
details.msg .count { display: inline-block; min-width: 3.5em; font-weight: 700; color: var(--bad); }
pre { background: var(--section); padding: 8px 10px; border-radius: 6px; overflow-x: auto; margin: 6px 0; }
pre.tail { max-height: 420px; overflow-y: auto; }
.timeline { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow-y: auto; }
.timeline li { padding: 2px 0; overflow-wrap: anywhere; }
.timeline .t { display: inline-block; min-width: 5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.charts { display: flex; flex-wrap: wrap; gap: 16px; }
.chart { margin: 0; flex: 1 1 280px; max-width: 420px; }
.chart svg { width: 100%; height: auto; display: block; background: var(--section); border-radius: 6px; }
.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--line); }
.chart .range { font-size: 12px; }
.files { padding-left: 20px; }
.note { display: grid; gap: 8px; }
.danger { margin-top: 12px; }
.danger button { color: var(--bad); }

.log { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.log table { font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.log td { border: 0; padding: 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log td:first-child { text-align: right; color: var(--muted); user-select: none; width: 1%; white-space: nowrap; }
.log td:first-child a { text-decoration: none; }
.log tr.ev td:last-child { color: var(--ev); }
.log tr.bad td:last-child { color: var(--bad); }
.log tr.hit, .log tr:target { background: var(--hit); }
.pager { margin: 8px 0; }

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
  .facts dt { margin-top: 6px; }
}
