/* RSNameBuilder (round 1, 3 Dec 2026): the shared structure builder. Compact (viewers, about 330 × 200) and full
   (pages). Colours: teal = your choice (the chosen atom, pressed atom button, the switch); greyed controls stay
   focusable and say why when pressed; navy focus rings. Every box has a fixed height, so nothing jumps. */

.rsb {
  --rsb-ink: #25242f;
  --rsb-muted: #5f6475;
  --rsb-line: #c9ced8;
  --rsb-soft: #f5f6fb;
  --rsb-teal: #0f766e;
  --rsb-teal-soft: #e3f4f1;
  --rsb-navy: #394362;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--rsb-ink);
  font-family: var(--rs-font-body,ABeeZee,system-ui,sans-serif);
  min-width: 0;
}

.rsb * {
  box-sizing: border-box;
}

.rsb-stage {
  position: relative;
  border: 1px solid var(--rsb-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.rsb-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.rsb-pic svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.rsb-empty {
  margin: 0;
  padding: 0 12px;
  color: var(--rsb-muted);
  font-size: .9rem;
  text-align: center;
}

.rsb .nm-mol .nm-hit {
  cursor: pointer;
  outline: none;
}

.rsb .nm-mol .nm-hit:hover {
  fill: rgba(15,118,110,.10);
}

.rsb .nm-mol .nm-hit:focus-visible, .rsb .nm-mol .nm-hit.is-near {
  stroke: var(--rsb-navy);
  stroke-width: 2.5;
  stroke-dasharray: 4 3;
}

.rsb .nm-mol text, .rsb .nm-mol .nm-num, .rsb .nm-mol .nm-sel, .rsb .nm-mol .nm-arom {
  pointer-events: none;
}

/* the atom buttons */

.rsb-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

.rsb-pick button {
  min-width: 34px;
  height: 26px;
  padding: 0 5px;
  border: 2px solid #8b91a1;
  border-radius: 999px;
  background: #fff;
  color: var(--rsb-ink);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rsb-pick button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 7px;
}

.rsb-pick button[aria-pressed="true"] {
  border-color: var(--rsb-teal);
  background: var(--rsb-teal-soft);
}

.rsb-pick button[aria-pressed="true"]::before {
  background: var(--rsb-teal);
}

.rsb-none {
  color: var(--rsb-muted);
  font-size: .8rem;
}

/* buttons */

.rsb-btn, .rsb-g {
  min-height: 32px;
  padding: 3px 10px;
  border: 1.5px solid #8b91a1;
  border-radius: 8px;
  background: #f5f6fb;
  color: var(--rsb-ink);
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
}

.rsb-btn:hover, .rsb-g:hover {
  background: #e9ecf4;
}

.rsb-btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--rsb-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rsb-btn--quiet:hover {
  background: #f1f2f6;
}

.rsb .is-grey {
  color: #6b7080;
  border-color: #b5bac6;
  border-style: dashed;
  background: #fafafc;
  cursor: help;
}

.rsb-btn--quiet.is-grey {
  background: transparent;
  border-color: transparent;
}

.rsb button:focus-visible, .rsb input:focus-visible {
  outline: 3px solid var(--rsb-navy);
  outline-offset: 2px;
}

/* the switch */

.rsb-sw {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.rsb .rsb-sw > input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #767b89;
  cursor: pointer;
  flex: 0 0 34px;
}

.rsb .rsb-sw > input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s;
}

.rsb .rsb-sw > input[type="checkbox"]:checked {
  background: var(--rsb-teal);
}

.rsb .rsb-sw > input[type="checkbox"]:checked::after {
  left: 17px;
}

.rsb .rsb-sw.is-grey > input[type="checkbox"] {
  background: #c3c7d0;
}

@media (prefers-reduced-motion:reduce) {
  .rsb .rsb-sw > input[type="checkbox"]::after {
    transition: none;
  }
}

.rsb-msg {
  margin: 0;
  color: var(--rsb-muted);
  font-size: .86rem;
  line-height: 1.3;
  overflow: hidden;
}

.rsb-msg.is-why {
  color: var(--rsb-ink);
}

/* a bond-limit message: the site's amber warning (as the naming page's round 5 builder); no extra height */

.rsb-msg.rsb-msg--warn {
  color: #6b4e00;
  background: #fff9e6;
  box-shadow: inset 3px 0 0 #e0a800;
  padding: 0 4px 0 8px;
  border-radius: 2px;
}

.rsb-msg.rsb-msg--warn::before {
  content: "⚠ ";
  color: #8a5a00;
}

/* ---------- compact (viewers): drawing 130 px, one toolbar row, a two-line message ---------- */

.rsb--compact {
  gap: 5px;
}

.rsb--compact .rsb-stage {
  height: 130px;
}

.rsb--compact .rsb-pick {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-wrap: wrap;
  padding: 3px 4px;
  background: rgba(255,255,255,.95);
  border-top: 1px solid var(--rsb-line);
}

.rsb--compact .rsb-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  flex-wrap: nowrap;
}

