/* Knowledge graph prototypes. Values copied from app/design-tokens.css (MarketInter, black and white, status
   colours only for state; the branch colours are marks on dots, bars and arcs, never on surfaces or text). */
@font-face {
  font-family: MarketInter;
  src: url("market-inter.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
}
:root {
  --ink: #0a0a0a;
  --muted: #666666;
  --line: #ebebeb;
  --subtle: #f5f5f5;
  --surface: #ffffff;
  --signal: #5e6ad2;
  --signal-soft: #eef0fb;
  --raised: 0 1px 1px rgba(10, 10, 10, 0.06), 0 2px 4px -1px rgba(10, 10, 10, 0.1), 0 4px 6px -4px rgba(10, 10, 10, 0.12);
  --panel: 0 1px 2px rgba(10, 10, 10, 0.06), 0 4px 8px -2px rgba(10, 10, 10, 0.08), 0 16px 16px -12px rgba(10, 10, 10, 0.14);
  --out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 MarketInter, Arial, sans-serif; color: var(--ink); background: var(--subtle); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
#app { display: flex; height: 100%; }

.rail { flex: 0 0 72px; height: 100%; background: var(--subtle) url("rail.jpg") left top / 72px auto no-repeat; }
.pane { flex: 1; min-width: 0; height: 100%; background: var(--surface); display: flex; flex-direction: column; }
.top { padding: 22px 28px 14px; }
.top h1 { font-size: 28px; line-height: 1.15; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.top .lead { margin: 6px 0 0; font-size: 16px; max-width: 860px; }
.top .lead span { color: var(--muted); }
.body { flex: 1; min-height: 0; display: flex; gap: 20px; padding: 0 20px 20px 28px; }

/* Stage */
.stage { position: relative; flex: 1; min-width: 0; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.stage.dark { background: #0a0a0a; border-color: #0a0a0a; }
svg.graph, canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage.panning svg.graph, .stage.panning canvas.gl { cursor: grabbing; }
.hint { position: absolute; left: 16px; bottom: 14px; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; }
.sample { position: absolute; right: 16px; top: 20px; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; }
.dark .hint, .dark .sample { color: #898781; }

/* Search: a field with a shortcut hint, results below */
.search { position: absolute; left: 12px; top: 12px; width: 300px; z-index: 30; }
.search .field {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 11px; border-radius: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--raised); cursor: text;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.search .field:focus-within { border-color: #cfcfcf; box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06), var(--raised); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--muted); }
.search kbd { font: 11px MarketInter, Arial, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.results { list-style: none; margin: 6px 0 0; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--panel); }
.results button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; }
.results button:hover, .results button[aria-selected="true"] { background: var(--subtle); }
.results i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.results b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results small { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--muted); flex: none; }
.dark .search .field { background: #161616; border-color: #2a2a2a; box-shadow: none; color: #898781; }
.dark .search .field:focus-within { border-color: #444; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
.dark .search input { color: #f0efec; }
.dark .search input::placeholder { color: #898781; }
.dark .search kbd { border-color: #2a2a2a; color: #898781; }
.dark .results { background: #161616; border-color: #2a2a2a; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
.dark .results button { color: #f0efec; }
.dark .results button:hover, .dark .results button[aria-selected="true"] { background: #222; }
.dark .results small { color: #898781; }

/* Zoom control */
.zoom { position: absolute; right: 12px; bottom: 12px; z-index: 30; display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--raised); }
.zoom button { height: 28px; min-width: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: none; font-size: 13px; cursor: pointer; transition: background-color 150ms ease-out; }
.zoom button:hover { background: var(--subtle); }
.zoom button:active { transform: scale(0.97); }
.dark .zoom { background: #161616; border-color: #2a2a2a; box-shadow: none; }
.dark .zoom button { color: #f0efec; }
.dark .zoom button:hover { background: #222; }
.search input:focus-visible { outline: none; }
.zoom button:focus-visible, .side button:focus-visible, .results button:focus-visible, .chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.dark .zoom button:focus-visible, .chip:focus-visible { outline-color: #f0efec; }

/* SVG graph */
.graph text { font-family: MarketInter, Arial, sans-serif; }
.halo { paint-order: stroke; stroke: #fff; stroke-linejoin: round; }
.nl { font-size: 12px; fill: var(--ink); stroke-width: 3px; pointer-events: none; }
.nl.hubl { font-size: 13px; font-weight: 600; }
.nl.soft { fill: var(--muted); }
.bl { cursor: pointer; }
.bl .name { font-size: 15px; font-weight: 600; fill: var(--ink); stroke-width: 4px; }
.bl .count { font-size: 13px; font-weight: 400; fill: var(--muted); stroke-width: 4px; }
.bl .take { font-size: 12px; fill: var(--muted); stroke-width: 4px; }
.e { fill: none; stroke: #d2d2d2; stroke-width: 1; vector-effect: non-scaling-stroke; transition: opacity 150ms ease-out; }
.e.x { stroke: #e6e6e6; }
.e.on { stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1.4; }
.n { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; transition: opacity 150ms ease-out; }
.n.hub { stroke-width: 3; }
.n.match { stroke: var(--ink); stroke-width: 2; }
.hit { fill: transparent; cursor: pointer; }
.ring { fill: none; stroke: var(--signal); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.guide { fill: none; stroke: #f0f0f0; stroke-width: 1; vector-effect: non-scaling-stroke; }
.arc { cursor: pointer; transition: opacity 150ms ease-out; }
.thread { fill: none; stroke-width: 1.1; vector-effect: non-scaling-stroke; transition: opacity 150ms ease-out; }

/* 3D chips */
.chips { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.chip {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; line-height: 1.2; color: #f0efec; padding: 4px 9px;
  border-radius: 999px; background: rgba(22, 22, 22, 0.88); border: 1px solid #2c2c2c; will-change: transform; pointer-events: none;
}
.chip.branch { pointer-events: auto; cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 12px; display: inline-flex; align-items: center; gap: 7px; }
.chip.branch i { width: 7px; height: 7px; border-radius: 50%; }
.chip.branch small { font-size: 12px; font-weight: 400; color: #898781; }
.chip.branch:hover { border-color: #4a4a4a; }
.chip.sel { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.3); }

/* Side panel */
.side { flex: 0 0 332px; border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 14px; overflow: auto; }
.side h2 { font-size: 16px; font-weight: 600; margin: 2px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.side h2 span, .side h3 span { font-weight: 400; color: var(--muted); font-size: 13px; }
.side h3 { font-size: 13px; font-weight: 600; margin: 18px 0 6px; display: flex; justify-content: space-between; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.branch-row { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 12px; padding: 9px 10px 10px; cursor: pointer; transition: background-color 150ms ease-out; }
.branch-row:hover, .branch-row:focus-visible { background: var(--subtle); }
.branch-row .line { display: flex; align-items: center; gap: 8px; }
.branch-row i, .big i, .back i, .rec i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.branch-row b { font-size: 14px; font-weight: 600; }
.branch-row .count { margin-left: auto; font-size: 13px; color: var(--muted); }
.branch-row .take { display: block; margin: 3px 0 0 16px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--subtle); border-radius: 999px; padding: 5px 10px 5px 8px; font-size: 12px; cursor: pointer; margin-bottom: 12px; transition: background-color 150ms ease-out; }
.back:hover { background: #ececec; }
.kindline { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0; }
.big { font-size: 20px; font-weight: 600; line-height: 1.25; margin: 4px 0 2px; display: flex; align-items: center; gap: 8px; }
.meta { margin: 0; font-size: 13px; color: var(--muted); }
.note { font-size: 14px; margin: 6px 0 0; }
.counts li { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 10px; background: var(--subtle); font-size: 13px; }
.counts b { font-weight: 600; }
.bars button { width: 100%; text-align: left; border: 0; background: none; border-radius: 10px; padding: 6px 8px; cursor: pointer; transition: background-color 150ms ease-out; }
.bars button:hover { background: var(--subtle); }
.bars .line { display: flex; justify-content: space-between; font-size: 13px; }
.bars .line b { font-weight: 600; }
.bars .bar { display: block; height: 4px; margin-top: 5px; border-radius: 999px; background: var(--subtle); overflow: hidden; }
.bars .bar span { display: block; height: 100%; border-radius: 999px; }
.rec { display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; cursor: pointer; transition: background-color 150ms ease-out; }
.rec:hover { background: var(--subtle); }
.rec i { margin-top: 5px; }
.rec span { min-width: 0; }
.rec em { display: block; font-style: normal; font-size: 12px; color: var(--signal); }
.rec b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
.rec small { display: block; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .search .field, .zoom button, .e, .n, .arc, .thread, .branch-row, .back, .bars button, .rec { transition: none; }
}

/* The picker: harness chrome, copied verbatim from the prototype skill's PICKER.md. Do not restyle. */
.proto-picker {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483647;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  backdrop-filter: blur(12px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 8px 24px rgba(0, 0, 0, 0.24),
    0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.proto-picker-highlight {
  position: absolute;
  top: 4px;
  left: 0;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  will-change: transform;
}

/* The slide is enabled only after first paint (data-ready), so load doesn't animate. */
.proto-picker[data-ready] .proto-picker-highlight {
  transition:
    transform 250ms cubic-bezier(0.23, 1, 0.32, 1),
    width 250ms cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-reduced-motion: reduce) {
  .proto-picker[data-ready] .proto-picker-highlight { transition: none; }
}

.proto-picker-item {
  position: relative; /* sits above the highlight */
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  cursor: pointer;
  transition: color 150ms ease-out;
}

.proto-picker-item:hover {
  color: rgba(255, 255, 255, 0.85);
}

.proto-picker-item:active {
  transform: scale(0.97);
}

.proto-picker-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

.proto-picker-item[data-active] {
  color: #fff;
}

.proto-picker-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.12);
}

.proto-picker-replay {
  padding: 0 10px;
  font-size: 14px;
}

.proto-picker[data-position="top"] {
  bottom: auto;
  top: 24px;
}

/* Constellation, detailed (mock) */
.hull { fill: none; stroke-width: 1.4; stroke-opacity: 0.5; stroke-dasharray: 0.5 6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: opacity 150ms ease-out; }
.arc-link { fill: none; stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.arc-link.on { stroke-width: 1.7; }
.shape { transition: opacity 150ms ease-out; }
.shape .solid { stroke: #fff; stroke-width: 1.5; }
.shape .group { stroke-width: 2; }
.hub-dot { stroke: #fff; stroke-width: 2.5; }
.hub-count { font-size: 11px; font-weight: 600; fill: #fff; pointer-events: none; }
.belief-ring { fill: #fff; stroke-width: 1.4; stroke-opacity: 0.45; }
.belief-ring.weak { stroke-dasharray: 2 2.2; stroke-opacity: 0.8; }
.belief-score { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.result-ring { fill: #fff; fill-opacity: 0; stroke-width: 1.4; }
.kg-tip, .kg-card { position: absolute; left: 0; top: 0; z-index: 20; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--panel); }
.kg-tip { width: 260px; padding: 10px 12px 11px; }
.kg-tip .h { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; }
.kg-tip .h i { width: 8px; height: 8px; border-radius: 50%; }
.kg-tip .h b { font-weight: 600; }
.kg-tip .h span { margin-left: auto; color: var(--muted); }
.kg-tip .t { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.kg-card { width: 260px; padding: 11px 13px 12px; }
.kg-card .k { margin: 0; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kg-card .h { margin: 3px 0 2px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.kg-card .m { margin: 0; font-size: 12px; color: var(--muted); }
.kg-card .c { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .hull, .shape { transition: none; } }

/* Ring plus: the orbit, direction marks, pulses, ping */
.orbit { fill: none; stroke: #0a0a0a; stroke-opacity: 0.3; stroke-width: 1.6; stroke-dasharray: 0.5 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.orbit.inner { stroke-opacity: 0.14; }
.orbit.moving { animation: kg-march 40s linear infinite; }
@keyframes kg-march { to { stroke-dashoffset: -150; } }
.chev { fill: none; stroke: #0a0a0a; stroke-opacity: 0.42; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pulse { pointer-events: none; stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ping { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.bl .num { font-weight: 400; fill: var(--muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .orbit.moving { animation: none; } }

/* Journey */
.orbit-dot { fill: #0a0a0a; }
.trail { fill: none; stroke: #0a0a0a; stroke-opacity: 0.35; stroke-width: 1.4; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.trail-dot { fill: #fff; stroke: #0a0a0a; stroke-opacity: 0.45; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.nl.nl-big { font-size: 16px; font-weight: 600; }
.group-label { font-size: 12px; font-weight: 500; fill: var(--signal); stroke-width: 4px; }
.crumbs { position: absolute; left: 12px; top: 58px; z-index: 25; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--raised); max-width: calc(100% - 24px); overflow: hidden; }
.crumbs .crumb { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 999px; padding: 5px 10px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background-color 150ms ease-out; }
.crumbs .crumb:hover { background: var(--subtle); color: var(--ink); }
.crumbs .crumb.now { color: var(--ink); font-weight: 600; }
.crumbs .crumb i { width: 7px; height: 7px; border-radius: 50%; }
.crumbs .sep { color: #c4c4c4; font-size: 12px; }
.edge-marks { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.edge-mark { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--raised); font-size: 12px; cursor: pointer; white-space: nowrap; transition: border-color 150ms ease-out; }
.edge-mark:hover { border-color: #cfcfcf; }
.edge-mark i { width: 7px; height: 7px; border-radius: 50%; }
.edge-mark .n { color: var(--muted); }
.edge-mark b { font-weight: 600; }
.edge-mark.far { opacity: 0.85; }
.edge-mark:focus-visible, .crumbs .crumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .crumbs .crumb, .edge-mark { transition: none; } }
.edge-mark[hidden] { display: none; }
.bl.dimmed .take { display: none; }



/* Ring, animated (alive): JS eases every opacity itself, so the CSS transitions step aside */
.graph.alive .e, .graph.alive .shape { transition: none; }
@keyframes kg-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .graph.alive { animation: kg-fade-in 200ms ease-out; } }
.trace { fill: none; stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
