/* =====================================================================================
   rs-spec-viewer.css: shared look for the A-level spectroscopy viewers (IR now; mass spec,
   carbon-13 NMR and proton NMR next). Approved round 2 design, 29 Nov 2026.

   How a viewer adopts it
   1. Load this file before the viewer's own stylesheet.
   2. Either give the viewer's markup the shared classes (wrapper .sv-card, then .sv-head,
      .sv-title, .sv-context, .sv-field, .sv-view, .sv-landing, .sv-mode-card, .sv-setup,
      .sv-panel, .sv-checks, .sv-nav, .sv-tabs/.sv-tab, .sv-toolbar, .sv-pickers/.sv-picker,
      .sv-cycle, .sv-instructions, .sv-work, .sv-pane, .sv-structure-panel, .sv-structure,
      .sv-structure-title, .sv-note-slot, .sv-note (.is-visible), .sv-note-title, .sv-note-text,
      .sv-spectrum-panel, .sv-spectrum, .sv-axis-*, .sv-trace, .sv-spec-head, .sv-group (--ref,
      --zoom, --view, --peaks, --answer), .sv-switches/.sv-switch, .sv-spec-foot, .sv-answer,
      .sv-report, .sv-btn with
      --go/--sheet/--layout/--toggle, .sv-feedback with --error/--ok, .sv-info, .sv-table,
      .sv-dialog-layer/.sv-dialog/.sv-close, .sv-backdrop/.sv-confirm, .sv-report-link,
      .sv-sr-only),
      or, so that no script has to rename anything, add the viewer's existing selectors to the
      selector lists below, scoped by its wrapper id, exactly as the IR viewer's are
      ("#ir-tool-wrapper .ir-btn, .sv-card .sv-btn { … }"). NOTES.md lists the IR mapping.
   3. Keep the viewer's own pieces (spectrum marks, structure drawing, deduce steps, data sheet
      window, full-screen extras) in its own stylesheet, scoped by its wrapper id.
   Size queries use the views (container "svview") and the spectrum box ("svspec"), not the
   card, so fixed-position windows inside the card stay on the viewport. No important flags.
   ===================================================================================== */

/* ---- colours: the old IRviewer.css and D1/D2 values; "AA" marks a value darkened for
   WCAG AA (old value in brackets; ratios in notes.md) ---- */

#ir-tool-wrapper, .sv-card {
  --ink: #25242f;
  --muted: #394362;
  --accent: #d33e16;
  --chem: #d33c16;
  --blue: #5ba4cf;
  --soft: #f5f6fb;
  --tab: #e7e9f5;
  --line: #d0d4e0;
  --line-soft: #e6e6e6;
  --peach: #fff6f1;
  --edge: #848eae;
  --tab-edge: #7a85a8;
  --card-edge: #e26c51;
  --err-bg: #fff0ec;
  --err-line: #f2bcb0;
  --err-text: #7c2412;
  --ok-bg: #eaf8ee;
  --ok-line: #9ad0a8;
  --ok-text: #22552b;
  --ok-edge: #499e5f;
  --info-bg: #eef8ff;
  --info-line: #7db7e8;
  --act-bg: #ffc0b3;
  --act-bg-h: #ffb2a1;
  --act-shadow: rgba(211, 60, 22, 0.9);
  --ds-bg: #fff3e0;
  --ds-bg-h: #ffe0b2;
  --ds-edge: #d78000;
  --ds-text: #c54600;
  --ds-text-h: #b43f00;
  --tb-bg: #e0f7fa;
  --tb-bg-h: #b2ebf2;
  --tb-text: #006064;
  --tb-edge: #1ea3b4;
  --lb-bg: #e8f5e9;
  --lb-bg-h: #c8e6c9;
  --lb-text: #2e7d32;
  --lb-text-h: #29702d;
  --lb-edge: #4ca750;
  --zone: #378abc;
  --quiet: #6d797a;
  --focus: #185abc;
  position: relative;
  box-sizing: border-box;
  padding: 20px;
  border: 1px solid #d6d9e2;
  border-top: 3px solid #121643;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  font-family: ABeeZee, Lexend, Calibri, system-ui, sans-serif;
  line-height: 1.45;
}

#ir-tool-wrapper *, #ir-tool-wrapper ::before, #ir-tool-wrapper ::after, .sv-card *, .sv-card ::before, .sv-card ::after {
  box-sizing: border-box;
}

#ir-tool-wrapper :is(h2, h3, h4), .sv-card :is(h2, h3, h4) {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.25;
}

#ir-tool-wrapper .ir-view, .sv-card .sv-view {
  container: svview / inline-size;
}

/* ---- head: title, exam board, level, How it works, Cheat sheet, Full screen ---- */

#ir-tool-wrapper .ir-head, .sv-card .sv-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
}

#ir-tool-wrapper .ir-title, .sv-card .sv-title {
  margin: 0;
  font-size: 1.4rem;
}

#ir-tool-wrapper .ir-study-context-panel, .sv-card .sv-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

