/* ! rs-atom-tools.css v1.2 (30 Nov 2026, proposed shared file) · Inside an atom, Electron arrangements, Count the particles
   (rs-atom-tools.js). The card rules from the GCSE Modern atomic model and Isotopes pages' <style> blocks, moved from the page
   wrapper ids (#rsAtomicModel, #rsIsotopesPage) to the card ids (#rsamParticles, #rsamArrangement, #isoCount), so they keep
   the same strength. Three values come from the basics page's reviewed copy (accessibility, 29–30 Nov): greyed table rows
   #6b7080 (was #9a9dab, 2.7:1), the chosen element's number #fff (was #ffe1d6), the answer box focus ring #185abc. */

#rsamParticles.rsam-card {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  background: #fff;
}

#rsamParticles .rsam-card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--rs-navy);
}

#rsamParticles .rsam-card-intro {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--rs-muted, #696e7f);
}

#rsamParticles .rsam-btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}

#rsamParticles .rsam-px {
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(0, 1fr);
  gap: 16px 20px;
  align-items: center;
}

#rsamParticles .rsam-px-atom .rs-atom-svg {
  display: block;
  width: 100%;
  height: auto;
}

#rsamParticles .rsam-px-atom .rs-atom-p, #rsamParticles .rsam-px-atom .rs-atom-n, #rsamParticles .rsam-px-atom .rs-atom-e {
  cursor: pointer;
  transition: opacity .2s;
}

#rsamParticles .rsam-px-atom[data-show="proton"] :is(.rs-atom-n, .rs-atom-e, .rs-atom-shell), #rsamParticles .rsam-px-atom[data-show="neutron"] :is(.rs-atom-p, .rs-atom-e, .rs-atom-shell), #rsamParticles .rsam-px-atom[data-show="electron"] :is(.rs-atom-p, .rs-atom-n) {
  opacity: 0.2;
}

#rsamParticles .rsam-px-cap {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--rs-muted, #696e7f);
  text-align: center;
}

#rsamParticles .rsam-table-wrap {
  overflow-x: auto;
}

#rsamParticles .rsam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

#rsamParticles .rsam-table th, #rsamParticles .rsam-table td {
  padding: 7px 8px;
  border: 1px solid #d0d4e0;
  text-align: center;
  vertical-align: middle;
}

#rsamParticles .rsam-table thead th {
  background: var(--rs-soft, #f5f6fb);
  color: var(--rs-navy);
  font-size: 0.88rem;
}

#rsamParticles .rsam-table tbody th {
  text-align: left;
  padding: 4px;
}

#rsamParticles .rsam-table tbody tr {
  transition: background .15s;
}

#rsamParticles .rsam-table tbody tr.is-on {
  background: #fff8f5;
}

#rsamParticles .rsam-table tbody tr.is-off {
  color: #6b7080;
}

#rsamParticles .rsam-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

#rsamParticles .rsam-dot--p {
  background: var(--rs-chem, #d33c16);
}

#rsamParticles .rsam-dot--n {
  background: #5ba4cf;
}

#rsamParticles .rsam-dot--e {
  background: var(--rs-ink, #25242f);
}

#rsamParticles .rsam-px-msg {
  min-height: 3em;
  margin: 10px 0 0;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  #rsamParticles .rsam-px {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #rsamParticles .rsam-px-atom {
    max-width: 220px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  #rsamParticles .rsam-table {
    font-size: 0.85rem;
  }
}

@media (max-width: 640px) {
  #rsamParticles .rsam-table th, #rsamParticles .rsam-table td {
    padding: 5px 3px;
  }
}

#rsamParticles .rsam-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0 0 4px;
}

#rsamArrangement .rsam-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0 0 4px;
}

#rsamParticles .rsam-head .rsam-card-title, #rsamParticles .rsam-head .rsam-ea-title {
  margin: 0;
  padding-top: 4px;
}

#rsamArrangement .rsam-head .rsam-card-title, #rsamArrangement .rsam-head .rsam-ea-title {
  margin: 0;
  padding-top: 4px;
}

#rsamParticles [data-howto-head] {
  display: inline-flex;
}

#rsamArrangement [data-howto-head] {
  display: inline-flex;
}

#rsamArrangement.rsam-ea {
  margin: 18px 0 25px;
  padding: 20px;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  background: #fff;
}

#rsamArrangement .rsam-ea-title {
  margin: 0 0 2px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rs-ink);
}

