/* sd.allahabadi.dev: the results view (sd-results.js, RESULTS-REDESIGN-SPEC.md). Only sd.css tokens.
   The view replaces the requirements and the conversation (sd.js sets .is-results on the player). The diagram's
   own state classes (sdb-st-*) are in sd-board.css. */

/* the page while the results are open: only the view (the rest stays in the DOM, its state alive) */
.sd-player.is-results > :not(.sd-rx-slot):not(.sd-sheet):not(.sr-only) { display: none !important; }
.sd-player.is-results { display: block !important; padding-bottom: 0; }
body.sd:has(.sd-player.is-results) { padding-bottom: 0; }

/* sticky offsets: under the top bar while it shows, else near the top */
.sd-rx { --rx-top: 14px; }
body:has(.sd-top:not(.is-away)) .sd-rx { --rx-top: 78px; }

.sd-rx { padding: 0 var(--gut) 56px; animation: sd-arrive .5s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .sd-rx { animation: sd-fade .2s linear both; } }

/* title row: the question's title, and the way back on the right */
.sd-rx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap;
  padding: clamp(14px, 1.4vw, 20px) 0 clamp(12px, 1.4vw, 18px); }
.sd-rx-head h1 { margin: 0; font-size: clamp(1.75rem, 2.8vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; flex: 1 1 0; min-width: 12ch; }
.sd-rx-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-block: -6px; color: var(--text);
  font: 700 1.05rem/1.2 var(--font-body); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; white-space: nowrap; }
.sd-rx-back-ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sd-rx-back:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* the result band: the only full-bleed colour on the view */
.sd-rx-band { margin-inline: calc(-1 * var(--gut)); padding: 18px var(--gut) 16px; background: var(--sd-h-fill); color: var(--sd-h-on);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; scroll-margin-top: 80px; }
.sd-rx-band h2 { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1.1; }
.sd-rx-band h2:focus { outline: none; }
.sd-rx-count { margin: 0; min-height: 1.4em; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font: 700 clamp(1.1rem, 1.5vw, 1.35rem)/1.3 var(--font-body); }
.sd-rx-count .sd-cv-dots span { background: currentColor; }
.sd-rx-retry { min-height: 40px; padding: 6px 14px; border-radius: 6px; border: 2px solid currentColor; background: transparent; color: inherit;
  font: 800 1rem/1.2 var(--font-body); cursor: pointer; }
.sd-rx-retry:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.sd-rx-intro { padding: 14px 0 18px; }
.sd-rx-lead { margin: 0; font-size: clamp(1.1rem, 1.3vw, 1.25rem); line-height: 1.5; }
/* while the grade is checked, the summary's room is kept (2-3 sentences: about 2 lines wide, 5 on a phone), so its
   arrival moves as little as possible */
.sd-rx-lead.is-waiting { min-height: 3em; color: var(--text-muted); }
@media (max-width: 899px) { .sd-rx-lead.is-waiting { min-height: 4.5em; } }
@media (max-width: 599px) { .sd-rx-lead.is-waiting { min-height: 7.5em; } }
.sd-rx-lead:empty:not(.is-waiting) { display: none; }

/* the switch: the hero's segmented control */
.sd-rx-tabs { scroll-margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; width: min(100%, 860px);
  border: 1.5px solid var(--rule); border-radius: 9px; background: var(--paper-2); margin-bottom: 20px; }
body:has(.sd-top:not(.is-away)) .sd-rx-tabs { scroll-margin-top: 74px; }
.sd-rx-tabs[hidden] { display: none; }
.sd-rx-tab { min-height: 48px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font: 700 1.05rem/1.2 var(--font-body); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
@media (hover: hover) { .sd-rx-tab:hover { background: var(--paper); } }
.sd-rx-tab[aria-selected="true"] { background: var(--action); color: var(--action-on); }
.sd-rx-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-tab:active { transform: scale(.98); }
.sd-rx-tab-s { display: none; }

/* ---------- panel 1: diagram left (sticky), the part right ---------- */
.sd-rx-panel[hidden] { display: none !important; }
.sd-rx-answer { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr); gap: clamp(24px, 3vw, 44px); align-items: start;
  scroll-margin-top: 10px; }
