:root {
  --bg: #faf6f0; --panel: #fff; --ink: #3b2a22; --muted: #8a7568; --line: #eadfd3; --accent: #c7622b;
  --add: #dff3dc; --add-ink: #1f6b2a; --del: #fbe3df; --del-ink: #a13324;
  --tutorial: #5b8def; --normal: #9aa3ad; --hard: #d9534f; --relief: #4caf7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1815; --panel: #28211d; --ink: #f1e6da; --muted: #a8968a; --line: #3a302a; --accent: #f0915a;
    --add: #1f3a24; --add-ink: #9be0a5; --del: #45211c; --del-ink: #f2a79b;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header { position: sticky; top: 0; z-index: 2; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
footer { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; font-size: 13px; }
.muted { color: var(--muted); }
select, input[type=search] { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; max-width: 100%; }
input[type=search] { flex: 1 1 260px; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; color: var(--ink); background: var(--panel); border: 0; padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: 56px 132px 64px 1fr; gap: 10px; align-items: baseline; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--ink); }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--bg); text-decoration: none; }
.num { font-weight: 700; font-variant-numeric: tabular-nums; }
.size { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.cats { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 999px; color: #fff; white-space: nowrap; }
.badge.tutorial { background: var(--tutorial); } .badge.normal { background: var(--normal); }
.badge.hard { background: var(--hard); } .badge.relief { background: var(--relief); }
.badge.changed { background: var(--accent); margin-left: 6px; }
.chapter { padding: 6px 12px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg); border-top: 1px solid var(--line); }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.card h2 { font-size: 15px; margin: 0 0 2px; }
.card .meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.group { padding: 3px 0; }
.group b { font-weight: 600; }
.group.gone { opacity: .55; text-decoration: line-through; }
.group.added b, ins { background: var(--add); color: var(--add-ink); text-decoration: none; border-radius: 4px; padding: 0 3px; }
del { background: var(--del); color: var(--del-ink); border-radius: 4px; padding: 0 3px; }
.note { font-size: 12px; color: var(--muted); margin-left: 6px; }
.more { display: block; width: 100%; margin-top: 12px; padding: 10px; font: inherit; color: var(--accent); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
@media (max-width: 640px) {
  .row { grid-template-columns: 44px 1fr 56px; }
  .row .cats { grid-column: 1 / -1; white-space: normal; }
}
