/* Layout: header with progress per milestone, a sticky filter bar, then one collapsible section per item category.
   Inside each category items run in progression order, with a divider where the Dragon Slayer milestone falls. */
:root {
  --bg: #eaefe9;
  --surface: #f7f9f5;
  --fg: #1b241e;
  --muted: #56645b;
  --line: #cbd5cc;
  --accent: #a3461c;
  --accent-soft: #f4e3d3;
  --done: #2f7449;
  --done-soft: #dcebdf;
  --font-display: "Alegreya Sans SC", "Trebuchet MS", sans-serif;
  --font-body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121815; --surface: #1a221e; --fg: #e3eae4; --muted: #95a49a; --line: #2c3832;
    --accent: #e48a52; --accent-soft: #3a2a1e; --done: #79c08f; --done-soft: #1f3327; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121815; --surface: #1a221e; --fg: #e3eae4; --muted: #95a49a; --line: #2c3832;
  --accent: #e48a52; --accent-soft: #3a2a1e; --done: #79c08f; --done-soft: #1f3327; color-scheme: dark;
}
/* The display rules below would otherwise override the hidden attribute (the reset confirmation and button). */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 48px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.wrap { max-width: 1080px; margin: 0 auto; display: grid; gap: 20px; }
header { display: grid; gap: 12px; }
.eyebrow { font-family: var(--font-display); letter-spacing: .08em; color: var(--accent); font-size: 15px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 5vw, 44px); line-height: 1.05; margin: 0; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 66ch; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.stat { display: grid; gap: 6px; min-width: 0; }
.stat-label { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.stat-label b { font-family: var(--font-data); font-weight: 500; color: var(--fg); font-variant-numeric: tabular-nums; font-size: 13px; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--done); transition: width .25s ease; }
.meter.after > span { background: var(--accent); }
.meter.unknown > span { background: var(--muted); }
.filters {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding-block: 10px; border-bottom: 1px solid var(--line);
}
input[type="search"], select, button, .toggle {
  font: inherit; font-size: 14px; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
input[type="search"] { flex: 1 1 220px; min-width: 0; }
select { max-width: 100%; }
button, .toggle { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .toggle:hover, select:hover { border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--surface); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.danger { color: var(--accent); }
.confirm { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.status { font-size: 13px; color: var(--muted); }
.shown { font-size: 13px; color: var(--muted); font-family: var(--font-data); }
details.cat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
details.cat > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary::before { content: "\25B8"; color: var(--muted); transition: transform .15s; display: inline-block; }
details.cat[open] > summary::before { transform: rotate(90deg); }
details.cat h2 { font-family: var(--font-display); font-size: 21px; margin: 0; }
details.cat .count { margin-left: auto; font-family: var(--font-data); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
details.cat.complete .count { color: var(--done); }
.rows { list-style: none; margin: 0; padding: 0 16px 8px; }
.rows > li { border-top: 1px solid var(--line); }
.milestone { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-family: var(--font-display); font-size: 15px; color: var(--accent); letter-spacing: .04em; }
.milestone::before, .milestone::after { content: ""; flex: 1; height: 2px; background: var(--accent); opacity: .5; }
.rows > li.milestone-row { border-top: 0; }
.item { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 10px; padding: 9px 0; align-items: start; }
.item input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--done); cursor: pointer; }
.item label { font-weight: 500; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.item .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; background: var(--done-soft); color: var(--fg); }
.chip.after { background: var(--accent-soft); }
.chip.unknown { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.wiki { font-size: 12px; color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.wiki:hover { color: var(--accent); border-color: var(--accent); }
.detail { grid-column: 2 / 4; font-size: 14px; color: var(--muted); display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.detail .k { font-family: var(--font-data); font-size: 12px; color: var(--fg); margin-right: 4px; }
.detail .fac { color: var(--fg); }
.item.checked label { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }
footer { font-size: 13px; color: var(--muted); max-width: 76ch; display: grid; gap: 6px; }
footer a { color: var(--accent); }
@media (max-width: 520px) {
  .item { grid-template-columns: 22px 1fr; }
  .item .meta { grid-column: 2; justify-content: flex-start; }
  .detail { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { .meter > span, details.cat > summary::before { transition: none; } }