#ir-tool-wrapper .ir-study-context-field, .sv-card .sv-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

#ir-tool-wrapper :is(.ir-study-context-field, .ir-toolbar-field) label, .sv-card :is(.sv-field, .sv-picker) label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.2;
}

#ir-tool-wrapper :is(.ir-config-panel, .ir-filter-grid > div) > label, .sv-card :is(.sv-panel, .sv-panel > div) > label {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

#ir-tool-wrapper .rs-viewer-btns, .sv-card .rs-viewer-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* the three head buttons share one look (the D1/D2 one); height, not min-height, because the
   site's .rs-page rule pins min-height and padding on .ct-help-btn and .ct-fs-btn */

#ir-tool-wrapper :is(.ct-help-btn, .ct-fs-btn, .rs-viewer-btns #ir-btn-help), .sv-card :is(.ct-help-btn, .ct-fs-btn, .sv-head-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  min-height: 0;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.85rem;
  box-shadow: none;
}

#ir-tool-wrapper :is(.ct-help-btn, .ct-fs-btn, .rs-viewer-btns #ir-btn-help):hover, .sv-card :is(.ct-help-btn, .ct-fs-btn, .sv-head-btn):hover {
  background: var(--tab);
}

#ir-tool-wrapper .ct-help-btn > span:first-child, .sv-card .ct-help-btn > span:first-child {
  background: var(--muted);
}

@media (max-width: 520px) {
  #ir-tool-wrapper, .sv-card {
    padding: 14px 12px 16px;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper .ir-study-context-field, .sv-card .sv-field {
    flex: 1 1 120px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper .rs-viewer-btns, .sv-card .rs-viewer-btns {
    flex: 1 1 100%;
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper .rs-viewer-btns > button, .sv-card .rs-viewer-btns > button {
    flex: 1 1 auto;
    padding: 4px 8px;
  }
}

/* phone: Full screen shows its icon only; its name stays (aria-label set by the viewer) */

@media (max-width: 520px) {
  #ir-tool-wrapper .ct-fs-label, .sv-card .ct-fs-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper .ct-fs-btn, .sv-card .ct-fs-btn {
    flex: 0 0 44px;
  }
}

/* ---- form controls ---- */

#ir-tool-wrapper select, .sv-card select {
  min-height: 40px;
  max-width: 100%;
  padding: 6px 26px 6px 8px;
  text-overflow: ellipsis;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

#ir-tool-wrapper select:disabled, .sv-card select:disabled {
  color: #6b7080;
  background-color: var(--soft);
}

#ir-tool-wrapper input[type="checkbox"]:not([role="switch"]), .sv-card input[type="checkbox"]:not([role="switch"]) {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
}

/* ---- buttons: the old meanings. Grey pill = move or change; peach with a red edge = go on;
   orange = data sheet; teal = exam answer layout; green = labels ---- */

#ir-tool-wrapper .ir-btn, .sv-card .sv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  filter: none;
}

#ir-tool-wrapper .ir-btn:hover, .sv-card .sv-btn:hover {
  background: var(--tab);
}

#ir-tool-wrapper :is(.ir-btn-action, #btn-ir-start-explore, #btn-ir-start-filtered, #btn-ir-ws-next-question, #ir-confirm-ok), .sv-card .sv-btn--go {
  border-color: var(--accent);
  background: var(--act-bg);
  color: #000;
  box-shadow: 2px 2px 0 var(--act-shadow);
}

#ir-tool-wrapper :is(.ir-btn-action, #btn-ir-start-explore, #btn-ir-start-filtered, #btn-ir-ws-next-question, #ir-confirm-ok):hover:enabled, .sv-card .sv-btn--go:hover:enabled {
  background: var(--act-bg-h);
  box-shadow: 4px 4px 0 var(--accent);
}

#ir-tool-wrapper #ir-btn-absorption-guide, .sv-card .sv-btn--sheet {
  border-color: var(--ds-edge);
  background: var(--ds-bg);
  color: var(--ds-text);
}

#ir-tool-wrapper #ir-btn-absorption-guide:hover, .sv-card .sv-btn--sheet:hover {
  background: var(--ds-bg-h);
  color: var(--ds-text-h);
}

#ir-tool-wrapper #ir-btn-table, .sv-card .sv-btn--layout {
  border-color: var(--tb-edge);
  background: var(--tb-bg);
  color: var(--tb-text);
}

#ir-tool-wrapper #ir-btn-table:hover, .sv-card .sv-btn--layout:hover {
  background: var(--tb-bg-h);
}

/* round 4: kept for old copies of the markup only (the Combined techniques tool until it is rebuilt) */

#ir-tool-wrapper button#ir-btn-wn-labels, .sv-card .sv-btn--toggle {
  border-color: var(--lb-edge);
  background: var(--lb-bg);
  color: var(--lb-text);
}

#ir-tool-wrapper button#ir-btn-wn-labels:hover, .sv-card .sv-btn--toggle:hover {
  background: var(--lb-bg-h);
  color: var(--lb-text-h);
}

