/* AusSci · What's inside an atom? (Year 9): the black boxes, the simulations' controls, the drawings and the charts.
   Diagrams are drawn on a light plate, and the tube, the foil, the sources and the models on a dark one, with fixed
   colours in light and dark mode alike. Charts on the page follow the page's colours (the --viz-* tokens below, the
   same pair as the big bang lesson, checked with the dataviz palette validator). Each particle keeps one colour
   through the lesson (AT.C in at-kit.js): protons red, neutrons grey-blue, electrons and beta particles blue, alpha
   particles orange and gamma rays violet. */

/* ---------- drawings ---------- */
.dia { display: block; width: 100%; height: auto; font-family: 'Atkinson Next', system-ui, sans-serif; touch-action: manipulation; }
.plate { background: #fbfbf6; border: 1px solid #d8ded9; border-radius: 4px; color: #15231d; }
.dia text { fill: #15231d; pointer-events: none; }
.d-lab { font-size: 13px; fill: #34423c; }
.d-small { font-size: 11.5px; fill: #34423c; }
.dia .d-strong { font-weight: 800; fill: #15231d; }
.dia .d-muted { fill: #5f6b66; }
.dia .d-num { font-variant-numeric: tabular-nums; font-weight: 700; }
.dia .d-halo { paint-order: stroke; stroke: rgba(251, 251, 246, 0.92); stroke-width: 3.5px; stroke-linejoin: round; }
.dia .d-on-dark { fill: #eef2f7; }
.art { position: relative; width: 100%; }
.art-cv { display: block; width: 100%; height: auto; border-radius: 4px; background: #101a2e; }
.art .art-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; overflow: visible; }
.arrow line { stroke: #15231d; stroke-width: 1.6; }
.arrow .arrow-head { fill: #15231d; }
.nuc-sup, .nuc-sub { font-weight: 700; }

/* ---------- chart tokens ---------- */
.lab { --viz-ink: var(--ink); --viz-ink-2: var(--ink-2); --viz-muted: var(--ink-3); --viz-grid: #e3e8e4; --viz-s1: #2a78d6; --viz-s2: #eb6834; }
@media (prefers-color-scheme: dark) { .lab { --viz-grid: #26332d; --viz-s1: #3987e5; --viz-s2: #d95926; } }

/* ---------- controls ---------- */
.ctl .label { margin-bottom: 0.3rem; }
.ctl-range label { display: block; font-size: 0.889rem; font-weight: 700; margin-bottom: 0.2rem; }
.ctl-range output { font-weight: 800; color: var(--y-deep); margin-left: 0.25rem; }
.ctl-range input[type="range"] { width: 100%; max-width: 36rem; accent-color: var(--accent); min-height: 2rem; }
.lab-run { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; }
.at-opt { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.889rem; font-weight: 700; cursor: pointer; min-height: 2rem; }
.at-opt input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.model-note { font-size: 0.833rem; color: var(--ink-3); margin: 0; max-width: 46rem; }

/* ---------- screen 1: the sealed boxes ---------- */
.box-slot { max-width: 40rem; }
.dia .box-table { fill: #efe8da; }
.dia .box-wall { fill: #8a6a45; }
.dia .box-floor { fill: #f7f3ea; }
.dia .box-lid-bg { fill: #4a4f57; }
.dia .box-lid-grain { stroke: #575d66; stroke-width: 3; }
.dia .box-lid { stroke: #2f3339; stroke-width: 1; }
.dia .box-lid-t { fill: #f2efe6; font-weight: 800; }
.dia .box-lid-t2 { fill: #d9d6cc; }
.dia .box-shape { fill: #5a6b7d; stroke: #2e3a46; stroke-width: 1.5; }
.dia .box-idea-shape { fill: rgba(255, 255, 255, 0.12); stroke: #ffe28a; stroke-width: 2; stroke-dasharray: 6 4; }
.dia .box-shot line, .dia .box-shot path { stroke: #9aa39d; stroke-width: 1.4; fill: none; }
.dia .box-shot .arrow-head { fill: #9aa39d; }
.dia .box-shot .box-dot { fill: #9aa39d; }
.dia .box-shot.is-hit line, .dia .box-shot.is-hit path { stroke: var(--c); stroke-width: 2.2; }
.dia .box-shot.is-hit .arrow-head, .dia .box-shot.is-hit .box-dot { fill: var(--c); }
.dia .box-shot .box-inner { stroke-dasharray: 4 3; }
.dia .box-miss-line { stroke: #d1342b; stroke-width: 2; stroke-dasharray: 4 3; }
.dia .box-miss-x { stroke: #d1342b; stroke-width: 2.6; stroke-linecap: round; }
.box-port { cursor: pointer; }
.box-port:focus { outline: none; }
.dia .box-port-hit { fill: #ffffff; stroke: #8a6a45; stroke-width: 1.5; }
.box-port:hover .box-port-hit, .box-port:focus-visible .box-port-hit { fill: #fff3cf; stroke: #15231d; stroke-width: 2.5; }
.dia .box-port-arrow line { stroke: #6b4e2c; stroke-width: 2; }
.dia .box-port-arrow .arrow-head { fill: #6b4e2c; }
.dia .box-tick { fill: #1f7a45; font-weight: 800; }
.dia .box-cross { fill: #b3261e; font-weight: 800; }
.dia .box-ball { fill: #f2b233; stroke: #8a5a00; stroke-width: 1.2; }
.box-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; max-width: 40rem; }
.box-idea-btn { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.45rem; min-height: 0; height: auto; text-align: center; font-size: 0.833rem; line-height: 1.25; }
.box-idea-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn svg.box-thumb { width: 2.8rem; height: 2.8rem; }
.box-thumb-bg { fill: #4a4f57; }
.box-thumb-shape { fill: #ffe28a; }
.box-thumb-t { fill: #f2efe6; font-size: 18px; font-weight: 700; }
.box-fit { font-weight: 400; }

/* ---------- screen 2: the cathode ray tube ---------- */
.tube-slot { max-width: 48rem; }
.tube-ctls { display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; }
.dia .tube-sign { font-size: 18px; font-weight: 800; }
.dia .tube-tick { stroke: rgba(220, 235, 255, 0.7); stroke-width: 1.2; }
.dia .tube-ghost-ring { fill: none; stroke: #ffd36a; stroke-width: 2.5; stroke-dasharray: 4 3; }
.dia .tube-ghost-t { fill: #ffd36a; font-weight: 700; paint-order: stroke; stroke: rgba(10, 14, 24, 0.8); stroke-width: 3px; }
.dia .tube-ghost-arrow line { stroke: #ffd36a; stroke-width: 2; }
.dia .tube-ghost-arrow .arrow-head { fill: #ffd36a; }
.tube-guess { border-top: 1px solid var(--rule); padding-top: 0.6rem; }

/* ---------- screen 3: the gold foil ---------- */
.foil-top { display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; }
.foil-slot { max-width: 48rem; }
.foil-chart-slot { max-width: 48rem; }
.foil-tab { display: none; margin-top: 0.5rem; }
.foil-chart .foil-grid { stroke: var(--viz-grid); stroke-width: 1; }
.foil-chart .foil-base { stroke: var(--viz-muted); stroke-width: 1.2; }
.foil-chart text.foil-axis { fill: var(--viz-ink-2); }
.foil-chart text.foil-axis-t { fill: var(--viz-ink-2); font-weight: 700; }
.foil-chart text.foil-val { fill: var(--viz-ink); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 11px; }
.foil-chart text.foil-val-p { fill: var(--viz-ink-2); font-weight: 400; }
.foil-bar-m { fill: var(--viz-s1); }
.foil-bar-p { fill: none; stroke: var(--viz-s2); stroke-width: 2; stroke-dasharray: 4 2; }

/* ---------- screen 4: the proton and Chadwick's experiment ---------- */
.pro-slot { max-width: 40rem; }
.chad-slot { max-width: 48rem; }
.dia .chad-myst { fill: #5a3fb0; font-weight: 700; }
.chad-test { border-top: 1px solid var(--rule); padding-top: 0.6rem; display: grid; gap: 0.6rem; }
.chad-chart-slot { max-width: 48rem; }
.chad-chart .chad-grid { stroke: var(--viz-grid); stroke-width: 1; }
.chad-chart text.chad-axis { fill: var(--viz-ink-2); }
.chad-chart text.chad-axis-t { fill: var(--viz-ink-2); font-weight: 700; }
.chad-chart text.chad-val { fill: var(--viz-ink); font-variant-numeric: tabular-nums; }
.chad-bar-m { fill: var(--viz-s1); }
.chad-bar-p { fill: var(--viz-s2); }

/* ---------- screen 5: build an atom ---------- */
.bld-grid { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 1rem 1.4rem; align-items: start; }
.bld-art .art-cv { background: #f6f4ec; border: 1px solid #d8ded9; }
.bld-ctls { display: grid; gap: 0.45rem; }
.bld-row { display: grid; grid-template-columns: 1rem 6.2rem 2.75rem 2.6rem 2.75rem; align-items: center; gap: 0.4rem; }
.bld-name { font-weight: 800; }
.bld-btn { min-width: 2.75rem; min-height: 2.75rem; font-size: 1.222rem; font-weight: 800; padding: 0; }
.bld-n { font-weight: 800; font-size: 1.222rem; text-align: center; font-variant-numeric: tabular-nums; }
.bld-dot { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 50%; vertical-align: -0.05rem; }
.bld-dot-p { background: #d6453a; }
.bld-dot-n { background: #7f8fa3; }
.bld-dot-e { background: #2f7be0; }
.bld-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0.9rem 0 0; }
.bld-read div { border-left: 3px solid var(--y-stripe); padding-left: 0.55rem; }
.bld-read dt { font-size: 0.778rem; font-weight: 700; color: var(--ink-3); }
.bld-read dd { margin: 0; font-weight: 800; }
.bld-read div:last-child { grid-column: 1 / -1; }
.bld-lower { display: grid; grid-template-columns: minmax(0, 21rem) minmax(0, 1fr); gap: 1rem 1.4rem; align-items: start; margin-top: 0.4rem; }
.bld-cell { cursor: pointer; }
.bld-cell:focus { outline: none; }
.dia .bld-cell-r { fill: #eef1ed; stroke: #d3dbd5; stroke-width: 1; }
.dia .bld-cell.is-stable .bld-cell-r { fill: #2f8f5b; stroke: #1f6b3f; }
.dia .bld-cell.is-stable .bld-cell-t { fill: #ffffff; font-weight: 700; font-size: 10.5px; }
.dia .bld-cell.is-here .bld-cell-r { stroke: #15231d; stroke-width: 3; }
.bld-cell:hover .bld-cell-r, .bld-cell:focus-visible .bld-cell-r { stroke: #15231d; stroke-width: 2; }
.dia .bld-key-s { fill: #2f8f5b; }
.bld-tab { border-collapse: collapse; font-size: 0.889rem; width: 100%; }
.bld-tab th, .bld-tab td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--rule); }
.bld-tab thead th { font-size: 0.778rem; color: var(--ink-3); }
.bld-tab tbody th { white-space: nowrap; }
.bld-puzzles { display: grid; gap: 0.5rem; }
.bld-pz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.bld-q { border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.7rem; background: var(--box); display: grid; gap: 0.4rem; align-content: start; }
.bld-q p { margin: 0; }
.bld-q.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.bld-fb { font-size: 0.889rem; }

/* ---------- screen 6: the sealed sources and the decay chain ---------- */
.src-top { display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; }
.src-slot { max-width: 48rem; }
.dia .src-count { font-weight: 800; font-variant-numeric: tabular-nums; }
.src-log { border-collapse: collapse; font-size: 0.889rem; min-width: 18rem; }
.src-log caption { text-align: left; font-weight: 700; font-size: 0.833rem; color: var(--ink-3); padding-bottom: 0.25rem; }
.src-log th, .src-log td { padding: 0.25rem 0.6rem; border-bottom: 1px solid var(--rule); text-align: left; }
.src-log .num { text-align: right; font-variant-numeric: tabular-nums; }
.src-inf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.src-f { border: 1px solid var(--rule); border-radius: 4px; padding: 0.4rem 0.7rem 0.5rem; margin: 0; display: grid; gap: 0.1rem; }
.src-f legend { font-weight: 800; padding: 0 0.2rem; }
.src-reveal { display: grid; gap: 0.5rem; }
.src-r { border: 1px solid var(--rule); border-radius: 4px; padding: 0.55rem 0.75rem; background: var(--box); }
.src-r p { margin: 0.15rem 0; }
.src-r.is-ok { border-color: var(--ok); }
.src-r.is-no { border-color: var(--bad); }
.src-eq { font-size: 1.111rem; }
.nuc { display: inline-flex; align-items: center; gap: 0.06em; white-space: nowrap; }
.nuc-az { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1; font-size: 0.62em; }
.nuc-az sup, .nuc-az sub { vertical-align: baseline; position: static; font-size: 1em; }
.chain-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 13rem); gap: 1rem; align-items: start; max-width: 48rem; }
.dia .chain-bg { fill: #f1f3ef; }
.dia .chain-cell { fill: #f4c7bd; stroke: #b4574a; stroke-width: 1.2; }
.dia .chain-cell.is-stable { fill: #b8e3c8; stroke: #2f8f5b; }
.dia .chain-cell.is-here { stroke: #15231d; stroke-width: 3; }
.dia .chain-t { fill: #15231d; }
.dia .chain-t2 { fill: #34423c; font-size: 10px; }
.dia .chain-arrow line { stroke-width: 2.6; }
.dia .chain-arrow { paint-order: stroke; filter: drop-shadow(0 0 1.5px #ffffff) drop-shadow(0 0 1px #ffffff); }
.dia .chain-alpha line { stroke: #c46a00; }
.dia .chain-alpha .arrow-head { fill: #c46a00; }
.dia .chain-beta line { stroke: #2563c4; }
.dia .chain-beta .arrow-head { fill: #2563c4; }
.chain-nuc .art-cv { background: #f6f4ec; border: 1px solid #d8ded9; }

/* ---------- screen 7: half-life ---------- */
.half-grid { display: grid; grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); gap: 1rem 1.4rem; align-items: start; max-width: 50rem; }
.half-art .art-cv { background: #f6f4ec; border: 1px solid #d8ded9; }
.half-art .art-svg { cursor: pointer; }
.half-chart .half-gl { stroke: var(--viz-grid); stroke-width: 1; }
.half-chart .half-tick { stroke: var(--viz-muted); stroke-width: 1; }
.half-chart text.half-axis { fill: var(--viz-ink-2); }
.half-chart text.half-axis-t { fill: var(--viz-ink-2); font-weight: 700; }
.half-chart .half-guide { fill: none; stroke: var(--viz-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.half-chart .half-curve { fill: none; stroke: var(--viz-s2); stroke-width: 2; stroke-dasharray: 6 3; }
.half-chart .half-run { fill: none; stroke: var(--viz-s1); stroke-width: 2.4; }
.half-chart .half-dot { fill: var(--viz-s1); }

/* ---------- screen 8: radiocarbon, the models and the notebook ---------- */
.c14-slot { max-width: 48rem; }
.c14-svg { touch-action: none; }
.dia .c14-limit { fill: rgba(120, 120, 120, 0.12); }
.dia .c14-limit-t { fill: #5f6b66; }
.dia .c14-grid { stroke: #e3e8e4; stroke-width: 1; }
.dia .c14-tick { stroke: #5f6b66; }
.dia .c14-half { fill: none; stroke: #9aa59f; stroke-width: 1; stroke-dasharray: 3 3; }
.dia .c14-curve { fill: none; stroke: #2a78d6; stroke-width: 2.6; }
.dia .c14-meas { stroke: #c2410c; stroke-width: 1.6; stroke-dasharray: 6 3; }
.dia .c14-meas-t { fill: #9a3412; font-weight: 700; }
.dia .c14-age { stroke: #15231d; stroke-width: 1.6; stroke-dasharray: 5 3; }
.dia .c14-dot { fill: #ffffff; stroke: #15231d; stroke-width: 2; }
.dia .c14-hit { fill: transparent; cursor: ew-resize; }
.dia .c14-axis2 { stroke: #34423c; stroke-width: 1.4; }
.dia .c14-rev line { stroke: #8b968f; stroke-width: 1.4; stroke-dasharray: 3 2; }
.dia .c14-rev .arrow-head { fill: #8b968f; }
.dia .c14-site { fill: #0f6a6a; stroke: #fbfbf6; stroke-width: 1.5; }
.dia .c14-site-old { fill: #fbfbf6; stroke: #0f6a6a; stroke-width: 1.8; }
.mod-years { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mod-y[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mod-y.is-seen:not([aria-pressed="true"]) { border-color: var(--y-stripe); }
.mod-grid { display: grid; grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); gap: 1rem 1.4rem; align-items: start; max-width: 50rem; margin-top: 0.7rem; }
.mod-text p { margin: 0 0 0.5rem; }
.mod-year { font-size: 1.444rem; font-weight: 800; color: var(--y-deep); }
.mod-nos { border-left: 3px solid var(--y-stripe); padding-left: 0.6rem; }
.mod-nos .label { display: block; }
.nb-list { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.35rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 40rem; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.944rem; }
.data-table caption { text-align: left; font-weight: 700; font-size: 0.889rem; color: var(--ink-2); padding-bottom: 0.35rem; }
.data-table th, .data-table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); }
.data-table thead th { font-size: 0.833rem; color: var(--ink-3); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .d-small { font-size: 12.5px; }
  .d-lab { font-size: 14px; }
  .box-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bld-grid, .bld-lower, .chain-grid, .half-grid, .mod-grid { grid-template-columns: minmax(0, 1fr); }
  .bld-art, .half-art, .mod-art { max-width: 22rem; }
  .bld-pz, .src-inf-grid { grid-template-columns: minmax(0, 1fr); }
  .chain-nuc { max-width: 14rem; }
  .foil-tab { display: block; }
}
/* the tube's record of the spot for each cathode metal */
.tube-rec-wrap { max-width: 30rem; margin-top: 0.4rem; }
.tube-rec tr.is-now th, .tube-rec tr.is-now td { font-weight: 700; }
.tube-rec tr.is-now th { box-shadow: inset 3px 0 0 var(--viz-s1); }
.dia .tube-metal { font-weight: 700; }
