:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --raised: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --line: rgba(11, 11, 11, 0.10);
  --line-2: rgba(11, 11, 11, 0.20);
  --focus: #2a6df4;
  --warn-bg: #fff3d1;

  --done: #0ca30c;
  --wip: #fab219;
  --missing: #b4b2a9;
  --on-done: #ffffff;
  --on-wip: #0b0b0b;
  --on-missing: #0b0b0b;

  --thumb: 208px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --raised: #201f1e;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a19a;
    --line: rgba(255, 255, 255, 0.10);
    --line-2: rgba(255, 255, 255, 0.22);
    --focus: #6d9bff;
    --warn-bg: #3a2e10;
    --missing: #5a5954;
    --on-missing: #f0efec;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── header ── */
header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 12px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
h1 { font-size: 30px; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.dot {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.dot.done    { background: var(--done);    color: var(--on-done); }
.dot.wip     { background: var(--wip);     color: var(--on-wip); }
.dot.missing { background: var(--missing); color: var(--on-missing); }
.dot-wrap { display: inline-flex; }

/* ── people filter ── */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }
.filters-label { color: var(--ink-2); }
.filters button {
  border: 1px solid var(--line-2); background: transparent; border-radius: 999px;
  padding: 2px 12px; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* ── rows ── */
.cols-head {
  display: grid; grid-template-columns: var(--thumb) minmax(0, 1fr); gap: 20px;
  margin: 24px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
main { display: flex; flex-direction: column; gap: 14px; }

.cap {
  display: grid; grid-template-columns: var(--thumb) minmax(0, 1fr); gap: 20px; align-items: start;
  transition: grid-template-columns 0.25s ease, opacity 0.2s;
  scroll-margin-top: 16px;
}
.cap.open { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
.cap.s-done    { --accent: var(--done); }
.cap.s-wip     { --accent: var(--wip); }
.cap.s-missing { --accent: var(--missing); }

.media {
  aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: #000; border: 1px solid var(--line); cursor: pointer;
}
.cap.open .media { cursor: auto; }
.media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.cap.open .media video { object-fit: contain; }
.media:has(.noclip) { background: transparent; border: none; cursor: auto; }
.noclip {
  width: 100%; height: 100%; display: grid; place-items: center;
  border: 1px dashed var(--line-2); border-radius: 10px;
  color: var(--muted); font-size: 13px; background: var(--surface);
}

.card {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--raised); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 14px 16px 12px;
}
.card:hover { border-color: var(--line-2); border-left-color: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cap-name { font-size: 18px; font-weight: 600; }

.bar { display: flex; gap: 2px; height: 8px; }
.seg { flex-basis: 0; min-width: 8px; border-radius: 4px; }
.seg.done    { background: var(--done); }
.seg.wip     { background: var(--wip); }
.seg.missing { background: var(--missing); }

.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.spacer { flex: 1; }
.chev {
  width: 8px; height: 8px; margin: 0 4px 3px 0;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2);
  transform: rotate(45deg); transition: transform 0.2s;
}
.cap.open .chev { transform: rotate(-135deg); margin-bottom: -3px; }

/* ── expanded panel ── */
.panel { padding-top: 12px; }
.summary { margin: 0 0 10px; color: var(--ink-2); }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 10px 12px; transition: opacity 0.2s;
}
.item.s-done    { --accent: var(--done); }
.item.s-wip     { --accent: var(--wip); }
.item.s-missing { --accent: var(--missing); }
.item-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; }
.item-name { font-weight: 600; }
.names { font-size: 13px; color: var(--ink-2); }
.item .names { text-align: right; }
.names.none { color: var(--muted); font-style: italic; }

.wheres { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.where { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; min-width: 0; text-decoration: none; }
.where .ico { display: inline-flex; color: var(--ink-2); padding-top: 2px; flex: none; }
.host { font-weight: 600; flex: none; }
.path {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; flex: 1;
}
.copy {
  flex: none; font-size: 12px; padding: 0 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; border-radius: 6px;
}
.link-text { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; overflow-wrap: anywhere; }
a.where:hover .link-text { text-decoration-color: currentColor; }

.note { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.warn { margin: 6px 0 0; padding: 4px 8px; border-radius: 6px; background: var(--warn-bg); font-size: 13px; }

.dim { opacity: 0.35; }

footer { margin-top: 40px; font-size: 12px; color: var(--muted); }

.loading { color: var(--muted); }
.error { border: 1px solid var(--line-2); border-left: 4px solid #d03b3b; border-radius: 10px; padding: 12px 16px; background: var(--surface); }
.error h2 { margin: 0 0 8px; font-size: 16px; }
.error pre { margin: 0; white-space: pre-wrap; font-size: 13px; }

/* ── phones ── */
@media (max-width: 720px) {
  :root { --thumb: 112px; }
  .cols-head { display: none; }
  .cap, .cap.open { gap: 12px; }
  .cap.open { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; }
  .cap-name { font-size: 16px; }
  .card-top { flex-wrap: wrap; }
  .item-top { grid-template-columns: auto minmax(0, 1fr); }
  .item .names { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .cap, .chev, .item { transition: none; }
}
