/* Agent City viewer. City at night: agent work glows warm, human work stays cool, unknown stays dark. */
:root {
  --bg: #0b1018;
  --panel: #111a26;
  --panel-2: #0f1722;
  --line: #243145;
  --fg: #e7ecf4;
  --muted: #8b98ae;
  --human: #4f6d8f;
  --agent: #ffa24a;
  --unknown: #384150;
  --rework: #ff5a5a;
  --ok: #4fc3a1;
  --focus: #7db4ff;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); }
button, label.btn { font: inherit; }
code { font-family: var(--mono); font-size: .92em; }

.app > * { min-width: 0; }
.app { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; gap: 12px; padding: 12px max(16px, env(safe-area-inset-left)) 16px max(16px, env(safe-area-inset-right)); max-width: 1600px; margin: 0 auto; }

.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .02em; }
.mark { width: 14px; height: 14px; background: linear-gradient(135deg, var(--human) 0 50%, var(--agent) 50%); border-radius: 2px; }
.repo { flex: 1; min-width: 0; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn { display: inline-block; cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg); background: transparent; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.verdicts:empty { display: none; }
.verdict { background: var(--panel); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); padding: 10px 14px; display: grid; gap: 4px; min-width: 0; border: 0; text-align: left; color: var(--fg); font: inherit; cursor: pointer; }
.verdict:hover:not([disabled]) { background: #152030; }
.verdict[disabled] { cursor: default; }
.verdict.wide { grid-column: 1 / -1; cursor: default; }
.verdict.wide .a { color: var(--muted); max-width: 110ch; }
.verdict a { color: var(--focus); }
.verdict .q { font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.verdict .q i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.verdict .a { font-size: 14px; }
.verdict .a b { font-weight: 600; }
.verdict .a code { word-break: break-all; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; min-height: 0; }
@media (max-width: 960px) { .main { grid-template-columns: minmax(0, 1fr); } }

.stage { position: relative; min-height: 460px; height: min(72vh, 820px); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: radial-gradient(ellipse at 50% 20%, #142033, var(--bg) 75%); }
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.stage canvas:active { cursor: grabbing; }
.layers { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 4px; background: rgba(11, 16, 24, .8); border: 1px solid var(--line); border-radius: 5px; padding: 3px; }
.layers button { border: 0; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 3px; cursor: pointer; font-size: 13px; }
.layers button[aria-pressed="true"] { background: var(--line); color: var(--fg); }
.legend { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px 14px; font: 11px var(--mono); color: var(--muted); pointer-events: none; max-width: calc(100% - 20px); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 10px; border-radius: 2px; display: inline-block; }
.lbl { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; white-space: nowrap; transform: translate(-50%, -50%); font: 12px var(--mono); color: var(--muted); text-shadow: 0 1px 3px var(--bg), 0 0 6px var(--bg); }
.lbl.d1 { color: var(--fg); font-size: 13px; }
.tip { position: absolute; z-index: 3; pointer-events: none; width: max-content; max-width: min(360px, 80%); background: rgba(11, 16, 24, .95); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; font: 12px/1.5 var(--mono); display: grid; gap: 2px; }
.tip b { font-weight: 500; color: var(--fg); word-break: break-all; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.tip .row span:last-child { color: var(--fg); font-variant-numeric: tabular-nums; }

.err { color: var(--rework) !important; }
.brand { color: var(--fg); text-decoration: none; }
.landing { display: grid; gap: 28px; max-width: 980px; width: 100%; margin: 0 auto; padding-block: 24px 8px; }
.hero { display: grid; gap: 14px; }
.hero h1 { margin: 0; font-size: clamp(28px, 4.4vw, 46px); line-height: 1.08; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; max-width: 22ch; }
.pitch { margin: 0; font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 68ch; }
.cmd { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 10px 10px 16px; width: fit-content; max-width: 100%; }
.cmd code { font-size: 16px; color: var(--agent); overflow-wrap: anywhere; }
.small { margin: 0; font-size: 13px; color: var(--muted); max-width: 72ch; }
.landing h2 { margin: 0 0 10px; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.examples ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.examples a { display: grid; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); text-decoration: none; }
.examples a:hover, .examples a:focus-visible { border-color: var(--agent); outline: none; }
.examples b { font-size: 16px; }
.examples span { font: 12px var(--mono); color: var(--muted); }
.examples small { font-size: 13px; color: var(--muted); }
.questions ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); max-width: 80ch; }
.questions b { color: var(--fg); font-weight: 600; }
.own p { margin: 0 0 12px; color: var(--muted); }
.credit { margin: 0; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.credit a { color: var(--fg); }
body.is-landing .repo { visibility: hidden; }

.side { display: grid; gap: 10px; align-content: start; min-width: 0; max-height: min(72vh, 820px); overflow: auto; }
@media (max-width: 960px) { .side { max-height: none; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; gap: 8px; }
.card h2 { margin: 0; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card .lead { margin: 0; font-size: 13px; }
.card .note { margin: 0; font-size: 12px; color: var(--muted); }
table.era { width: 100%; border-collapse: collapse; font-size: 12px; }
table.era th, table.era td { padding: 4px 0; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.era th:first-child { text-align: left; font-weight: 400; color: var(--muted); padding-right: 8px; }
table.era thead th { font: 500 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
table.era td { font-family: var(--mono); padding-left: 10px; }
table.era td.good { color: var(--ok); }
table.era td.bad { color: var(--rework); }
.scope { display: flex; gap: 4px; }
.scope button { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.scope button[aria-pressed="true"] { background: var(--line); color: var(--fg); }
.commits .who { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); padding-bottom: 4px; z-index: 1; }
.tabs button { flex: 1 1 0; min-width: 0; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 4px; border-radius: 4px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button[aria-selected="true"] { color: var(--fg); border-color: var(--fg); }
.tabs .n { font: 11px var(--mono); color: var(--muted); }
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.findings button { width: 100%; text-align: left; display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--fg); cursor: pointer; font: inherit; }
.findings button:hover { border-color: var(--muted); }
.findings button.sel { border-color: var(--agent); }
.findings .path { font: 12px var(--mono); overflow-wrap: anywhere; }
.findings .sum { font-size: 12px; color: var(--muted); }
.findings .none { color: var(--muted); padding: 8px 2px; }
.evidence { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 6px; }
.evidence h3 { margin: 0; font: 500 13px var(--mono); overflow-wrap: anywhere; }
.evidence h4 { margin: 6px 0 0; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.evidence p { margin: 0; color: var(--muted); font-size: 13px; }
.commits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.commits li { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; font-size: 12px; align-items: baseline; }
.commits .sha { font-family: var(--mono); color: var(--focus); }
.commits .when { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.commits .subj { grid-column: 1 / -1; overflow-wrap: anywhere; }
.commits .tags { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font: 10px/1 var(--mono); padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.tag.a { color: var(--agent); border-color: var(--agent); }
.tag.r { color: var(--rework); border-color: var(--rework); }
.tag.t { color: var(--ok); border-color: var(--ok); }
.foot { font: 12px/1.6 var(--mono); color: var(--muted); }
.foot p { margin: 0; max-width: 120ch; }

.drop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(11, 16, 24, .85); border: 3px dashed var(--agent); font-size: 20px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
