  html, body { margin: 0; }
  img { max-width: 100%; }
  :root {
    --bg: #eef0f3; --surface: #fbfcfd; --surface-2: #e4e7ec;
    --line: #cfd5dd; --line-soft: #dfe4ea; --text: #191d24; --muted: #666f7e;
    --accent: #0f7a72; --accent-ink: #ffffff;
    --add: #a8690c; --mod: #0f7a72; --del: #a4423a; --tag: #5f4d97; --warn: #8a5a05;
    --shadow: 0 1px 2px rgba(20, 26, 36, .07);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #10131a; --surface: #181d25; --surface-2: #202731;
      --line: #2c3540; --line-soft: #222a34; --text: #e3e8ef; --muted: #8b95a4;
      --accent: #3fc9bb; --accent-ink: #07130f;
      --add: #e0a33d; --mod: #3fc9bb; --del: #e07065; --tag: #a894e6; --warn: #e0a33d;
      --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    }
  }
  :root[data-theme="dark"] {
    --bg: #10131a; --surface: #181d25; --surface-2: #202731;
    --line: #2c3540; --line-soft: #222a34; --text: #e3e8ef; --muted: #8b95a4;
    --accent: #3fc9bb; --accent-ink: #07130f;
    --add: #e0a33d; --mod: #3fc9bb; --del: #e07065; --tag: #a894e6; --warn: #e0a33d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }

  * { box-sizing: border-box; }
  body {
    background: var(--bg); color: var(--text);
    font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    font-size: 15px; line-height: 1.5; padding: 0 16px;
  }
  .wrap { max-width: 980px; margin: 0 auto; padding-block: 24px 48px; }
  header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
  h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
  .tagline { color: var(--muted); font-size: 13px; }
  .lede { margin: 10px 0 20px; color: var(--muted); font-size: 13.5px; max-width: 64ch; }
  .lede strong { color: var(--text); font-weight: 500; }

  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
  .panel + .panel { margin-top: 14px; }
  .pad { padding: 13px 14px; }

  h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; margin: 0; }
  .panel > h2 { padding: 13px 14px 0; }
  .pad > h2 { padding: 0; }

  button {
    font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 4px; padding: 7px 12px; cursor: pointer;
  }
  button:hover { border-color: var(--muted); }
  button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .transport { padding: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
  #play { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; min-width: 104px; }
  .clock { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .vol { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
  input[type=range] { width: 100px; accent-color: var(--accent); }
  .presets { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }
  .presets button { border-color: var(--accent); color: var(--accent); }

  .row { display: flex; flex-wrap: wrap; gap: 9px 18px; align-items: center; margin-top: 9px; font-size: 13.5px; }
  .row label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
  input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: none; }
  .num { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 52px; }
  select { font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; max-width: 100%; }
  select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .packs-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
  .packs-row button { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; padding: 7px 11px; }
  .packs-row button span { font-size: 11px; color: var(--muted); }
  .packs-row button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface); }
  .packs-row button[aria-pressed="true"] span { color: var(--accent); }
  .variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 10px; border-top: 1px dashed var(--line); }
  .variants button { padding: 5px 10px; font-size: 12.5px; }
  .variants button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 500; }
  .note2 { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

  .roll-wrap { padding: 0; overflow: hidden; }

  /* whole-project overview: density, eras, playhead */
  .map-wrap { padding: 0; overflow: hidden; }
  #overview { height: 72px; cursor: pointer; }
  .map-foot {
    display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center;
    padding: 8px 14px; border-top: 1px solid var(--line-soft);
    font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted);
  }
  .map-foot .hint { margin-left: auto; }

  /* who is still here */
  .who { display: flex; flex-wrap: wrap; gap: 6px; padding: 11px 14px; }
  .who .chip {
    display: flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px 3px 7px;
    font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--muted);
  }
  .who .chip i {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    display: inline-block; opacity: .12;
  }
  .who .chip.live { border-color: var(--accent); color: var(--text); }
  .who .chip b { font-weight: 500; font-variant-numeric: tabular-nums; }
  canvas { display: block; width: 100%; height: 148px; }
  .roll-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line-soft); font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted); }
  .swatch { display: inline-flex; align-items: center; gap: 6px; }
  .swatch i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
  .meter { margin-left: auto; font-variant-numeric: tabular-nums; }
  .meter b { color: var(--text); font-weight: 500; }

  .cols { display: grid; grid-template-columns: 1.05fr .95fr; gap: 14px; margin-top: 14px; }
  @media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
  .cols .panel { margin-top: 0; }

  .rule { padding: 13px 14px; border-top: 1px solid var(--line-soft); }
  .rule-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .rule-head label { font-weight: 500; font-size: 14px; cursor: pointer; }
  .rule p { margin: 5px 0 0 25px; font-size: 12.5px; color: var(--muted); }
  .rule p em { color: var(--text); font-style: normal; }
  .rule .sel { margin: 8px 0 0 25px; }

  ol.phases { list-style: none; margin: 0; padding: 6px 8px 10px; }
  ol.phases button { display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: left; background: none; border: none; border-radius: 4px; padding: 6px 8px; font-size: 13.5px; }
  ol.phases button:hover { background: var(--surface-2); }
  ol.phases .t { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 34px; }
  ol.phases .what { flex: 1; }
  ol.phases .note { display: block; font-size: 11.5px; color: var(--muted); }
  ol.phases li[aria-current="true"] button { background: var(--surface-2); }
  ol.phases li[aria-current="true"] .what { color: var(--accent); font-weight: 500; }

  table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
  th { color: var(--muted); font-weight: 500; white-space: nowrap; }
  tr:last-child td, tr:last-child th { border-bottom: none; }

  footer { margin-top: 22px; font-size: 12.5px; color: var(--muted); }
  footer code { font-family: "IBM Plex Mono", monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
  .facts {
    display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 20px;
    font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--muted);
  }
  .facts b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
  .loading { margin: 10px 0 20px; padding: 14px; }
  .loading-head {
    display: flex; gap: 12px; align-items: baseline;
    font-size: 13.5px; color: var(--text);
  }
  .loading-head .elapsed {
    margin-left: auto; font-family: "IBM Plex Mono", monospace;
    font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  }
  .bar {
    height: 5px; margin-top: 10px; border-radius: 3px;
    background: var(--surface-2); overflow: hidden;
  }
  .bar i {
    display: block; height: 100%; width: 0%;
    background: var(--accent); border-radius: 3px;
    transition: width .35s ease;
  }
  /* until git says how far along it is, the bar paces itself so the page
     never looks frozen */
  .bar i.waiting {
    width: 35%; animation: slide 1.6s ease-in-out infinite;
  }
  @keyframes slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
  }
  .loading-note { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); }
  .loading.failed .bar { display: none; }
  .loading.failed .loading-head span:first-child { color: var(--del); }
  @media (prefers-reduced-motion: reduce) {
    .bar i.waiting { animation: none; width: 100%; opacity: .35; }
  }