#rsamArrangement .rsam-ea-intro {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: #686b78;
}

#rsamArrangement .rsam-ea-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

#rsamArrangement .rsam-mini {
  display: grid;
  grid-template-columns: 26px repeat(8, minmax(0, 1fr));
  gap: 4px;
}

#rsamArrangement .rsam-mini-h {
  font-size: 0.75rem;
  font-weight: 800;
  color: #686b78;
  text-align: center;
  align-self: end;
}

#rsamArrangement .rsam-mini-p {
  font-size: 0.75rem;
  font-weight: 800;
  color: #686b78;
  align-self: center;
  text-align: center;
}

#rsamArrangement .rsam-mini-el {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid #d0d4e0;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--rs-ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

#rsamArrangement .rsam-mini-sym {
  font-size: clamp(0.8rem, 2.2vw, 1.1rem);
  font-weight: 700;
}

#rsamArrangement .rsam-mini-el small {
  font-size: 0.62rem;
  color: #686b78;
}

#rsamArrangement .rsam-mini-el:hover {
  background: #fff0ec;
}

#rsamArrangement .rsam-mini-el[aria-pressed="true"] {
  background: var(--rs-chem, #d33c16);
  border-color: var(--rs-chem, #d33c16);
  color: #fff;
}

#rsamArrangement .rsam-mini-el[aria-pressed="true"] small {
  color: #fff;
}

#rsamArrangement .rsam-mini-el.is-period {
  box-shadow: inset 0 0 0 2px #f2bcb0;
}

#rsamArrangement .rsam-mini-el.is-group {
  box-shadow: inset 0 0 0 2px #9cc5e0;
}

#rsamArrangement .rsam-mini-el.is-period.is-group {
  box-shadow: none;
}

#rsamArrangement .rsam-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-top: 12px;
}

#rsamArrangement .rsam-stylewrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--rs-navy);
}

#rsamArrangement .rsam-ea-out {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 16px;
  align-items: center;
}

#rsamArrangement .rsam-ea-svg {
  grid-row: span 3;
  width: 190px;
}

#rsamArrangement .rsam-ea-svg .rs-atom-svg {
  width: 100%;
  height: auto;
  display: block;
}

#rsamArrangement .rsam-ea-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--rs-ink);
}

#rsamArrangement .rsam-ea-code {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--rs-chem, #d33c16);
  letter-spacing: 0.02em;
}

#rsamArrangement .rsam-ea-shells {
  font-size: 0.85rem;
  color: #686b78;
}

#rsamArrangement .rsam-ea-links {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

#rsamArrangement .rsam-ea-links li {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f5f6fb;
}

#rsamArrangement .rsam-ea-links li.is-period {
  border-left: 4px solid #f2bcb0;
}

#rsamArrangement .rsam-ea-links li.is-group {
  border-left: 4px solid #9cc5e0;
}

#rsamArrangement .rsam-ea-note {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: #686b78;
}

@media (max-width: 767.98px) {
  #rsamArrangement .rsam-ea-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  #rsamArrangement .rsam-ea-svg {
    width: 150px;
  }
}

@media (max-width: 575.98px) {
  #rsamParticles .rsam-px, #rsamArrangement .rsam-ea-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  #rsamArrangement .rsam-ea-out {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  #rsamArrangement .rsam-ea-svg {
    grid-row: auto;
    margin: 0 auto;
  }
}

#isoCount .ct-body {
  align-items: stretch;
}

#isoCount .ct-stage {
  display: flex;
}

#isoCount .ct-side {
  align-content: start;
}

#isoCount .icp-tile {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #d0d4e0;
  border-radius: 12px;
  background: #f5f6fb;
}

#isoCount .icp-name {
  margin: 0;
  color: var(--rs-navy);
  font-weight: 900;
}

#isoCount .icp-not {
  display: flex;
  align-items: center;
  gap: 6px;
}

#isoCount .icp-nums {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#isoCount .icp-a {
  color: var(--rs-navy);
}

#isoCount .icp-z {
  color: var(--rs-chem-deep, #a42d12);
}

#isoCount .icp-sym {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--rs-ink);
}

#isoCount .icp-q {
  align-self: flex-start;
  min-width: 2.2ch;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--rs-ink);
}

#isoCount .icp-key {
  display: grid;
  gap: 4px;
  color: #394362;
  font-size: 0.88em;
  line-height: 1.35;
}