body:has(.sd-top:not(.is-away)) .sd-rx-answer { scroll-margin-top: 74px; }
.sd-rx-stagecol { min-width: 0; align-self: stretch; }
.sd-rx-sticky { position: sticky; top: var(--rx-top); transition: top .28s var(--ease); }
.sd-rx-cap { margin: 0 0 6px; min-height: calc(2 * 1.35em); font: 700 1.1rem/1.35 var(--font-body); text-wrap: pretty; }
.sd-rx-frame.sdb.is-staged { max-height: calc(100svh - var(--rx-top) - 110px); }
.sd-rx-key { display: flex; flex-wrap: wrap; gap: 6px 18px; min-height: 1.3em; margin: 0 0 8px; font: 700 .98rem/1.3 var(--font-body); color: var(--text-muted); }
.sd-rx-k { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.sd-rx-k::before { content: ""; width: 22px; height: 14px; border-radius: 4px; border: 3px solid currentColor; box-sizing: border-box; }
.sd-rx-k.is-new::before { border-color: var(--sd-green-ink); }
.sd-rx-k.is-focus::before { border-color: var(--text); }
.sd-rx-k.is-good::before { border-color: var(--sd-green-ink); background: var(--sd-green-bg); }
.sd-rx-k.is-partial::before { border-color: var(--sd-amber-ink); background: var(--sd-amber-bg); }
.sd-rx-k.is-nr::before { border: 2.5px dashed var(--sd-slate-ink); }
.sd-rx-k-n { margin-left: auto; font-weight: 700; }

/* the right column */
.sd-rx-side { min-width: 0; scroll-margin-top: 10px; }
.sd-rx-rail { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sd-rx-dot { min-width: 44px; height: 44px; padding: 0 6px; border-radius: 22px; border: 2px solid var(--sd-h-ink, var(--rule)); background: var(--sd-h-bg, var(--paper));
  color: var(--sd-h-tx, var(--text)); font: 800 1.05rem/1 var(--font-body); cursor: pointer; transition: transform .1s var(--ease), box-shadow .15s var(--ease); }
.sd-rx-dot.is-all { padding: 0 14px; border-color: var(--rule); background: var(--paper); color: var(--text); }
.sd-rx-dot[data-st="not-reached"] { border-style: dashed; }
.sd-rx-dot[aria-current="step"] { background: var(--sd-h-fill, var(--action)); color: var(--sd-h-on, var(--action-on)); border-color: var(--sd-h-fill, var(--action)); border-style: solid;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--text); }
.sd-rx-dot.is-all[aria-current="step"] { background: var(--action); color: var(--action-on); border-color: var(--action); }
.sd-rx-dot:active { transform: scale(.94); }
.sd-rx-dot:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.sd-rx-nav { display: flex; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.sd-rx-nav .sd-btn { min-height: 48px; padding: 8px 14px; font-size: 1rem; text-align: left; min-width: 0; flex: 0 1 auto; display: inline-flex; align-items: center; gap: 8px; }
.sd-rx-nav .sd-rx-prev { flex: none; }
.sd-rx-nav .sd-rx-next { margin-left: auto; text-align: right; }
.sd-rx-nav .sd-btn[hidden] { display: none; }
.sd-rx-arw { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sd-rx-card { padding-top: 6px; }
.sd-rx-title { margin: 12px 0 14px; font-size: clamp(1.45rem, 2vw, 1.9rem); line-height: 1.15; }
.sd-rx-chip { display: inline-block; padding: 4px 10px; border-radius: 4px; background: var(--sd-h-fill); color: var(--sd-h-on); font: 800 .95rem/1.2 var(--font-body); white-space: nowrap; }
.sd-rx-chip[data-hue="slate"] { background: transparent; color: var(--sd-slate-ink); box-shadow: inset 0 0 0 2px var(--sd-slate-ink); }
.sd-rx-chip.is-none { background: transparent; min-width: 7.6em; min-height: 1.9em; display: inline-flex; align-items: center; justify-content: flex-end; }
.sd-rx-chip.is-none .sd-cv-dots span { width: 8px; height: 8px; background: var(--text-muted); }

.sd-rx-you { background: var(--sd-h-bg, var(--paper-2)); border: 1.5px solid var(--sd-h-ink, var(--rule)); border-radius: 6px; padding: 14px 16px; color: var(--sd-h-tx, var(--text)); }
.sd-rx-you[data-st="not-reached"] { border-style: dashed; }
.sd-rx-you-h { margin: 0; display: flex; gap: 12px; align-items: baseline; line-height: 1.45; font-size: 1.08rem; }
.sd-rx-you-h .sd-rx-chip { flex: none; }
.sd-rx-said { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--sd-h-ink, var(--rule)) 30%, transparent); }
.sd-rx-said figcaption { font: 700 .95rem/1.2 var(--font-body); color: var(--text-muted); }
.sd-rx-said blockquote { margin: 4px 0 0; font-size: 1.08rem; line-height: 1.45; overflow-wrap: anywhere; }
.sd-rx-more-t { border: 0; padding: 0; background: none; color: inherit; font: 700 1rem/1.4 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sd-rx-more-t:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-ans { margin-top: 20px; }
.sd-rx-ans-h { margin: 0; font: 700 clamp(1.2rem, 1.5vw, 1.35rem)/1.35 var(--font-body); text-wrap: pretty; }
.sd-rx-ans-d { margin: 8px 0 0; font-size: 1.1rem; line-height: 1.55; color: var(--text-muted); }
.sd-rx-blk { margin-top: 22px; }
.sd-rx-blk h4 { margin: 0 0 6px; font-size: 1.15rem; color: var(--sd-h-ink, var(--text)); }
.sd-rx-nums, .sd-rx-mist, .sd-rx-parts { list-style: none; margin: 0; padding: 0; }
.sd-rx-nums li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border); line-height: 1.4; }
.sd-rx-nums li:last-child { border-bottom: 1px solid var(--border); }
.sd-rx-num-l { color: var(--text-muted); font-weight: 700; font-size: 1rem; }
.sd-rx-num-v { font-weight: 800; font-size: 1.15rem; }
.sd-rx-num-w { color: var(--text-muted); font-size: 1rem; }
.sd-rx-mist li { padding: 10px 0; border-top: 1px solid var(--border); line-height: 1.5; }
.sd-rx-mist li > span { color: var(--text-muted); }
.sd-rx-alt { margin-top: 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sd-rx-alt summary { min-height: 48px; display: flex; align-items: center; gap: 10px; font: 700 1.1rem/1.2 var(--font-body); cursor: pointer; list-style: none; }
.sd-rx-alt summary::-webkit-details-marker { display: none; }
.sd-rx-alt summary::before, .sd-rx-more > summary::before { content: ""; flex: none; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--ease); }
.sd-rx-alt[open] summary::before, .sd-rx-more[open] > summary::before { transform: rotate(45deg); }
.sd-rx-alt summary:focus-visible, .sd-rx-more > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-alt li { padding: 0 0 12px; line-height: 1.5; }
.sd-rx-alt ul { list-style: none; margin: 0; padding: 0; }
.sd-rx-alt li span { color: var(--text-muted); }
.sd-rx-try { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; min-height: 48px; padding: 8px 16px; border-radius: 6px;
  border: 1.5px solid var(--sd-amber-ink); background: var(--sd-amber-bg); color: var(--sd-amber-tx, var(--text)); font: 700 1.05rem/1.2 var(--font-body); cursor: pointer; text-align: left; }
