/* =====================================================================================
   MSviewer.css: the Mass Spectrometry Viewer's own rules (#ms-tool-wrapper).
   Load after rs-spec-viewer.css, which holds the card, controls, panels and spectrum box
   (the markup carries the shared .sv-* classes). This file: the landing note, set-up forms,
   structure drawing, spectrum marks (peaks, m/z labels), Deduce cards, the ion guide and
   cheat sheet text, and Deduce in full screen. 29 Nov 2026. No important flags.
   ===================================================================================== */

/* ---- head, landing and set-up ---- */

#ms-tool-wrapper #ms-study-context-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#ms-tool-wrapper .ms-landing-note {
  max-width: 80ch;
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 0.95rem;
}

#ms-tool-wrapper #ms-view-config-explore .ms-config-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

#ms-tool-wrapper #ms-view-config-explore select {
  margin-bottom: 8px;
}

#ms-tool-wrapper .ms-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#ms-tool-wrapper .ms-filter-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

@container svview (min-width: 620px) {
  #ms-tool-wrapper #ms-view-config-explore .ms-config-panel {
    grid-template: auto auto / repeat(2, minmax(0, 300px));
    grid-auto-flow: column;
    column-gap: 16px;
  }
}

@container svview (min-width: 620px) {
  #ms-tool-wrapper #ms-view-config-explore select {
    margin-bottom: 0;
  }
}

@container svview (min-width: 620px) {
  #ms-tool-wrapper .ms-filter-grid {
    grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(0, 2fr);
    gap: 20px;
  }
}

@container svview (min-width: 620px) {
  #ms-tool-wrapper #ms-filter-fg-group {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* (g) unavailable filter choices: no fade; italic text, and the checkbox itself is disabled */

#ms-tool-wrapper .ms-checkbox-group label.ms-unavailable {
  color: var(--muted);
  font-style: italic;
  cursor: not-allowed;
}

/* ---- workspace ---- */

#ms-tool-wrapper #btn-ms-ws-exit-explore {
  margin-left: auto;
}

#ms-tool-wrapper #ms-ws-toolbar-question {
  justify-content: space-between;
}

/* 30 Nov 2026 (round 4): the S7a picker widths are gone; the pickers have a row of their own (rs-spec-viewer.css) */

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

#ms-tool-wrapper #ms-molecule-svg {
  display: block;
  width: 100%;
  height: 100%;
}

#ms-tool-wrapper #ms-molecule-zoom-group text {
  fill: var(--ink);
  font-family: inherit;
  font-weight: 800;
}

#ms-tool-wrapper #ms-molecule-zoom-group :is(line, path) {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

#ms-tool-wrapper #ms-molecule-zoom-group g.ms-faded {
  opacity: 0.18;
}

#ms-tool-wrapper #ms-molecule-zoom-group g:is(.ms-active-frag, .ms-highlight-locked) {
  opacity: 1;
}

#ms-tool-wrapper #ms-molecule-zoom-group g:is(.ms-active-frag, .ms-highlight-locked) text {
  fill: var(--accent);
  font-weight: 900;
}

#ms-tool-wrapper #ms-molecule-zoom-group g:is(.ms-active-frag, .ms-highlight-locked) :is(line, path) {
  stroke: var(--accent);
  stroke-width: 3;
}

#ms-tool-wrapper .ms-frag-hitbox {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: pointer;
}

#ms-tool-wrapper .ms-frag-hitbox:hover {
  fill: rgba(211, 62, 22, 0.05);
  stroke: rgba(211, 62, 22, 0.16);
}

#ms-tool-wrapper.ms-deduce-unsolved .ms-fragment-note-slot {
  display: none;
}

/* ---- spectrum marks: key peaks (red when highlighted), background peaks, m/z labels ---- */

#ms-tool-wrapper .ms-background-peak {
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: 0.62;
}

#ms-tool-wrapper .ms-peak-hitbox {
  fill: transparent;
  pointer-events: all;
  cursor: pointer;
}

#ms-tool-wrapper .ms-peak-line {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: butt;
}

#ms-tool-wrapper .ms-peak-group:is(:hover, .ms-active-peak, .ms-highlight-locked) .ms-peak-line {
  stroke: var(--accent);
  stroke-width: 5;
}

#ms-tool-wrapper .ms-peak-group.ms-faded {
  opacity: 0.22;
}

#ms-tool-wrapper .ms-peak-group:is(.ms-active-peak, .ms-highlight-locked) {
  opacity: 1;
}

#ms-tool-wrapper .ms-peak-label {
  display: none;
  fill: var(--muted);
  font-size: 18px;
  font-weight: 900;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--soft);
  stroke-width: 5px;
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center bottom;
}

#ms-tool-wrapper .ms-label-guide {
  display: none;
  stroke: var(--quiet);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

#ms-tool-wrapper .ms-show-mz-labels :is(.ms-mz-label, .ms-label-guide) {
  display: block;
}

