:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #5d6066;
  --line: #dcdcd6;
  --accent: #1f5eff;
  --accent-text: #ffffff;
  --code-bg: #efefea;
  --frame-bg: #e6e6e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --surface: #1b1c1f;
    --text: #ececea;
    --muted: #9a9da3;
    --line: #2f3135;
    --accent: #7aa2ff;
    --accent-text: #0b0c0e;
    --code-bg: #26282c;
    --frame-bg: #0c0d0e;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: hidden; }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.82rem; background: var(--code-bg); border-radius: 4px; }
code { padding: 0.1em 0.35em; overflow-wrap: anywhere; }
pre { padding: 0.6rem 0.8rem; margin: 0.25rem 0; overflow-x: auto; }
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 1rem; align-items: center; padding: 0.55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.top nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.top nav a { padding: 0.3rem 0.65rem; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 0.9rem; }
.top nav a:hover { color: var(--text); background: var(--code-bg); }
.top nav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { margin-top: 2.5rem; }
.lede { color: var(--muted); max-width: 60ch; }
.count { color: var(--text); font-weight: 600; }
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; list-style: none; padding: 0; }
.stats li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 1rem; }
.stats b { font-size: 1.4rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child > * { border-bottom: 0; }
.jump { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 1.5rem; }
.jump a { font-size: 0.85rem; padding: 0.2rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--surface); }
.jump a.muted { color: var(--muted); }
.cards { display: grid; gap: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; min-width: 0; }
.card > header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.card h3 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.5rem; }
.open { margin-left: auto; font-size: 0.85rem; }
.previews { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
.pane { margin: 0; min-width: 0; }
.pane figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.frame { position: relative; overflow: hidden; background: var(--frame-bg); border: 1px solid var(--line); border-radius: 8px; width: 100%; aspect-ratio: calc(var(--w) / var(--h)); }
.pane-mobile .frame { width: 242px; }
.frame iframe { position: absolute; top: 0; left: 0; width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); border: 0; background: #fff; transform-origin: 0 0; transform: scale(var(--s, 0.5)); }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; pointer-events: none; }
.frame.loaded .placeholder { display: none; }
.view-toggle { display: none; gap: 0.25rem; grid-column: 1 / -1; }
.view-toggle button, .load { font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.view-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
[data-click-load] .previews:not(.armed) .frame { opacity: 0.55; }
.load { position: absolute; z-index: 2; top: 40%; left: 40%; transform: translate(-50%, -50%); padding: 0.7rem 1.2rem; background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.armed .load { display: none; }
.not-rendered { margin: 0; padding: 0.7rem 0.9rem; background: var(--code-bg); border-radius: 8px; color: var(--muted); }
.meta { margin: 1rem 0 0; display: grid; gap: 0.6rem; font-size: 0.9rem; }
.meta > div { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.75rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.meta p { margin: 0.2rem 0; }
.note { color: var(--muted); }
.files { list-style: none; margin: 0; padding: 0; }
details summary { cursor: pointer; color: var(--accent); }
@media (max-width: 900px) {
  .previews { grid-template-columns: minmax(0, 1fr); }
  .view-toggle { display: flex; }
  .pane { display: none; }
  .previews[data-view="mobile"] .pane-mobile, .previews[data-view="desktop"] .pane-desktop { display: block; }
  .pane-mobile .frame { width: min(390px, 100%); }
  .load { left: 50%; }
}
@media (max-width: 600px) {
  main { padding-inline: 0.75rem; }
  .meta > div { grid-template-columns: 1fr; gap: 0.1rem; }
  .brand { font-size: 0.95rem; }
}
.status { font-size: 0.72rem; border-radius: 999px; padding: 0.05rem 0.55rem; border: 1px solid var(--line); }
.status-in-use { color: #1a7f37; border-color: #1a7f37; }
.status-unused { color: #b4540a; border-color: #b4540a; }
.status-lead-only { color: #7c3aed; border-color: #7c3aed; }
@media (prefers-color-scheme: dark) { .status-in-use { color: #56d364; border-color: #56d364; } .status-unused { color: #f0a050; border-color: #f0a050; } .status-lead-only { color: #b794f6; border-color: #b794f6; } }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 0; }
.filters button { font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0.25rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.card[hidden], .jump a[hidden] { display: none; }
