/* The home page's explainers, and the pieces the parity and benchmark pages reuse. */

/* 1. Replay: one lane per API, one block per request. */
.replay svg { display: block; width: 100%; height: auto; }
.replay text { font: 12.5px "IBM Plex Sans", sans-serif; fill: var(--muted); }
.replay .lbl { fill: var(--ink); font-weight: 600; font-size: 13.5px; }
.replay .num { fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.replay .lbl .sub { fill: var(--muted); font-weight: 400; font-size: 12.5px; }
.replay .lane { fill: var(--grid); }
.replay .req { stroke: var(--surface); stroke-width: 1; }
.replay .tick { stroke: var(--line); }
.replay .head { stroke: var(--ink); stroke-width: 1.5; }
.replay .axis line { stroke: var(--grid); }
.replay-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 14.5px; }
i.api { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--fc); margin-right: 7px; vertical-align: -1px; }

/* 1. Readers: what you see while each API works */
.readers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 14px; }
.reader { border: 1px solid var(--line); border-top: 3px solid var(--fc); border-radius: 10px; background: var(--bg); min-width: 0; overflow: hidden; }
.reader-bar { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--surface); }
.reader-bar .count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reader-bar .abbr, .reader-bar .tally { display: none; }
.reader-body { position: relative; padding: 10px 12px 14px; }
.reader .reader-body { min-height: 190px; }
.passage { margin: 0 !important; font-size: 16px; line-height: 1.9; }
.passage .w { border-radius: 3px; padding: 0 1px; }
.passage .w.mined { box-shadow: inset 0 -2px 0 var(--fc); }
.passage .w.now { background: color-mix(in srgb, var(--fc) 22%, transparent); }
.rpop { position: absolute; width: 196px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.rpop-word { font-size: 13px; color: var(--muted); }
.rpop-word b { font-size: 17px; color: var(--ink); font-weight: 500; }
.rpop-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin: 4px 0; padding: 0; }
.rpop-steps li { font-size: 10.5px; text-align: center; border-radius: 4px; padding: 1px 0; background: var(--cell-empty); color: var(--muted); white-space: nowrap; overflow: hidden; }
.rpop-steps li.now { background: var(--fc); color: var(--surface); font-weight: 600; }
.rpop-steps li.done { background: color-mix(in srgb, var(--fc) 25%, transparent); color: var(--ink); }
.rpop-req { display: block; font-size: 11px; background: none; padding: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcursor { position: absolute; pointer-events: none; }
/* The words mined so far, filling the space under the passage. */
.mined-list { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0 0; padding: 0; min-height: 26px; }
.mined-list li { font-size: 13px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--fc) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--fc) 45%, transparent); }
@media (prefers-reduced-motion: no-preference) { .mined-list li:last-child { animation: arrive .3s ease-out; } }
.rpop { z-index: 1; }

