    :root {
      --bg: #ffffff;
      --fg: #1a1a1a;
      --fg-muted: #555555;
      --fg-faint: #888888;
      --fg-fainter: #999999;
      --fg-strong: #000000;
      --heading: #333333;
      --link: #2a4f7a;
      --link-hover: #000000;
      --border: #dddddd;
      --border-soft: #eeeeee;
      --border-fainter: #f0f0f0;
      --code-bg: #f6f6f6;
      --table-head-bg: #fafafa;
      --input-bg: #ffffff;
      --input-border: #cccccc;
      --button-bg: #f4f4f4;
      --button-fg: #1a1a1a;
      --button-border: #cccccc;
      --button-hover-bg: #e8e8e8;
      --status-todo-bg: #fff2cc;     --status-todo-fg: #7a5b00;
      --status-partial-bg: #d6e9f5;  --status-partial-fg: #1f5279;
      --status-working-bg: #d8efd6;  --status-working-fg: #1f6020;
      --status-broken-bg: #f5d6d6;   --status-broken-fg: #7a1f1f;
      --status-framing-bg: #ececec;  --status-framing-fg: #555555;
    }
    @media (prefers-color-scheme: dark) {
      :root {
        --bg: #1a1a1a;
        --fg: #e6e6e6;
        --fg-muted: #aaaaaa;
        --fg-faint: #888888;
        --fg-fainter: #666666;
        --fg-strong: #ffffff;
        --heading: #cfcfcf;
        --link: #8fb4e0;
        --link-hover: #ffffff;
        --border: #333333;
        --border-soft: #2a2a2a;
        --border-fainter: #2a2a2a;
        --code-bg: #232323;
        --table-head-bg: #242424;
        --input-bg: #232323;
        --input-border: #444444;
        --button-bg: #2a2a2a;
        --button-fg: #e6e6e6;
        --button-border: #444444;
        --button-hover-bg: #353535;
        --status-todo-bg: #3a2f00;     --status-todo-fg: #f5d97a;
        --status-partial-bg: #14304a;  --status-partial-fg: #9ec8e8;
        --status-working-bg: #143a18;  --status-working-fg: #9ed89c;
        --status-broken-bg: #3a1414;   --status-broken-fg: #e89a9a;
        --status-framing-bg: #2a2a2a;  --status-framing-fg: #bbbbbb;
      }
      img { filter: brightness(0.9); }
    }

    html { overflow-x: clip; }
    body { font-family: ui-serif, Georgia, serif; margin: 0; line-height: 1.55; background: var(--bg); color: var(--fg); }
    .page-content { max-width: 44rem; margin: 0 auto; padding: 0 1rem 4rem; }
    .past-banner { background: var(--status-partial-bg); color: var(--status-partial-fg); padding: 0.5rem 1rem; font-size: 0.9rem; text-align: center; border-bottom: 1px solid var(--border); }
    .past-banner a { color: inherit; text-decoration: underline; }
    h1, h2, h3 { font-weight: normal; line-height: 1.25; }
    h1 { margin: 1.5rem 0 0.5rem; font-size: 2rem; }
    h2 { margin: 2.5rem 0 0.5rem; font-size: 1.4rem; border-bottom: 1px solid var(--border-soft); padding-bottom: 0.3rem; }
    h3 { margin: 1.5rem 0 0.4rem; font-size: 1.1rem; color: var(--heading); }
    p { margin: 0.8rem 0; }
    a { color: var(--link); }
    a:hover { color: var(--link-hover); }
    blockquote { border-left: 3px solid var(--border); margin: 1rem 0; padding: 0.2rem 1rem; color: var(--fg-muted); font-style: italic; }
    .lede { font-size: 1.2rem; color: var(--fg-muted); font-style: italic; margin-top: 0; }

    code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 0.2rem; }
    pre { background: var(--code-bg); padding: 0.8rem 1rem; overflow-x: auto; border-radius: 0.3rem; font-size: 0.85rem; line-height: 1.4; }
    pre code { background: none; padding: 0; border-radius: 0; font-size: 1em; }
    table { border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; width: 100%; }
    th, td { text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
    th { font-weight: bold; background: var(--table-head-bg); }
    hr { border: 0; border-top: 1px solid var(--border-soft); margin: 2rem 0; }

    .site-nav { display: flex; gap: 0.75rem 1rem; align-items: baseline; flex-wrap: wrap; padding: 0.6rem 1.25rem; border-bottom: 1px solid var(--border); }
    .site-nav .brand { font-weight: bold; text-decoration: none; margin-right: auto; white-space: nowrap; }
    .site-nav nav { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
    .site-nav nav a { text-decoration: none; }
    .site-nav nav a.active, .site-nav .brand.active { color: var(--fg-strong); text-decoration: underline; }
    .viewer-chip { display: inline-flex; gap: 0.35rem; align-items: baseline; padding: 0.15rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; text-decoration: none; color: var(--fg-muted); background: var(--code-bg); max-width: 100%; overflow: hidden; }
    @media (max-width: 28rem) {
      .site-nav .brand { font-size: 0.95rem; }
      .site-nav .vc-label { display: none; }
    }
    .viewer-chip:hover { color: var(--fg-strong); border-color: var(--fg-muted); }
    .viewer-chip .vc-name { color: var(--fg-strong); font-weight: 600; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .viewer-chip .vc-flag { font-size: 0.75rem; padding: 0 0.35rem; border-radius: 0.25rem; background: var(--border-soft); color: var(--fg-muted); }
    .viewer-chip .vc-flag.vc-op { background: #ffe98a; color: #5a4500; }
    .viewer-chip .vc-flag.vc-verified { background: #cfe9c8; color: #244c1d; }
    .viewer-chip .vc-flag.vc-unverified { background: #f0d6d6; color: #6b2727; }
    .viewer-chip.guest { color: var(--fg-muted); }

    form { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
    form input { flex: 1; padding: 0.4rem; font: inherit; background: var(--input-bg); color: var(--fg); border: 1px solid var(--input-border); border-radius: 0.2rem; }
    form.me-form input { min-width: 12rem; }
    button { font: inherit; padding: 0.4rem 0.9rem; background: var(--button-bg); color: var(--button-fg); border: 1px solid var(--button-border); border-radius: 0.2rem; cursor: pointer; }
    button:hover { background: var(--button-hover-bg); }
    ul { list-style: none; padding: 0; margin: 0.8rem 0; }

    .prose ul { padding-left: 1.2rem; list-style: disc; }
    .prose li { padding: 0.2rem 0; }

    .manual-crumb { font-size: 0.85rem; color: var(--fg-muted); margin: 0 0 0.4rem; }
    .manual-crumb a { color: var(--fg-muted); }
    .manual-chapters { list-style: decimal; padding-left: 1.5rem; margin: 1.5rem 0 2rem; }
    .manual-chapters li { padding: 0.5rem 0; }
    .manual-chapters a { font-size: 1.05rem; }
    .manual-chapter-blurb { display: block; color: var(--fg-muted); font-size: 0.9rem; margin-top: 0.15rem; }
    .manual-pager { display: flex; gap: 1rem; justify-content: space-between; margin: 2.5rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--border-fainter); font-size: 0.95rem; }
    .manual-pager .next { margin-left: auto; }

    button.tombstone { background: none; border: none; color: var(--fg-fainter); cursor: pointer; font: inherit; padding: 0 0.4rem; line-height: 1; }
    button.tombstone:hover { background: none; color: #c33; }

    .cat-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.05rem 0.4rem; border-radius: 0.2rem; background: var(--code-bg); color: var(--fg-muted); flex-shrink: 0; }
    .cat-tag.cat-alert { background: var(--status-broken-fg); color: var(--bg); }
    .range-form { flex-wrap: wrap; }
    .range-form input { min-width: 8rem; }
    #ranges li { padding: 0.6rem 0; border-bottom: 1px solid var(--border-soft); display: block; }
    #ranges li .range-head { display: flex; gap: 0.5rem; align-items: baseline; justify-content: space-between; }
    #ranges li .range-head .title { font-weight: bold; }
    #ranges li time { color: var(--fg-muted); font-size: 0.9rem; }
    #ranges li .range-body { color: var(--fg-muted); margin: 0.2rem 0; }
    #ranges li .range-foot { display: flex; gap: 0.6rem; align-items: baseline; }
    #ranges li .range-foot .byline { color: var(--fg-faint); font-size: 0.85rem; font-style: italic; flex: 1; }
    #ranges li.tombstoned { color: var(--fg-faint); font-style: italic; }
    #ranges li.empty { color: var(--fg-fainter); font-style: italic; }

    .cc-profile-pixels { image-rendering: pixelated; border: 1px solid var(--border); border-radius: 0.2rem; }
    /* Shared style for both scrubbers — same row pattern, paired axis tags. */
    cc-time-scrubber, cc-log-scrubber { display: block; }
    cc-time-scrubber .cc-scrubber, cc-log-scrubber .cc-scrubber { display: flex; flex-direction: column; gap: 0.15rem; }
    cc-time-scrubber .cc-scrubber-top, cc-log-scrubber .cc-scrubber-top { display: flex; gap: 0.4rem; align-items: center; }
    cc-time-scrubber input[type=range], cc-log-scrubber input[type=range] { display: block; width: 100%; position: relative; z-index: 1; margin: 0; }
    cc-time-scrubber .cc-scrubber-track, cc-log-scrubber .cc-scrubber-track { position: relative; }
    cc-time-scrubber .cc-scrubber-tick, cc-log-scrubber .cc-scrubber-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg-muted); opacity: 0.45; transform: translateX(-1px); pointer-events: none; z-index: 0; }
    cc-time-scrubber .cc-scrubber-axis, cc-log-scrubber .cc-scrubber-axis { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--fg-faint); flex: 0 0 auto; min-width: 3.2rem; }
    cc-time-scrubber .cc-scrubber-label, cc-log-scrubber .cc-scrubber-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; color: var(--fg-muted); flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    cc-time-scrubber .cc-scrubber-offset, cc-log-scrubber .cc-scrubber-offset { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-serif, Georgia, serif; font-size: 0.78rem; color: var(--fg-faint); font-style: italic; }
    /* Standalone usage outside the floating panel keeps some vertical breathing room. */
    cc-time-scrubber:not(.viewer-scrubber) { margin: 1rem 0 1.2rem; }
    cc-log-scrubber:not(.viewer-log-scrubber) { margin: 0.6rem 0 1rem; }

    /* ---- Floating time-travel panel ----
       Top-center over the map. Each scrubber lives inside its own
       <details>: collapsed = compact pill button ("Timeline" / "As of"
       + live state); open = expanded card with slider + nudge buttons.
       Frees the sidebar for ranges; stays reachable when sidebar
       collapses. */
    .map-timetravel {
      position: absolute; z-index: 20;
      top: 0.6rem; left: 0.6rem;
      display: flex; flex-direction: column; gap: 0.3rem;
      align-items: flex-start;
      max-width: calc(100% - 1.2rem);
    }
    .tt-section {
      background: var(--map-tooltip-bg);
      color: var(--map-tooltip-fg);
      border: 1px solid var(--border-soft); border-radius: 0.45rem;
      box-shadow: 0 4px 14px rgba(0,0,0,0.18);
      backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
      min-width: 10rem;
    }
    .tt-section[open] { min-width: min(26rem, calc(100vw - 2rem)); }
    .tt-summary { cursor: pointer; list-style: none; display: flex; gap: 0.5rem; align-items: center; padding: 0.35rem 0.65rem; user-select: none; }
    .tt-summary::-webkit-details-marker { display: none; }
    .tt-summary::marker { content: ''; }
    .tt-name { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--fg); flex: 0 0 auto; }
    .tt-state { font-family: ui-serif, Georgia, serif; font-style: italic; font-size: 0.78rem; color: var(--fg-faint); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tt-chev { color: var(--fg-faint); font-size: 0.7rem; flex: 0 0 auto; transition: transform 0.15s; }
    .tt-section[open] .tt-chev { transform: rotate(180deg); }
    .tt-section[open] > cc-time-scrubber,
    .tt-section[open] > cc-log-scrubber { display: block; padding: 0.3rem 0.65rem 0.5rem; border-top: 1px solid var(--border-soft); }
    /* Visual flag when "as of" log time is not at HEAD: accent border +
       colored label. body[data-log-head="1"] is set server-side when at
       HEAD; absence means a past-log view (later edits hidden). */
    body:not([data-log-head="1"]) .tt-section[data-tt="log"] { border-color: var(--status-partial-fg); box-shadow: 0 4px 14px rgba(0,0,0,0.18), 0 0 0 1px var(--status-partial-fg); }
    body:not([data-log-head="1"]) .tt-section[data-tt="log"] .tt-name { color: var(--status-partial-fg); }
    body:not([data-log-head="1"]) .tt-section[data-tt="log"] .tt-state { color: var(--status-partial-fg); font-style: normal; font-weight: 600; }
    /* Axis tag is redundant inside the floating panel (summary says it). */
    .map-timetravel .cc-scrubber-axis { display: none; }
    body[data-viewer-mode="tiny"] .map-timetravel,
    body[data-viewer-mode="paint"] .map-timetravel { display: none; }
    @media (max-width: 800px) {
      .map-timetravel { top: 0.4rem; left: 0.4rem; right: 0.4rem; max-width: none; }
      .tt-section, .tt-section[open] { min-width: 0; }
    }

    /* Nudge row: segmented (no gaps). Sequence is
       −1w  −1d  −4h  −1h  [now/HEAD]  +1h  +4h  +1d  +1w
       Borders collapse so the buttons read as one strip; the center home
       button keeps its full border to anchor it visually. */
    .cc-scrubber-nudge { display: flex; gap: 0; align-items: stretch; margin-top: 0.4rem; }
    .cc-scrubber-nudge button { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; padding: 0.35rem 0.7rem; color: var(--fg-muted); background: var(--bg); border: 1px solid var(--border); cursor: pointer; line-height: 1.2; flex: 1 1 0; min-width: 0; }
    .cc-scrubber-nudge button + button { border-left: 0; }
    .cc-scrubber-nudge > :first-child { border-radius: 0.25rem 0 0 0.25rem; }
    .cc-scrubber-nudge > :last-child { border-radius: 0 0.25rem 0.25rem 0; }
    .cc-scrubber-nudge button:hover:not(:disabled) { color: var(--fg); background: var(--button-hover-bg); }
    .cc-scrubber-nudge button:disabled { opacity: 0.3; cursor: not-allowed; }
    /* Home button (now/HEAD) in the center: bolder + accent color so the
       home anchor reads above the nudge buttons. */
    .cc-scrubber-nudge .cc-scrubber-now { color: var(--fg); font-weight: 700; }
    .cc-scrubber-nudge .cc-scrubber-now:hover:not(:disabled) { border-color: var(--fg); }

    .lineage { list-style: none; padding: 0; }
    .lineage ul { list-style: none; padding-left: 1.2rem; border-left: 1px dashed var(--border-soft); margin: 0.3rem 0; }
    .lineage li { padding: 0.2rem 0; }
    .lineage li.revoked .name { text-decoration: line-through; color: var(--fg-faint); }
    .lineage .name { font-weight: 500; }
    .lineage .verified-at { color: var(--fg-faint); font-size: 0.85rem; margin-left: 0.5rem; }
    .lineage .revoked-tag { color: var(--status-broken-fg); background: var(--status-broken-bg); padding: 0.05rem 0.4rem; border-radius: 0.2rem; font-size: 0.75rem; margin-left: 0.5rem; }
    .lineage .lineage-revoke { font-size: 0.75rem; padding: 0.1rem 0.4rem; margin-left: 0.5rem; }
    .lineage .inline-form { display: inline; }
    p.error { color: var(--status-broken-fg); background: var(--status-broken-bg); padding: 0.4rem 0.6rem; border-radius: 0.2rem; }

    /* Viewer layout: body is the viewport. Header + scrubber pin to
       the top; the map canvas fills the rest underneath. The side
       panel is an absolutely-positioned floating drawer over the map. */
    :root {
      --map-bg: #eee8da; --map-grid: rgba(0,0,0,0.06);
      --map-tap: #1f6020;
      --map-pin: #3a7ac6;
      --map-focus: #1f6020;
      --map-focus-inset: #ffffff;
      --map-scale-fg: #2a2a2a;
      --map-scale-bg: rgba(255,255,255,0.78);
      --map-tooltip-bg: rgba(255,255,255,0.94);
      --map-tooltip-fg: #1a1a1a;
    }
    @media (prefers-color-scheme: dark) {
      :root {
        --map-bg: #1f2520; --map-grid: rgba(255,255,255,0.05);
        --map-tap: #7fbf80;
        --map-pin: #6aa8e8;
        --map-focus: #7fbf80;
        --map-focus-inset: #0e120f;
        --map-scale-fg: #d8d8d8;
        --map-scale-bg: rgba(20,24,22,0.78);
        --map-tooltip-bg: rgba(28,32,30,0.94);
        --map-tooltip-fg: #e8e8e8;
      }
    }
    body.viewer-body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
    body.viewer-body > .site-nav { flex: 0 0 auto; }

    .viewer-stage { flex: 1 1 0; min-height: 0; display: flex; flex-direction: row; overflow: hidden; }
    .viewer-map-wrap { flex: 1 1 0; min-width: 0; min-height: 0; position: relative; overflow: hidden; background: var(--map-bg); }
    cc-map.viewer-map { position: absolute; inset: 0; display: block; background: var(--map-bg); }
    cc-map.viewer-map .cc-map-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
    cc-map.viewer-map .cc-map-tooltip {
      position: absolute; pointer-events: none; z-index: 5;
      padding: 0.15rem 0.45rem; font-size: 0.8rem; line-height: 1.25;
      max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      background: var(--map-tooltip-bg); color: var(--map-tooltip-fg);
      border: 1px solid var(--border-soft); border-radius: 0.2rem;
      box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }
    cc-map.viewer-map .cc-map-tooltip[hidden] { display: none; }

    /* ---- Viewer sidebar slot ----
       Sidebar lives as a sibling of the map (not an overlay) so the map
       and the panel split horizontally. All panel content (scrubber,
       sidebar list, range editor, paint HUD) is a child of this slot;
       body[data-viewer-mode] picks which child is visible. Modes:
       list | edit | tiny | paint. */
    .viewer-slot { flex: 0 0 22rem; width: 22rem; min-height: 0; box-sizing: border-box; padding: 0.75rem; border-left: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; overflow-x: hidden; }
    body[data-viewer-mode="edit"] .viewer-slot { padding-top: 0.3rem; }
    .viewer-slot > * { min-width: 0; }
    /* Mode-gated children. Default-hidden; the active mode flips its
       owner back on. */
    .viewer-slot > .viewer-side,
    .viewer-slot > cc-range-details,
    .viewer-slot > .viewer-paint-hud { display: none; }
    body[data-viewer-mode="list"]  .viewer-slot > .viewer-side       { display: flex; flex-direction: column; gap: 0.9rem; }
    body[data-viewer-mode="edit"]  .viewer-slot > cc-range-details   { display: flex; flex-direction: column; gap: 0.5rem; }
    body[data-viewer-mode="tiny"]  .viewer-slot > cc-range-details   { display: flex; flex-direction: column; gap: 0.5rem; }
    body[data-viewer-mode="paint"] .viewer-slot > .viewer-paint-hud  { display: flex; flex-direction: column; gap: 0.5rem; }
    /* Tiny shrinks the slot so the map gets most of the row while the
       user drags. */
    body[data-viewer-mode="tiny"] .viewer-slot { width: auto; padding: 0.25rem 0.55rem; overflow: hidden; gap: 0; }

    /* Sidebar sections — each gets a small uppercase heading so the
       panel reads as labeled regions instead of a flat stack. */
    .viewer-section { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
    .viewer-section-title { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); }
    .viewer-ranges-head { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; min-width: 0; }
    .viewer-ranges-head .viewer-section-title { flex: 0 0 auto; }
    .viewer-new { flex: 0 0 auto; font-size: 0.8rem; padding: 0.25rem 0.7rem; background: var(--fg-strong); color: var(--bg); border-color: var(--fg-strong); font-weight: 600; border-radius: 999px; line-height: 1.2; }
    .viewer-new:hover { background: var(--fg); border-color: var(--fg); }

    /* Map control cluster: floating, bottom-right of the map canvas.
       Map-level actions (fit, hide-all, collapse panel) live on the map
       so they read as map controls — not sidebar header furniture. */
    .map-controls { position: absolute; right: 0.6rem; bottom: 0.6rem; z-index: 15; display: flex; flex-direction: column; gap: 0.3rem; }
    .map-ctl-btn { width: 2.1rem; height: 2.1rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 0.4rem; box-shadow: 0 1px 3px rgba(0,0,0,0.12); cursor: pointer; line-height: 1; }
    .map-ctl-btn:hover { background: var(--button-hover-bg); color: var(--fg-strong); }
    .map-ctl-btn[aria-pressed="true"] { background: var(--fg-strong); color: var(--bg); border-color: var(--fg-strong); }
    body.panel-collapsed .map-ctl-collapse svg { transform: rotate(180deg); }
    @media (max-width: 800px) { .map-controls { right: 0.5rem; bottom: 0.5rem; } .map-ctl-collapse { display: none; } }

    /* OSM attribution — required by the OSM tile usage policy whenever
       the basemap is on. Lives inside cc-map so it inherits viewport
       positioning; bottom-right, above the map-controls cluster. */
    cc-map { position: relative; }
    .cc-map-attribution { position: absolute; right: 3.4rem; bottom: 0.6rem; z-index: 14; background: rgba(255,255,255,0.78); color: #2a2a2a; font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 0.2rem; pointer-events: auto; }
    .cc-map-attribution a { color: inherit; text-decoration: underline; }

    body.panel-collapsed .viewer-slot { display: none; }
    /* In paint draw mode the map canvas is also the paint surface;
       crosshair cursor hints that. */
    body[data-viewer-mode="paint"] cc-map.viewer-map .cc-map-canvas { cursor: crosshair; }
    /* Square brush cursor drawn as a DOM overlay (cc-sprite-editor
       positions it on every mousemove while the pointer is over the
       map). Layered borders keep it visible on any background.
       pointer-events: none so it never blocks paint strokes. */
    .cc-brush-cursor {
      position: fixed;
      left: 0;
      top: 0;
      pointer-events: none;
      z-index: 10000;
      box-sizing: border-box;
      border: 1px solid #000;
      box-shadow: 0 0 0 1px #fff, 0 0 0 2px #000;
      display: none;
    }
    body[data-viewer-mode="paint"] .viewer-slot > .viewer-paint-hud { gap: 0.3rem; }
    .viewer-paint-hud .cc-paint-hud-head { display: flex; gap: 0.5rem; align-items: center; padding: 0 0 0.25rem; border-bottom: 1px solid var(--border-soft); }
    .viewer-paint-hud .cc-back { font-size: 0.85rem; padding: 0.15rem 0.55rem; }
    .viewer-paint-hud .cc-paint-title { font-size: 0.8rem; color: var(--fg-muted); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .viewer-paint-hud .cc-paint-title strong { color: var(--fg); font-weight: 600; }
    .viewer-paint-hud .cc-paint-done { font-size: 0.8rem; padding: 0.15rem 0.7rem; background: var(--fg-strong); color: var(--bg); border: 1px solid var(--fg-strong); border-radius: 999px; cursor: pointer; font-weight: 600; flex: 0 0 auto; }
    .viewer-paint-hud .cc-paint-done:hover { background: var(--fg); border-color: var(--fg); }
    .viewer-paint-hud .cc-paint-tools { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
    .viewer-paint-hud .cc-paint-tools button { font-size: 0.75rem; padding: 0.1rem 0.5rem; }
    .viewer-paint-hud .cc-paint-palette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 2px; background: var(--border-soft); border-radius: 0.25rem; }
    .viewer-paint-hud .cc-paint-palette .cc-swatch { width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 2px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); transition: transform 0.08s; }
    .viewer-paint-hud .cc-paint-palette .cc-swatch:hover { transform: scale(1.18); z-index: 1; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.25); }
    .viewer-paint-hud .cc-paint-palette .cc-swatch.selected { outline: 2px solid var(--fg); outline-offset: 1px; z-index: 2; position: relative; }
    .viewer-paint-hud .cc-paint-palette .cc-swatch-erase { grid-column: 1 / -1; aspect-ratio: auto; height: 0.9rem; }
    .viewer-paint-hud .cc-paint-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
    .viewer-paint-hud .cc-paint-brushes { display: flex; gap: 0.25rem; flex-wrap: wrap; flex: 1 1 auto; }
    .viewer-paint-hud .cc-paint-brushes .cc-brush { min-width: 1.6rem; padding: 0.1rem 0.4rem; font-size: 0.78rem; border: 1px solid var(--border-soft); background: var(--bg); border-radius: 0.2rem; cursor: pointer; }
    .viewer-paint-hud .cc-paint-brushes .cc-brush.selected { outline: 2px solid var(--fg); outline-offset: -1px; }
    .viewer-paint-hud .cc-paint-shape { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; font-size: 0.78rem; }
    .viewer-paint-hud .cc-paint-shape label { display: inline-flex; gap: 0.2rem; align-items: center; }
    .viewer-paint-hud .cc-paint-shape input { width: 3rem; padding: 0.1rem 0.25rem; font-size: 0.78rem; }
    .viewer-paint-hud .cc-paint-shape button { font-size: 0.75rem; padding: 0.1rem 0.55rem; }
    .viewer-paint-hud .cc-paint-color { display: inline-flex; align-items: center; flex: 0 0 auto; }
    .viewer-paint-hud .cc-paint-color input[type="color"] { width: 1.9rem; height: 1.6rem; padding: 0; border: 1px solid var(--border-soft); border-radius: 0.2rem; background: var(--bg); cursor: pointer; }

    .viewer-range-list { padding: 0; margin: 0; list-style: none; }
    .viewer-range-list li { padding: 0.25rem 0.3rem 0.25rem 0.55rem; border-bottom: 1px solid var(--border-fainter); border-left: 4px solid transparent; display: flex; gap: 0.4rem; align-items: center; border-radius: 0 0.25rem 0.25rem 0; transition: background 0.12s; }
    .viewer-range-list li:hover { background: var(--button-hover-bg); }
    .viewer-range-list li[data-layer="background"] { border-left-color: #9ec0e6; }
    .viewer-range-list li[data-layer="ground"]     { border-left-color: #b4d4a3; }
    .viewer-range-list li[data-layer="foreground"] { border-left-color: #e6c79e; }
    .viewer-range-list li[data-tombstoned="1"]     { border-left-color: var(--status-broken-bg); }
    .viewer-range-list li.empty { color: var(--fg-fainter); font-style: italic; display: block; padding: 0.6rem 0.3rem; border-left-color: transparent; }
    .viewer-range-list li.empty:hover { background: transparent; }
    .viewer-range-list .viewer-range-select { flex: 1; min-width: 0; text-align: left; background: none; border: 1px solid transparent; border-radius: 0.25rem; padding: 0.2rem 0.35rem; font: inherit; color: var(--fg); cursor: pointer; display: flex; gap: 0.45rem; align-items: baseline; flex-wrap: wrap; }
    .viewer-range-list .viewer-range-select:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
    .viewer-range-list .viewer-range-title { font-weight: 500; flex: 1 1 auto; min-width: 0; }
    .viewer-range-list .viewer-range-meta { color: var(--fg-faint); font-size: 0.75rem; display: inline-flex; gap: 0.25rem; flex-wrap: wrap; flex: 0 0 auto; align-items: center; }
    .viewer-range-list .viewer-range-meta .meta-flag { background: var(--code-bg); padding: 0.05rem 0.35rem; border-radius: 0.25rem; color: var(--fg-muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
    .viewer-range-list .viewer-range-when { color: var(--fg-muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
    .viewer-range-list .viewer-range-layer { display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; border-radius: 0.2rem; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; color: var(--fg-strong); }
    .viewer-range-list .viewer-range-layer-background { background: #9ec0e6; }
    .viewer-range-list .viewer-range-layer-ground { background: #b4d4a3; }
    .viewer-range-list .viewer-range-layer-foreground { background: #e6c79e; }
    .viewer-range-list .viewer-range-sprite { flex: 0 0 auto; width: 2rem; height: 2rem; object-fit: contain; image-rendering: pixelated; border-radius: 0.2rem; background: var(--code-bg); align-self: center; }

    /* Filter component: one flat row of toggle chips. Active (visible)
       is filled; off is outlined. A hairline separator divides
       categories from flags so the two groups read as distinct without
       a nested menu. */
    cc-range-filter { display: block; font-size: 0.8rem; }
    cc-range-filter .cc-filter-search { display: block; width: 100%; box-sizing: border-box; font: inherit; font-size: 0.8rem; padding: 0.3rem 0.5rem; margin: 0 0 0.4rem; background: var(--input-bg); color: var(--fg); border: 1px solid var(--input-border); border-radius: 0.25rem; }
    cc-range-filter .cc-filter-search:focus { outline: none; border-color: var(--fg-muted); }
    cc-range-filter .cc-filter-row { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; padding: 0.05rem 0; }
    cc-range-filter .cc-filter-group { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
    cc-range-filter .cc-filter-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0.1rem 0.15rem; }
    cc-range-filter .cc-filter-chip { font: inherit; font-size: 0.75rem; padding: 0.15rem 0.6rem; border-radius: 999px; cursor: pointer; background: var(--fg); color: var(--bg); border: 1px solid var(--fg); text-transform: lowercase; line-height: 1.35; transition: background 0.12s, color 0.12s, border-color 0.12s; }
    cc-range-filter .cc-filter-chip:hover { filter: brightness(1.08); }
    cc-range-filter .cc-filter-chip.off { background: var(--bg); color: var(--fg-faint); border-color: var(--border); }
    cc-range-filter .cc-filter-chip.off:hover { color: var(--fg); border-color: var(--fg-muted); filter: none; }
    cc-range-filter .cc-filter-flag { background: var(--status-broken-fg); border-color: var(--status-broken-fg); color: var(--bg); }
    cc-range-filter .cc-filter-flag.off { background: var(--bg); color: var(--fg-faint); border-color: var(--border); }
    cc-range-filter .cc-filter-layer-background { background: #9ec0e6; border-color: #9ec0e6; color: var(--fg-strong); }
    cc-range-filter .cc-filter-layer-ground     { background: #b4d4a3; border-color: #b4d4a3; color: var(--fg-strong); }
    cc-range-filter .cc-filter-layer-foreground { background: #e6c79e; border-color: #e6c79e; color: var(--fg-strong); }
    cc-range-filter .cc-filter-layer.off { background: var(--bg); color: var(--fg-faint); border-color: var(--border); }
    cc-range-filter .cc-filter-tag { background: var(--code-bg); border-color: var(--border); color: var(--fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; }
    cc-range-filter .cc-filter-tag.off { color: var(--fg-faint); }
    cc-range-filter .cc-filter-reset { font: inherit; font-size: 0.7rem; padding: 0.1rem 0.5rem; margin-left: auto; background: none; color: var(--fg-faint); border: 1px solid transparent; border-radius: 999px; cursor: pointer; line-height: 1.35; }
    cc-range-filter .cc-filter-reset:hover { color: var(--fg); border-color: var(--border); }
    cc-range-filter .cc-filter-reset[hidden] { display: none; }

    /* Range-details lives inside .viewer-slot; the slot owns position,
       chrome and overflow. This rule only carries the in-slot layout
       (gap, etc.) — visibility is gated by body[data-viewer-mode]. */
    cc-range-details.viewer-details { min-width: 0; }
    cc-range-details.viewer-details .cc-tiny-banner { display: flex; gap: 0.5rem; align-items: center; padding: 0.4rem 0.6rem; background: var(--status-partial-bg, rgba(0,0,0,0.08)); color: var(--fg-strong); border-left: 3px solid var(--status-partial-fg, var(--fg)); border-radius: 0.25rem; margin-bottom: 0.4rem; }
    cc-range-details.viewer-details .cc-tiny-banner-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); flex: 0 0 auto; font-weight: 600; }
    cc-range-details.viewer-details .cc-tiny-banner-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
    cc-range-details.viewer-details .cc-tiny-banner-done { font-size: 0.8rem; padding: 0.2rem 0.7rem; background: var(--fg-strong); color: var(--bg); border: 1px solid var(--fg-strong); border-radius: 999px; cursor: pointer; flex: 0 0 auto; font-weight: 600; }
    cc-range-details.viewer-details .cc-tiny-banner-done:hover { background: var(--fg); border-color: var(--fg); }
    cc-range-details.viewer-details .cc-tiny { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }
    cc-range-details.viewer-details .cc-tiny-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
    cc-range-details.viewer-details .cc-tiny-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--status-partial-fg, var(--fg)); box-shadow: 0 0 0 3px var(--status-partial-bg, rgba(0,0,0,0.08)); animation: cc-tiny-pulse 1.1s ease-in-out infinite; flex: 0 0 auto; }
    cc-range-details.viewer-details .cc-tiny-title { color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
    cc-range-details.viewer-details .cc-tiny-mode { color: var(--fg-muted); font-style: italic; font-size: 0.78rem; }
    cc-range-details.viewer-details .cc-tiny-coord { font-size: 0.78rem; color: var(--fg-muted); }
    cc-range-details.viewer-details .cc-tiny-coord-label { flex: 0 0 1.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
    cc-range-details.viewer-details .cc-tiny-coord input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; padding: 0.2rem 0.35rem; }
    cc-range-details.viewer-details .cc-tiny-row-actions { gap: 0.4rem; }
    cc-range-details.viewer-details .cc-tiny-row-actions button { flex: 1 1 0; }
    cc-range-details.viewer-details .cc-tiny-status { font-size: 0.75rem; color: var(--fg-faint); min-height: 1em; }
    cc-range-details.viewer-details .cc-tiny-status:empty { display: none; }
    @keyframes cc-tiny-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.7); opacity: 0.55; } }
    .cc-screen { display: flex; flex-direction: column; gap: 0.5rem; }
    .cc-screen-head { display: flex; gap: 0.4rem; align-items: baseline; flex-wrap: wrap; }
    .cc-screen-head .cc-back { font-size: 0.85rem; padding: 0.15rem 0.55rem; }
    .cc-screen-head .cc-screen-short { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; color: var(--fg-faint); margin-left: auto; }
    .cc-screen-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; padding-top: 0.3rem; }
    .cc-screen-actions .danger,
    .cc-paint-remove { background: var(--status-broken-bg); color: var(--status-broken-fg); border-color: var(--status-broken-fg); }
    .cc-screen-actions button.active { background: var(--status-partial-bg); color: var(--status-partial-fg); border-color: var(--status-partial-fg); }
    .cc-screen-status { color: var(--fg-muted); font-size: 0.8rem; min-height: 1em; }

    .cc-detail-title { margin: 0; font-size: 1.1rem; flex: 1; min-width: 0; }
    .cc-detail-desc { color: var(--fg); font-size: 0.95rem; margin: 0; }
    .cc-detail-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem; font-size: 0.85rem; margin: 0; }
    .cc-detail-meta dt { color: var(--fg-muted); }
    .cc-detail-meta dd { margin: 0; }
    .cc-detail-state { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.85rem; flex-wrap: wrap; }
    .cc-detail-state-label { color: var(--fg-muted); }
    .cc-detail-state-label strong { color: var(--fg); }
    .cc-detail-state-claimed .cc-detail-state-label strong,
    .cc-detail-state-done .cc-detail-state-label strong { color: var(--status-partial-fg, var(--fg)); }
    .cc-detail-claimer { color: var(--fg-muted); }
    .cc-detail-state-actions { display: flex; gap: 0.4rem; margin-left: auto; }
    .cc-detail-state-actions button { font-size: 0.8rem; padding: 0.2rem 0.55rem; }
    .cc-detail-pastnote { background: var(--status-partial-bg); color: var(--status-partial-fg); padding: 0.4rem 0.6rem; border-radius: 0.2rem; font-size: 0.8rem; margin: 0; }
    .cc-detail-pastnote a { color: inherit; text-decoration: underline; }

    /* Edit screen: single-column object-editor layout (Figma-style
       right rail). Sections stack vertically; the panel is narrow so
       multi-col grids fight content. */
    .cc-editor-form { display: flex; flex-direction: column; gap: 0.45rem; margin: 0; }
    .cc-ed-head { display: flex; align-items: center; gap: 0.4rem; }
    .cc-ed-head .cc-back { font-size: 0.85rem; padding: 0.15rem 0.55rem; }
    .cc-ed-head .cc-ed-short { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; color: var(--fg-faint); }
    .cc-ed-head .cc-ed-spacer { flex: 1; }
    .cc-ed-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
    .cc-ed-actions button { font: inherit; font-size: 0.78rem; padding: 0.2rem 0.55rem; background: var(--button-bg); color: var(--fg); border: 1px solid var(--border); border-radius: 0.25rem; cursor: pointer; }
    .cc-ed-actions button:hover { background: var(--code-bg); }
    .cc-ed-actions button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
    .cc-ed-actions button.danger { background: var(--status-broken-fg); color: var(--bg); border-color: var(--status-broken-fg); font-weight: 600; }
    .cc-ed-actions button.danger:hover { filter: brightness(1.1); }

    .cc-ed-title { font: inherit; font-size: 1.05rem; font-weight: 600; padding: 0.3rem 0.4rem; background: var(--input-bg); color: var(--fg); border: 1px solid transparent; border-radius: 0.25rem; width: 100%; box-sizing: border-box; }
    .cc-ed-title:hover { border-color: var(--border-soft); }
    .cc-ed-title:focus { border-color: var(--input-border); outline: none; }
    .cc-ed-desc { font: inherit; font-size: 0.9rem; padding: 0.3rem 0.4rem; background: var(--input-bg); color: var(--fg); border: 1px solid transparent; border-radius: 0.25rem; resize: vertical; min-height: 2.2rem; width: 100%; box-sizing: border-box; }
    .cc-ed-desc:hover { border-color: var(--border-soft); }
    .cc-ed-desc:focus { border-color: var(--input-border); outline: none; }

    .cc-ed-section { display: flex; flex-direction: column; gap: 0.3rem; padding-top: 0.25rem; border-top: 1px solid var(--border-soft); }
    .cc-ed-section:first-of-type { border-top: 0; padding-top: 0; }
    .cc-ed-section-head { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-faint); }
    .cc-ed-row { display: flex; align-items: center; gap: 0.4rem; min-height: 1.6rem; }
    .cc-ed-row-label { font-size: 0.75rem; color: var(--fg-muted); flex: 0 0 3.4rem; }
    .cc-ed-row-value { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }

    /* Segmented toggle (layer). */
    .cc-ed-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 0.25rem; overflow: hidden; }
    .cc-ed-seg button { font: inherit; font-size: 0.78rem; padding: 0.25rem 0.55rem; background: var(--bg); color: var(--fg-muted); border: 0; border-right: 1px solid var(--border); cursor: pointer; }
    .cc-ed-seg button:last-child { border-right: 0; }
    .cc-ed-seg button.on { background: var(--fg); color: var(--bg); }
    .cc-ed-seg button:hover:not(.on) { background: var(--code-bg); color: var(--fg); }

    /* Chip row (category, when presets, duration). */
    .cc-ed-chip { font: inherit; font-size: 0.75rem; padding: 0.18rem 0.6rem; border-radius: 999px; cursor: pointer; background: var(--bg); color: var(--fg-muted); border: 1px solid var(--border); line-height: 1.3; }
    .cc-ed-chip:hover { color: var(--fg); border-color: var(--fg-muted); }
    .cc-ed-chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
    .cc-ed-chip.cat-dot::before { content: ''; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--dot, var(--fg-muted)); margin-right: 0.35rem; vertical-align: middle; }

    /* Tag chips in the editor: pill, leading #, hover-x for removal.
       Add input shares the row, grows to fit. */
    .cc-ed-tag-row { gap: 0.25rem; }
    .cc-ed-tag { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.1rem 0.45rem; background: var(--code-bg); color: var(--fg); border: 1px solid var(--border); border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; line-height: 1.25; }
    .cc-ed-tag-x { font: inherit; font-size: 0.78rem; padding: 0 0.1rem; background: none; border: 0; color: var(--fg-faint); cursor: pointer; line-height: 1; }
    .cc-ed-tag-x:hover { color: var(--status-broken-fg); background: none; }
    .cc-ed-tag-input { flex: 1 1 5rem; min-width: 5rem; font: inherit; font-size: 0.75rem; padding: 0.15rem 0.45rem; background: var(--input-bg); color: var(--fg); border: 1px dashed var(--border); border-radius: 999px; }
    .cc-ed-tag-input:focus { outline: none; border-style: solid; border-color: var(--fg-muted); }

    /* Sidebar row tag chips: small, monospace-ish, sit alongside the
       category and layer markers. */
    .viewer-range-list .viewer-range-tag { display: inline-flex; align-items: center; padding: 0.05rem 0.35rem; background: var(--code-bg); color: var(--fg-muted); border-radius: 0.2rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.65rem; }

    /* When block: starts/ends in compact rows with inline editable datetime. */
    .cc-ed-when { display: flex; flex-direction: column; gap: 0.25rem; }
    .cc-ed-when input[type="datetime-local"] { font: inherit; font-size: 0.78rem; padding: 0.18rem 0.35rem; background: var(--input-bg); color: var(--fg); border: 1px solid var(--input-border); border-radius: 0.2rem; min-width: 0; }
    .cc-ed-when .cc-ed-add-end { font: inherit; font-size: 0.75rem; padding: 0.18rem 0.6rem; background: var(--bg); color: var(--fg-muted); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; line-height: 1.3; }
    .cc-ed-when .cc-ed-add-end:hover { color: var(--fg); border-color: var(--fg-muted); }
    .cc-ed-when .cc-ed-clear-end { font: inherit; font-size: 0.78rem; padding: 0; background: transparent; color: var(--fg-faint); border: 0; cursor: pointer; }
    .cc-ed-when .cc-ed-clear-end:hover { color: var(--status-broken-fg); }

    /* Sprite block: thumbnail + actions. */
    .cc-ed-sprite-block { display: flex; align-items: center; gap: 0.5rem; }
    .cc-ed-sprite-thumb { width: 4rem; height: 4rem; flex: 0 0 4rem; display: grid; place-items: center; background: var(--code-bg); border: 1px solid var(--border); border-radius: 0.25rem; overflow: hidden; }
    .cc-ed-sprite-thumb canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
    .cc-ed-sprite-thumb.empty { color: var(--fg-faint); font-size: 0.7rem; font-style: italic; }
    .cc-ed-sprite-meta { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--fg-muted); }
    .cc-ed-sprite-meta .cc-ed-sprite-actions { display: flex; gap: 0.3rem; }
    .cc-ed-sprite-meta button { font: inherit; font-size: 0.78rem; padding: 0.2rem 0.5rem; }

    /* Changelog: newest-first fact log for this range. Lazy-loaded
       <details>. The summary doubles as the section header so it lines
       up with the "when" head visually. */
    .cc-ed-history { padding-top: 0.25rem; border-top: 1px solid var(--border-soft); }
    .cc-ed-history > summary { cursor: pointer; list-style: none; }
    .cc-ed-history > summary::-webkit-details-marker { display: none; }
    .cc-ed-history > summary::before { content: '▸'; display: inline-block; width: 0.8rem; color: var(--fg-faint); transition: transform 0.15s; }
    .cc-ed-history[open] > summary::before { transform: rotate(90deg); }
    .cc-ed-history-slot { padding: 0.3rem 0 0.1rem; font-size: 0.78rem; }
    .cc-ed-history-empty { margin: 0; color: var(--fg-faint); font-style: italic; }
    .cc-ed-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
    .cc-ed-history-row { display: grid; grid-template-columns: 8ch 7ch 1fr 7ch; gap: 0.4rem; align-items: baseline; padding: 0.15rem 0; border-bottom: 1px solid var(--border-soft); }
    .cc-ed-history-row:last-child { border-bottom: 0; }
    .cc-ed-history-row.excised { color: var(--fg-faint); }
    .cc-ed-history-when { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; color: var(--fg-faint); }
    .cc-ed-history-attr { font-size: 0.72rem; color: var(--fg-muted); }
    .cc-ed-history-value { font-size: 0.78rem; color: var(--fg); overflow-wrap: anywhere; }
    .cc-ed-history-excised { font-style: italic; color: var(--fg-faint); }
    .cc-ed-history-by { font-size: 0.72rem; color: var(--fg-muted); text-align: right; }
    .cc-ed-history-by a { color: inherit; text-decoration: none; }
    .cc-ed-history-by a:hover { text-decoration: underline; }
    .cc-ed-history-system { font-style: italic; }

    /* Advanced collapse: native details. */
    .cc-ed-status { color: var(--fg-muted); font-size: 0.75rem; min-height: 1em; }
    .cc-ed-status:empty { display: none; }
    .cc-ed-status.saved { color: var(--fg-faint); }
    .cc-ed-status.error { color: var(--status-broken-fg); }

    .cc-editor-readonly { font-size: 0.8rem; color: var(--fg-faint); font-style: italic; margin: 0.2rem 0; }
    .cc-detail-readonly { font-size: 0.8rem; color: var(--fg-faint); font-style: italic; margin: 0.4rem 0; padding: 0.3rem 0.6rem; background: var(--code-bg); border-left: 3px solid var(--border); }
    .cc-editor-form-readonly input[disabled],
    .cc-editor-form-readonly textarea[disabled] { background: var(--code-bg); color: var(--fg-muted); cursor: not-allowed; }
    .cc-editor-form-readonly button[disabled] { opacity: 0.55; cursor: not-allowed; }
    .cc-editor-form-readonly button[disabled]:hover { background: var(--button-bg); color: var(--fg); }
    .cc-ed-empty { color: var(--fg-faint); font-size: 0.85rem; }

    /* Paint screen: the painter + tile coords. */
    .cc-paint-hint { font-size: 0.85rem; color: var(--fg-muted); margin: 0; }
    .cc-paint-tile { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: var(--fg-faint); margin: 0; }
    .cc-paint-remove { align-self: flex-start; font-size: 0.8rem; padding: 0.15rem 0.55rem; }

    .cc-paint-shape { display: flex; gap: 0.4rem; align-items: end; flex-wrap: wrap; font-size: 0.8rem; }
    .cc-paint-shape label { display: flex; flex-direction: column; }
    .cc-paint-shape input { width: 5rem; padding: 0.2rem; font: inherit; font-size: 0.8rem; background: var(--input-bg); color: var(--fg); border: 1px solid var(--input-border); border-radius: 0.2rem; }

    /* Filter classes on body. Each filter checkbox flips a body class
       and these rules hide matching list rows; map filtering happens
       server-side in /ranges/active. */
    body.filter-hide-cat-need [data-category="need"],
    body.filter-hide-cat-offer [data-category="offer"],
    body.filter-hide-cat-lost-and-found [data-category="lost-and-found"],
    body.filter-hide-cat-alert [data-category="alert"],
    body.filter-hide-cat-plain [data-category=""],
    body.filter-hide-layer-background [data-layer="background"],
    body.filter-hide-layer-ground [data-layer="ground"],
    body.filter-hide-layer-foreground [data-layer="foreground"],
    body.filter-hide-flag-pinned [data-pinned="1"],
    body.filter-hide-flag-painted [data-painted="1"],
    body.filter-hide-flag-tombstoned [data-tombstoned="1"] { display: none; }
    /* Tag hides are dynamic (any user-defined slug), so JS injects
       inline display:none on matching rows rather than enumerate
       per-slug CSS rules. data-tags is space-separated. */

    /* Tombstoned rows: faded, struck out, no map presence anyway. */
    .viewer-range-list li[data-tombstoned="1"] { opacity: 0.55; }
    .viewer-range-list li[data-tombstoned="1"] .viewer-range-title { text-decoration: line-through; color: var(--fg-faint); }
    .viewer-range-list .meta-tombstoned { background: var(--status-broken-bg); color: var(--status-broken-fg); }

    /* Mobile: stage stacks vertically — map on top, panel as a fixed-
       height bottom sheet underneath. Height stays constant across modes
       (list / edit / tiny / paint) so the map never reflows when the user
       enters/leaves move (tiny) mode. */
    @media (max-width: 800px) {
      .viewer-stage { flex-direction: column; }
      .viewer-slot,
      body[data-viewer-mode="tiny"] .viewer-slot {
        flex: 0 0 55vh;
        width: 100%;
        height: 55vh;
        padding: 0.75rem;
        gap: 0.5rem;
        overflow-y: auto;
        overflow-x: hidden;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 0.5rem 0.5rem 0 0;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
      }
    }

    .legend { font-size: 0.9rem; color: var(--fg-muted); margin: 0.5rem 0 2rem; }
    .legend .status { margin: 0 0.15rem; }

    .status { display: inline-block; min-width: 4.5rem; font-size: 0.75rem; text-align: center; padding: 0.1rem 0.3rem; border-radius: 0.2rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex-shrink: 0; text-transform: lowercase; letter-spacing: 0.02em; }
    .status-working { background: var(--status-working-bg); color: var(--status-working-fg); }

    /* Raw Data Explorer */
    .explorer-crumb { font-size: 0.85rem; color: var(--fg-muted); margin: 0.6rem 0 0.2rem; }
    .explorer-crumb a { color: var(--fg-muted); text-decoration: none; }
    .explorer-crumb a:hover { color: var(--fg); text-decoration: underline; }
    .explorer-note { font-size: 0.9rem; color: var(--fg-muted); background: var(--code-bg); border-left: 3px solid var(--border); padding: 0.5rem 0.8rem; }
    .explorer-storage { padding-left: 1.2rem; list-style: disc; font-size: 0.95rem; }
    .explorer-storage li { padding: 0.15rem 0; }
    .explorer-reads { padding-left: 1.2rem; list-style: disc; font-size: 0.9rem; }
    .explorer-reads li { padding: 0.2rem 0; }
    .explorer-kind { margin: 1rem 0 1.4rem; }
    .explorer-kind h3 { margin: 0.4rem 0; }
    .explorer-count { color: var(--fg-muted); font-size: 0.85rem; font-weight: normal; }
    .explorer-attrs, .explorer-entities, .explorer-head, .explorer-facts, .explorer-log { font-size: 0.85rem; width: 100%; border-collapse: collapse; }
    .explorer-attrs th, .explorer-attrs td,
    .explorer-entities th, .explorer-entities td,
    .explorer-head th, .explorer-head td,
    .explorer-facts th, .explorer-facts td,
    .explorer-log th, .explorer-log td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border-fainter); vertical-align: top; }
    .explorer-attrs th, .explorer-entities th, .explorer-head th, .explorer-facts th, .explorer-log th { background: var(--table-head-bg); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); text-align: left; }
    .explorer-entities tr.tombstoned, .explorer-head tr.excised, .explorer-log tr.excised, .explorer-facts tr.excised { color: var(--fg-faint); }
    .explorer-val { max-width: 32rem; word-break: break-all; overflow-wrap: anywhere; }
    .explorer-facts td:nth-child(4) { max-width: 28rem; word-break: break-all; overflow-wrap: anywhere; }
    .explorer-bounds { font-size: 0.8rem; color: var(--fg-muted); }
    .tag { display: inline-block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.05rem 0.35rem; border-radius: 0.2rem; margin-left: 0.25rem; vertical-align: baseline; }
    .tag-req { background: var(--status-todo-bg); color: var(--status-todo-fg); }
    .tag-content { background: var(--status-partial-bg); color: var(--status-partial-fg); }
    .tag-tombstoned { background: var(--status-broken-bg); color: var(--status-broken-fg); }
    .excised-tag { background: var(--status-broken-bg); color: var(--status-broken-fg); padding: 0.05rem 0.35rem; border-radius: 0.2rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
    .explorer-readpath { margin: 0.8rem 0; font-size: 0.85rem; }
    .explorer-readpath summary { cursor: pointer; color: var(--fg-muted); }
    .explorer-readpath pre { font-size: 0.75rem; }
    .explorer-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.8rem; font-size: 0.9rem; margin: 0.5rem 0 1rem; }
    .explorer-meta dt { color: var(--fg-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
    .explorer-meta dd { margin: 0; }
    .explorer-transitions { font-size: 0.85rem; color: var(--fg-muted); margin: 0.4rem 0 0.8rem; display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; }
    .explorer-trans-edge { display: inline-flex; gap: 0.25rem; align-items: baseline; }
    .explorer-filter-form { display: flex; flex-wrap: wrap; gap: 0.45rem 0.6rem; align-items: end; margin: 0.6rem 0 1rem; padding: 0.6rem; background: var(--code-bg); border-radius: 0.3rem; }
    .explorer-filter-form label { display: flex; flex-direction: column; font-size: 0.7rem; color: var(--fg-muted); gap: 0.15rem; }
    .explorer-filter-form input, .explorer-filter-form select { font: inherit; font-size: 0.85rem; padding: 0.25rem 0.4rem; background: var(--input-bg); color: var(--fg); border: 1px solid var(--input-border); border-radius: 0.2rem; min-width: 8rem; }
    .explorer-filter-chk { flex-direction: row !important; align-items: baseline; gap: 0.3rem; }
    .explorer-filter-chk input { min-width: 0; }
    .explorer-filter-actions { display: flex; gap: 0.5rem; align-items: baseline; }
    .explorer-pager { display: flex; gap: 1rem; align-items: baseline; margin: 1rem 0; padding-top: 0.5rem; border-top: 1px solid var(--border-fainter); }
    .explorer-scrubber { margin: 0.8rem 0 1.2rem; display: block; }

    /* Log-time scrubber (forensic / as-of-L) — non-linear range slider
       that posts ?log=<unix>. Past-only counterpart of cc-time-scrubber.
       Shape lives in the shared block above; standalone usage gets a
       subtle code-bg panel below. */
    cc-log-scrubber:not(.viewer-log-scrubber) { padding: 0.35rem 0.55rem 0.45rem; background: var(--code-bg); border-left: 3px solid var(--border); border-radius: 0.2rem; }

    /* "edited <time> by <name>" on range rows */
    .viewer-range-edited { display: block; font-size: 0.65rem; color: var(--fg-muted); margin-top: 0.1rem; letter-spacing: 0.02em; }


    /* --- Explorer full-width layout & density pass --- */
    body.explorer-body { padding-bottom: 3rem; }
    .explorer-page { padding: 0.6rem 1.25rem 0; max-width: none; }
    .explorer-page > .explorer-crumb { margin: 0 0 0.4rem; }

    /* Hero: title + lede + at-a-glance stats on one row */
    .explorer-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem 1.5rem; align-items: end; padding: 0.4rem 0 0.8rem; border-bottom: 1px solid var(--border-soft); margin-bottom: 1rem; }
    .explorer-hero h1 { margin: 0; font-size: 1.6rem; }
    .explorer-hero .lede { font-size: 1rem; margin: 0.2rem 0 0; font-style: normal; }
    .explorer-hero .explorer-stats { grid-column: 2; display: flex; gap: 1rem; align-items: baseline; font-size: 0.8rem; color: var(--fg-muted); }
    .explorer-stat { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0.05rem; }
    .explorer-stat strong { color: var(--fg-strong); font-size: 1.25rem; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1; }
    .explorer-stat span { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-faint); }
    @media (max-width: 800px) {
      .explorer-hero { grid-template-columns: 1fr; }
      .explorer-hero .explorer-stats { grid-column: 1; justify-content: flex-start; }
      .explorer-stat { align-items: flex-start; }
    }

    /* Section heading bar — flatter, denser than default <h2> */
    .explorer-page h2 { margin: 1.4rem 0 0.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); border-bottom: 1px solid var(--border-soft); padding: 0 0 0.25rem; font-weight: 600; }
    .explorer-page h2 .explorer-count { font-size: 0.75rem; text-transform: none; letter-spacing: 0; margin-left: 0.4rem; font-weight: normal; }
    .explorer-page h2 .legend { font-size: 0.75rem; text-transform: none; letter-spacing: 0; }

    /* Catalog: responsive card grid instead of stacked sections */
    .explorer-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr)); gap: 0.8rem; margin: 0.4rem 0 1.2rem; }
    .explorer-kind-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem 0.8rem 0.7rem; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 0.35rem; min-width: 0; }
    .explorer-kind-card:hover { border-color: var(--border); }
    .explorer-kind-card h3 { margin: 0; display: flex; gap: 0.5rem; align-items: baseline; justify-content: space-between; font-size: 0.95rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border-fainter); }
    .explorer-kind-card h3 a { text-decoration: none; }
    .explorer-kind-card h3 a code { font-size: 0.85rem; background: var(--code-bg); padding: 0.1rem 0.5rem; border-radius: 999px; color: var(--fg-strong); font-weight: 600; }
    .explorer-kind-card h3 a:hover code { background: var(--fg-strong); color: var(--bg); }
    .explorer-kind-card .explorer-count { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; }
    .explorer-kind-card .explorer-attrs { margin: 0; font-size: 0.78rem; }
    .explorer-kind-card .explorer-attrs th, .explorer-kind-card .explorer-attrs td { padding: 0.15rem 0.4rem; }
    .explorer-kind-card .explorer-transitions { margin: 0.2rem 0 0; padding: 0.3rem 0.5rem; background: var(--code-bg); border-radius: 0.25rem; font-size: 0.75rem; }

    /* Two-column main + aside for kind / entity pages */
    .explorer-split { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(18rem, 1fr); gap: 1.2rem 1.5rem; align-items: start; }
    .explorer-split > .explorer-main { min-width: 0; }
    .explorer-split > .explorer-aside { min-width: 0; position: sticky; top: 0.5rem; }
    .explorer-split > .explorer-aside h2 { margin-top: 0; }
    @media (max-width: 1000px) {
      .explorer-split { grid-template-columns: 1fr; }
      .explorer-split > .explorer-aside { position: static; }
    }

    /* Denser table styling for explorer */
    .explorer-page .explorer-attrs, .explorer-page .explorer-entities,
    .explorer-page .explorer-head, .explorer-page .explorer-facts,
    .explorer-page .explorer-log { font-size: 0.8rem; }
    .explorer-page .explorer-attrs th, .explorer-page .explorer-attrs td,
    .explorer-page .explorer-entities th, .explorer-page .explorer-entities td,
    .explorer-page .explorer-head th, .explorer-page .explorer-head td,
    .explorer-page .explorer-facts th, .explorer-page .explorer-facts td,
    .explorer-page .explorer-log th, .explorer-page .explorer-log td { padding: 0.2rem 0.5rem; }
    .explorer-page tbody tr:hover { background: var(--code-bg); }
    .explorer-page .explorer-entities tbody tr:hover,
    .explorer-page .explorer-facts tbody tr:hover,
    .explorer-page .explorer-log tbody tr:hover,
    .explorer-page .explorer-head tbody tr:hover { background: var(--table-head-bg); }
    .explorer-page td code, .explorer-page th code { font-size: 0.78rem; }

    /* ID columns: monospace, no wrap, ellipsis */
    .explorer-entities td:first-child code,
    .explorer-facts td:nth-child(2) code,
    .explorer-facts td:nth-child(6) code,
    .explorer-facts td:first-child code { white-space: nowrap; }

    /* Filter form: sticky bar look, single dense row */
    .explorer-page .explorer-filter-form { margin: 0 0 1rem; padding: 0.5rem 0.7rem; gap: 0.3rem 0.7rem; border: 1px solid var(--border-soft); background: var(--code-bg); border-radius: 0.35rem; align-items: end; }
    .explorer-page .explorer-filter-form label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; }
    .explorer-page .explorer-filter-form input,
    .explorer-page .explorer-filter-form select { font-size: 0.8rem; padding: 0.2rem 0.4rem; min-width: 7rem; }
    .explorer-page .explorer-filter-form .explorer-filter-actions { gap: 0.4rem; }
    .explorer-page .explorer-filter-form button { font-size: 0.8rem; padding: 0.25rem 0.7rem; }

    /* Read path: subtle inline panel */
    .explorer-page .explorer-readpath { margin: 0 0 0.8rem; padding: 0.3rem 0.6rem; background: var(--code-bg); border: 1px solid var(--border-soft); border-radius: 0.3rem; font-size: 0.8rem; }
    .explorer-page .explorer-readpath summary { padding: 0.1rem 0; font-weight: 600; color: var(--fg-muted); }
    .explorer-page .explorer-readpath[open] summary { margin-bottom: 0.3rem; }
    .explorer-page .explorer-readpath pre { margin: 0.3rem 0; padding: 0.5rem 0.7rem; background: var(--bg); border: 1px solid var(--border-soft); }

    /* Metadata strip on entity pages — horizontal not vertical */
    .explorer-page .explorer-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; padding: 0.5rem 0.7rem; background: var(--code-bg); border: 1px solid var(--border-soft); border-radius: 0.3rem; margin: 0 0 1rem; font-size: 0.8rem; grid-template-columns: none; }
    .explorer-page .explorer-meta dt { display: inline-block; margin-right: 0.3rem; font-size: 0.65rem; }
    .explorer-page .explorer-meta dd { display: inline; margin: 0; }
    .explorer-page .explorer-meta > div { display: inline-flex; gap: 0.3rem; align-items: baseline; }

    /* Note / info panel */
    .explorer-page .explorer-note { font-size: 0.8rem; padding: 0.4rem 0.7rem; margin: 0.4rem 0 0.8rem; }

    /* Storage + read paths inline list */
    .explorer-page .explorer-storage { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; padding: 0; margin: 0.3rem 0 1rem; list-style: none; font-size: 0.85rem; }
    .explorer-page .explorer-storage li { padding: 0; }
    .explorer-page .explorer-reads { padding-left: 1.2rem; font-size: 0.82rem; columns: 2; column-gap: 1.5rem; }
    @media (max-width: 800px) { .explorer-page .explorer-reads { columns: 1; } }
    .explorer-page .explorer-reads li { padding: 0.15rem 0; break-inside: avoid; }

    /* Pager — right-aligned, subtle */
    .explorer-page .explorer-pager { justify-content: flex-end; font-size: 0.85rem; }

    /* Value column color hint for entity references */
    .explorer-page .hist-value { color: var(--fg); word-break: break-word; }

    /* Wider value cells now that we have room */
    .explorer-page .explorer-val { max-width: 48rem; }
    .explorer-page .explorer-facts td:nth-child(4) { max-width: 42rem; }

    /* Cross-document view transitions: fade between pages on nav.
       Datastar uses the same View Transitions API for SSE morphs that opt in
       with `useViewTransition true`; this rule covers full-page <a href> nav. */
    @view-transition { navigation: auto; }
    ::view-transition-old(root),
    ::view-transition-new(root) {
      animation-duration: 180ms;
      animation-timing-function: ease;
    }
    @media (prefers-reduced-motion: reduce) {
      ::view-transition-old(root),
      ::view-transition-new(root) { animation: none; }
    }

