.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 32px; max-width: 1480px; margin: 0 auto; display: grid; gap: 14px; }
.mono { font-family: var(--mono); }
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
header h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
header .eyebrow { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); width: 100%; }
header p { margin: 0; color: var(--ink-2); max-width: 78ch; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font: 500 11px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
select, button { font: inherit; color: var(--ink); }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; max-width: 260px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 13px; display: inline-flex; gap: 6px; align-items: baseline; }
.chip .n { font: 11px var(--mono); color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip[aria-pressed="true"] .n { color: var(--surface); opacity: 0.7; }
.chip.ghost { border-style: dashed; color: var(--ink-2); }
.check { display: inline-flex; gap: 6px; align-items: center; padding-bottom: 5px; cursor: pointer; }
button:focus-visible, select:focus-visible, .chip:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 9px 14px 10px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; display: grid; text-align: left; gap: 1px; }
.tab b { font-weight: 600; font-size: 14px; }
.tab small { font-size: 12px; color: var(--muted); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
@media (max-width: 700px) { .tabs { flex-wrap: nowrap; overflow-x: auto; } .tab { white-space: nowrap; } .tab small { display: none; } }

/* Main */
.main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
@media (max-width: 960px) { .main { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.view-head { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; align-items: center; padding: 12px 14px 4px; }
.view-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.view-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; max-width: 72ch; }
.view-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; color: var(--ink-2); }
.view-tools label { display: inline-flex; gap: 6px; align-items: center; }
.view-tools input[type=range] { width: 110px; accent-color: var(--ink); }
.view-tools output { font: 12px var(--mono); min-width: 3.2em; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 4px 14px 8px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.key-line { width: 22px; height: 0; border-top: 3px solid; border-radius: 2px; }
.key-box { width: 11px; height: 11px; border-radius: 3px; }
.key-ring { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--post); border-left-color: transparent; border-bottom-color: transparent; transform: rotate(45deg); }
.scroll-x { overflow-x: auto; }
svg text { fill: var(--ink); }
.empty { padding: 60px 20px; text-align: center; color: var(--ink-2); }

/* Graph marks */
.edge { fill: none; stroke-linecap: round; opacity: 0.42; transition: opacity .15s; }
.edge.R { stroke: var(--research); }
.edge.P { stroke: var(--post); }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14px; cursor: pointer; }
.arrow-R { fill: var(--research); }
.arrow-P { fill: var(--post); }
.node circle.body { fill: var(--node); stroke: var(--ink-2); stroke-width: 1.5px; }
.node.pseudo circle.body { fill: var(--raise); stroke-dasharray: 3 2; }
.node .ring { fill: var(--post); }
.node text, .label { font: 11.5px var(--mono); paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.node { cursor: pointer; }
.node.selected circle.body { stroke: var(--ink); stroke-width: 3px; }
.dimmed .edge { opacity: 0.07; }
.dimmed .edge.hot { opacity: 0.85; }
.dimmed .node { opacity: 0.35; }
.dimmed .node.hot { opacity: 1; }
.routes.dimmed .label:not(.hot) { opacity: 0.3; }
svg g[tabindex]:focus { outline: none; }
svg g[tabindex]:focus-visible circle, svg g[tabindex]:focus-visible rect { stroke: var(--accent); stroke-width: 3px; }
.key-line.dashed { border-top-style: dashed; }
.cmp { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wedge { fill: none; stroke: var(--edge); opacity: 0.22; }
.wedge.hot { stroke: var(--accent); opacity: 0.85; }
.web.dimmed .wedge:not(.hot) { opacity: 0.05; }
.mnode circle { fill: var(--ink); }
.mnode text { font: 600 12.5px var(--sans); paint-order: stroke; stroke: var(--halo); stroke-width: 4px; stroke-linejoin: round; }
.mnode text.sub { font: 11px var(--mono); fill: var(--muted); font-weight: 400; }
.mnode { cursor: pointer; }
.mnode.hot circle { fill: var(--accent); }
.snode circle { fill: var(--node); stroke: var(--ink-2); stroke-width: 1.3px; }
.snode { cursor: pointer; }
.snode.hot circle { stroke: var(--accent); stroke-width: 2.5px; }
.web.dimmed .snode:not(.hot) { opacity: 0.25; }
.web.dimmed .mnode:not(.hot) { opacity: 0.4; }
.vendor-arc { fill: none; stroke: var(--line); stroke-width: 1px; }
.vendor-label { font: 500 11px var(--sans); fill: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* Heatmap */
.cell { cursor: pointer; }
.cell rect.bg { fill: var(--raise); }
.cell rect.fill { fill: var(--seq); }
.cell text { font: 10.5px var(--mono); pointer-events: none; }
.cell:hover rect.bg, .cell.sel rect.bg { stroke: var(--ink); stroke-width: 1.5px; }
.axis-label { font: 11.5px var(--mono); fill: var(--ink-2); }
.row-label { font: 500 12.5px var(--sans); }
.row-sub { font: 11px var(--mono); fill: var(--muted); }
.col-hit { cursor: pointer; }
.col-hit:hover text { fill: var(--ink); text-decoration: underline; }
.section-title { font-size: 14px; font-weight: 600; margin: 0; }

/* Openings */
table.openings { width: 100%; border-collapse: collapse; font-size: 13px; }
table.openings th { text-align: left; font: 500 11px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.openings td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.openings tr.row { cursor: pointer; }
table.openings tr.row:hover td { background: var(--raise); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.moves { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.move { display: inline-grid; grid-template-columns: auto auto; gap: 0 6px; align-items: baseline; font-size: 12.5px; }
.move .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--ink-2); opacity: .55; }
.move .host { font-family: var(--mono); }
.move .pct { color: var(--muted); font: 11px var(--mono); }
.stack { display: flex; height: 14px; border-radius: 3px; overflow: hidden; gap: 2px; min-width: 140px; }
.stack > span { display: block; height: 100%; }
.stack-labels { display: flex; gap: 10px; font: 11px var(--mono); color: var(--ink-2); margin-top: 3px; }

/* Panel */
.panel { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 10px); max-height: calc(100vh - 20px); overflow: auto; }
@media (max-width: 960px) { .panel { position: static; max-height: none; } }
.panel h3 { margin: 0; font-size: 18px; font-weight: 600; word-break: break-all; }
.panel h3.mono { font-weight: 500; font-size: 17px; }
.panel h4 { margin: 0 0 6px; font: 500 11px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.panel .meta { color: var(--ink-2); font-size: 13px; }
.panel a { color: var(--accent); }
.bars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 7.5em) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.bar-row.click { cursor: pointer; border-radius: 4px; }
.bar-row.click:hover { background: var(--raise); }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.bar-row .track span { display: block; height: 100%; background: var(--seq); border-radius: 4px; }
.bar-row .val { font: 11.5px var(--mono); color: var(--ink-2); text-align: right; white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--raise); display: inline-flex; gap: 5px; align-items: center; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; font-size: 12.5px; }
.list li { display: flex; justify-content: space-between; gap: 10px; }
.list li .k { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list li .v { font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.list li.click { cursor: pointer; border-radius: 3px; }
.list li.click:hover { background: var(--raise); }
.list.wrap li .k { white-space: normal; font-family: var(--sans); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }
.btn:hover { background: var(--raise); }
.hint { color: var(--muted); font-size: 12.5px; }


footer { color: var(--muted); font-size: 12.5px; display: grid; gap: 4px; max-width: 110ch; }
footer p { margin: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* New views */
.mini-tiles { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; }
.mini-tile { display: grid; gap: 1px; flex: 1 1 150px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.mini-tile b { font: 500 18px var(--mono); }
.mini-tile span { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.sdots { display: inline-flex; gap: 3px; vertical-align: middle; }
.sdot { width: 9px; height: 9px; border-radius: 50%; border: 1.4px solid var(--muted); }
.sdot.on { background: var(--seq); border-color: var(--seq); }
.nowrap { white-space: nowrap; }
table.openings td.num { white-space: nowrap; }
.ep-name { max-width: 300px; overflow-wrap: anywhere; font-size: 12.5px; }
.ep-hosts { display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: baseline; }
.ep-models { min-width: 130px; font-size: 12.5px; color: var(--ink-2); }
.ep-bar { display: grid; grid-template-columns: 60px 2.4em; gap: 6px; align-items: center; }
.ep-track { display: block; height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.ep-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.linkish { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; }
.linkish:hover { text-decoration: underline; }
.seed-card { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.seed-msg { min-width: 240px; font-size: 12.5px; color: var(--ink-2); }

/* Embedded in the story: only the chart and its legend. */
.embed body { background: var(--surface); }
.embed .wrap { display: block; padding: 0; max-width: none; }
.embed header, .embed .filters, .embed .tabs, .embed .panel, .embed footer, .embed .view-head { display: none; }
.embed .main { display: block; }
.embed .card { border: 0; border-radius: 0; background: transparent; }
.embed .legend { padding-top: 10px; }

/* Link back to the story. */
.back { color: var(--accent); text-decoration: none; }
.back:hover { text-decoration: underline; }