#ir-tool-wrapper :is(#ir-btn-absorption-guide, #ir-btn-table).active, .sv-card :is(.sv-btn--sheet, .sv-btn--layout).active {
  font-weight: 900;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* disabled: dashed edge, full-contrast text (no opacity fade), and no go-on colour */

#ir-tool-wrapper :is(.ir-btn, .ir-btn-action, #btn-ir-start-explore, #btn-ir-start-filtered, #btn-ir-ws-next-question, #ir-confirm-ok):disabled, .sv-card :is(.sv-btn, .sv-btn--go):disabled {
  border-style: dashed;
  border-color: var(--edge);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

#ir-tool-wrapper .ir-report-link, .sv-card .sv-report-link {
  margin-left: auto;
  padding: 8px 4px;
  color: var(--quiet);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#ir-tool-wrapper .ir-report-link:hover, .sv-card .sv-report-link:hover {
  color: var(--muted);
}

/* text for screen readers only */

#ir-tool-wrapper .ir-sr-only, .sv-card .sv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* one visible ring on every control */

#ir-tool-wrapper :is(button, select, a, input, [tabindex]):focus-visible, .sv-card :is(button, select, a, input, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- landing: two mode choices on the peach panel ---- */

#ir-tool-wrapper #ir-view-landing, .sv-card .sv-landing {
  padding: 16px;
  border-radius: 8px;
  background: var(--peach);
}

#ir-tool-wrapper .ir-landing-intro, .sv-card .sv-landing-intro {
  max-width: 64ch;
  margin: 0 0 14px;
}

#ir-tool-wrapper .ir-landing-intro p, .sv-card .sv-landing-intro p {
  margin: 0;
  color: var(--muted);
}

#ir-tool-wrapper .ir-landing-grid, .sv-card .sv-landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

#ir-tool-wrapper .ir-landing-card, .sv-card .sv-mode-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  column-gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--card-edge);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 0 var(--card-edge);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

#ir-tool-wrapper .ir-landing-card:is(:hover, :focus-visible), .sv-card .sv-mode-card:is(:hover, :focus-visible) {
  transform: translateY(-3px);
  border-color: var(--chem);
  box-shadow: 0 5px 0 var(--chem);
}

#ir-tool-wrapper .ir-landing-icon, .sv-card .sv-mode-icon {
  grid-row: 1 / span 3;
  color: var(--chem);
}

#ir-tool-wrapper .ir-landing-icon svg, .sv-card .sv-mode-icon svg {
  display: block;
  width: 32px;
  height: 32px;
}

#ir-tool-wrapper .ir-landing-card h3, .sv-card .sv-mode-card h3 {
  margin: 2px 0 4px;
  color: var(--accent);
  font-size: 1.2rem;
}

#ir-tool-wrapper .ir-landing-card p, .sv-card .sv-mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

#ir-tool-wrapper .rs-go, .sv-card .rs-go {
  justify-self: start;
  margin-top: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--chem);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  #ir-tool-wrapper .ir-landing-card, .sv-card .sv-mode-card {
    transition: none;
    transform: none;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper #ir-view-landing, .sv-card .sv-landing {
    padding: 10px;
  }
}

/* ---- set-up views ---- */

#ir-tool-wrapper :is(#ir-view-config-explore, #ir-view-config-filter) > h2, .sv-card .sv-setup > h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

#ir-tool-wrapper :is(#ir-view-config-explore, #ir-view-config-filter) > p, .sv-card .sv-setup > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

#ir-tool-wrapper .ir-config-panel, .sv-card .sv-panel {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--soft);
}

#ir-tool-wrapper .ir-checkbox-group, .sv-card .sv-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

#ir-tool-wrapper .ir-checkbox-group label, .sv-card .sv-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.25;
  cursor: pointer;
}

#ir-tool-wrapper .ir-nav-buttons, .sv-card .sv-nav {
  display: flex;
  flex-flow: row-reverse wrap;
  justify-content: flex-end;
  gap: 10px;
}

@container svview (min-width: 620px) {
  #ir-tool-wrapper .ir-checkbox-group, .sv-card .sv-checks {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container svview (min-width: 620px) {
  #ir-tool-wrapper .ir-checkbox-group label, .sv-card .sv-checks label {
    min-height: 32px;
  }
}

/* ---- workspace head: grey segmented mode tabs, pickers on the soft toolbar ---- */

#ir-tool-wrapper .ir-header, .sv-card .sv-work-head {
  margin: 0 0 12px;
}

#ir-tool-wrapper .ir-ws-head, .sv-card .sv-ws-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

#ir-tool-wrapper .ir-tabs, .sv-card .sv-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--tab);
}

#ir-tool-wrapper .ir-tab, .sv-card .sv-tab {
  min-height: 40px;
  margin: 0;
  padding: 6px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
}

#ir-tool-wrapper .ir-tab:hover:not(.active), .sv-card .sv-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