#ms-tool-wrapper .ms-zoom-box {
  stroke: var(--blue);
  stroke-width: 1;
  pointer-events: none;
}

@container svspec (max-width: 620px) {
  #ms-tool-wrapper .ms-peak-label {
    transform: scale(1.3);
  }
}

@container svspec (max-width: 440px) {
  #ms-tool-wrapper .ms-peak-label {
    transform: scale(1.7);
  }
}

/* MS axis geometry (the plot starts at m/z 0 and its titles are longer than IR's): the x "0" at the
   origin moves right, clear of the y axis and the y "0"; the x title "m/z" moves down, clear of the
   tick numbers below it; the long y title moves left, clear of the "100". Each step keeps the shared
   vertical drop of the tick numbers (rs-spec-viewer.css). */

#ms-tool-wrapper .ms-axis-group > .ms-axis-label[text-anchor="middle"][x="74"] {
  translate: 5px 1px;
}

#ms-tool-wrapper .ms-axis-title:not([transform]) {
  translate: 0 6px;
}

#ms-tool-wrapper .ms-axis-title[transform] {
  translate: -4px 0;
}

@container svspec (max-width: 820px) {
  #ms-tool-wrapper .ms-axis-group > .ms-axis-label[text-anchor="middle"][x="74"] {
    translate: 6px 2px;
  }
}

@container svspec (max-width: 820px) {
  #ms-tool-wrapper .ms-axis-title:not([transform]) {
    translate: 0 8px;
  }
}

@container svspec (max-width: 820px) {
  #ms-tool-wrapper .ms-axis-title[transform] {
    translate: -6px 0;
  }
}

@container svspec (max-width: 620px) {
  #ms-tool-wrapper .ms-axis-group > .ms-axis-label[text-anchor="middle"][x="74"] {
    translate: 8px 3px;
  }
}

@container svspec (max-width: 620px) {
  #ms-tool-wrapper .ms-axis-title:not([transform]) {
    translate: 0 11px;
  }
}

@container svspec (max-width: 620px) {
  #ms-tool-wrapper .ms-axis-title[transform] {
    translate: -8px 0;
  }
}

@container svspec (max-width: 440px) {
  #ms-tool-wrapper .ms-axis-group > .ms-axis-label[text-anchor="middle"][x="74"] {
    translate: 12px 10px;
  }
}

@container svspec (max-width: 440px) {
  #ms-tool-wrapper .ms-axis-title:not([transform]) {
    translate: 0 28px;
  }
}

@container svspec (max-width: 440px) {
  #ms-tool-wrapper .ms-axis-title[transform] {
    font-size: 28px;
    translate: -32px 0;
  }
}

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

#ms-tool-wrapper .ms-clues-list {
  margin: 0;
  padding-left: 20px;
}

#ms-tool-wrapper.ms-deduce-unsolved .ms-molecule-wrapper {
  height: auto;
  overflow: visible;
  border: 0;
  cursor: default;
}

#ms-tool-wrapper .ms-hidden-structure-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

#ms-tool-wrapper .ms-hidden-structure-note strong {
  color: var(--ink);
  font-size: 1.05rem;
}

#ms-tool-wrapper .ms-hidden-structure-note span {
  font-size: 0.92rem;
  line-height: 1.4;
}

#ms-tool-wrapper .ms-hidden-structure-note .sv-btn {
  margin-top: 4px;
}

#ms-tool-wrapper .ms-deduce-choice-section {
  margin: 20px 0 0;
}

#ms-tool-wrapper .ms-deduce-choice-section h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  text-align: left;
}

#ms-tool-wrapper .ms-deduce-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  width: 100%;
}

#ms-tool-wrapper .ms-isomer-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--soft);
  text-align: center;
  cursor: pointer;
}

#ms-tool-wrapper .ms-isomer-card:hover {
  border-color: var(--blue);
  background: #fff;
}

#ms-tool-wrapper .ms-isomer-card.active {
  border-color: var(--accent);
  background: var(--err-bg);
}

#ms-tool-wrapper .ms-isomer-card.correct {
  border-color: var(--ok-edge);
  background: var(--ok-bg);
}

#ms-tool-wrapper .ms-structural-formula {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#ms-tool-wrapper .ms-isomer-name {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

/* (g) set-aside cards keep full-contrast text, with a dashed edge and a tag; the tag also says
   "Correct" or "Not this one", so the state is not shown by colour alone */

#ms-tool-wrapper .ms-isomer-card.ms-rejected {
  border-style: dashed;
  background: #fff;
}

#ms-tool-wrapper .ms-isomer-card.ms-rejected.active {
  border-color: var(--accent);
}

#ms-tool-wrapper .ms-card-tag {
  align-self: center;
  margin-top: 4px;
  padding: 2px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--err-text);
  font-size: 0.8rem;
  font-weight: 800;
}

#ms-tool-wrapper .ms-isomer-card.correct .ms-card-tag {
  border-color: var(--ok-edge);
  color: var(--ok-text);
}