.rsb--compact .rsb-bar .rsb-btn {
  padding: 3px 8px;
}

.rsb--compact .rsb-bar .rsb-btn--quiet {
  padding: 3px 4px;
}

.rsb--compact .rsb-gbtn::after {
  content: " ▾";
  font-size: .75em;
}

.rsb--compact .rsb-gbtn[aria-expanded="true"] {
  border-color: var(--rsb-teal);
  background: var(--rsb-teal-soft);
}

.rsb--compact .rsb-undo {
  margin-left: auto;
}

.rsb--compact .rsb-msg {
  height: 2.6em;
}

/* the pop-out pad of groups: opens downwards over the message line and what is below it, so the drawing stays in view; it never moves anything */

.rsb-pad {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  padding: 6px 8px;
  border: 1.5px solid var(--rsb-navy);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(37,36,47,.18);
}

.rsb-pad[hidden] {
  display: none;
}

.rsb-pad-lab {
  margin: 0 0 4px;
  font-size: .8rem;
  font-weight: 800;
  color: var(--rsb-muted);
}

.rsb-pad-g {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 5px;
}

.rsb-pad-g .rsb-g {
  padding: 3px 4px;
}

.rsb-pad-g .rsb-g--wide {
  grid-column: span 5;
}

.rsb-pad-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
  margin-top: 4px;
}

/* ---------- full (pages): drawing 320 px, rows of controls ---------- */

.rsb--full .rsb-top {
  display: flex;
  justify-content: flex-start;
}

.rsb--full .rsb-stage {
  height: 320px;
}

.rsb--full .rsb-pick {
  min-height: 64px;
  align-content: flex-start;
}

.rsb--full .rsb-stage {
  display: flex;
  flex-direction: column;
}

.rsb--full .rsb-stage .rsb-pic {
  flex: 1 1 auto;
  min-height: 0;
}

.rsb--full .rsb-pick {
  flex: 0 0 auto;
  padding: 6px;
  border-top: 1px solid #e6e8ee;
  background: var(--rsb-soft);
}

.rsb--full .rsb-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rsb--full .rsb-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rsb--full .rsb-lab {
  margin: 0;
  color: var(--rsb-muted);
  font-size: .85rem;
  font-weight: 800;
}

.rsb--full .rsb-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rsb--full .rsb-groups .rsb-g {
  min-width: 46px;
}

.rsb--full .rsb-msg {
  min-height: 3.9em;
}

.rsb--full .rsb-views button {
  min-height: 32px;
}

@media (max-width:520px) {
  .rsb--full .rsb-stage {
    height: 260px;
  }
}

@media (max-width:520px) {
  .rsb--full .rsb-msg {
    min-height: 5.2em;
  }
}

.rsb-sfwrap {
  text-align: center;
  padding: 0 10px;
}

.rsb-sf {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
}

.rsb-note {
  margin: 0;
  color: var(--rsb-muted);
  font-size: .85rem;
}

/* full layout in a wide box: drawing on the left, controls on the right (no empty band beside the drawing) */

.rsb-host {
  container-type: inline-size;
}

@container (min-width:720px) {
  .rsb--full {
    display: grid;
    grid-template-columns: minmax(0,1.1fr) minmax(0,1fr);
    grid-template-rows: auto 1fr auto;
    column-gap: 16px;
  }
}

@container (min-width:720px) {
  .rsb--full .rsb-top {
    grid-column: 1;
    grid-row: 1;
  }
}

@container (min-width:720px) {
  .rsb--full .rsb-stage {
    grid-column: 1;
    grid-row: 2 / span 2;
  }
}

