:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #74736e;
  --accent: #2a78d6;
  --track: #e6e5e0;
  --good: #0a7d0a;
  --good-bg: #e3f3e3;
  --warn: #8a5a00;
  --warn-bg: #fdf0d2;
  --stub: #5c5b57;
  --stub-bg: #ecebe7;
  --warn-label: #ec835a;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #2f2f2c;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #9a998f;
    --accent: #3987e5;
    --track: #2c2c29;
    --good: #5fd35f;
    --good-bg: #173117;
    --warn: #fab219;
    --warn-bg: #352a10;
    --stub: #b4b3aa;
    --stub-bg: #2a2a27;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.85em; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; }
.brand { font-weight: 650; color: var(--text); }
.brand span { color: var(--muted); font-weight: 450; }
.top-links { display: flex; gap: 16px; font-size: 0.9rem; }
.foot { color: var(--muted); font-size: 0.85rem; padding-top: 32px; padding-bottom: 40px; }

/* The request a view was built from: this page is also the API's preview. */
.request {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  margin: 16px 0 20px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 0.85rem; color: var(--text-2);
}
.request a { font-family: var(--mono); }
.request .verb { font-family: var(--mono); font-weight: 650; color: var(--good); }

.crumbs { margin-top: 20px; font-size: 0.9rem; color: var(--muted); }
.page-head { display: flex; gap: 16px; align-items: center; margin: 8px 0 4px; flex-wrap: wrap; }
.page-head img { max-height: 56px; max-width: 160px; object-fit: contain; }
.sub { color: var(--text-2); margin-top: 4px; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 20px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--text-2); font-size: 0.85rem; }
.tile .value { font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .value small { font-size: 0.9rem; color: var(--muted); font-weight: 450; }
.tile .bar { margin-top: 8px; }
.breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Progress bar: one hue; full bars turn the "complete" color. */
.bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 0; }
.bar.full > i { background: var(--good); }

/* Status badges always carry their label, never color alone. */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.complete { color: var(--good); background: var(--good-bg); }
.badge.partial { color: var(--warn); background: var(--warn-bg); }
.badge.stub { color: var(--stub); background: var(--stub-bg); }

/* Warning label before a set's name, e.g. a missing logo; its tooltip says why. */
.warn {
  display: inline-grid; place-items: center; width: 1.15em; height: 1.15em; margin-right: 0.35em; vertical-align: 0.08em;
  border-radius: 4px; background: var(--warn-label); color: #1a1a19; font-size: 0.8em; font-weight: 800; line-height: 1; cursor: help;
}

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.chip {
  font: inherit; font-size: 0.85rem; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search {
  font: inherit; font-size: 0.9rem; padding: 5px 12px; border-radius: 999px; min-width: 0; flex: 1 1 180px; max-width: 280px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}

/* Series and set tiles */
.series { margin-top: 28px; }
.series-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.series-head .bar { width: 160px; margin-top: 6px; }
.series-stats { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 10px; }
.set {
  display: flex; flex-direction: column; gap: 8px; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.set:hover { text-decoration: none; border-color: var(--accent); }
.set-top { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.logo { width: 64px; height: 36px; flex: none; display: grid; place-items: center; }
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo .code { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 2px 6px; }
.set-name { font-weight: 600; line-height: 1.25; }
.set-meta { color: var(--muted); font-size: 0.8rem; }
.set-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.numberings { display: grid; gap: 2px; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.numberings div { display: flex; justify-content: space-between; gap: 8px; }

/* Checklist grid */
.numbering { margin-top: 28px; }
.numbering-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.numbering-head .bar { width: 200px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 10px; }
.cell {
  display: flex; flex-direction: column; gap: 1px; min-height: 58px; padding: 7px 9px; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 0.82rem;
}
a.cell:hover, a.cell:focus-visible { text-decoration: none; border-color: var(--accent); outline: none; }
.cell .num { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.cell .name { font-weight: 550; line-height: 1.25; }
.cell .rarity { font-size: 0.72rem; color: var(--muted); }
.cell.missing { background: transparent; border-style: dashed; color: var(--muted); justify-content: center; }
.cell.missing .num { color: var(--muted); }
.cell.no-image .name::after { content: " · no image"; font-weight: 400; color: var(--muted); font-size: 0.72rem; }
.note { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }

/* Hover preview of a card image */
.preview {
  position: fixed; z-index: 20; pointer-events: none; width: 245px; aspect-ratio: 63 / 88;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); display: grid; place-items: center; color: var(--muted); font-size: 0.85rem;
}
.preview[hidden] { display: none; }
.preview img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Card view */
.card-view { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 28px; margin-top: 16px; }
@media (max-width: 720px) { .card-view { grid-template-columns: 1fr; } }
.card-image { width: 100%; max-width: 320px; aspect-ratio: 63 / 88; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.card-image img { width: 100%; height: 100%; object-fit: contain; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-top: 10px; }
.block .title { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.block p { margin: 4px 0 0; color: var(--text-2); font-size: 0.9rem; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 10px; }
.variant { cursor: default; }
.error-box { margin-top: 24px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