#ir-tool-wrapper .ir-tab.active, .sv-card .sv-tab.active {
  border-color: var(--tab-edge);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#ir-tool-wrapper .ir-ws-toolbar, .sv-card .sv-toolbar {
  align-items: flex-end;
  gap: 8px 12px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

#ir-tool-wrapper .ir-toolbar-group, .sv-card .sv-pickers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 12px;
  flex: 1 1 100%;
  margin: 0;
}

#ir-tool-wrapper .ir-toolbar-field, .sv-card .sv-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#ir-tool-wrapper .ir-toolbar-field select, .sv-card .sv-picker select {
  width: 100%;
}

#ir-tool-wrapper .ir-cycle, .sv-card .sv-cycle {
  display: flex;
  gap: 8px;
}

#ir-tool-wrapper #ir-instructions, .sv-card .sv-instructions {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 520px) {
  #ir-tool-wrapper .ir-ws-toolbar, .sv-card .sv-toolbar {
    padding: 10px;
  }
}

@media (max-width: 520px) {
  #ir-tool-wrapper .ir-ws-toolbar .ir-btn, .sv-card .sv-toolbar .sv-btn {
    padding: 6px 12px;
  }
}

/* ---- workspace layout: the molecule panel is display: contents, so its parts and the
   spectrum share one grid. Phone: structure, spectrum, note. Wide: spectrum left; structure
   and note right. ---- */

#ir-tool-wrapper .ir-container, .sv-card .sv-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "clues" "mt" "mol" "reset" "spec" "ans" "note" "rep";
  column-gap: 20px;
  align-items: start;
}

#ir-tool-wrapper .ir-panel, .sv-card .sv-pane {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

#ir-tool-wrapper .ir-panel-molecule, .sv-card .sv-structure-panel {
  display: contents;
}

#ir-tool-wrapper .ir-panel-spectrum, .sv-card .sv-spectrum-panel {
  grid-area: spec;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-top: 16px;
}

#ir-tool-wrapper .ir-panel h3, .sv-card .sv-pane h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

#ir-tool-wrapper #ir-molecule-title, .sv-card .sv-structure-title {
  grid-area: mt;
  margin-top: 4px;
}

#ir-tool-wrapper #ir-clues-container, .sv-card .sv-clues {
  grid-area: clues;
}

#ir-tool-wrapper #ir-single-mol-wrapper, .sv-card .sv-structure {
  grid-area: mol;
}

#ir-tool-wrapper .ir-mol-controls, .sv-card .sv-structure-controls {
  grid-area: reset;
  justify-content: flex-start;
  margin: 6px 0 0;
}

/* state classes (sv-st-*) are set by rs-sv-state.js (5 Dec 2026): :has() tests on inline styles made every inline
   style change on the page restyle the whole page */

#ir-tool-wrapper .ir-mol-controls.sv-st-none, .sv-card .sv-structure-controls.sv-st-none {
  display: none;
}

#ir-tool-wrapper #ir-absorption-note-slot, .sv-card .sv-note-slot {
  grid-area: note;
}

@container svview (min-width: 700px) {
  #ir-tool-wrapper .ir-container, .sv-card .sv-work {
    grid-template: "clues clues" "spec mt" "spec mol" "spec reset" "spec ans" "spec note" 1fr "rep rep" / minmax(0, 1.85fr) minmax(220px, 1fr);
  }
}

@container svview (min-width: 700px) {
  #ir-tool-wrapper .ir-panel-spectrum, #ir-tool-wrapper #ir-molecule-title, .sv-card .sv-spectrum-panel, .sv-card .sv-structure-title {
    margin-top: 0;
  }
}

@container svview (min-width: 700px) {
  #ir-tool-wrapper .ir-toolbar-group, .sv-card .sv-pickers {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1.15fr);
    flex-basis: 100%;
  }
}

/* round 4 (round 2 decision 3): the three pickers fill a row of their own, Previous / Next and Exit to menu under them; the middle one holds molecule names, the longest text */

/* ---- structure ---- */

#ir-tool-wrapper .ir-molecule-wrapper, .sv-card .sv-structure {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
}

@container svview (min-width: 700px) {
  #ir-tool-wrapper .ir-molecule-wrapper, .sv-card .sv-structure {
    height: 240px;
  }
}

/* ---- explanation box: white, red left rule, red title (the old note) ---- */

#ir-tool-wrapper .ir-absorption-note-slot, .sv-card .sv-note-slot {
  display: none;
  width: 100%;
  margin: 12px 0 0;
}

#ir-tool-wrapper .ir-absorption-note-slot:is(:has(.ir-note-visible), .ir-note-slot-visible), .sv-card .sv-note-slot:has(.is-visible) {
  display: block;
}

#ir-tool-wrapper .ir-absorption-tooltip, .sv-card .sv-note {
  display: none;
  position: static;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

#ir-tool-wrapper .ir-absorption-tooltip.ir-note-visible, .sv-card .sv-note.is-visible {
  display: block;
}

#ir-tool-wrapper #ir-tooltip-text, .sv-card .sv-note-title {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 900;
}