.sd-rx-try-ic { width: 16px; height: 16px; fill: currentColor; flex: none; }
.sd-rx-try:active { transform: scale(.97); }
.sd-rx-try:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-parts li { border-top: 1px solid var(--border); }
.sd-rx-parts li:last-child { border-bottom: 1px solid var(--border); }
.sd-rx-parts button { width: 100%; display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 48px; padding: 6px 4px;
  border: 0; background: transparent; color: var(--text); font: 700 1.08rem/1.25 var(--font-body); text-align: left; cursor: pointer; }
@media (hover: hover) { .sd-rx-parts button:hover { background: var(--paper-2); } }
.sd-rx-parts button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.sd-rx-pn { color: var(--text-muted); }

/* ---------- panel 2: controls left, the live view right ---------- */
.sd-rx-sim { display: grid; grid-template-columns: minmax(340px, .85fr) minmax(0, 1.25fr); gap: clamp(24px, 3vw, 44px); align-items: start; }
.sd-rx-view { min-width: 0; align-self: stretch; }
.sd-rx-controls { min-width: 0; }
.sd-rx-cgroup { padding: 4px 0 14px; border-top: 1px solid var(--border); }
.sd-rx-cgroup:first-child { border-top: 0; padding-top: 0; }
.sd-rx-cgroup h3 { margin: 10px 0 6px; font-size: 1.2rem; color: var(--sd-amber-ink); }
.sd-rx-more > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; color: var(--sd-amber-ink); }
.sd-rx-more > summary::-webkit-details-marker { display: none; }
.sd-rx-more > summary h3 { margin: 0; }
.sd-rx-scens { display: flex; flex-wrap: wrap; gap: 8px; }
.sd-rx-scen { min-height: 44px; padding: 8px 14px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--text);
  font: 700 1rem/1.2 var(--font-body); cursor: pointer; text-align: left; }