#isoCount .icp-key > span {
  display: grid;
  grid-template-columns: 6.4em minmax(0, 1fr);
  gap: 6px;
}

#isoCount .icp-k {
  font-weight: 900;
  color: var(--rs-navy);
}

#isoCount .icp-rows {
  display: grid;
  gap: 6px;
}

#isoCount .icp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.2em auto 1.4em;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e0e3e8;
  border-radius: 10px;
  background: #fff;
}

#isoCount .icp-row.is-right {
  border-color: #2f8f5b;
  background: #eefbf2;
}

#isoCount .icp-row.is-wrong {
  border-color: #d9534f;
  background: #fdf3f3;
}

#isoCount .icp-lab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 900;
  color: var(--rs-navy);
}

#isoCount .icp-in {
  width: 100%;
  min-height: 36px;
  padding: 4px 6px;
  border: 2px solid #d86712;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 900;
  text-align: center;
  color: var(--rs-ink);
}

#isoCount .icp-in:focus-visible {
  outline: 3px solid #185abc;
  outline-offset: 2px;
}

#isoCount .icp-mark {
  font-weight: 900;
  font-size: 1.15em;
  text-align: center;
}

#isoCount .icp-row.is-right .icp-mark {
  color: #1d5c3c;
}

#isoCount .icp-row.is-wrong .icp-mark {
  color: #b52b27;
}

#isoCount .icp-again {
  justify-self: start;
}

#isoCount .icp-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #394362;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  color: var(--rs-ink);
}

#isoCount .icp-dot--p {
  background: #f4a29a;
}

#isoCount .icp-dot--n {
  background: #d5d9e2;
}

#isoCount .icp-dot--e {
  background: #25242f;
}

/* ---- shared fixes (30 Nov) ---- */

/* nothing chosen on load: rs-startempty.js (release 26a) styles its states for .ct-card only (rs-page.css); these two cards
   are .rsam-card / .rsam-ea, so the same rules are given to them here */

#rsamParticles.se-empty .se-hide, #rsamArrangement.se-empty .se-hide {
  visibility: hidden !important;
}

#rsamParticles.se-empty .se-blank, #rsamArrangement.se-empty .se-blank {
  color: transparent !important;
}

#rsamParticles.se-empty .se-blank *, #rsamArrangement.se-empty .se-blank * {
  visibility: hidden !important;
}

#rsamParticles.se-empty .se-off, #rsamArrangement.se-empty .se-off {
  opacity: 0.45;
  pointer-events: none;
}

#rsamArrangement.se-empty .rsam-mini-el {
  box-shadow: none;
}

/* no period / group outlines before an element is chosen */

#rsamParticles .se-prompt, #rsamArrangement .se-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--rs-muted, #696e7f);
  visibility: visible !important;
  pointer-events: none;
  z-index: 2;
}

/* Count the particles at 390 px and below: the four parts of each row fit, so "Neutrons" and "Electrons" are not cut off */

@media (max-width: 480px) {
  #isoCount .icp-row {
    grid-template-columns: minmax(0, 1fr) 3.2em auto 1.1em;
    gap: 6px;
    padding: 6px;
  }
}

@media (max-width: 480px) {
  #isoCount .icp-lab {
    gap: 4px;
    font-size: 0.95em;
  }
}

@media (max-width: 480px) {
  #isoCount .icp-check {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* ---- Inside an atom: the table (v1.1, round 4, owner 30 Nov: "very small should run on its own line", no empty fifth
   column, no squashed Relative charge column) ----
   Wide cards (table area 500 px or more): five fixed columns, every heading on one line, "(very small)" on its own line
   under 1/1836, and the particle buttons fill their column, so pressing one moves nothing.
   Narrow cards (phones, and tablets where the table sits beside the atom): v1.2, see the end of this file. */

#rsamParticles .rsam-table-wrap {
  container-type: inline-size;
  overflow-x: visible;
}

#rsamParticles .rsam-table {
  table-layout: fixed;
}

#rsamParticles .rsam-table col.rsam-c-p {
  width: 25.5%;
}

#rsamParticles .rsam-table col.rsam-c-m {
  width: 21%;
}

#rsamParticles .rsam-table col.rsam-c-c {
  width: 22%;
}

#rsamParticles .rsam-table col.rsam-c-w {
  width: 13.5%;
}

#rsamParticles .rsam-table col.rsam-c-n {
  width: 18%;
}

#rsamParticles .rsam-table th, #rsamParticles .rsam-table td {
  padding-left: 6px;
  padding-right: 6px;
}

