/* SPDX-License-Identifier: AGPL-3.0-or-later
   Render report – the inspector's colours, type and toolbar, full window. */
:root {
  --bg: #fff; --fg: #1f1f1f; --muted: #6b6b6b; --line: #e3e3e3; --hover: #eef3fd;
  --sel: #d3e3fd; --bar: #f3f3f3; --accent: #0b57d0; --icon: #474747; --canvas: #e8e8e8;
  --pass: #1e8e3e; --fail: #d93025; --known: #b06000; --error: #a142f4;
  --check-a: #f4f4f4; --check-b: #e6e6e6;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #1f2023; --fg: #e3e3e3; --muted: #9aa0a6; --line: #3a3b3f; --hover: #2a313c;
    --sel: #33476a; --bar: #26272b; --accent: #7cacf8; --icon: #c4c7c5; --canvas: #131416;
    --pass: #81c995; --fail: #f28b82; --known: #fdd663; --error: #d7aefb;
    --check-a: #202124; --check-b: #17181a;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 12px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

#app { height: 100%; }
.rep { display: flex; flex-direction: column; height: 100%; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
/* Three groups: the tests (start), how both sides are shown (middle), tools (end). */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; flex: none; min-height: 34px; padding: 2px 6px;
  background: var(--bar); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sep { flex: none; width: 1px; height: 16px; margin: 0 5px; background: var(--line); }
.fill { flex: 1 1 0; }
.ib { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 26px; height: 26px; padding: 0 4px; border: 0; border-radius: 6px;
  background: none; color: var(--icon); cursor: pointer; white-space: nowrap; }
.ib:hover { background: var(--hover); color: var(--fg); }
.ib:disabled { opacity: .4; cursor: default; background: none; }
.ib:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ib.on, .ib[aria-pressed="true"] { color: var(--accent); background: var(--hover); }
.ib.text { padding: 0 7px; }
.pick select { font-family: var(--mono); max-width: 30ch; height: 24px; }
.field { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); padding: 0 4px; }
.field input { width: 8ch; font-family: var(--mono); text-align: right; height: 22px; }
.field .reset { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 2px; }
/* a segmented pair or three, as Chrome's device toolbar */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; height: 24px; }
.seg button { border: 0; background: var(--bg); color: var(--icon); padding: 0 8px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--fg); }

/* the status of a test: a dot, and a word */
.st { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; padding: 0 6px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st.pass { color: var(--pass); } .st.fail { color: var(--fail); } .st.known { color: var(--known); }
.st.fixed { color: var(--known); } .st.error { color: var(--error); } .st.none { color: var(--muted); }

/* ── What the test says ──────────────────────────────────────────────────── */
.problems { flex: none; max-height: 20vh; overflow: auto; margin: 0; padding: 6px 12px 6px 28px;
  border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; }
.problems li { margin: 2px 0; }
.problems.fail { background: color-mix(in srgb, var(--fail) 8%, var(--bg)); }
.problems.known, .problems.fixed { background: color-mix(in srgb, var(--known) 10%, var(--bg)); }
.problems.error { background: color-mix(in srgb, var(--error) 10%, var(--bg)); white-space: pre-wrap; }

/* ── The two sides, and the list ────────────────────────────────────────── */
.main { flex: 1; min-height: 0; display: flex; }
/* side by side, or stacked (data-dir: row, column) */
.compare { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; }
.compare[data-dir="column"] { flex-direction: column; }
.side { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.compare[data-dir="column"] .side + .side { border-top: 1px solid var(--line); }
/* every pane's heading one height */
.side h2, .list h2 { display: flex; align-items: center; gap: 4px; flex: none; height: 30px; margin: 0; padding: 0 4px 0 10px;
  font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bar); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; }
.side h2 .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .04em; }
.side h2 .mono { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* a switch in a heading: smaller than the toolbar's */
h2 .seg { height: 22px; font-size: 11px; font-weight: 400; flex: none; }
h2 .seg button { padding: 0 7px; }
/* The list's filters: what counts as an error */
.filters { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 2px 8px; flex: none; padding: 4px 8px 6px 10px;
  border-bottom: 1px solid var(--line); font-size: 11.5px; }
.filters .caption { grid-column: 1 / -1; font-size: 11px; }
.filters .field { padding: 0; color: var(--fg); justify-content: flex-start; }
.filters .field input { width: 7ch; }
/* A pane: a checkerboard, as an image editor shows no content – what shows
   past the end of a side. It scrolls with the stage (local). */
.scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 9px;
  background-color: var(--check-a); background-attachment: local;
  background-image: conic-gradient(var(--check-b) 25%, transparent 0 50%, var(--check-b) 0 75%, transparent 0);
  background-size: 16px 16px; }