#ir-tool-wrapper #ir-tooltip-subtext, .sv-card .sv-note-text {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- spectrum: soft box, red-tinted fingerprint region, blue highlight, teal peak labels ---- */

#ir-tool-wrapper .ir-spectrum-container, .sv-card .sv-spectrum {
  container: svspec / inline-size;
  position: relative;
  width: 100%;
  padding: 8px 8px 8px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  user-select: none;
}

#ir-tool-wrapper .ir-spectrum-svg, .sv-card .sv-spectrum > svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 350;
  overflow: visible;
  border: 0;
  background: none;
}

#ir-tool-wrapper .ir-axis-line, .sv-card .sv-axis-line {
  stroke: var(--ink);
  stroke-width: 2;
}

#ir-tool-wrapper .ir-axis-tick, .sv-card .sv-axis-tick {
  stroke: var(--ink);
  stroke-width: 1.5;
}

#ir-tool-wrapper .ir-axis-label, .sv-card .sv-axis-label {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
  translate: 0 1px;
}

#ir-tool-wrapper .ir-axis-title, .sv-card .sv-axis-title {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 800;
  translate: 0 2px;
}

#ir-tool-wrapper .ir-spectrum-line, .sv-card .sv-trace {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Text is in viewBox units (800 wide), so it shrinks with the picture: each step keeps tick
   numbers at about 12px or more. Bigger text pushes the axis titles out with translate (which
   keeps the y title's own rotate attribute); the svg shows overflow and the box has padding. */

@container svspec (max-width: 820px) {
  #ir-tool-wrapper .ir-axis-label, .sv-card .sv-axis-label {
    font-size: 16px;
    translate: 0 2px;
  }
}

@container svspec (max-width: 820px) {
  #ir-tool-wrapper .ir-axis-title, .sv-card .sv-axis-title {
    font-size: 17px;
    translate: 0 3px;
  }
}

@container svspec (max-width: 620px) {
  #ir-tool-wrapper .ir-axis-label, .sv-card .sv-axis-label {
    font-size: 21px;
    translate: 0 3px;
  }
}

@container svspec (max-width: 620px) {
  #ir-tool-wrapper .ir-axis-title, .sv-card .sv-axis-title {
    font-size: 21px;
    translate: 0 5px;
  }
}

@container svspec (max-width: 440px) {
  #ir-tool-wrapper .ir-axis-label, .sv-card .sv-axis-label {
    font-size: 33px;
    translate: 0 10px;
  }
}

@container svspec (max-width: 440px) {
  #ir-tool-wrapper .ir-axis-title, .sv-card .sv-axis-title {
    font-size: 33px;
    translate: 0 20px;
  }
}

/* y numbers do not move, except the "0" at the origin, which moves up clear of the x "4000"
   (it is the 7th-from-last child of .ir-axis-group: 0, tick, 50, tick, 100, y title, x title);
   the y title moves left, not down */

#ir-tool-wrapper .ir-axis-label[text-anchor="end"], .sv-card .sv-axis-label[text-anchor="end"] {
  translate: none;
}

#ir-tool-wrapper .ir-axis-title[transform], .sv-card .sv-axis-title[transform] {
  translate: none;
}

@container svspec (max-width: 440px) {
  #ir-tool-wrapper .ir-axis-title[transform], .sv-card .sv-axis-title[transform] {
    translate: -29px 0;
  }
}

/* phone: the spectrum box also uses the card's side padding */

@container svview (max-width: 460px) {
  #ir-tool-wrapper .ir-spectrum-container, .sv-card .sv-spectrum {
    width: auto;
    margin: 0 -6px;
    padding: 6px 2px 12px 18px;
  }
}

/* round 4: the old single action row; no viewer uses it now (kept for old copies of the markup) */

#ir-tool-wrapper .ir-spectrum-controls, .sv-card .sv-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
}

/* ---- Deduce: clues, hidden structure, steps, choices ---- */

#ir-tool-wrapper .ir-clues-container, .sv-card .sv-info {
  margin: 0 0 12px;
  padding: 12px 16px;
  border-left: 4px solid var(--info-line);
  border-radius: 0 12px 12px 0;
  background: var(--info-bg);
}

#ir-tool-wrapper .ir-clues-container h4, .sv-card .sv-info h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

#ir-tool-wrapper :is(.ir-feedback, .ir-absorption-check-feedback:is(.error, .success)), .sv-card .sv-feedback {
  display: block;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
}

#ir-tool-wrapper :is(.ir-feedback, .ir-absorption-check-feedback).error, .sv-card .sv-feedback--error {
  border-color: var(--err-line);
  background: var(--err-bg);
  color: var(--err-text);
}

#ir-tool-wrapper .ir-feedback.success, .sv-card .sv-feedback--ok {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok-text);
}

/* 29 Nov 2026 (owner, 21:30): an answer shown by Reveal is not a correct answer, so it is not green */

#ir-tool-wrapper .ir-feedback.sv-feedback--answer, .sv-card .sv-feedback--answer {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--ink);
}

/* ---- tables: exam answer layout and data sheet ---- */