@container (min-width:720px) {
  .rsb--full .rsb-rows {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@container (min-width:720px) {
  .rsb--full .rsb-msg {
    grid-column: 2;
    grid-row: 3;
  }
}

/* ---------- in the viewers: a view switch and the "Use the full editor" fallback above the compact builder ---------- */

.rsb-vp {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
}

.rsb-vp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rsb-seg {
  display: inline-flex;
}

.rsb-seg button {
  min-height: 32px;
  padding: 3px 12px;
  border: 2px solid #7a8199;
  background: #fff;
  color: #25242f;
  font: inherit;
  font-size: .86rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rsb-seg button + button {
  margin-left: -2px;
}

.rsb-seg button:first-child {
  border-radius: 8px 0 0 8px;
}

.rsb-seg button:last-child {
  border-radius: 0 8px 8px 0;
}

.rsb-seg button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
}

.rsb-seg button[aria-pressed="true"] {
  border-color: #0f766e;
  background: #e3f4f1;
  position: relative;
  z-index: 1;
}

.rsb-seg button[aria-pressed="true"]::before {
  background: #0f766e;
}

.rsb-seg button:focus-visible, .rsb-vp-full:focus-visible {
  outline: 3px solid #394362;
  outline-offset: 2px;
}

.rsb-seg[hidden], .rsb-vp-host[hidden] {
  display: none;
}

.rsb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.rsb-vp-note {
  margin: 0;
  color: #25242f;
  font-size: .86rem;
}

.rsb-vp-note[hidden] {
  display: none;
}

.rsb .rsb-sw.is-grey {
  border: 0;
  background: transparent;
}

/* a viewer whose answer box has a fixed height (the Combined techniques tool on a wide screen): the drawing area takes the
   space the editor's box took */

.rsb-vp--fill {
  flex: 1 1 auto;
  min-height: 0;
}

.rsb-vp--fill .rsb-vp-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rsb-vp--fill .rsb-vp-host > .rsb {
  flex: 1 1 auto;
  min-height: 0;
}

.rsb-vp--fill .rsb-stage {
  flex: 1 1 0;
  height: auto !important;
  min-height: 64px;
}

/* SB2 (4 Dec): a narrow compact builder (under 350 px) puts Undo and Clear on a second toolbar row, so nothing is cut off;
   its height is fixed for that width */

@container (max-width:350px) {
  .rsb--compact .rsb-bar:has(.rsb-clear) {
    flex-wrap: wrap;
    row-gap: 4px;
    min-height: 72px;
    align-content: flex-start;
  }
}

@container (max-width:350px) {
  .rsb--compact .rsb-bar:has(.rsb-clear) .rsb-undo {
    margin-left: 0;
  }
}

@container (max-width:350px) {
  .rsb--compact .rsb-bar:has(.rsb-clear) > .rsb-btn--quiet {
    order: 5;
  }
}

@container (max-width:350px) {
  .rsb--compact .rsb-bar:has(.rsb-clear) .rsb-gbtn {
    margin-right: auto;
  }
}

@container (max-width:350px) {
  .rsb--compact .rsb-msg {
    height: 3.9em;
  }
}

@container (max-width:350px) {
  .rsb-pad-foot {
    flex-wrap: wrap;
    gap: 2px 8px;
  }
}

/* the compact layout has no atom-button row (SB2): the drawing is the keyboard way in */

.rsb--compact .rsb-pick {
  display: none !important;
}

.rsb .nm-mol .nm-hit:focus-visible {
  stroke: #394362;
  stroke-width: 3;
  stroke-dasharray: none;
}

.rsb .rsb-msg, .rsb .rsb-bar, .rsb .rsb-top, .rsb .rsb-rows {
  flex: none;
}

/* very narrow (under 300 px, the viewers on small phones): the toolbar always takes two rows */

@container (max-width:300px) {
  .rsb--compact .rsb-bar {
    flex-wrap: wrap;
    row-gap: 4px;
    min-height: 72px;
    align-content: flex-start;
  }
}

@container (max-width:300px) {
  .rsb--compact .rsb-undo {
    margin-left: 0;
  }
}

@container (max-width:300px) {
  .rsb--compact .rsb-bar > .rsb-btn--quiet {
    order: 5;
  }
}

@container (max-width:300px) {
  .rsb--compact .rsb-gbtn {
    margin-right: auto;
  }
}