.stage { position: relative; margin: 0 auto; }
.stage > .sheet { position: absolute; left: 0; top: 0; display: block; background: #fff; }
.stage > .boxes { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
/* the live page: as tall as the stage, scaled to it, transparent past its end */
.stage > .page { position: absolute; left: 0; top: 0; border: 0; background: transparent; transform-origin: 0 0; color-scheme: light; }
.empty { padding: 24px; color: var(--muted); }

.list { flex: 0 0 280px; min-width: 200px; display: flex; flex-direction: column; }
.list .rows { flex: 1; min-height: 0; overflow: auto; font-family: var(--mono); font-size: 11.5px; }
.list .row { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: baseline;
  padding: 2px 10px; cursor: pointer; white-space: nowrap; }
.list .row:hover { background: var(--hover); }
.list .row[aria-selected="true"] { background: var(--sel); }
.list .row .what { overflow: hidden; text-overflow: ellipsis; }
.list .row .k { color: var(--fail); text-align: center; }
.list .row.allowed .k { color: var(--known); }
.list .more { padding: 6px 10px; color: var(--muted); }

/* ── The View menu ───────────────────────────────────────────────────────── */
.menuwrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; min-width: 190px; padding: 4px 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.menu .mhead { padding: 6px 12px 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.menu button { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 12px 4px 8px; border: 0; background: none;
  text-align: left; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu .check { width: 14px; color: var(--accent); text-align: center; }

/* ── Bottom bar ──────────────────────────────────────────────────────────── */
/* Like the toolbar: the legend, where the pointer and the area are (in the
   middle), and the run's numbers and files. */
.foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; flex: none; padding: 3px 10px; min-height: 22px;
  background: var(--bar); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.key { display: inline-flex; align-items: center; gap: 4px; }
.sw { width: 12px; height: 9px; border: 1.5px solid #d93025; }
.sw.dash { border-style: dashed; border-color: #e37400; }
.sw.sel { border-color: #0b57d0; background: rgba(11,87,208,.15); }
.bar .group { display: flex; align-items: center; gap: 2px; min-width: 0; }
.bar .start { justify-self: start; }
.bar .middle { justify-self: center; gap: 4px; }
.bar .end { justify-self: end; }
.totals .st { font-weight: 400; padding: 0 4px; }
/* too narrow for three columns: one row after another */
@media (max-width: 980px) {
  .bar { display: flex; flex-wrap: wrap; }
  .bar .middle { margin: 0 auto; }
}

/* ── The pointer's ghost and the selected area, on both sides ─────────────── */
/* the system's pointer, an arrow over all of it (the crosshair goes with it: makeMarks) */
.scroll { cursor: default; }
.stage > .overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > svg { position: absolute; left: 0; top: 0; overflow: visible; }
/* the crosshair inverts what is under it */
.overlay > .cursor { mix-blend-mode: difference; }
.overlay .ghost, .overlay .area { display: none; }
.overlay .ghost[data-on], .overlay .area[data-on] { display: inline; }
.marks .area { fill: rgba(11,87,208,.08); stroke: #0b57d0; stroke-width: 1.5px; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.foot .group { display: flex; align-items: center; gap: 14px; min-width: 0; white-space: nowrap; }
.foot .start { justify-self: start; }
.foot .end { justify-self: end; }
.foot .where { justify-self: center; white-space: pre; color: var(--fg); }
/* TeX inverted: both sides' content through one filter; the marks, the
   boxes and the pattern keep their colours */
.compare.inverted .stage > .sheet, .compare.inverted .stage > .page { filter: invert(1); }
/* A drag in a pane draws an area: it selects nothing, and the PDF's image
   (or the snapshot) is not dragged – the pointer goes to the pane. */
.scroll { user-select: none; -webkit-user-select: none; }
.stage > .sheet, .stage > .boxes { pointer-events: none; -webkit-user-drag: none; }
