/* Cartographic instrument: chart-paper ground, slate ink, one colour per data source.
   magenta = what the UAV image shows (SAM3), teal = what the map says (OSM), amber = cars.
   Question placeholders (visual prompts) are the only yellow / cyan on screen; answers are green;
   change highlights are red (not on the map) and violet (missing in the image). */
:root {
  --paper: #e5ebe9;
  --panel: #f8faf9;
  --card: #ffffff;
  --ink: #14222a;
  --ink-2: #4b5d65;
  --ink-3: #7f9097;
  --rule: #d3dcdb;
  --rule-2: #e7ecec;
  --visual: #d0307a;
  --map: #0a8a8f;
  --car: #f0a202;
  --edge: #6e56cf;
  --p1: #ffd400;
  --p2: #00d1ff;
  --ans: #2ee59d;
  --unmapped: #ff3355;
  --missing: #8b5cf6;
  --block: #f0781e;
  --bad: #c2410c;
  --font: 'Barlow', system-ui, sans-serif;
  --cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --r-sm: 5px;
  --r-md: 10px;
  --shadow: 0 1px 2px rgba(20, 34, 42, 0.06), 0 2px 8px rgba(20, 34, 42, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
body.viewer .pipeline-only, body:not(.viewer) .viewer-only { display: none !important; }

/* ------------------------------------------------------------ header */
.top {
  display: grid; grid-template-columns: auto minmax(220px, 420px) 1fr; align-items: center; gap: 20px;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 34px; height: 34px; color: var(--ink); flex: none; }
.brand h1 { font: 600 23px/1.05 var(--cond); margin: 0; }
.brand p { margin: 1px 0 0; color: var(--ink-2); font-size: 13px; }
.frame {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 12px 5px 6px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--card); border-radius: var(--r-md); text-align: left;
}
.frame:hover { border-color: var(--ink-3); }
.frame img { width: 56px; height: 36px; object-fit: cover; border-radius: 4px; background: #cfd8d7; flex: none; }
.frame-text { display: grid; min-width: 0; flex: 1; padding-left: 4px; }
.frame-text b { font: 600 15px/1.2 var(--cond); }
.frame-text small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-cta { font-size: 13px; font-weight: 600; color: var(--map); flex: none; }
.controls { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

.btn { border: 1px solid var(--ink); background: transparent; border-radius: var(--r-sm); padding: 6px 14px; cursor: pointer; font-weight: 500; }
.btn:hover:not(:disabled) { background: var(--ink); color: var(--panel); }
.btn.primary { background: var(--ink); color: var(--panel); }
.btn.primary:hover:not(:disabled) { background: #2b3d47; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.icon { padding: 5px 7px; display: inline-grid; place-items: center; }
.btn.icon svg { width: 18px; height: 18px; }
.link { border: 0; background: none; padding: 0; color: var(--ink-2); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 5px 12px; cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--panel); }

/* ------------------------------------------------------------ pipeline strip */
.pipeline {
  display: grid; grid-template-columns: minmax(300px, 1.5fr) 28px repeat(3, minmax(150px, 1fr));
  gap: 0 10px; align-items: center; padding: 14px 24px 2px;
}
.lanes { display: grid; gap: 6px; }
.merge { width: 28px; height: 70px; }
.merge path { fill: none; stroke: var(--rule); stroke-width: 2; vector-effect: non-scaling-stroke; }
.mod {
  position: relative; display: grid; grid-template-columns: 12px auto 1fr; column-gap: 8px; align-items: baseline;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 6px 10px 8px; cursor: pointer; overflow: hidden;
}
.mod b { font: 600 15px/1.2 var(--cond); white-space: nowrap; }
.mod em { font-style: normal; color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod .sum { grid-column: 2 / 4; font-style: normal; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1em; }
.mod .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink-3); align-self: center; }
.mod .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--ink); transition: width 0.3s; }
.mod[data-state="running"] .dot { border-color: var(--ink); background: var(--p1); animation: pulse 1s infinite alternate; }
.mod[data-state="done"] .dot { background: var(--ink); border-color: var(--ink); }
.mod[data-state="error"] .dot { background: var(--bad); border-color: var(--bad); }
.mod[data-state="error"] .sum { color: var(--bad); }
.mod[data-state="skipped"] { opacity: 0.5; }
@keyframes pulse { to { opacity: 0.35; } }