#ir-tool-wrapper :is(.ir-table, .ir-datasheet-table), .sv-card .sv-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

#ir-tool-wrapper :is(.ir-table, .ir-datasheet-table) :is(th, td), .sv-card .sv-table :is(th, td) {
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

#ir-tool-wrapper :is(.ir-table, .ir-datasheet-table) th, .sv-card .sv-table th {
  background: var(--tab);
  color: var(--ink);
  font-weight: 900;
}

#ir-tool-wrapper :is(.ir-modal, .ir-confirm-backdrop), .sv-card :is(.sv-dialog-layer, .sv-backdrop) {
  position: fixed;
  inset: 0;
  z-index: 10080;
  background: rgba(0, 0, 0, 0.38);
}

#ir-tool-wrapper .ir-modal, .sv-card .sv-dialog-layer {
  padding: 24px;
  overflow: auto;
}

#ir-tool-wrapper .ir-confirm-backdrop, .sv-card .sv-backdrop {
  z-index: 10070;
  background: rgba(0, 0, 0, 0.35);
}

#ir-tool-wrapper :is(.ir-modal-content, .ir-confirm-modal), .sv-card :is(.sv-dialog, .sv-confirm) {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

#ir-tool-wrapper .ir-modal-content, .sv-card .sv-dialog {
  position: relative;
  max-width: 680px;
  margin: 60px auto;
  padding: 24px;
}

#ir-tool-wrapper .ir-modal-content h3, .sv-card .sv-dialog h3 {
  margin: 0 0 10px;
  padding-right: 44px;
}

#ir-tool-wrapper .ir-modal-close, .sv-card .sv-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

#ir-tool-wrapper .ir-modal-close:hover, .sv-card .sv-close:hover {
  border-color: var(--edge);
  background: var(--soft);
}

#ir-tool-wrapper .ir-confirm-modal, .sv-card .sv-confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10075;
  width: calc(100% - 40px);
  max-width: 420px;
  padding: 20px;
  transform: translate(-50%, -50%);
}

#ir-tool-wrapper .ir-confirm-modal p, .sv-card .sv-confirm p {
  margin: 0 0 14px;
  color: var(--muted);
}

#ir-tool-wrapper .ir-confirm-buttons, .sv-card .sv-confirm-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- full screen: the wide layout; in Deduce the steps sit beside the spectrum ---- */

#ir-tool-wrapper:fullscreen, .sv-card:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 16px 24px;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

#ir-tool-wrapper:fullscreen .ir-molecule-wrapper, .sv-card:fullscreen .sv-structure {
  height: 300px;
}

/* 29 Nov 2026 (MS and 13C NMR agents): a head button that is not also a viewer button had no button font */

.sv-card .sv-head-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

/* ---- 30 Nov 2026 (round 4): layout B+, the owner's choice. Each group sits where it acts:
   Data sheet and Exam answer layout at the right of the mode row (Reference); the zoom pair at the
   right of the Spectrum heading; the display switches under that heading, above the spectrum;
   under the spectrum only Add peak and Clear all (Predict). Reveal answer and Check answer (Answer)
   are a grid row of their own (area ans): under the structure on a wide card, after the spectrum
   on a phone. "Think something is incorrect?" ends the work area (area rep). The DOM order is the
   order on screen, so Tab follows what is seen (no CSS order). ---- */