@media (hover: hover) { .sd-rx-scen:hover { border-color: var(--text); } }
.sd-rx-scen[aria-pressed="true"] { background: var(--action); color: var(--action-on); border-color: var(--action); }
.sd-rx-scen:active { transform: scale(.97); }
.sd-rx-scen:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-ctl { padding: 8px 0; }
.sd-rx-ctl.is-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.sd-rx-ctl.is-toggle label { display: flex; flex-direction: column; cursor: pointer; }
.sd-rx-cl { font-size: 1.05rem; line-height: 1.35; }
.sd-rx-ctl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.sd-rx-val { font: 700 1.05rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-rx-ctl.is-changed .sd-rx-val { color: var(--text); background: var(--sd-amber-bg); box-shadow: 0 0 0 4px var(--sd-amber-bg); border-radius: 2px; }
.sd-rx-refv { display: block; font-size: .98rem; color: var(--text-muted); }
.sd-rx-refv:empty { display: none; }
.sd-rx-ctl input[type="range"] { width: 100%; margin: 8px 0 2px; height: 28px; accent-color: var(--action); }
.sd-rx-ctl input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-rx-sw { appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 30px; border-radius: 15px; background: var(--rule); position: relative; cursor: pointer; margin: 0;
  transition: background-color .2s var(--ease); }
.sd-rx-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s var(--ease); }
.sd-rx-sw:checked { background: var(--action); }
.sd-rx-sw:checked::after { transform: translateX(22px); }
.sd-rx-sw:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sd-rx-reset { margin-top: 10px; }