/* 2. Request by request */
.goals { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; padding: 0; counter-reset: goal; }
.goals li { counter-increment: goal; position: relative; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; color: var(--muted); background: var(--bg); }
.goals li::before { content: counter(goal) ". "; font-weight: 600; position: absolute; left: 10px; top: 8px; pointer-events: none; }
.goals li:hover { border-color: var(--accent); }
/* The whole step is the button that jumps to it. */
.goals button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 8px 10px 8px 26px; cursor: pointer; border-radius: 10px; }
.goals button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.goals li.now { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.goals li.done { color: var(--ink); }
/* 2's controls stay in view while its requests grow below. */
#p-controls { position: sticky; top: 0; z-index: 5; background: var(--surface); margin: 10px -18px; padding: 8px 18px; border-bottom: 1px solid var(--line); }
#popup .req-card { scroll-margin: 70px 0 24px; }
.payoff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.payoff .total { border-left: 4px solid var(--fc); padding: 4px 12px; }
.payoff small { display: block; font-size: 13px; color: var(--muted); }
.payoff b { display: block; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.payoff span { font-size: 15px; font-variant-numeric: tabular-nums; }
.lanes2 h3 { margin-top: 10px; }
.popup-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; margin: 12px 0 4px; }
.popup-row .goals { grid-template-columns: minmax(0, 1fr); margin: 0; }
.mock { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 0; --fc: var(--accent); }
.mock .reader-body { padding: 12px 14px 14px; }
.mock .passage { font-size: 17px; }
.mock .w { position: relative; }
.mock .rcursor { left: 60%; top: 55%; }
.ypop { margin: 4px 0 0 28px; max-width: 360px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); overflow: hidden; }
.ypop ul { list-style: none; margin: 0; padding: 0; }
.ypop li { display: grid; grid-template-columns: 5.6em minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 14px; transition: background .3s; }
.ypop li:first-child { border-top: 0; }
.ypop li.hit { background: var(--accent-soft); }
.ypop .term { display: flex; flex-direction: column; line-height: 1.2; }
.ypop .term b { font-size: 18px; font-weight: 500; }
.ypop .term small { font-size: 11.5px; color: var(--muted); }
.ypop .gloss { color: var(--muted); min-width: 0; }
.ybtn { font-size: 12.5px; white-space: nowrap; border-radius: 6px; padding: 2px 9px; border: 1px solid transparent; }
.ybtn.wait { color: var(--muted); }
.ybtn.add { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ybtn.saved { color: var(--good); font-weight: 600; }
.ybtn.view { border-color: var(--line); color: var(--ink); }
.ybtn.added { background: var(--accent); color: var(--surface); font-weight: 600; }
.reqs { display: grid; gap: 8px; }
.req-card { border: 1px solid var(--line); border-left: 4px solid var(--fc); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.req-card.old { opacity: .6; }
.req-card.old pre, .req-card.old .ans { display: none; }
.req-card .t { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.req-card .t b { font: 600 13px var(--mono); }
.req-card .t span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.req-card .ans { font-size: 13px; color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) { .req-card.new { animation: arrive .3s ease-out; } }
@keyframes arrive { from { opacity: 0; transform: translateY(-4px); } }

/* 3. Events */
.events { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; margin: 6px 0 12px; }
.events .explain { margin-top: 0; }
.toy { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); }
.toy-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.toy label { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 6px 0; }
.toy input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
.toy-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 6px 0; }
.toy-tags { display: flex; gap: 6px; min-height: 28px; align-items: center; border-radius: 6px; }
.toy-tags .chip { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0 2px 0 9px; background: var(--surface); }
.toy-tags button { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; border-radius: 999px; line-height: 1; }
.toy-tags .x { width: 20px; height: 20px; }
.toy-tags .plus { width: 26px; height: 26px; border: 1px dashed var(--line); font-size: 16px; }
.toy-tags button:hover { color: var(--accent); background: var(--accent-soft); }
.ui-cursor { position: absolute; z-index: 2; pointer-events: none; }
.ui-cursor.moving { transition: left .55s ease-in-out, top .55s ease-in-out; }
.ui-cursor.click::before { content: ""; position: absolute; left: -9px; top: -9px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); animation: tap .4s ease-out forwards; }
@keyframes tap { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.toy input.typing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
@media (prefers-reduced-motion: no-preference) { .toy .flash { animation: flash 1s ease-out; } }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); } }
.wait { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 6px; min-height: 34px; font-size: 13px; color: var(--muted); }
.wait i { display: block; height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.wait i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--accent); border-radius: 3px; }
.replay .req.empty { fill: var(--surface); stroke-width: 1.5; }
.replay .band { fill: var(--ink); opacity: .07; }
.replay .you { fill: var(--muted); }
.replay .badge { fill: var(--surface); stroke: var(--line); }
.replay .badge.you { fill: var(--muted); stroke: none; }
.replay .badge.ac { stroke: var(--api-ac); }
.replay .badge.ts { stroke: var(--api-ts); }
.replay .badge.partial { fill: var(--warn); stroke: none; }
.replay text.badge-n { font-size: 11px; font-weight: 600; fill: var(--ink); }
.replay text.badge-n.you, .replay text.badge-n.partial { fill: var(--surface); }
.seen-table { margin-top: 8px; font-size: 13.5px; }
.seen-table td:first-child, .seen-table th:first-child { width: 28px; padding-right: 0; }
.seen-table .badge-cell { display: inline-grid; place-items: center; min-width: 20px; height: 18px; border-radius: 9px; background: var(--muted); color: var(--surface); font-size: 11px; font-weight: 600; }
.seen-table .half { color: var(--warn); font-size: 12.5px; }
.why-later { font-size: 13.5px; color: var(--muted); margin: 8px 0 0; max-width: 86ch; }