/* ---- exam answer layout ---- */

#ms-tool-wrapper .ms-data-table td:first-child {
  white-space: nowrap;
  font-weight: 800;
}

/* ---- windows: ion guide and cheat sheet text ---- */

#ms-tool-wrapper :is(#ms-ion-guide-content, #ms-help-content) {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

#ms-tool-wrapper :is(#ms-ion-guide-content, #ms-help-content) ul {
  margin: 0;
}

/* ---- full screen in Deduce: the choices sit beside the spectrum ---- */

#ms-tool-wrapper:fullscreen:is(.ms-deduce-unsolved, .ms-deduce-solved) .ms-container {
  float: left;
  width: 58%;
  grid-template: "clues" "spec" "mt" "mol" "reset" "note" "rep" / minmax(0, 1fr);
}

/* round 5: Reveal answer has moved to the steps (beside the spectrum in full screen) */

#ms-tool-wrapper:fullscreen:is(.ms-deduce-unsolved, .ms-deduce-solved) .ms-panel-spectrum {
  margin: 0 0 12px;
}

#ms-tool-wrapper:fullscreen.ms-deduce-unsolved .ms-molecule-wrapper {
  height: auto;
}

#ms-tool-wrapper:fullscreen .ms-deduce-choice-section {
  display: flow-root;
  margin: 0 0 0 calc(58% + 24px);
}

#ms-tool-wrapper:fullscreen .ms-deduce-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

#ms-tool-wrapper:fullscreen #ms-table-container {
  clear: both;
  padding-top: 12px;
}

/* ---- 29 Nov 2026 accessibility ---- */

/* (d) keyboard focus on a peak, a fragment or a bond: the shared 3px ring colour, drawn round
   the peak's hit area or the fragment/bond outline (an SVG <g> takes no usable outline) */

#ms-tool-wrapper :is(.ms-peak-group, .ms-frag-hitbox):focus {
  outline: none;
}

#ms-tool-wrapper .ms-peak-group:focus-visible .ms-peak-hitbox {
  stroke: var(--focus);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

#ms-tool-wrapper .ms-frag-hitbox:focus-visible {
  stroke: var(--focus);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

/* (e) a sideways drag on the spectrum zooms with a finger too; an up-and-down swipe still scrolls the page */

#ms-tool-wrapper #ms-spectrum-svg {
  touch-action: pan-y;
}

/* 30 Nov 2026 (round 3): for AQA, fragment and M+1 explanations are marked "Beyond your course": the
   site's slate-grey dashed outline and grey pill (colour decisions, 21 Nov, point 10). The border keeps
   its widths, so nothing moves when the note changes between a molecular ion and a fragment. */

#ms-tool-wrapper .ms-beyond-pill {
  display: inline-block;
  margin: 0 8px 0 0;
  padding: 1px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #e8ecf1;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

#ms-tool-wrapper .sv-note.ms-note-beyond {
  border-style: dashed;
  border-color: #64748b;
}

#ms-tool-wrapper .sv-note.ms-note-beyond .sv-note-title {
  color: #334155;
}

#ms-tool-wrapper .sv-note-title .ms-beyond-pill {
  display: table;
  margin: 0 0 6px;
}

/* its own line above the title */

#ms-tool-wrapper .ms-data-table .ms-beyond-pill, #ms-tool-wrapper #ms-ion-guide-content .ms-beyond-pill {
  margin-right: 6px;
}

/* ---- 30 Nov 2026 (round 5) ---- */

/* full screen: the hidden-structure box is one short block (its Full screen button and the line about full
   screen are not needed there), so the spectrum and the steps keep the room */

#ms-tool-wrapper:fullscreen .ms-hidden-structure-note {
  gap: 2px;
  padding: 8px 12px;
}

#ms-tool-wrapper:fullscreen .ms-hidden-structure-note :is(span:nth-of-type(2), button) {
  display: none;
}

/* full screen Explore (and Deduce once solved): the note box under the structure keeps its room, so a note
   appearing on hover never makes the card scroll or anything move (control standard: reserve the tallest state) */

#ms-tool-wrapper:fullscreen:not(.ms-deduce-unsolved) :is(.ms-absorption-note-slot, .sv-note-slot) {
  display: block;
  min-height: var(--sv-fs-note, 120px);
}

/* Reveal answer under the structure cards, at the right (round 5) */

#ms-tool-wrapper .ms-cards-actions {
  justify-content: flex-end;
  margin: 12px 0 0;
}

/* 5 Dec 2026 (particle standard): displayed formula letters stay ink; the data colours some atoms (Cl, O, N) */

#ms-molecule-zoom-group text[fill="#2ecc71"], #ms-molecule-zoom-group text[fill="#e74c3c"], #ms-molecule-zoom-group text[fill="#2980b9"], #ms-molecule-zoom-group text[fill="#8e44ad"] {
  fill: #25242f;
}