.sd-rx-view .sd-rx-sticky { scroll-margin-top: 10px; }
.sd-rx-changed { margin: 0 0 10px; min-height: calc(2 * 1.4em); font-size: 1.08rem; line-height: 1.4; text-wrap: pretty; }
.sd-rx-verdict { border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; border: 1.5px solid var(--sd-green-ink); background: var(--sd-green-bg); color: var(--sd-green-tx, var(--text)); }
.sd-rx-verdict[data-tone="near"] { border-color: var(--sd-amber-ink); background: var(--sd-amber-bg); color: var(--sd-amber-tx, var(--text)); }
.sd-rx-verdict[data-tone="over"] { border-color: var(--sd-rose-ink); background: var(--sd-rose-bg); color: var(--sd-rose-tx, var(--text)); }
.sd-rx-v-h { margin: 0; font: 800 1.1rem/1.35 var(--font-body); }
.sd-rx-verdict[data-tone="over"] .sd-rx-v-h { color: var(--sd-rose-ink); }
.sd-rx-v-d { margin: 4px 0 0; font-size: 1.02rem; line-height: 1.45; }
.sd-rx-v-also { margin: 6px 0 0; font: 700 .98rem/1.4 var(--font-body); color: var(--sd-rose-ink); }
.sd-rx-meters { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px 20px; }
.sd-rx-meters li { min-width: 0; }
.sd-rx-m-h { margin: 0; display: flex; justify-content: space-between; gap: 8px; font: 700 1rem/1.25 var(--font-body); }
.sd-rx-m-n { min-width: 0; }
.sd-rx-m-w { flex: none; text-align: right; }
li[data-tone="ok"] .sd-rx-m-w { color: var(--sd-green-ink); }
li[data-tone="near"] .sd-rx-m-w { color: var(--sd-amber-ink); }
li[data-tone="over"] .sd-rx-m-w { color: var(--sd-rose-ink); }
li[data-tone="idle"] .sd-rx-m-w { color: var(--text-muted); }
.sd-rx-bar { position: relative; height: 10px; border-radius: 5px; background: var(--sd-track); margin: 6px 0 4px; }
.sd-rx-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--sd-green-ink); transition: width .25s var(--ease); }
li[data-tone="near"] .sd-rx-bar span { background: var(--sd-amber-ink); }
li[data-tone="over"] .sd-rx-bar span { background: var(--sd-rose-ink); }
.sd-rx-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); }
.sd-rx-m-v { margin: 0; font-size: .98rem; line-height: 1.35; color: var(--text-muted); }
.sd-rx-metrics { list-style: none; margin: 12px 0 0; padding: 0; }
.sd-rx-metrics li { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 1rem; line-height: 1.35; }
.sd-rx-metrics li strong { margin-left: auto; font-family: var(--font-mono); }
.sd-rx-metrics .sd-rx-m-ref { color: var(--text-muted); flex-basis: 100%; text-align: right; }
@media (prefers-reduced-motion: reduce) { .sd-rx-bar span { transition: none; } .sd-rx-sticky { transition: none; } }

/* 900 and wider: the tabs and the whole panel fit on one screen (Rahul: "I want everything to be visible on screen").
   The controls scroll inside their own column, so changing one never moves the page and the live view never leaves the
   screen. --rx-sim-off is the room above and below the panel: tabs 10 + 59 + 14 under them, and enough below that
   the panel is still whole when the page is scrolled to the footer (101px + 8). */