#rsamParticles .rsam-table thead th, #rsamParticles .rsam-table thead th * {
  white-space: nowrap;
}

#rsamParticles .rsam-table tbody th {
  padding: 4px;
}

#rsamParticles .rsam-pick {
  width: 100%;
  justify-content: flex-start;
  gap: 6px;
  padding-left: 9px;
  padding-right: 9px;
  white-space: nowrap;
}

#rsamParticles .rsam-vsmall {
  display: block;
  white-space: nowrap;
}

#rsamParticles .rsam-table .rs-frac {
  text-align: center;
}

#rsamParticles [data-count] {
  font-variant-numeric: tabular-nums;
}

/* ---- Inside an atom: narrow cards (v1.2, round 5, owner 30 Nov: the phone view "looks like a dump of words and numbers") ----
   Below a 500 px table area the same table is set out as one designed card per particle:
   - a header strip: the particle button (colour dot + name) on the left; on the right the number of that particle in the
     chosen atom in a round navy badge, with its quiet label ("In sodium", "In the atom" before a choice) beside it;
   - under it, the three values in a grid of three equal, centred columns, each a quiet label over a larger value; the
     electron's 1/1836 is a centred stacked fraction with "(very small)" centred under it;
   - the pressed particle's card has a teal outline and a teal-tinted header (teal = your choice); the other two cards
     keep their layout, with their values greyed.
   Every card keeps one height in every state: the border is always 2 px (only its colour changes), the badge has a fixed
   size, every value label keeps two lines, and the electron's mass cell sets the row height.
   Below a 280 px table area: the same card with the values two across (Where under Relative mass). */

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table, #rsamParticles .rsam-table tbody {
    display: block;
    width: 100%;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table colgroup {
    display: none;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 10px;
    border: 2px solid #d0d4e0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    transition: border-color .15s;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr:last-child {
    margin-bottom: 0;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody th {
    grid-row: 1;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid #e0e3e8;
    background: #f5f6fb;
    transition: background-color .15s;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-pick {
    width: auto;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td[data-count] {
    grid-row: 1;
    grid-column: 3;
    z-index: 1;
    align-self: center;
    justify-self: end;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    margin-right: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--rs-navy, #394362);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td[data-count]::before {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 7px);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: #5a5e6e;
    white-space: nowrap;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td:not([data-count]) {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 7px 3px 9px;
    border: 0;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--rs-ink, #25242f);
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td:not([data-count]) ~ td:not([data-count]) {
    border-left: 1px solid #eceef3;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td:not([data-count])::before {
    content: attr(data-label);
    display: block;
    align-self: stretch;
    margin-bottom: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: #5a5e6e;
    white-space: nowrap;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td .rs-frac {
    font-size: 0.9em !important;
    vertical-align: baseline !important;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td .rs-frac > span:first-child {
    padding: 0 4px 2px;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody td .rs-frac > span:last-child {
    padding-top: 2px;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-vsmall {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #5a5e6e;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr.is-on {
    border-color: #0f766e;
    background: #fff;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr.is-on > th {
    background: #e3f4f1;
    border-bottom-color: #b9e0d9;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr.is-off > td:not([data-count]) {
    color: #6b7080;
  }
}

@container (max-width: 499.98px) {
  #rsamParticles .rsam-table tbody tr.is-off > td[data-count] {
    background: #6b7080;
  }
}

/* narrow phones (table area under 290 px): the labels wrap, so every label keeps two lines and the values stay level;
   the count moves under the button, so a pressed button and the label never meet */

@container (max-width: 289.98px) {
  #rsamParticles .rsam-table tbody td:not([data-count])::before {
    min-height: 2.5em;
    white-space: normal;
  }
}

@container (max-width: 289.98px) {
  #rsamParticles .rsam-table tbody td:not([data-count]) {
    font-size: 1rem;
  }
}

@container (max-width: 289.98px) {
  #rsamParticles .rsam-table tbody th {
    min-height: 0;
    padding-bottom: 46px;
  }
}

@container (max-width: 289.98px) {
  #rsamParticles .rsam-table tbody td[data-count] {
    grid-column: 1;
    justify-self: start;
    align-self: end;
    margin: 0 0 7px 10px;
  }
}

@container (max-width: 289.98px) {
  #rsamParticles .rsam-table tbody td[data-count]::before {
    right: auto;
    left: calc(100% + 7px);
  }
}