/* ------------------------------------------------------------ work area */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; padding: 14px 24px 24px; align-items: start; }
.card, .stage-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); }
.stage-card { padding: 10px 12px 10px; min-width: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 0 0 10px; }
.tgroup { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tlabel { font: 600 13px var(--cond); color: var(--ink-3); margin-right: 2px; }
.tg {
  display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--rule); background: transparent;
  border-radius: 999px; padding: 3px 11px 3px 9px; cursor: pointer; font-size: 13px; color: var(--ink-3); user-select: none;
}
.tg:hover { border-color: var(--ink-3); color: var(--ink); }
.tg .sw { opacity: 0.45; }
.tg[aria-pressed="true"] { background: #fff; border: 1px solid var(--ink-2); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 34, 42, 0.08); }
.tg[aria-pressed="true"] .sw { opacity: 1; }
.tg .n { font-variant-numeric: tabular-nums; opacity: 0.75; }
.tg.hl[aria-pressed="true"] { color: #fff; }
.tg.hl[aria-pressed="true"][data-hl="unmapped"] { background: var(--unmapped); border-color: var(--unmapped); }
.tg.hl[aria-pressed="true"][data-hl="missing"] { background: var(--missing); border-color: var(--missing); }
.tg.hl[aria-pressed="true"][data-hl="block"] { background: var(--block); border-color: var(--block); }
.tg.hl[aria-pressed="true"] .sw { border-color: #fff; }
.tg:disabled { opacity: 0.4; cursor: default; }
.sw { width: 12px; height: 9px; border-radius: 2px; display: inline-block; border: 2px solid; flex: none; }
.sw.visual { border-color: var(--visual); background: color-mix(in srgb, var(--visual) 30%, transparent); }
.sw.map { border-color: var(--map); }
.sw.pairs { border-image: linear-gradient(90deg, #e6194b, #3cb44b, #4363d8) 1; }
.sw.car { border-color: var(--car); }
.sw.rej { border-color: var(--ink-3); border-style: dashed; }
.sw.edge { border-color: var(--edge); border-width: 0 0 2px; height: 6px; }
.sw.unmapped { border-color: var(--unmapped); }
.sw.missing { border-color: var(--missing); }
.sw.block { border-color: var(--block); border-style: dashed; }
.zoom { margin-left: auto; display: inline-flex; }
.zoom button { border: 1px solid var(--rule); background: var(--panel); min-width: 30px; padding: 2px 8px; cursor: pointer; font-size: 14px; }
.zoom button + button { border-left: 0; }
.zoom button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.zoom button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.stage { position: relative; overflow: hidden; background: #1d2a30; border-radius: 7px; aspect-ratio: 16 / 9; margin: 0 auto; cursor: grab; touch-action: none; }
.stage.dragging { cursor: grabbing; }
.viewport { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.viewport img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.below { display: flex; justify-content: space-between; gap: 6px 18px; flex-wrap: wrap; padding-top: 8px; }
.caption { color: var(--ink-2); font-size: 13px; margin: 0; min-height: 1.4em; flex: 1 1 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 15px; height: 10px; border: 2px solid; border-radius: 2px; }
.lg.matched { border-color: var(--visual); background: color-mix(in srgb, var(--visual) 25%, transparent); }
.lg.unmapped { border-color: var(--unmapped); border-style: dashed; }
.lg.missing { border-color: var(--missing); border-style: dashed; }
.lg.amb { border-color: #9aa9ae; border-style: dotted; }
.lg.block { border-color: var(--block); background: rgba(240, 120, 30, 0.25); border-style: dashed; }

.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: #cfdadb; }
.empty p { margin: 0; font: 500 21px var(--cond); }
.empty .btn { border-color: #cfdadb; background: #cfdadb; color: var(--ink); }
.north { position: absolute; right: 14px; top: 14px; width: 60px; height: 60px; border-radius: 50%; background: rgba(248, 250, 249, 0.92); display: grid; place-items: center; pointer-events: none; }
.north svg { width: 42px; height: 42px; }
.north b { font: 600 12px var(--cond); color: var(--ink); }
.pickhint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--p1); color: var(--ink);
  padding: 6px 14px; border-radius: 999px; font-weight: 600; pointer-events: none; max-width: 92%; text-align: center; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ SVG overlay (user units = image px; --u = 1 / zoom) */
.overlay text {
  font-family: var(--cond); font-weight: 600; font-size: calc(var(--u, 1) * 13px);
  paint-order: stroke; stroke: rgba(10, 18, 22, 0.85); stroke-width: calc(var(--u, 1) * 3px); fill: #fff; pointer-events: none;
}
#mov text { font-size: 16px; stroke-width: 3.5px; }
.overlay .ent { cursor: pointer; }
.overlay path, .overlay polygon, .overlay polyline, .overlay line, .overlay circle, .overlay rect { vector-effect: non-scaling-stroke; }
.b-visual { fill: color-mix(in srgb, var(--visual) 18%, transparent); stroke: var(--visual); stroke-width: 1.6; }
.b-visual.vo { stroke-dasharray: 4 3; fill: color-mix(in srgb, var(--visual) 8%, transparent); }
.b-map { fill: color-mix(in srgb, var(--map) 14%, transparent); stroke: var(--map); stroke-width: 1.6; stroke-dasharray: 6 3; }
.b-amb { fill: rgba(200, 210, 212, 0.12); stroke: #c3cdd0; stroke-width: 1.4; stroke-dasharray: 2 3; }
.b-block { fill: rgba(240, 120, 30, 0.2); stroke: var(--block); stroke-width: 2; stroke-dasharray: 9 3 2 3; }
.b-osm { fill: none; stroke: var(--map); stroke-width: 1.2; opacity: 0.9; pointer-events: none; }
.r-line { fill: none; stroke: var(--map); stroke-width: 3; opacity: 0.75; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.r-foot { fill: none; stroke: #7fc8cb; stroke-width: 1; opacity: 0.6; pointer-events: none; }
.r-hit { fill: none; stroke: transparent; stroke-width: 16; stroke-linecap: round; cursor: pointer; }
.w-poly { fill: color-mix(in srgb, #4a90d9 30%, transparent); stroke: #4a90d9; stroke-width: 1; pointer-events: none; }
.g-poly { fill: color-mix(in srgb, #5fae57 18%, transparent); stroke: none; pointer-events: none; }
.c-poly { fill: color-mix(in srgb, var(--car) 30%, transparent); stroke: var(--car); stroke-width: 1.8; }
.c-hit { fill: transparent; stroke: none; cursor: pointer; }
.c-rej { fill: none; stroke: #b9c4c7; stroke-width: 1; stroke-dasharray: 3 2; pointer-events: none; }
.e-line { stroke: var(--edge); stroke-width: 1.6; opacity: 0.85; pointer-events: none; }
.e-line.near { stroke-dasharray: 5 3; }
.fp { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 7 4; pointer-events: none; }
.fp-live { stroke: var(--bad); }
.lifted { fill: var(--car); stroke: #5a3e00; stroke-width: 1; }

.ent.hover { stroke: #fff !important; stroke-width: 3 !important; }
.r-hit.hover { stroke: rgba(255, 255, 255, 0.45) !important; stroke-width: 16 !important; }
.c-hit.hover { fill: rgba(255, 255, 255, 0.25); }

/* change highlights: the selected classes glow, everything else in the building layer recedes */
body.hl-on .overlay .L-buildings > :not(.hl), body.hl-on .overlay .L-osm { opacity: 0.22; }
.overlay .hl { stroke-width: 3.2 !important; stroke-dasharray: none !important; }
.overlay .hl.chg-unmapped { stroke: var(--unmapped) !important; fill: color-mix(in srgb, var(--unmapped) 30%, transparent) !important; filter: drop-shadow(0 0 3px var(--unmapped)); }
.overlay .hl.chg-missing { stroke: var(--missing) !important; fill: color-mix(in srgb, var(--missing) 30%, transparent) !important; filter: drop-shadow(0 0 3px var(--missing)); }
.overlay .hl.blk { stroke: var(--block) !important; fill: rgba(240, 120, 30, 0.38) !important; filter: drop-shadow(0 0 3px var(--block)); }
@media (prefers-reduced-motion: no-preference) {
  .overlay .hl { animation: glow 1.6s ease-in-out infinite alternate; }
}
@keyframes glow { to { stroke-opacity: 0.55; } }

/* picking: only entities of the requested type are live (building slots also take merged blocks) */
body.picking .stage { cursor: crosshair; }
body.picking .overlay .ent { opacity: 0.22; pointer-events: none; }
body.pick-building .overlay .ent[data-type="building"], body.pick-building .overlay .ent[data-type="block"],
body.pick-car .overlay .ent[data-type="car"], body.pick-road .overlay .ent[data-type="road"] { opacity: 1; pointer-events: auto; }

.prompt { fill: none; stroke-width: 3.2; pointer-events: none; }
.prompt.p1 { stroke: var(--p1); }
.prompt.p2 { stroke: var(--p2); }
.prompt.ans { stroke: var(--ans); stroke-dasharray: 8 4; }
.prompt-halo { fill: none; stroke: rgba(0, 0, 0, 0.7); stroke-width: 6; pointer-events: none; }
.prompt-lbl.p1 { fill: var(--p1); }
.prompt-lbl.p2 { fill: var(--p2); }
.prompt-lbl.ans { fill: var(--ans); }
.arrow { stroke: #fff; stroke-width: 2.6; fill: none; pointer-events: none; }
.arrowhead { fill: #fff; }

.hide-buildings .L-buildings, .hide-osm .L-osm, .hide-cars .L-cars, .hide-rejected .L-rejected,
.hide-edges .L-edges, .hide-labels .L-labels { display: none; }
.overlay:not(.lod-car) .lbl-car, .overlay:not(.lod-building) .lbl-building { display: none; }

/* ------------------------------------------------------------ side column */
.side { display: grid; gap: 12px; min-width: 0; position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 0 2px 2px 0; }
body.viewer:not(.show-map) .mapcard { display: none; }
.mapcard { padding: 10px 10px 6px; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 2px 6px; }
.cardhead h2 { font: 600 15px var(--cond); margin: 0; white-space: nowrap; }
.cardhead span { color: var(--ink-3); font-size: 12px; text-align: right; }
.mapbox { position: relative; aspect-ratio: 1; width: min(100%, 42vh); margin: 0 auto; background: #eee9df; border-radius: var(--r-sm); overflow: hidden; }
.mapbox img { width: 100%; height: 100%; display: block; }
.attrib { margin: 4px 2px 0; font-size: 11px; color: var(--ink-3); }

.asker { padding: 0 0 4px; overflow: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); padding: 0 8px; background: var(--panel); }
.tabs button { border: 0; background: transparent; padding: 8px 12px 7px; cursor: pointer; font: 600 15px var(--cond); color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab { padding: 12px 14px; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; font-size: 14px; }
.row input[type="number"] { width: 64px; padding: 2px 4px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: #fff; }
.row select { padding: 2px 4px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: #fff; }

/* templates, grouped by benchmark level */
.level { border-top: 1px solid var(--rule-2); }
.level:first-child { border-top: 0; }
.level > summary { list-style: none; display: grid; grid-template-columns: 30px 1fr auto; gap: 1px 10px; align-items: center; padding: 9px 2px 7px; cursor: pointer; }
.level > summary::-webkit-details-marker { display: none; }
.lvl-badge { grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--cond); color: #fff; background: var(--ink); }
.lvl-name { font: 600 16px/1.1 var(--cond); }
.lvl-desc { grid-column: 2; color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.lvl-count { grid-row: 1 / 3; grid-column: 3; color: var(--ink-3); font-size: 12px; }
.level[open] > summary .lvl-count::after { content: ' ▴'; }
.level:not([open]) > summary .lvl-count::after { content: ' ▾'; }
.level[data-level="I"] .lvl-badge { background: #2f6fd8; }
.level[data-level="II"] .lvl-badge { background: #d63c5e; }
.level[data-level="III"] .lvl-badge { background: #b07800; }
.level[data-level="IV"] .lvl-badge { background: #9332b8; }
.level[data-level="M"] .lvl-badge { background: var(--map); }
.tpl { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 5px 8px 5px 40px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; line-height: 1.45; }
.tpl:hover { background: #eef3f1; }
.tpl[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tpl:last-child { margin-bottom: 8px; }
.ph { display: inline-block; font: 600 12.5px/1.25 var(--cond); padding: 0 6px; border-radius: 999px; border: 1px dashed currentColor; opacity: 0.8; }
.templates.off { opacity: 0.45; pointer-events: none; }

.qbox { margin: 0 0 12px; padding: 12px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-md); }
.qhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.lvl { font: 600 13px var(--cond); color: var(--ink-3); }
.qtext { font-size: 18px; line-height: 1.65; margin: 0 0 8px; }
.slot {
  display: inline-flex; align-items: center; gap: 4px; border: 2px dashed var(--ink-2); background: #fff;
  border-radius: 999px; padding: 0 10px; margin: 0 2px; cursor: pointer; font: 600 16px var(--cond); line-height: 1.5;
}
.slot.p1 { border-color: #c9a800; }
.slot.p2 { border-color: #00a6cc; }
.slot.filled { border-style: solid; }
.slot.filled.p1 { background: var(--p1); }
.slot.filled.p2 { background: var(--p2); }
.slot.active { outline: 3px solid var(--ink); outline-offset: 1px; }

.answer { border-left: 4px solid var(--ans); padding: 2px 0 2px 12px; margin-top: 4px; }
.a-main { font-size: 17px; font-weight: 500; margin: 0 0 6px; }
.a-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 4px; font-size: 13px; color: var(--ink-3); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 8px; border: 1px solid; }
.pill.high { color: #0f7a4f; border-color: #0f7a4f; }
.pill.medium { color: #946200; border-color: #946200; }
.pill.low { color: var(--bad); border-color: var(--bad); }
.answer ul { margin: 6px 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.answer .cav { color: #8a4b00; }
.answer details { margin-top: 6px; font-size: 13px; }
.answer summary { cursor: pointer; color: var(--ink-2); }
.answer details pre {
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px; font: 12px/1.45 ui-monospace, monospace;
}
.llm { margin-top: 10px; display: grid; gap: 6px; }
.llm .out { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 10px; white-space: pre-wrap; font-size: 14px; }
.llm .meta { color: var(--ink-3); font-size: 12px; margin: 0; }
.llm label { font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.vqa-sum { font-size: 13px; color: var(--ink-2); margin: 6px 0; }
.vqa-item { border-top: 1px solid var(--rule-2); padding: 7px 2px; cursor: pointer; font-size: 14px; }
.vqa-item:hover { background: #eef3f1; }
.vqa-item .a { color: #0f7a4f; font-weight: 600; }
.vqa-item .o { color: var(--ink-3); font-size: 12px; }

.triples { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow: auto; font-size: 14px; }
.triples li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 4px; border-top: 1px solid var(--rule-2); }
.triples li:hover { background: #eef3f1; }
.triples .p { color: var(--edge); font-weight: 600; font-family: var(--cond); }
.triples .x { grid-column: 1 / 4; color: var(--ink-3); font-size: 12px; margin-top: -2px; }
#log { font: 12px/1.5 ui-monospace, monospace; max-height: 480px; overflow: auto; white-space: pre-wrap; }
#log h4 { font: 600 14px var(--cond); margin: 10px 0 2px; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--panel); border-radius: var(--r-sm); padding: 6px 10px; font-size: 13px; max-width: 320px; line-height: 1.4; box-shadow: var(--shadow); }
.tip b { font-family: var(--cond); font-size: 15px; }

/* gallery */
dialog#gallery { width: min(1200px, 94vw); max-height: 88vh; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--panel); padding: 16px 18px; color: var(--ink); }
dialog::backdrop { background: rgba(20, 34, 42, 0.55); }
.ghead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ghead h2 { font: 600 22px var(--cond); margin: 0; }
.gbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.gfilters { display: flex; gap: 6px; flex-wrap: wrap; }
.gfilters button { border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 2px 11px; cursor: pointer; font-size: 13px; }
.gfilters button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
#gsurvey, #gsearch { padding: 3px 6px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: #fff; font-size: 13px; }
#gsurvey { max-width: 220px; }
.gsort { margin-left: auto; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 8px; }
.card-i { border: 0; padding: 0; background: transparent; text-align: left; cursor: pointer; border-radius: var(--r-sm); }
.card-i img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-sm); display: block; background: #cfd8d7; }
.card-i:hover img { outline: 3px solid var(--ink); }
.card-i .t { font: 600 14px var(--cond); margin-top: 3px; }
.card-i .m { font-size: 12px; color: var(--ink-2); }
.card-i .ready { color: #0f7a4f; font-weight: 600; }
.grid .more { grid-column: 1 / -1; justify-self: center; margin: 8px 0; }

/* viewer mode: the image gets the room */
body.viewer .work { grid-template-columns: minmax(0, 1fr) 420px; padding-top: 16px; }

@media (max-width: 1150px) {
  .top { grid-template-columns: 1fr; }
  .controls { justify-content: flex-start; }
  .work, body.viewer .work { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .pipeline { grid-template-columns: 1fr 1fr; gap: 6px; }
  .lanes { grid-column: 1 / 3; }
  .merge { display: none; }
}
@media (max-width: 640px) {
  .pipeline, .work, .top { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .mod .bar { transition: none; }
  .mod[data-state="running"] .dot { animation: none; }
}