/* 4. Waffle of actions (roles here, parity on its page) */
.waffle { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 10px; }
.wgroup h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.wgroup h4 span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.wcells { display: grid; grid-template-columns: repeat(auto-fill, 18px); gap: 3px; }
.wcells button { width: 18px; height: 18px; border: 0; padding: 0; border-radius: 4px; background: var(--cell-empty); cursor: pointer; }
.wcells button.on { background: var(--accent); }
.wcells button.half { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--cell-empty) 3px 6px); }
.wcells button:hover, .wcells button.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.wcells button.dim { opacity: .25; }
.wcells button[data-n="1"] { background: var(--seq-1); }
.wcells button[data-n="2"] { background: var(--seq-2); }
.wcells button[data-n="3"] { background: var(--seq-3); }
.wcells button.bug { box-shadow: inset 0 0 0 2px var(--bad); }
/* 4's squares: a refused one is an empty outline, so lit against refused reads at a glance; with names on, each square is its action's name. */
.wcells button span { display: none; }
#r-waffle .wcells button:not(.on):not(.half) { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 55%, transparent); }
#r-keys i.refused { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 55%, transparent); }
#r-waffle.named .wcells { display: flex; flex-wrap: wrap; gap: 3px; }
#r-waffle.named .wcells button { width: auto; height: auto; padding: 1px 6px; font: 11.5px var(--mono); color: var(--muted); }
#r-waffle.named .wcells button span { display: inline; }
#r-waffle.named .wcells button.on { color: var(--surface); }
#r-waffle.named .wcells button.half { color: var(--ink); }
.extras { margin-top: 14px; }
.extras h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.extras .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.extras .extra { border: 1px solid var(--line); background: var(--cell-empty); color: var(--muted); font: inherit; font-size: 13.5px; padding: 3px 11px; border-radius: 999px; cursor: default; }
.extras .extra.on { background: var(--accent); border-color: var(--accent); color: var(--surface); }

/* Where to start: one question, two paths of steps */
.flow { margin-top: 12px; }
.flow-root { width: max-content; max-width: 100%; margin: 0 auto !important; padding: 0 4px; font-weight: 600; font-size: 15px; }
.flow-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; position: relative; padding-top: 26px; }
/* The fork: down from the question, across, and down to each path. */
.flow-branches::before { content: ""; position: absolute; top: 12px; left: 25%; right: 25%; height: 14px; border: 2px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.flow-branches::after { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 12px; background: var(--line); }
.branch { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; background: var(--bg); min-width: 0; }
.branch h3 { margin: 0 0 10px; text-align: center; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 38px; display: flex; flex-direction: column; font-size: 14.5px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--accent); color: var(--accent); font-weight: 600; font-size: 13px; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.steps li a, .steps li strong { font-weight: 600; line-height: 26px; }
.steps li span { font-size: 13.5px; color: var(--muted); }

@media (max-width: 560px) {
  /* On a phone the three readers are just their counts, side by side; the timeline below shows the race. */
  .readers { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px; }
  .reader .reader-body { display: none; }
  .reader-bar { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 12.5px; border-bottom: 0; }
  .reader-bar b { white-space: nowrap; font-size: 12px; }
  .reader-bar b i.api { display: none; }
  .reader-bar .full, .reader-bar .count { display: none; }
  .reader-bar .abbr { display: inline; }
  .reader-bar .tally { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
}
@media (max-width: 760px) {
  .readers, .popup-row { grid-template-columns: minmax(0, 1fr); }
  .flow-branches { grid-template-columns: minmax(0, 1fr); }
  .flow-branches::before { left: 50%; right: auto; width: 0; border-width: 0 0 0 2px; border-radius: 0; }
  .goals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .events { grid-template-columns: minmax(0, 1fr); }
}
