/* Narrow fixes only: retain the approved models and palette. */
.hq5-manip #counterStage .counter { border: 0; padding: 0; font-family: inherit; flex-shrink: 0; }
.hq5-manip #tileStage .algebra-tile { padding: 0; color: #334155; font-family: inherit; font-size: inherit; border-radius: 0; flex-shrink: 0; }
.hq5-manip :is(#counterStage .counter, #tileStage .algebra-tile, #nlSvg):focus-visible { outline: 3px solid #1d4ed8 !important; outline-offset: 4px; }
.hq5-manip #fractionCompare.error { color: #991b1b; border: 2px solid #b91c1c; }
.hq5-manip #nlStatus:empty { display: none; }
.hq5-manip input[aria-invalid="true"], .hq5-graph #gdData[aria-invalid="true"] { border-color: #b91c1c !important; }
.hq5-graph .hq-graph-data-scroll { max-width: 100%; overflow-x: auto; }
.hq5-graph #gdDataTable { width: 100%; border-collapse: collapse; }
.hq5-graph #gdDataTable caption { text-align: left; font-weight: 700; padding: 8px 0; }
.hq5-graph #gdDataTable :is(th, td) { text-align: left; border: 1px solid #cbd5e1; padding: 8px 10px; overflow-wrap: anywhere; }
.hq5-graph #gdDataTable th { background: #f6f2ff; }
.hq5-graph #gdGraphState[data-stale="true"] { color: #991b1b; font-weight: 700; }

.hq5-graph #gdPreviewHeading { margin: 0; font: inherit; }
.hq5-graph .hq-graph-teacher-toggle { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.hq5-graph #gdTeacherGuide[hidden] { display: none; }
@media print {
  /* Only the validated output prints; toolbar, setup, hero and page chrome do not. */
  body.hq5-graph .site-header, body.hq5-graph .site-footer, body.hq5-graph .stem-hero, body.hq5-graph .stem-side,
  body.hq5-graph .stem-card > :not(#gdResults), body.hq5-graph .hq-chart-options,
  body.hq5-graph .hq-graph-teacher-toggle { display: none !important; }
  body.hq5-graph :is(main, .wrap, .stem-shell, .stem-layout, .stem-card, .stem-results, .stem-output) { display: block !important; width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: #fff !important; color: #000 !important; }
  body.hq5-graph #hqChartWrap { overflow: visible !important; min-width: 0 !important; width: 100% !important; }
  body.hq5-graph #gdChart { width: 100% !important; min-width: 0 !important; height: auto !important; max-height: 100mm; }
  body.hq5-graph #gdTeacherGuide { display: none !important; }
  body.hq5-graph.hq-graph-print-teacher #gdTeacherGuide { display: block !important; }
  body.hq5-graph #gdDataTable { font-size: 10pt; }
  body.hq5-graph #gdDataTable thead { display: table-header-group; }
  body.hq5-graph :is(#gdDataTable tr, .analysis-prompts > div) { break-inside: avoid; }
  body.hq5-graph #gdDataTable :is(th, td) { background: #fff; color: #000; border-color: #777; }
  body.hq5-graph .hq-graph-data-scroll { overflow: visible; }
  body.hq5-graph #gdGraphState { color: #000; }
}