:is(#ir-tool-wrapper, .sv-card) .sv-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* a group whose controls are all hidden by the viewer's script takes no room */

:is(#ir-tool-wrapper, .sv-card) .sv-group.sv-st-empty {
  display: none;
}

:is(#ir-tool-wrapper, .sv-card) :is(.ir-ws-head, .sv-ws-head) > .sv-group--ref {
  margin-left: auto;
}

:is(#ir-tool-wrapper, .sv-card) .sv-spec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 8px;
}

:is(#ir-tool-wrapper, .sv-card) .sv-spec-head > h3 {
  margin: 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-spec-head > .sv-group--zoom {
  margin-left: auto;
}

/* zoom: one joined control; Reset zoom joins the end of it when it shows */

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom {
  flex-wrap: nowrap;
  gap: 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom > button {
  border-radius: 0;
  padding-inline: 12px;
  white-space: nowrap;
}

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom > button + button {
  margin-left: -1px;
}

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom > button:first-child {
  border-radius: 999px 0 0 999px;
}

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom > button:nth-last-child(1 of :not([style*="display: none"])) {
  border-radius: 0 999px 999px 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-group--zoom > button:focus-visible {
  position: relative;
  z-index: 1;
}

/* display switches (control standard v2): a native checkbox with role="switch"; teal track when on,
   and a teal dot by the label; the switch never moves when it is turned on or off */

:is(#ir-tool-wrapper, .sv-card) .sv-switches {
  gap: 0 18px;
  margin: 0 0 8px;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 2px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: #7a8199;
  cursor: pointer;
  transition: background-color 0.15s;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"]:checked {
  background: #0f766e;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
  background: transparent;
}

:is(#ir-tool-wrapper, .sv-card) .sv-switch > input:checked + span::before {
  background: #0f766e;
}

@media (prefers-reduced-motion: reduce) {
  :is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"], :is(#ir-tool-wrapper, .sv-card) .sv-switch > input[type="checkbox"]::after {
    transition: none;
  }
}

/* under the spectrum (Predict only): Add peak and Clear all */

:is(#ir-tool-wrapper, .sv-card) .sv-spec-foot {
  margin: 12px 0 0;
}

/* the answer group: Reveal answer (secondary), then Check answer (the one primary) */

:is(#ir-tool-wrapper, .sv-card) .sv-answer {
  grid-area: ans;
  justify-content: flex-end;
  margin: 12px 0 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-report {
  grid-area: rep;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  margin: 8px 0 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-report > a {
  margin-left: 0;
}

/* full screen: the report line takes less height, so Explore fits a 1440 x 900 screen without scrolling */

:is(#ir-tool-wrapper, .sv-card):fullscreen .sv-report {
  margin-top: 0;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen .sv-report > a {
  padding-block: 2px;
}

/* a 320px screen: the three mode tabs were 23px too wide for the card (sideways scroll); narrower padding */

@container svview (max-width: 300px) {
  #ir-tool-wrapper .ir-tab, .sv-card .sv-tab {
    padding-inline: 10px;
  }
}

@media (max-width: 520px) {
  :is(#ir-tool-wrapper, .sv-card) :is(.ir-ws-head, .sv-ws-head) > .sv-group--ref {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-answer {
    justify-content: flex-start;
  }
}

/* ---- 30 Nov 2026 (round 5) ----
   1. The title line (Y6, owner-approved): title, exam board (and level), then How it works, Cheat sheet and
      Full screen at the right, all on one line when the card is wide enough. .sv-context wraps as one
      piece, so on a narrower card the board and the three buttons go to the second line together, as
      before; on a phone they stack as before (the 520px rules above). Data sheet stays on the mode line. */

:is(#ir-tool-wrapper, .sv-card) :is(.ir-head, .sv-head) {
  flex-flow: row wrap;
  align-items: center;
  column-gap: 24px;
}

:is(#ir-tool-wrapper, .sv-card) :is(.ir-title, .sv-title) {
  flex: 0 1 auto;
  min-width: 0;
}

:is(#ir-tool-wrapper, .sv-card) :is(.ir-study-context-panel, .sv-context) {
  flex: 1 1 auto;
  min-width: 0;
}

/* 2. The action row (Y2, Y3): editing actions at the left, answer actions at the right, one row.
      Kinds (control standard v2, no new colours):
      - Check answer / Check absorptions / Check structure: the one filled primary (.sv-btn--go);
      - Reveal answer / Reveal structure: a quiet underlined text button, the "give up" action (.sv-btn--reveal);
      - Add peak: a secondary grey pill with a plus (.sv-btn--add);
      - Clear all peaks / Clear drawing: a quiet text button with a bin icon, no fill (.sv-btn--clear). */

:is(#ir-tool-wrapper, .sv-card) .sv-actrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-width: 0;
  margin: 12px 0 0;
}

:is(#ir-tool-wrapper, .sv-card) .sv-actrow.sv-st-noact.sv-st-noact {
  display: none;
}

:is(#ir-tool-wrapper, .sv-card) .sv-actrow > .sv-group--answer {
  justify-content: flex-end;
  margin: 0 0 0 auto;
}

:is(#ir-tool-wrapper, .sv-card) .sv-btn--add::before {
  content: "+";
  margin: -2px 0 0;
  font-size: 1.3em;
  font-weight: 900;
  line-height: 1;
}

/* (a script may show a button with display: block; the icon is inline-block so it still shows, with a gap) */

:is(#ir-tool-wrapper, .sv-card) .sv-btn--clear[style*="block"]::before, :is(#ir-tool-wrapper, .sv-card) .sv-btn--add[style*="block"]::before {
  margin-right: 6px;
}

:is(#ir-tool-wrapper, .sv-card) :is(.sv-btn--reveal, .sv-btn--clear) {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding-inline: 10px;
}

:is(#ir-tool-wrapper, .sv-card) .sv-btn--reveal {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

:is(#ir-tool-wrapper, .sv-card) :is(.sv-btn--reveal, .sv-btn--clear):hover:enabled {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

:is(#ir-tool-wrapper, .sv-card) .sv-btn--clear::before {
  content: "";
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  margin-right: 0;
  vertical-align: -3px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

:is(#ir-tool-wrapper, .sv-card) :is(.sv-btn--reveal, .sv-btn--clear):disabled {
  border-style: dashed;
  border-color: var(--edge);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  cursor: not-allowed;
}

/* phone: a tidy 2 + 2 (editing actions, then Reveal answer and a full-width Check answer last) */

@container svview (max-width: 460px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow > .sv-group {
    flex: 1 1 100%;
    flex-wrap: nowrap;
  }
}

@container svview (max-width: 460px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow :is(.sv-btn--add, .sv-btn--clear) {
    white-space: nowrap;
  }
}

@container svview (max-width: 460px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow > .sv-group--answer > .sv-btn--go {
    flex: 1 1 auto;
  }
}

@container svview (max-width: 460px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow > .sv-group--answer > .sv-btn--reveal {
    flex: none;
    white-space: nowrap;
  }
}

/* 3. Full screen (Y4): the card is the screen. The head, mode line and toolbar take less height (the pickers,
      Previous / Next and Exit to menu share one line), and each viewer's script makes the spectrum (then the
      structure box, then the drawing box) smaller until nothing needs scrolling (sv fit, in the script). */

:is(#ir-tool-wrapper, .sv-card):fullscreen {
  padding: 10px 24px 6px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-head, .sv-head) {
  margin-bottom: 10px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head) {
  margin-bottom: 8px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-ws-head, .sv-ws-head) {
  margin-bottom: 8px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-ws-toolbar, .sv-toolbar) {
  padding: 8px 14px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-toolbar-group, .sv-pickers) {
  flex: 1 1 520px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(#ir-instructions, .sv-instructions) {
  margin-top: 6px;
}

:is(#ir-tool-wrapper, .sv-card):fullscreen .sv-actrow {
  margin-top: 8px;
}

/* full screen, wide: the heading, the zoom pair and the display switches share one line (they wrap if they
   do not fit); the fit narrows the spectrum box (centred), and its height follows */

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-panel-spectrum, .sv-spectrum-panel) {
    flex-flow: row wrap;
    align-items: center;
    column-gap: 16px;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-panel-spectrum, .sv-spectrum-panel) > .sv-spec-head {
    display: contents;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen .sv-spec-head > .sv-group--zoom {
    margin-left: 0;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-panel-spectrum, .sv-spectrum-panel) > .sv-switches {
    margin: 0 0 0 auto;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-spectrum-container, .sv-spectrum) {
    flex: 1 1 100%;
    margin: 8px auto 0;
  }
}

/* the exam answer layout opens as a window over the bottom of the work area, and scrolls inside itself
   (the view is the containing block: its size container contains fixed boxes) */

:is(#ir-tool-wrapper, .sv-card):fullscreen :is(#ir-table-container, #ms-table-container, #cnmr-table-container, #nmr-table-container) {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  max-height: 45%;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.16);
}

/* full screen, Deduce and Predict: Change settings and Next question join the mode line (at its right), so the
   spectrum keeps another 64 px of height; Explore keeps its pickers row */

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head).sv-st-q.sv-st-q {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head).sv-st-q.sv-st-q > :is(.ir-ws-head, .sv-ws-head) {
    display: contents;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head).sv-st-q.sv-st-q .sv-group--ref {
    margin-left: 0;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head) > [id$="ws-toolbar-question"] {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
  }
}

@container svview (min-width: 700px) {
  :is(#ir-tool-wrapper, .sv-card):fullscreen :is(.ir-header, .sv-work-head) > :is(#ir-instructions, .sv-instructions) {
    flex: 1 1 100%;
  }
}

/* ---- 3 Dec 2026 (header) ----
   The header in two rows, the agreed common ground for Y6 and L3 (header-spec.md): row 1 is the title, with
   How it works, Cheat sheet and Full screen at the right; row 2 is the course (exam board, and level where the
   viewer has one), labels beside the selects. The context panel lets its children join the head's own rows
   (display: contents), so no markup or script changes. Phones (520 px and under) keep the stacked head above.
   Full screen keeps the round 5 title line (title, course, buttons on one line): height matters most there.
   The Combined techniques card (#cb-tool-wrapper, also .sv-card) has its own rules in rs-spec-combined.css. */

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-head, .sv-head) {
    row-gap: 6px;
    column-gap: 16px;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-study-context-panel, .sv-context) {
    display: contents;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-title, .sv-title) {
    order: 0;
    flex: 1 1 auto;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) .rs-viewer-btns {
    order: 1;
    margin-left: auto;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-head, .sv-head)::after {
    content: "";
    order: 2;
    flex: 0 0 100%;
    height: 0;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-study-context-field, .sv-field, [id$="study-context-note"]) {
    order: 3;
  }
}

@media (min-width: 521px) {
  :is(#ir-tool-wrapper, .sv-card):not(:fullscreen):not(#cb-tool-wrapper) :is(.ir-study-context-field, .sv-field) + :is(.ir-study-context-field, .sv-field) {
    margin-left: 8px;
  }
}

/* ---- end 3 Dec header ---- */

/* 3 Dec: on the narrowest views (320 px phones) Add peak and Clear all peaks fit side by side on one line */

@container svview (max-width: 300px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow > .sv-group--peaks {
    gap: 6px;
  }
}

@container svview (max-width: 300px) {
  :is(#ir-tool-wrapper, .sv-card) .sv-actrow :is(.sv-btn--add, .sv-btn--clear) {
    padding-inline: 8px;
    font-size: 0.85rem;
  }
}

