/* Palette: black, white and grey carry the page. Two colours carry meaning and nothing else:
   blue marks city records, pink marks Qloo. Amber and red are for cautions and errors. */
:root {
  --bg: #F4F4F2;
  --surface: #FFFFFF;
  --field: #F6F6F4;
  --ink: #0A0A0B;
  --ink-2: #2B2B2F;
  --muted: #66666C;
  --faint: #9A9AA0;
  --rule: #E2E2DE;
  --rule-2: #CFCFCA;
  --city: #2146F0;
  --qloo: #D4266E;
  --city-tint: #E9EDFF;
  --qloo-tint: #FDE8F0;
  --ok: #1B8A4B;
  --warn: #8F5E00;
  --err: #B3261E;
  --shadow: 0 1px 2px rgba(10, 10, 11, .04), 0 8px 24px -12px rgba(10, 10, 11, .10);
  --map-filter: grayscale(1) contrast(1.05) brightness(1.02);
  /* the header is black in both themes */
  --h-bg: #0A0A0B; --h-ink: #FAFAF7; --h-muted: #A6A6AC; --h-rule: rgba(255, 255, 255, .14);
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --nav: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0B; --surface: #131315; --field: #1B1B1E; --ink: #F5F5F2; --ink-2: #D6D6D2; --muted: #A0A0A7;
    --faint: #6E6E76; --rule: #26262A; --rule-2: #3A3A40;
    --city: #8AA0FF; --qloo: #FF7FB0; --city-tint: #171D3A; --qloo-tint: #3A1526;
    --ok: #5FD08F; --warn: #E6B552; --err: #FF8078;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
    --map-filter: grayscale(1) invert(1) brightness(.92) contrast(.9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0A0B; --surface: #131315; --field: #1B1B1E; --ink: #F5F5F2; --ink-2: #D6D6D2; --muted: #A0A0A7;
  --faint: #6E6E76; --rule: #26262A; --rule-2: #3A3A40;
  --city: #8AA0FF; --qloo: #FF7FB0; --city-tint: #171D3A; --qloo-tint: #3A1526;
  --ok: #5FD08F; --warn: #E6B552; --err: #FF8078;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --map-filter: grayscale(1) invert(1) brightness(.92) contrast(.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; cursor: pointer; color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--ink); color: var(--bg); padding: .5rem .9rem; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 1200; height: var(--nav);
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 max(var(--pad), calc((100vw - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
.logo-mark { width: 16px; height: 16px; border: 2.5px solid currentColor; display: inline-block; flex: none; }
.nav-links { display: flex; gap: .15rem; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 500; padding: .4rem .7rem; border-radius: 999px; white-space: nowrap; }
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.nav-tools { display: flex; align-items: center; gap: .6rem; }
.pill {
  display: inline-flex; align-items: center; gap: .45rem; font: 500 .7rem var(--mono); letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--rule-2); border-radius: 999px; padding: .28rem .65rem; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.on::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: none; border: 1px solid var(--rule-2); color: var(--ink); flex: none; }
.icon-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- header: headline on the left, the tool on the right ---------- */
.top {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--h-bg); color: var(--h-ink);
  padding: clamp(1.8rem, 3.6vw, 3.2rem) var(--pad) 0;
  border-bottom: 1px solid var(--h-rule);
}
.grid-art {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 56px 56px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(90% 80% at 20% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(90% 80% at 20% 0%, #000 0%, transparent 75%);
}
.hero {
  max-width: var(--max); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 500px); gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}
.eyebrow { font: 500 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--h-muted); }
.eyebrow span { color: var(--h-ink); margin-left: .8rem; padding-left: .8rem; border-left: 1px solid var(--h-rule); white-space: nowrap; }
.wordmark { font: 400 clamp(2.7rem, 6.2vw, 5.6rem)/.98 var(--display); letter-spacing: -.025em; margin: 1.1rem 0 0; text-wrap: balance; }
.wordmark em { font-style: italic; color: var(--h-muted); }
.lede { max-width: 54ch; margin: 1.4rem 0 0; color: var(--h-muted); font-size: 1.06rem; }
.src { font-weight: 600; color: var(--ink); padding: 0 .1em; border-bottom: 2px solid; }
.src.city { border-color: var(--city); }
.src.qloo { border-color: var(--qloo); }
.top .lede .src { color: var(--h-ink); }
.top .lede .src.city { border-color: #8AA0FF; }
.top .lede .src.qloo { border-color: #FF7FB0; }
.points { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: .5rem; color: var(--h-muted); font-size: .92rem; }
.points li { display: grid; grid-template-columns: 1.4rem 1fr; align-items: baseline; }
.points li::before { content: ""; width: 8px; height: 8px; border: 1.5px solid var(--h-ink); align-self: center; }
.stats {
  max-width: var(--max); margin: clamp(1.8rem, 3.6vw, 3rem) auto 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--h-rule);
}
.stats > div { padding: 1.1rem 1rem 1.3rem 0; }
.stats > div + div { padding-left: 1.2rem; border-left: 1px solid var(--h-rule); }
.stats dt { font: 500 .68rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--h-muted); }
.stats dd { margin: .3rem 0 0; font: 400 clamp(1.7rem, 3.2vw, 2.6rem)/1 var(--display); font-variant-numeric: tabular-nums; }

/* ---------- shared pieces ---------- */
.panel { background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.ph { font-size: 1.08rem; font-weight: 600; }
.kicker { font: 500 .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 .7rem; }
.band { padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad); }
.band > * { max-width: var(--max); margin-inline: auto; }
.band + .band { border-top: 1px solid var(--rule); }
.band-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 2.5rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.band-head.second { margin-top: clamp(2.5rem, 5vw, 4rem); }
.band-head h2, .evidence > h2 { font: 400 clamp(2rem, 4.2vw, 3.2rem)/1.02 var(--display); letter-spacing: -.02em; }
.band-head .hint { max-width: 46ch; margin: 0; }
.hint { font-size: .86rem; color: var(--muted); margin: .4rem 0 .5rem; }
label { display: block; font-size: .84rem; font-weight: 600; margin: .9rem 0 .3rem; }
.count { float: right; font: 400 .72rem var(--mono); color: var(--faint); margin-top: .15rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .7rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { resize: vertical; min-height: 4.6rem; line-height: 1.45; display: block; }
input:hover, select:hover, textarea:hover { border-color: var(--rule-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
input::placeholder { color: var(--faint); }
.primary {
  width: 100%; padding: .8rem 1rem; border: 1px solid var(--ink); border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 600; transition: transform .12s ease, opacity .15s ease;
}
.primary:hover:not(:disabled) { opacity: .88; }
.primary:active:not(:disabled) { transform: scale(.985); }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary.busy { cursor: progress; }
.quiet { background: none; border: 1px solid var(--rule-2); border-radius: 10px; padding: .45rem .75rem; color: var(--ink); font-weight: 500; }
.quiet:hover:not(:disabled) { border-color: var(--ink); }
.quiet:disabled { opacity: .5; cursor: not-allowed; }
.quiet.small { font-size: .82rem; padding: .3rem .7rem; border-radius: 999px; white-space: nowrap; }
.form-error { color: var(--err); font-size: .9rem; margin: .7rem 0 0; padding: .55rem .7rem; border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--err) 7%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { background: none; border: 1px solid var(--rule-2); border-radius: 999px; padding: .26rem .7rem; font-size: .8rem; color: var(--ink-2); transition: background .15s ease, color .15s ease, border-color .15s ease; }
.chips button:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toggle { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; background: var(--field); }
.toggle button { border: 0; background: none; padding: .35rem .9rem; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .86rem; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.toggle button:hover { color: var(--ink); }
.toggle button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.toggle button[aria-checked="true"][data-mode="city"] { background: var(--city); color: var(--surface); }
.toggle button[aria-checked="true"][data-mode="qloo"] { background: var(--qloo); color: var(--surface); }
.rank-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; }
summary { cursor: pointer; font-weight: 600; }

/* ---------- the form ---------- */
/* compact enough to sit above the fold on a 768 px tall laptop */
.inputs label { margin-top: .7rem; }
.inputs { padding: 22px 24px; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .6); }
.inputs h2 { font: 400 1.9rem/1 var(--display); letter-spacing: -.01em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.examples { margin-top: .6rem; }
.mode-toggle { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; border-radius: 12px; }
.mode-toggle button { padding: .5rem .3rem; font-size: .84rem; border-radius: 9px; }
.leases { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .45rem; }
.leases li { display: flex; gap: .4rem; }
.leases .num { font: 500 .78rem var(--mono); width: 1.3rem; flex: none; align-self: center; color: var(--faint); }
.leases button { flex: none; width: 2.5rem; padding: 0; font-size: 1.1rem; line-height: 1; }
.run-row { display: flex; gap: .5rem; margin-top: 1.1rem; }
#stop { flex: none; padding: .8rem 1rem; border-radius: 12px; }
.run-hint { margin: .6rem 0 0; }

/* ---------- saved runs ---------- */
.golden { list-style: none; padding: 0; margin-block: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.golden li { display: grid; }
.golden li.hint { margin: 0; }
.golden button {
  text-align: left; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 1rem 1.1rem; color: var(--ink);
  display: grid; grid-template-columns: 1fr auto; gap: .5rem .8rem; align-content: space-between; min-height: 112px;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.golden button:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.golden button strong { font-weight: 600; font-size: .98rem; line-height: 1.3; }
.golden button span { font: 400 .72rem var(--mono); color: var(--muted); grid-column: 1 / -1; }
.golden button::after { content: "\25B6"; grid-column: 2; grid-row: 1; font-size: .6rem; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--rule-2); border-radius: 50%; color: var(--muted); padding-left: 2px; }
.golden button:hover::after, .golden li.active button::after { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.golden li.active button { border-color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }

/* ---------- a run: results on the left, map and agent on the right ---------- */
.app { background: color-mix(in srgb, var(--ink) 3%, var(--bg)); }
.credits { font: 400 .76rem var(--mono); color: var(--muted); }
.verdict { font-size: 1rem; padding: 1.4rem 1.5rem; background: var(--ink); color: var(--bg); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 20px; }
.verdict > b { display: block; font: 400 clamp(1.6rem, 2.8vw, 2.3rem)/1.1 var(--display); letter-spacing: -.01em; margin-bottom: .5rem; }
.scout-summary { margin: .8rem 0 0; font-size: .95rem; opacity: .85; max-width: 90ch; }
.measured, .not-measured { margin: .9rem 0 0; padding: 0; list-style: none; font-size: .8rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.measured li, .not-measured li { border: 1px solid color-mix(in srgb, var(--bg) 28%, transparent); border-radius: 999px; padding: .12rem .6rem; }
.measured .nm-head, .not-measured .nm-head { border: 0; padding: 0; font: 500 .68rem var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .7; flex-basis: 100%; }
.not-measured li:not(.nm-head) { border-style: dashed; opacity: .8; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: 20px; align-items: start; }
.main { display: grid; gap: 20px; min-width: 0; }
.main > * { animation: rise .4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.rail { position: sticky; top: calc(var(--nav) + 16px); display: grid; gap: 12px; min-width: 0; }
.map-wrap { position: relative; }
.map { height: 330px; border-radius: 16px; border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow); z-index: 0; }
.map-fit { position: absolute; right: 12px; top: 12px; z-index: 500; background: var(--surface); border: 1px solid var(--rule-2); border-radius: 999px; padding: .3rem .75rem; font-size: .8rem; font-weight: 500; box-shadow: var(--shadow); }
.map-fit:hover { border-color: var(--ink); }
.leaflet-container { font: inherit; background: var(--field); }
.leaflet-tile-pane { filter: var(--map-filter); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--rule) !important; }
.leaflet-tooltip { background: var(--ink); color: var(--bg); border: 0; border-radius: 8px; font-size: .8rem; padding: .3rem .55rem; box-shadow: var(--shadow); }
.leaflet-tooltip::before { display: none; }
.map-key { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center; padding: 0 .2rem; }
.map-key > span { display: inline-flex; align-items: center; gap: .35rem; }
.key-lease { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 .66rem var(--mono); }
.key-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--city); }
.key-ring { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--city); }
.lease-pin { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 .82rem var(--mono); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ink), 0 4px 10px rgba(0, 0, 0, .3); }

.trace { padding: 18px 20px; max-height: max(240px, calc(100vh - var(--nav) - 330px - 96px)); overflow: auto; }
.elapsed { font: 500 .76rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 2px; background: var(--rule); border-radius: 2px; overflow: hidden; margin: .8rem 0 0; }
.bar i { display: block; height: 100%; width: 35%; background: var(--ink); border-radius: inherit; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(300%); } }
.steps { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .55rem; font-size: .88rem; }
.steps li { display: grid; grid-template-columns: 1.2rem 1fr; gap: .55rem; }
.steps .idle { display: block; color: var(--muted); }
.steps .ico { font-weight: 700; text-align: center; font-size: .8rem; line-height: 1.5rem; }
.steps .running .ico::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--ink); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps .done .ico { color: var(--ok); }
.steps .error .ico { color: var(--err); }
.steps .stopped .ico { color: var(--faint); }
.steps .lab { font-weight: 500; }
.steps .detail { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.steps .sub { display: block; margin-left: .55rem; padding: .05rem 0 .05rem 1.1rem; border-left: 1px solid var(--rule-2); font: 400 .74rem/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.steps .sub.thinking { font-style: italic; }
.steps .sub.thinking::after { content: "\2026"; animation: pulse 1.4s ease-in-out infinite; }
.steps .sub.error { color: var(--warn); }
.steps .slow { display: block; font-size: .78rem; color: var(--muted); font-style: italic; }
@keyframes pulse { 50% { opacity: .2; } }
@keyframes spin { to { transform: rotate(360deg); } }
.calls { margin-top: 1rem; font-size: .82rem; border-top: 1px solid var(--rule); padding-top: .8rem; }
.calls ol { padding-left: 1.4rem; margin: .5rem 0 0; color: var(--muted); max-height: 220px; overflow: auto; font: 400 .72rem/1.6 var(--mono); }

.wait { color: var(--muted); font-size: .92rem; padding: 2.2rem 0 1.6rem; text-align: center; }
.rank-note { font-size: .88rem; color: var(--muted); margin: .9rem 0 .2rem; padding-left: .8rem; border-left: 2px solid var(--city); max-width: 84ch; }
.rank-note.qloo { border-color: var(--qloo); }
.rank-note strong { color: var(--ink); }
.rank-list { list-style: none; margin: 0; padding: 0; position: relative; }
.rank-list > li {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: .25rem .9rem;
  padding: 1.2rem .7rem; margin: 0 -.7rem; border-top: 1px solid var(--rule); cursor: pointer; transition: background .15s ease;
}
.rank-list > li:first-child { border-top-color: transparent; margin-top: .5rem; }
.rank-list > li:hover, .rank-list > li.on { background: var(--field); }
.rank-list > li > * { grid-column: 2; }
.rank-list .pos { grid-column: 1; grid-row: 1 / span 3; font: 400 3rem/.9 var(--display); color: var(--faint); font-variant-numeric: tabular-nums; }
.rank-list > li:first-child .pos { color: var(--ink); }
.rank-list .addr { font-weight: 600; font-size: 1.06rem; letter-spacing: -.01em; }
.rank-list .hood { color: var(--muted); font-weight: 400; font-size: .86rem; margin-left: .5rem; white-space: nowrap; }
.facts { display: flex; flex-wrap: wrap; gap: .3rem 1.3rem; font-size: .86rem; color: var(--muted); margin: .25rem 0 0; padding: 0; list-style: none; }
.facts b { color: var(--ink); font: 600 .9rem var(--mono); font-variant-numeric: tabular-nums; }
.facts .lead b { color: var(--city); }
.qmode .facts .lead b { color: var(--ink); }
.facts .taste { display: none; }
.qmode .facts .taste { display: inline; }
.qmode .facts .taste b { color: var(--qloo); }
.score { display: grid; grid-template-columns: minmax(80px, 200px) minmax(0, 1fr); gap: .7rem; align-items: center; margin: .5rem 0 .1rem; font-size: .8rem; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--city); transform-origin: left; animation: grow .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.flag { font-size: .85rem; color: var(--warn); margin: .3rem 0 0; }
.nearby { font-size: .84rem; color: var(--muted); margin: .15rem 0 0; }
.store { font-size: .84rem; margin: .2rem 0 0; color: var(--ink-2); }
.tag, .store .tag { display: inline-block; font: 500 .68rem var(--mono); letter-spacing: .04em; padding: .1rem .5rem; border-radius: 999px; background: var(--city-tint); color: var(--city); margin-left: .4rem; vertical-align: 1px; }
.reason { font-size: .9rem; margin: .5rem 0 0; padding: .6rem .8rem; background: var(--field); border-radius: 10px; color: var(--ink-2); max-width: 84ch; }
.rank-list > li:hover .reason, .rank-list > li.on .reason { background: var(--surface); }

.partners-body { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: .8rem; }
.partner { border: 1px solid var(--rule); border-radius: 12px; padding: .8rem .9rem; font-size: .88rem; }
.partner h3 { font-size: .95rem; margin: .15rem 0 .25rem; }
.partner .m { font: 500 .68rem var(--mono); letter-spacing: .04em; color: var(--muted); }
.partner p { color: var(--muted); margin-top: .25rem; overflow-wrap: anywhere; }
.partner ul { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .3rem; }
.partner li { display: flex; justify-content: space-between; gap: .8rem; border-top: 1px solid var(--rule); padding-top: .3rem; }
.partner li:first-child { border-top: 0; padding-top: 0; }
.partner li span { color: var(--muted); white-space: nowrap; font-size: .8rem; }

.brief-legend { font-size: .82rem; color: var(--muted); margin: .7rem 0 1rem; line-height: 1.9; }
.brief #brief-body h3 { font: 500 .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 1.4rem 0 .35rem; }
.brief p.sec { max-width: 72ch; font-size: 1.02rem; line-height: 1.65; }
.brief .draft { white-space: pre-line; color: var(--muted); }
.q { background: var(--qloo-tint); border-bottom: 2px solid var(--qloo); padding: 0 .15em; border-radius: 3px 3px 0 0; }
.c { border-bottom: 2px solid var(--city); }
.u { border-bottom: 2px dotted var(--warn); }
.sources-line { margin: .7rem 0 0; font-weight: 500; font-size: .92rem; }
.sources-line .n-q { color: var(--qloo); }
.sources-line .n-c { color: var(--city); }
.sources-line .n-u { color: var(--warn); }
.repair-note { font-size: .86rem; color: var(--muted); margin: 1rem 0 0; padding-left: .8rem; border-left: 2px solid var(--warn); }
.redacted { border: 1px dashed var(--rule-2); border-radius: 12px; padding: 1rem 1.1rem; margin-top: 1rem; color: var(--muted); font-size: .92rem; }
.redacted dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1.2rem; margin: .8rem 0 0; }
.redacted dt { font: 500 .7rem var(--mono); letter-spacing: .08em; text-transform: uppercase; align-self: center; }
.redacted dd { margin: 0; color: var(--ink); }
.evidence-used { margin-top: 1.3rem; font-size: .9rem; border-top: 1px solid var(--rule); padding-top: .9rem; }
.evidence-used dl { margin: .6rem 0 0; }
.evidence-used dt { font-weight: 600; margin-top: .5rem; }
.evidence-used dd { margin: .1rem 0 0; color: var(--muted); }
.evidence-used .used { color: var(--qloo); font-weight: 600; }

.next-list { margin: .6rem 0 0; padding: 0; list-style: none; counter-reset: n; display: grid; }
.next-list li { counter-increment: n; display: grid; grid-template-columns: 2rem 1fr; padding: .7rem 0; border-top: 1px solid var(--rule); font-size: .94rem; color: var(--ink-2); }
.next-list li::before { content: counter(n, decimal-leading-zero); font: 500 .72rem var(--mono); color: var(--faint); padding-top: .2rem; }
.next-list li.specific { color: var(--ink); font-weight: 500; }
.next-list li > span { max-width: 84ch; }
.next-list a { font: 500 .7rem var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-left: .5rem; color: var(--muted); white-space: nowrap; }

.ask .chips { margin: .5rem 0 .9rem; }
.ask-form { display: flex; gap: .5rem; }
.ask-form input { flex: 1; min-width: 0; }
.ask-btn { width: auto; flex: none; margin: 0; padding: .6rem 1.1rem; white-space: nowrap; }
.thread { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.thread:empty { margin: 0; }
.thread > li { border: 1px solid var(--rule); border-radius: 12px; padding: .9rem 1rem; }
.thread .q { background: none; border: 0; font-weight: 600; padding: 0; }
.thread .tools { list-style: none; padding: 0; margin: .5rem 0; font: 400 .76rem var(--mono); color: var(--muted); display: grid; gap: .2rem; }
.thread .tools:empty { margin: 0; }
.thread .tools .done::before { content: "\2713  "; color: var(--ok); font-weight: 700; }
.thread .tools .error::before { content: "\2715  "; color: var(--err); font-weight: 700; }
.thread .tools .running::before { content: "\2026  "; }
.thread .a { white-space: pre-line; max-width: 78ch; margin: .3rem 0 0; color: var(--ink-2); }
.thread .loose { font-size: .82rem; color: var(--warn); margin: .4rem 0 0; }

/* ---------- how it works, sources ---------- */
.flow { list-style: none; counter-reset: f; margin-block: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.flow li { counter-increment: f; padding: 1.4rem 1.6rem 1.6rem 0; border-bottom: 1px solid var(--rule); }
.flow li:not(:nth-child(3n + 1)) { padding-left: 1.6rem; border-left: 1px solid var(--rule); }
.flow li::before { content: "0" counter(f); display: block; font: 400 2.4rem/1 var(--display); color: var(--faint); margin-bottom: .9rem; }
.flow h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.flow p { font-size: .92rem; color: var(--muted); }
.sources { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.sources article { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 1.2rem 1.2rem 1.3rem; box-shadow: var(--shadow); border-top: 3px solid var(--ink); }
.sources .s-city { border-top-color: var(--city); }
.sources .s-qloo { border-top-color: var(--qloo); }
.tagline { font: 500 .66rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sources h3 { font-size: 1.02rem; margin: .5rem 0 .4rem; }
.sources p { font-size: .88rem; color: var(--muted); }

/* ---------- scene, evidence ---------- */
.evidence .lede { color: var(--muted); margin-top: 1rem; max-width: none; font-size: 1rem; }
.scene-form { margin-top: 1.4rem; }
.scene-form input { max-width: 520px; }
.scene-body:not(:empty) { margin-top: 1.2rem; }
.around h3:not(.ph), .scene-body h3 { font-size: 1rem; margin: 1.1rem 0 .3rem; }
.scene-body .panel h3 { margin-top: 0; }
.around-list, .scene-list { margin: .4rem 0 0; padding-left: 1.2rem; display: grid; gap: .3rem; font-size: .9rem; }
.around-list .m, .scene-list .m { color: var(--muted); font-size: .8rem; }
.around-list .qf { color: var(--qloo); font-weight: 600; font-variant-numeric: tabular-nums; }
.around-list .men { color: var(--muted); }
.around-list .nodetail { color: var(--faint); font-style: italic; font-size: .82rem; }
.among { margin: .7rem 0 0; padding-left: .8rem; border-left: 2px solid var(--qloo); max-width: 80ch; }
.notes { margin: 1rem 0 0; padding-left: 1.2rem; font-size: .82rem; color: var(--muted); display: grid; gap: .2rem; max-width: 84ch; }
.scene-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); margin-top: .8rem; }
.scene-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); column-gap: 1.6rem; }
.scene-list .unc { color: var(--faint); }
.scene-list .unc b { font-weight: 400; }
.matched { margin: .6rem 0 0; }
.taste-cols { display: grid; gap: .9rem; }
.taste-cols h4 { font: 500 .68rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--qloo); }
.taste-cols p { margin: .2rem 0 0; }

.medians { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 2rem; margin-bottom: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.medians > div { padding: 1.2rem 1.2rem 1.3rem 0; }
.medians > div + div { padding-left: 1.4rem; border-left: 1px solid var(--rule); }
.medians dt { font: 500 .7rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.medians .m-city dt::before, .medians .m-qloo dt::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--city); flex: none; }
.medians .m-qloo dt::before { background: var(--qloo); }
.medians dd { margin: .3rem 0 0; font: 400 clamp(2.4rem, 5vw, 3.8rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.medians p { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.chart-fig { margin-top: 1.6rem; margin-bottom: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 22px; position: relative; box-shadow: var(--shadow); }
.chart-fig figcaption strong { display: block; font-weight: 600; font-size: 1.05rem; }
.chart-fig figcaption span { font-size: .86rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; align-items: center; font-size: .86rem; margin: 1rem 0; }
.legend button { margin-left: auto; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; vertical-align: -1px; }
.sw.city { background: var(--city); }
.sw.qloo { background: var(--qloo); }
.chart { max-width: 940px; margin-inline: auto; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11.5px var(--mono); }
.chart .lab { fill: var(--ink); font: 13px var(--body); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .mid { stroke: var(--faint); stroke-dasharray: 3 3; }
.chart .gap { stroke: var(--rule-2); stroke-width: 2; }
.chart .d-city { fill: var(--city); stroke: var(--surface); stroke-width: 2; }
.chart .d-qloo { fill: var(--qloo); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .row:hover .hit { fill: color-mix(in srgb, var(--ink) 4%, transparent); }
.chart .row:hover .lab { font-weight: 600; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .8rem; padding: .5rem .7rem; border-radius: 10px; max-width: 260px; box-shadow: var(--shadow); z-index: 5; }
#chart-table, .tests-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; font-size: .86rem; width: 100%; }
table.data th { font: 500 .68rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
table.data th, table.data td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; vertical-align: top; }
#chart-table td:not(:first-child) { font-family: var(--mono); font-size: .82rem; }
.entries-head { display: flex; justify-content: space-between; align-items: flex-end; gap: .8rem 2rem; flex-wrap: wrap; margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.entries-head h3 { font: 400 clamp(1.6rem, 2.8vw, 2.2rem)/1.1 var(--display); }
.entries-head .hint { margin: 0; max-width: 56ch; }
.entries-head input { max-width: 260px; border-radius: 999px; padding: .45rem .9rem; background: var(--surface); }
.entries { columns: 3 340px; column-gap: 16px; margin-top: 1.2rem; }
.entry { break-inside: avoid; margin: 0 0 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: .55rem; }
.entry h3 { font-size: 1.02rem; margin-bottom: .2rem; }
.entry p { font-size: .9rem; color: var(--ink-2); }
.entry .k { display: block; font: 500 .66rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.entry .src-files { font: 400 .72rem var(--mono); color: var(--faint); border-top: 1px solid var(--rule); padding-top: .6rem; margin-top: .2rem; overflow-wrap: anywhere; }
.tests-wrap { margin-top: 1.2rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--shadow); }
.tests { min-width: 640px; }
.tests th, .tests td { padding: .75rem 1rem; }
.tests tr:last-child td { border-bottom: 0; }
.tests td:first-child { font: 400 1.5rem/1 var(--display); color: var(--faint); width: 4.2rem; white-space: nowrap; }
.tests td:nth-child(2) { width: 40%; font-weight: 500; }
.tests td:nth-child(3) { color: var(--ink-2); }
.tests tbody tr:hover td { background: var(--field); }

.foot { padding: 2.5rem var(--pad) 3rem; border-top: 1px solid var(--rule); font-size: .8rem; color: var(--muted); display: grid; gap: .7rem; }
.foot > * { max-width: var(--max); margin-inline: auto; width: 100%; }
.foot .logo { color: var(--ink); font-size: 1rem; }
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: var(--bg); border: 0; box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1300; background: var(--ink); color: var(--bg); font-size: .88rem; font-weight: 500; padding: .6rem 1rem; border-radius: 999px; box-shadow: var(--shadow); }

/* ---------- smaller screens ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .inputs { width: 100%; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; order: -1; }
  .trace { max-height: 320px; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow li:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
  .flow li:nth-child(even) { padding-left: 1.6rem; border-left: 1px solid var(--rule); }
}
@media (max-width: 700px) {
  .nav { gap: .5rem; }
  .nav-links a { padding: .4rem .45rem; font-size: .84rem; }
  .nav-links a:nth-child(-n + 2), .pill { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats > div:nth-child(n + 3) { border-top: 1px solid var(--h-rule); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .points { display: none; }
  .inputs { padding: 18px; }
  .mode-toggle button { font-size: .78rem; white-space: normal; line-height: 1.2; }
  .panel { padding: 18px; }
  .medians { grid-template-columns: minmax(0, 1fr); }
  .medians > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .map { height: 280px; }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow li, .flow li:nth-child(even) { padding-left: 0; border-left: 0; }
  .rank-list > li { grid-template-columns: 2.3rem minmax(0, 1fr); }
  .rank-list .pos { font-size: 2.1rem; }
  .rank-list .hood { display: block; margin-left: 0; }
  .score { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  .facts { flex-direction: column; gap: .15rem; }
  .ask-form { flex-wrap: wrap; }
  .ask-form input { flex-basis: 100%; }
  .ask-btn { width: 100%; }
  .legend button { margin-left: 0; }
  .redacted dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .redacted dd { margin-bottom: .5rem; }
  .entries-head input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .nav, .inputs, .saved, .how-it, .trace, .toggle, .ask, .evidence, .foot, .stats, .points, .grid-art, #print-report, #copy-brief, .map-key, .map-fit,
  .to-top, .toast, .skip, .around, .band-head, .leaflet-control-container { display: none !important; }
  .top { background: #fff; color: #000; padding: 0 0 8px; border: 0; --h-ink: #000; --h-muted: #444; }
  .hero { display: block; }
  .wordmark { font-size: 2rem; }
  .band { padding: 0; }
  .cols { display: block; }
  .rail { position: static; margin-top: 12px; }
  body, .app { background: #fff; color: #000; }
  .panel { border: 0; padding: 0 0 12px; box-shadow: none; break-inside: avoid; }
  .verdict { background: #fff; color: #000; border: 1px solid #000; box-shadow: none; }
  .map { height: 300px; break-inside: avoid; box-shadow: none; }
  .main > * { animation: none; }
}
