.curve-card {
  min-width: 0;
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: clamp(14px,1.45vw,21px);
  background: linear-gradient(140deg,var(--panel),var(--panel-end) 86%);
  font-variant-numeric: tabular-nums;
}
.curve-card h4 { font-size: 17px; line-height: 1.4; }
.curve-card p,.curve-card figcaption { color: var(--muted); font-size: 13px; line-height: 1.55; }
.curve-card p { margin: 3px 0 12px; }
.curve-card figcaption { border-top: 1px solid var(--edge); padding-top: 10px; margin-top: 13px; }
.curve-card a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.curve-card button { line-height: 1.5; }
.plot-controls,.scrub,.line-key button { display: flex; align-items: center; gap: 8px; }
.plot-controls { flex-wrap: wrap; justify-content: space-between; }
.curve-actions { display:flex; align-items:center; gap:12px; margin-left:auto; }
.curve-actions .expand-plot { font-weight:650; }
.plot-controls .prefix-switch { border-radius: 4px; overflow: hidden; }
.plot-controls .prefix-switch button { padding: 4px 8px; }
.plot-controls .prefix-switch button[aria-pressed=true] { background: var(--selected); }
.play-curve,.line-key button { font: 12px/1.45 var(--sans); color: var(--ivory); background: none; border: 0; padding: 3px 0; }
.play-curve { color: var(--link); min-width: 52px; text-align: right; font-weight: 650; }
.plot { display: block; width: 100%; cursor: crosshair; touch-action: pan-y; margin-block: 9px 4px; }
.plot text { font: 12px var(--mono); fill: var(--muted); }
.curve-grid { stroke: var(--edge); stroke-dasharray: 3 4; }
.scan-line { stroke: var(--body-copy); stroke-width: 1; opacity: .72; }
.scrub { gap: 12px; }
.scrub output { color: var(--link); font: 12px var(--mono); min-width: 104px; }
.scrub input { margin: 0; height: 22px; min-width: 0; flex: 1; accent-color: var(--gold); cursor: ew-resize; }
.line-key { display: flex; flex-wrap: wrap; gap: 3px 16px; margin-top: 5px; }
.line-key button { gap: 5px; min-height: 27px; }
.line-key button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--trace); }
.line-key button b { color: var(--trace); font-family: var(--mono); }
.line-key button[aria-pressed=false] { opacity: .6; text-decoration: line-through; }
.line-key button:hover, .play-curve:hover { text-decoration: underline; text-underline-offset: 3px; }
.decision-bars .bar-row { grid-template-columns: 78px 1fr 76px; }
#alignment .study { align-items: center; }
@media(max-width:900px) {
  .curve-card { padding: 13px; }
  .plot text { font-size: 15px; }
  .line-key { gap: 4px 12px; }
  .curve-card .prefix-switch button { font-size: 11px; padding: 5px 6px; }
}
@media(max-width:365px) {
  .curve-card { padding: 10px; }
  .plot text { font-size: 16px; }
  .play-curve { min-width: 40px; }
}

.plot-viewport { margin:12px 0 6px; overflow-x:auto; }
.source-plot { position:relative; overflow:hidden; border-radius:4px; cursor:crosshair; touch-action:pan-y; }
.source-plot img { display:block; width:100%; height:auto; }
.plot-sweep { position:absolute; top:8.4%; bottom:13.6%; left:0; right:0; background:linear-gradient(to right, transparent var(--x), #384960 var(--x) calc(var(--x) + 1px), #ffffffdb calc(var(--x) + 1px) 96.06%, transparent 96.06%);
  /* Keep the original five-line legend visible throughout the sweep. */
  clip-path:polygon(28% 0,100% 0,100% 100%,0 100%,0 27%,28% 27%); pointer-events:none; }
.plot-sweep.inspecting { background:transparent; left:var(--x); border-left:1px dashed #384960; clip-path:none; }
.expand-plot { margin-left:auto; font-size:12px; border:0; color:var(--link); padding:4px; background:none; }
.expand-plot:hover { text-decoration:underline; }
#sao-curve dialog { color:var(--ivory); width:min(97vw,145vh,1490px); max-width:97vw; max-height:95vh; }
#sao-curve dialog::backdrop { background:#090e17bf; }
@media(max-width:600px) {
  #sao-curve dialog .source-plot { width:850px; touch-action:pan-x pan-y; }
}