/* Interlinking chrome
   ----------------------------------------------------------------
   .cc-breadcrumbs is the spine: map > {context} > {leaf}. Renders
   above the page <h1>. .cc-from-pill is the contextual back-link
   shown when arriving via ?from=. .cc-ed-byline / .cc-ed-permalink
   are the panel-header chrome (author + copy-link). .cc-ed-similar
   is the "find similar" filter shortcut row. */

.cc-breadcrumbs {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--cc-fg-muted, #888);
}
.cc-breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}
.cc-breadcrumbs li::after {
  content: "›";
  margin-left: 0.5rem;
  opacity: 0.5;
}
.cc-breadcrumbs li:last-child::after { content: none; }
.cc-breadcrumbs a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.2); }
.cc-breadcrumbs a:hover { text-decoration-color: currentColor; }

.cc-from-pill {
  display: inline-block;
  margin: 0.25rem 0;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-size: 0.85rem;
}
.cc-from-pill a { color: inherit; text-decoration: none; }
.cc-from-pill a:hover { text-decoration: underline; }
.cc-from-range { border-left: 3px solid #4a86e8; }
.cc-from-participant { border-left: 3px solid #93c47d; }

.cc-ed-head { display: flex; align-items: center; gap: 0.5rem; }
.cc-ed-byline {
  font-size: 0.8rem;
  color: var(--cc-fg-muted, #888);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-ed-byline a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.25); }
.cc-ed-byline a:hover { color: var(--cc-fg, #eee); }
.cc-ed-spacer { flex: 1 1 auto; }
.cc-ed-permalink {
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  opacity: 0.6;
}
.cc-ed-permalink:hover { opacity: 1; background: rgba(255,255,255,0.05); }

.cc-ed-similar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.4rem 0;
  font-size: 0.8rem;
}
.cc-ed-similar-label { color: var(--cc-fg-muted, #888); }
.cc-ed-similar-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  color: inherit;
  font-size: 0.8rem;
}
.cc-ed-similar-chip:hover { background: rgba(255,255,255,0.12); }
.cc-ed-similar-tag { background: rgba(74,134,232,0.18); }
.cc-ed-similar-tag:hover { background: rgba(74,134,232,0.32); }

.profile-range-list {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.profile-range-list li { display: flex; align-items: baseline; gap: 0.5rem; }
.profile-range-list .body { color: var(--cc-fg, #eee); text-decoration: none; }
.profile-range-list .body:hover { text-decoration: underline; }
.profile-range-list .tombstoned .body { opacity: 0.5; font-style: italic; }
.profile-range-list .byline { color: var(--cc-fg-muted, #888); font-size: 0.78rem; margin-left: auto; }

/* ---- Publications archive ---- */

.pub-archive .page-content { max-width: 42rem; }
.pub-archive a { color: var(--fg); }

.pub-new-cta { text-align: right; margin: 0; }
.pub-new-cta a { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.85rem; padding: 0.3rem 0.8rem; border: 1px solid var(--border); border-radius: 0.2rem; text-decoration: none; color: var(--fg-muted); }
.pub-new-cta a:hover { color: var(--fg); border-color: var(--fg-muted); }

.pub-yr { margin-bottom: 1.25rem; }
.pub-yr-head { display: flex; align-items: baseline; gap: 0.75rem; padding-bottom: 0.35rem; border-bottom: 2px solid var(--fg); margin-bottom: 0.4rem; }
.pub-yr-num { font-size: 1.3rem; font-weight: 700; }
.pub-yr-head a { font-size: 0.85rem; color: var(--fg-muted); }


.pub-list-row { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.35rem 0 0.35rem 1rem; border-bottom: 1px solid var(--border-soft); }
.pub-list-row:last-child { border-bottom: none; }
.pub-list-label { flex: 1; font-size: 0.95rem; text-decoration: none; }
.pub-list-label:hover { text-decoration: underline; }
.pub-list-meta { font-size: 0.8rem; color: var(--fg-muted); white-space: nowrap; }

/* ---- Issue page (newspaper) ---- */

.pub-issue .page-content { max-width: 42rem; }
.pub-issue a { text-decoration: underline; }
.pub-issue h1, .pub-issue h2, .pub-issue h3 { font-family: ui-serif, Georgia, serif; }

.pub-nameplate { text-align: center; margin: 0.5rem 0 1rem; padding: 0.75rem 0; border-top: 3px solid var(--fg); border-bottom: 1px solid var(--fg); }
.pub-season { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.5rem; letter-spacing: 0.35em; text-transform: uppercase; font-weight: 700; }
.pub-date { display: block; font-size: 1rem; color: var(--fg-muted); font-style: italic; margin-top: 0.1rem; }
.pub-phase { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--fg-faint); margin-top: 0.25rem; }

.pub-headline { text-align: center; margin: 1rem 0 0.25rem; font-size: 1.75rem; line-height: 1.2; }
.pub-dek { text-align: center; color: var(--fg-muted); font-style: italic; font-size: 1rem; margin: 0 auto 1rem; max-width: 32rem; }

.pub-folio { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--fg-faint); font-family: ui-sans-serif, system-ui, sans-serif; margin: 0.5rem 0; }
.pub-folio-sep { color: var(--fg-fainter); }
.pub-folio-lock { margin-left: auto; }
.pub-lock-btn { padding: 0.2rem 0.5rem; border: 1px solid var(--border); background: var(--code-bg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; cursor: pointer; color: var(--fg-muted); }
.pub-lock-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.pub-rule { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.pub-empty { margin: 2rem 0; color: var(--fg-muted); font-style: italic; }

.pub-lead { padding: 1rem 0 0.5rem; }
.pub-lead-hed { font-size: 1.6rem; line-height: 1.2; margin: 0 0 0.3rem; font-weight: 700; }
.pub-lead-hed a { color: var(--fg); text-decoration: none; }
.pub-lead-hed a:hover { text-decoration: underline; }
.pub-lead-byline { font-size: 0.82rem; color: var(--fg-muted); margin: 0 0 0.75rem; font-style: italic; }
.pub-lead-byline a { color: var(--fg); }
.pub-lead-lede { font-size: 1.05rem; line-height: 1.6; margin: 0 0 0.5rem; max-width: 38rem; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.pub-lead-cont { font-size: 0.82rem; font-style: italic; margin: 0; }
.pub-lead-cont a { color: var(--fg-muted); text-decoration: none; }
.pub-lead-cont a:hover { color: var(--fg); text-decoration: underline; }

.pub-rest { padding: 0.25rem 0; }
.pub-rest-row { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-soft); }
.pub-rest-row:last-child { border-bottom: none; }
.pub-rest-hed { flex: 1; font-weight: 600; color: var(--fg); text-decoration: none; }
.pub-rest-hed:hover { text-decoration: underline; }
.pub-rest-by { font-style: italic; font-size: 0.85rem; color: var(--fg-muted); white-space: nowrap; }
.pub-rest-by a { color: var(--fg-muted); text-decoration: none; }
.pub-rest-by a:hover { text-decoration: underline; }

.pub-cta { text-align: center; font-style: italic; color: var(--fg-muted); font-size: 0.9rem; margin: 0.25rem 0 2rem; }
.pub-cta a { color: var(--fg-muted); }
.pub-cta a:hover { color: var(--fg); }
.pub-article { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
.pub-article:last-child { border-bottom: none; }
.pub-article-title { margin: 0; font-size: 1.4rem; }
.pub-article-byline { margin: 0.25rem 0 1rem; color: var(--fg-muted); font-size: 0.9rem; }
.pub-article-byline a { color: var(--fg); text-decoration: underline; }
.pub-article-byline a:hover { text-decoration: underline; }
.pub-article-when { font-style: italic; margin-left: 0.25rem; }
.pub-article-permalink { margin-left: 0.5rem; text-decoration: none; color: var(--fg-faint); }
.pub-article-permalink:hover { color: var(--fg); }
.pub-article-body p { margin: 0.75rem 0; max-width: 38rem; }
.pub-article-actions { margin-top: 1rem; }
.pub-article-remove { padding: 0.25rem 0.6rem; border: 1px solid var(--border); background: transparent; font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; color: var(--fg-muted); text-decoration: none; }
.pub-article-remove:hover { color: var(--fg-muted); border-color: var(--fg-muted); background: var(--code-bg); }
.pub-article-removed { color: var(--fg-faint); font-style: italic; }
.cc-from-pub { background: var(--code-bg); }

/* ---- Article page (newspaper) ---- */

.pub-article-page { max-width: 42rem; margin: 0 auto; padding: 1rem 1.5rem 4rem; font-family: ui-serif, Georgia, serif; line-height: 1.6; }
.pub-article-page a { text-decoration: underline; }
.pub-article-page h1 { font-family: ui-serif, Georgia, serif; }
.pub-article-body p:first-child::first-letter { font-size: 2.4em; float: left; line-height: 0.85; margin: 0.05em 0.08em 0 0; font-weight: 700; }

/* ---- Compose form ---- */

.pub-edit { max-width: 42rem; margin: 0 auto; padding: 1rem 1.5rem 4rem; }
.pub-edit-head { margin: 1.5rem 0 1.5rem; }
.pub-edit-error { padding: 0.5rem 0.75rem; border: 1px solid var(--status-broken-fg, #c33); color: var(--status-broken-fg, #c33); border-radius: 0.2rem; margin: 1rem 0; }
.pub-edit-form { display: flex; flex-direction: column; gap: 1.25rem; }
.pub-edit-field { display: flex; flex-direction: column; gap: 0.35rem; }
.pub-edit-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); font-weight: 600; }
.pub-edit-field input, .pub-edit-field textarea, .pub-edit-field select { font-family: ui-serif, Georgia, serif; font-size: 1rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 0.2rem; background: var(--bg); color: var(--fg); }
.pub-edit-field textarea { line-height: 1.55; resize: vertical; min-height: 16rem; }
.pub-edit-field input:focus, .pub-edit-field textarea:focus, .pub-edit-field select:focus { outline: 2px solid var(--fg); outline-offset: -1px; }
.pub-edit-hint { font-size: 0.78rem; color: var(--fg-faint); }
.pub-edit-field-ord input { max-width: 6rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pub-edit-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.pub-edit-cancel { color: var(--fg-muted); text-decoration: none; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.9rem; }
.pub-edit-cancel:hover { color: var(--fg); text-decoration: underline; }
.pub-edit-save { padding: 0.5rem 1.25rem; background: var(--fg); color: var(--bg); border: none; border-radius: 0.2rem; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.pub-edit-save:hover { opacity: 0.9; }

/* ---- Library ---- */

.lib-list { padding-left: 0; list-style: none; margin: 1.5rem 0; }
.lib-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border-soft); }
.lib-list li:last-child { border-bottom: none; }
.lib-list a { font-size: 1.05rem; text-decoration: none; color: var(--fg); }
.lib-list a:hover { text-decoration: underline; }
.lib-author { display: block; font-size: 0.85rem; color: var(--fg-muted); font-style: italic; margin-top: 0.1rem; }
.lib-empty { color: var(--fg-muted); font-style: italic; }

.library-book .page-content { max-width: 38rem; }
.library-book .book-body { line-height: 1.7; }
.library-book .book-body h1 { font-size: 1.8rem; margin: 1.5rem 0 0.25rem; }
.library-book .book-body h2 { font-size: 1.3rem; margin: 2rem 0 0.5rem; }
.library-book .book-body h3 { font-size: 1.05rem; }
.library-book .book-body p { margin: 0.75rem 0; }
.library-book .book-body blockquote { margin: 1.2rem 0; padding: 0.4rem 1.2rem; }
.library-book .book-body .book-author { font-style: italic; color: var(--fg-muted); margin-top: 0; }
.library-book .book-body .book-year { font-size: 0.95rem; color: var(--fg-muted); margin-top: 0; }
.library-book .book-body .footnote { font-size: 0.875rem; color: var(--fg-muted); margin: 0.75rem 0 1.25rem; padding-left: 1.5rem; border-left: 2px solid var(--border); }
.library-book .book-body .dateline { text-align: right; font-style: italic; color: var(--fg-muted); margin-top: 2rem; }