@media (min-width: 900px) {
  .sd-rx { --rx-sim-off: 120px; }
  .sd-rx:has(#rx-p-numbers:not([hidden])) { padding-bottom: 8px; }
  .sd-rx:has(#rx-p-numbers:not([hidden])) .sd-rx-tabs { margin-bottom: 14px; }
  .sd-rx-sim { height: max(500px, calc(100svh - var(--rx-sim-off))); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .sd-rx-controls { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 14px 12px 2px; scrollbar-gutter: stable; }
  .sd-rx-view { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  /* 4px at the bottom: the meters' reference ticks reach 3px past their bar and made the view scroll by 2px */
  .sd-rx-view .sd-rx-sticky { position: static; display: flex; flex-direction: column; min-height: 100%; box-sizing: border-box; padding-bottom: 4px; }
  .sd-rx-simstage { flex: 1 1 0; min-height: 150px; display: flex; flex-direction: column; }
  .sd-rx-simstage .sd-rx-frame.sdb.is-staged { flex: 1 1 auto; min-height: 0; height: auto; max-height: none; aspect-ratio: auto; }
  .sd-rx-changed { margin-bottom: 8px; }
  .sd-rx-verdict { margin-bottom: 10px; }
  .sd-rx-meters { margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 8px 18px; }
  .sd-rx-metrics { margin-top: 8px; }
  /* one line per number: label, then "reference X" (muted) beside the value, not under it */
  .sd-rx-metrics li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 0 14px; padding: 5px 0; }
  .sd-rx-metrics li strong { grid-column: 3; grid-row: 1; text-align: right; margin: 0; }
  .sd-rx-metrics .sd-rx-m-ref { grid-column: 2; grid-row: 1; flex-basis: auto; text-align: right; white-space: nowrap; }
  /* only the numbers that moved away from the reference: the rest repeat what the reference already says, and on
     payment-system (5 numbers) they took the diagram's room, down to names of 6px */
  .sd-rx-metrics li.is-same { display: none; }
  .sd-rx-metrics:not(:has(li:not(.is-same))) { display: none; }
  /* the controls get a fixed share, the live view (and its diagram) the rest of the width */
  .sd-rx-sim { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
}
/* A smaller screen (under 1200 wide or under 860 tall, e.g. 1024x768, 1280x720): the view keeps what changed, the
   verdict, the diagram and a bar per part on screen by dropping what repeats: the meters' "X of Y" line (the
   sentence above says it). */
@media (min-width: 900px) and (max-width: 1199px), (min-width: 900px) and (max-height: 860px) {
  .sd-rx-m-v { display: none; }
  .sd-rx-simstage { min-height: 120px; }
  .sd-rx-meters { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
  .sd-rx-changed { font-size: 1.02rem; }
  .sd-rx-v-d { font-size: .98rem; line-height: 1.4; }
}
/* ---------- 900-1199: still side by side; the camera frames the part (names stay 13px or more) ---------- */
@media (max-width: 1199px) {
  .sd-rx-answer { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); gap: 28px; }
  .sd-rx-sim { grid-template-columns: minmax(270px, 300px) minmax(0, 1fr); gap: 24px; }
}
/* ---------- under 900: stacked; the picture stays on screen (sticky) while you read or change things ---------- */
@media (max-width: 899px) {
  .sd-rx { --rx-top: 0px; }
  body:has(.sd-top:not(.is-away)) .sd-rx { --rx-top: 64px; }
  .sd-rx-answer, .sd-rx-sim { display: block; }
  .sd-rx-tab-l { display: none; } .sd-rx-tab-s { display: inline; }
  .sd-rx-stagecol { position: sticky; top: var(--rx-top); z-index: 2; background: var(--paper); margin-inline: calc(-1 * var(--gut)); padding: 8px var(--gut) 10px;
    box-shadow: 0 10px 16px -14px rgb(0 0 0 / .35); transition: top .28s var(--ease); }
  .sd-rx-sticky { position: static; }
  .sd-rx-cap { min-height: 0; font-size: 1rem; margin-bottom: 6px; }
  .sd-rx-frame.sdb.is-staged { aspect-ratio: auto; height: min(36svh, 300px); max-height: none; }
  .sd-rx-key { font-size: .92rem; gap: 4px 12px; margin-bottom: 6px; }
  .sd-rx-side { padding-top: 14px; }
  .sd-rx-sim { display: flex; flex-direction: column-reverse; }
  .sd-rx-view { position: sticky; top: var(--rx-top); z-index: 2; background: var(--paper); margin: 0 calc(-1 * var(--gut)) 14px; padding: 10px var(--gut);
    box-shadow: 0 10px 16px -14px rgb(0 0 0 / .35); transition: top .28s var(--ease); }
  .sd-rx-view .sd-rx-sticky { position: static; }
  .sd-rx-simstage, .sd-rx-metrics { display: none; }
  .sd-rx-changed { min-height: 0; font-size: 1rem; margin-bottom: 8px; }
  .sd-rx-verdict { padding: 8px 12px; margin-bottom: 8px; }
  .sd-rx-v-d { font-size: .98rem; }
  .sd-rx-v-h { font-size: 1rem; }
  .sd-rx-meters { grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 0; }
  .sd-rx-m-h { font-size: .95rem; flex-direction: column; gap: 0; }
  .sd-rx-m-w { text-align: left; }
  .sd-rx-m-v { display: none; }
  .sd-rx-bar { margin: 4px 0 0; height: 8px; }
}
@media (max-width: 600px) {
  .sd-rx-band { flex-direction: column; gap: 2px; }
  .sd-rx-nav .sd-btn { font-size: .98rem; }
  .sd-rx-head h1 { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sd-rx-stagecol, .sd-rx-view { transition: none; } }
.sd-rx-why-out { margin: 0 0 14px; padding: 10px 14px; border-radius: 6px; border: 1.5px solid var(--sd-rose-ink); background: var(--sd-rose-bg); color: var(--sd-rose-tx, var(--text));
  font-size: 1rem; line-height: 1.45; }
.sd-rx-why-out[hidden] { display: none; }
.sd-rx-why-out .sd-rx-v-d { margin: 0; }
