/* One-screen models (layouts/model-screen.njk), from 17 October 2026.
   The frame fills the screen under the site header. Shared parts start "ms-";
   each model's own parts use its own prefix in its model.css.
   Rules: plans/SCREEN-MODEL-GUIDE.md. */

.ms {
  /* particle and quantity colours, the same in every model */
  --ms-proton: #1b5fa8;      /* positive: blue, as on the rest of the site */
  --ms-electron: #b3261e;    /* negative: red */
  --ms-neutron: #8a99a8;
  --ms-charge: #7b3fa0;      /* charges written in a symbol: purple */
  --ms-readout: #16232f;
  --ms-soft: #e8eef3;        /* empty boxes, button backs */
  box-sizing: border-box;
  height: calc(100vh - var(--ms-head, 64px));
  height: calc(100dvh - var(--ms-head, 64px));
  min-height: 560px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
}
.ms *, .ms *::before, .ms *::after { box-sizing: border-box; }
.ms [hidden] { display: none !important; }
html.embed .ms { height: 100vh; height: 100dvh; }

.ms.high-contrast {
  --surface: #000000; --paper: #000000; --ink: #ffffff; --rule: #ffffff;
  --prussian: #ffeb3b; --malachite: #7CFC9A; --cinnabar: #ff8a80;
  --ms-proton: #ffffff; --ms-electron: #ffeb3b; --ms-neutron: #9aa7b3; --ms-charge: #ffeb3b;
  --ms-readout: #ffffff; --ms-soft: #222222;
  padding: 8px 12px 10px;
}

/* the title bar */
.ms-bar { display: flex; align-items: center; gap: 8px; flex: none; min-height: 48px; }
.ms-title { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.15; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 2px solid var(--rule); background: var(--surface); font: 700 1rem var(--body); color: var(--prussian); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.ms .progress-badge:not([hidden]) { flex: none; font-weight: 700; font-size: 1rem; color: var(--malachite); }

/* one line of instruction, the stage, the modes */
.ms-say { flex: none; margin: 0; text-align: center; font-weight: 700; min-height: 1.5em; }
.ms-stage { flex: 1 1 auto; min-height: 190px; position: relative; background: var(--surface); border: 2px solid var(--rule); border-radius: 16px; overflow: hidden; }
.ms-stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ms-stage svg text { font-family: var(--body); }
.ms-stage svg .ms-disp { font-family: var(--display); }
.ms-modes { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--ms-soft); border-radius: 14px; padding: 4px; }
.ms .ms-modes button { border: 0; border-radius: 11px; padding: 10px 4px; font: 700 1rem var(--body); text-align: center; background: transparent; color: var(--prussian); cursor: pointer; }
.ms .ms-modes button[aria-pressed="true"] { background: var(--prussian); color: #fff; }
.ms .ms-modes button:hover:not([aria-pressed="true"]) { background: var(--surface); }

/* buttons */
.ms-btn { border: 0; border-radius: 12px; min-height: 44px; padding: 0 16px; font: 700 1rem var(--body); background: var(--ink); color: var(--surface); white-space: nowrap; cursor: pointer; }
.ms-btn--quiet { background: var(--surface); color: var(--prussian); border: 2px solid var(--prussian); }
.ms-btn--go { background: var(--prussian); color: #fff; }
.ms-btn:disabled { opacity: 0.4; cursor: default; }

/* exam questions */
.ms-q { flex: none; background: var(--surface); border: 2px solid var(--rule); border-radius: 16px; padding: 10px 14px; line-height: 1.4; font-size: 1.03rem; }
.ms-q p { margin: 0 0 4px; }
.ms-q p:last-child { margin: 0; }
.ms-marks { float: right; font-weight: 700; margin-left: 8px; }
.ms-ans { background: var(--surface); border: 2px solid var(--rule); border-radius: 16px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; }
.ms-ans input { width: 100%; min-width: 0; height: 44px; border: 2px solid var(--ink); border-radius: 10px; padding: 0 8px; font: 700 1.25rem var(--body); text-align: center; background: var(--surface); color: var(--ink); }
.ms-ans input.is-bad { border-color: var(--cinnabar); background: #fdecea; color: #16232f; }
.ms-ans input.is-good { border-color: var(--malachite); background: #e8f5ee; color: #16232f; }
.ms-feedback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ms-feedback:empty { display: none; }
.ms-msg { flex: 1 1 180px; font-weight: 700; }
.ms-msg.is-bad { color: var(--cinnabar); }
.ms-msg.is-good { color: var(--malachite); }

/* a short definition when something in the picture is tapped */
.ms-tip { position: absolute; z-index: 5; max-width: min(320px, 92%); background: var(--ink); color: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 1rem; line-height: 1.4; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }

/* tap to explain: the card that opens in the picture (MS.explain) */
.ms [data-tip], .ms .ms-tap { cursor: pointer; }
.ms-tip.is-def { display: grid; gap: 4px; width: max-content; max-width: min(360px, calc(100% - 12px)); padding: 12px 40px 12px 14px;
  background: var(--surface); color: var(--ink); border: 3px solid var(--def, var(--ink)); border-radius: 14px; font-size: 1.05rem; line-height: 1.3; }
.ms-def-term { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--def, var(--ink)); }
.ms-def-eq { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.ms-def-x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border: 0; background: none; color: var(--ink); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.ms-tip.is-def::after { content: ""; position: absolute; left: calc(var(--ax, 50%) - 10px); width: 16px; height: 16px; background: var(--surface);
  border: 3px solid var(--def, var(--ink)); transform: rotate(45deg); }
.ms-tip.is-def[data-point="up"]::after { top: -11px; border-right: 0; border-bottom: 0; }
.ms-tip.is-def[data-point="down"]::after { bottom: -11px; border-left: 0; border-top: 0; }
.ms-tip.is-def[data-point="none"]::after { display: none; }
@media (max-width: 420px) { .ms-tip.is-def { padding: 10px 34px 10px 12px; } .ms-def-term { font-size: 1.1rem; } .ms-def-eq { font-size: 1.1rem; } }
.ms.high-contrast .ms-tip.is-def { background: #000; color: #fff; border-color: #ffd400; }
.ms.high-contrast .ms-def-term, .ms.high-contrast .ms-def-x { color: #ffd400; }
.ms.high-contrast .ms-tip.is-def::after { background: #000; border-color: #ffd400; }

/* sheets: notes, display options, mark schemes */
.ms-sheet-back { position: fixed; inset: 0; background: rgba(10, 20, 30, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.ms-sheet { background: var(--surface); color: var(--ink); width: min(640px, 100%); border-radius: 18px 18px 0 0; padding: 16px 18px 22px; max-height: 82vh; overflow: auto; line-height: 1.45; }
.ms-sheet h2 { font-family: var(--display); margin: 0 0 10px; font-size: 1.3rem; }
.ms-sheet ul { padding-left: 1.2rem; margin: 0 0 12px; }
.ms-sheet table { border-collapse: collapse; margin: 0 0 12px; width: 100%; }
.ms-sheet th, .ms-sheet td { border: 1px solid var(--rule); padding: 6px 8px; text-align: left; }
.ms-sheet details { margin: 0 0 12px; }
.ms-sheet summary { font-weight: 700; cursor: pointer; }
.ms-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--rule); }
.ms-tick { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; }
.ms-tick.is-yes { background: var(--malachite); }
.ms-tick.is-no { background: var(--cinnabar); }
.ms-opt { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-weight: 700; }
.ms-opt input { width: 22px; height: 22px; }

/* The journey: progress row, Back / Next, and what sits inside the picture.
   Colour roles: ORANGE = do something in the picture (play, fire, build);
   GREEN = move on (Next, lit once the step is done); outline = Back. */
.ms-progress { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.ms .ms-chip { border: 0; background: transparent; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; font: 700 1rem var(--body); color: var(--ink); cursor: pointer; border-radius: 0; }
.ms .ms-chip:hover:not([aria-pressed="true"]) { background: transparent; }
.ms .ms-chip.is-here .ms-chip-name { color: var(--prussian); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.ms-segs { display: flex; gap: 3px; }
.ms-segs i { flex: 1; height: 7px; border-radius: 4px; background: var(--rule); }
.ms-segs i.is-done { background: #8fc7ad; }
.ms-segs i.is-here { background: var(--prussian); }
.ms-nav { flex: none; display: flex; gap: 8px; }
.ms-nav button { min-height: 50px; border-radius: 14px; font: 700 1.1rem var(--body); cursor: pointer; }
.ms-navback { flex: 0 0 auto; padding: 0 18px; background: var(--surface); color: var(--ink); border: 2px solid var(--rule); }
.ms-navback:disabled { opacity: 0.35; cursor: default; }
.ms-navnext { flex: 1; background: var(--surface); color: var(--malachite); border: 2px solid var(--malachite); }
.ms-navnext.is-ready { background: var(--malachite); color: #fff; box-shadow: 0 4px 0 #11573c; animation: ms-nudge 1.4s ease-in-out 2; }
@keyframes ms-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* inside the picture: a caption banner and one big action */
.ms-banner { position: absolute; z-index: 2; top: 10px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); background: var(--surface); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 16px; font: 700 1.2rem/1.3 var(--display); text-align: center; color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); transition: opacity 0.45s; }
.ms-banner.is-off { opacity: 0; pointer-events: none; }
/* the step count on the banner (26 October 2026): tap the banner for the list of outcomes */
.ms-banner[data-step] { cursor: pointer; }
.ms-banner[data-step]::before { content: attr(data-step); display: inline-block; vertical-align: 0.12em; margin-right: 10px; padding: 1px 8px; border-radius: 999px; background: var(--ms-soft, #eef4fa); border: 1.5px solid var(--rule); font: 700 0.85rem/1.4 var(--body); color: var(--ink); }
.ms.high-contrast .ms-banner[data-step]::before { border-color: #ffd400; }
.ms-olist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.ms-olist li { display: flex; gap: 10px; align-items: baseline; }
.ms-olist li > span { flex: none; width: 1.3em; text-align: center; font-weight: 700; }
.ms-olist li button { border: 0; background: none; padding: 4px 0; text-align: left; font: 1rem/1.35 var(--body); color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.ms-olist li.is-done > span { color: #1b7a57; }
.ms-olist li.is-here > span { color: #d9580d; }
.ms-banner.is-mid { top: 38%; }
.ms-banner .ms-big { display: block; font-size: 2rem; line-height: 1.1; }
.ms-play { position: absolute; z-index: 3; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 22px 8px 8px; border: 0; border-radius: 999px; background: #d9580d; color: #fff; font: 700 1.2rem var(--body); white-space: nowrap; box-shadow: 0 6px 18px rgba(217, 88, 13, 0.35); cursor: pointer; }
.ms-play .ms-play-icon { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: #d9580d; display: grid; place-items: center; font-size: 1.1rem; }
.ms-play.is-again { left: auto; right: 10px; top: auto; bottom: 10px; transform: none; padding: 4px 14px 4px 4px; font-size: 1rem; background: var(--surface); color: #d9580d; border: 2px solid #d9580d; box-shadow: none; }
.ms-play.is-again .ms-play-icon { width: 30px; height: 30px; background: #d9580d; color: #fff; }
.ms.high-contrast .ms-play { background: #ffb74d; color: #000; }

/* short screens: let the picture shrink a little further before anything is pushed off */
@media (max-height: 680px) {
  .ms-stage { min-height: 130px; }
  .ms-ans input { height: 40px; }
  .ms-nav button { min-height: 46px; }
}

/* On a one-screen model page the site header keeps to one row on a phone. */
@media (max-width: 600px) {
  .site-header-inner { flex-wrap: nowrap; padding-block: 0.45rem; }
  .site-nav li:not(:first-child) { display: none; }
  .wordmark { font-size: 1.1rem; }
  .ms-title { font-size: 1.2rem; }
  .ms .progress-badge { display: none !important; }
}

/* The ladder of learning outcomes (18 October 2026): shown at the start of each step */
.ms-ladder { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -52%); width: min(360px, calc(100% - 24px)); background: var(--surface); border: 2px solid var(--rule); border-radius: 14px; padding: 10px 14px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.ms-ladder[hidden] { display: none; }
.ms-ladder { pointer-events: none; user-select: none; -webkit-user-select: none; }
.ms-ladder-n { margin: 0 0 6px; font: 700 0.85rem var(--body); color: var(--ink); opacity: 0.7; text-transform: uppercase; letter-spacing: 0.04em; }
.ms-ladder ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.ms-ladder li { display: flex; gap: 8px; align-items: baseline; font-size: 0.95rem; line-height: 1.3; padding: 2px 6px; border-radius: 8px; }
.ms-ladder li span { flex: none; width: 1.2em; text-align: center; font-weight: 700; }
.ms-ladder li.is-done { color: #1b7a57; }
.ms-ladder li.is-here { font-weight: 700; background: var(--ms-soft, #eef4fa); font-size: 1.05rem; }
.ms-ladder li.is-here span { color: #d9580d; }
.ms-ladder li.is-next { opacity: 0.55; }
.ms.high-contrast .ms-ladder { border-color: #ffd400; }
.ms.high-contrast .ms-ladder li.is-done { color: #69f0ae; }
.ms-outcomes { padding-left: 1.3em; }
.ms-outcomes li { margin-bottom: 4px; }

/* Predict first (18 October 2026): a question before the animation */
.ms-predict { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; background: var(--surface); border: 2px solid #d9580d; border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14); }
.ms-predict-h { margin: 0 0 4px; font: 700 0.85rem var(--body); color: #d9580d; text-transform: uppercase; letter-spacing: 0.04em; }
.ms-predict-q { margin: 0 0 10px; font: 700 1.05rem/1.35 var(--body); color: var(--ink); }
.ms-predict-opts { display: grid; gap: 6px; }
.ms-predict-opt { text-align: left; border: 2px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 8px 10px; font: 1rem/1.3 var(--body); cursor: pointer; }
.ms-predict-opt.is-good { border-color: var(--malachite, #1b7a57); background: #e8f5ee; color: #16232f; }
.ms-predict-opt.is-bad { border-color: var(--cinnabar, #b3261e); background: #fdecea; color: #16232f; }
.ms-predict-opt:disabled { cursor: default; }
.ms-predict-w { margin: 10px 0 8px; font-size: 0.98rem; line-height: 1.4; color: var(--ink); }
.ms.high-contrast .ms-predict { border-color: #ffd400; }
.ms.high-contrast .ms-predict-h { color: #ffd400; }
.ms-self { padding-left: 1.3em; }
.ms-self li { margin-bottom: 12px; }
.ms-self li span { display: block; font-size: 0.95rem; margin: 2px 0 4px; }
.ms-self input { width: 20px; height: 20px; vertical-align: -3px; }
/* examiners' report notes (18 October 2026) */
.ms-exnote { margin: 10px 0 6px; padding: 8px 10px; border-left: 4px solid var(--rule); background: var(--surface); font-size: 0.95rem; line-height: 1.4; color: var(--ink); }
.ms.high-contrast .ms-exnote { border-left-color: #ffd400; }

/* MS.ask: the prediction in the bottom strip, part-way through a step (19 October 2026).
   It never covers the drawing: the model shrinks the picture to fit above it. */
.ms-ask { position: absolute; z-index: 4; left: 50%; bottom: 8px; transform: translateX(-50%); width: min(560px, calc(100% - 16px)); max-height: 55%; overflow: auto; box-sizing: border-box; background: var(--surface); border: 2px solid #d9580d; border-radius: 14px; padding: 8px 10px; }
.ms-ask-q { margin: 0 0 6px; text-wrap: balance; font: 700 1rem/1.3 var(--body); color: var(--ink); }
.ms-ask-h { display: inline-block; margin-right: 4px; padding: 1px 8px; border-radius: 999px; background: #d9580d; color: #fff; font-size: 0.78rem; letter-spacing: 0.03em; text-transform: uppercase; vertical-align: 1px; }
.ms-ask-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ms-ask-opt { flex: 1 1 auto; min-height: 40px; min-width: 4.5em; border: 2px solid #d9580d; border-radius: 10px; background: var(--surface); color: var(--ink); padding: 6px 10px; font: 600 0.98rem/1.25 var(--body); cursor: pointer; }
.ms-ask-opt.is-good { border-color: var(--malachite, #1b7a57); background: #e8f5ee; color: #16232f; }
.ms-ask-opt.is-bad { border-color: var(--cinnabar, #b3261e); background: #fdecea; color: #16232f; }
.ms-ask-opt:disabled { cursor: default; }
.ms-ask-skip { flex: 0 0 auto; margin-left: 2px; border: 0; background: none; color: var(--ink); text-decoration: underline; font: 0.92rem var(--body); cursor: pointer; padding: 2px 0; }
.ms-ask-after { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ms-ask-w { flex: 1; margin: 0; font-size: 0.95rem; line-height: 1.35; color: var(--ink); }
.ms-ask-go { flex: none; border: 0; border-radius: 999px; background: #d9580d; color: #fff; font: 700 1rem var(--body); padding: 9px 16px; cursor: pointer; white-space: nowrap; }
.ms.high-contrast .ms-ask { border-color: #ffd400; }
.ms.high-contrast .ms-ask-go, .ms.high-contrast .ms-ask-h { background: #ffb74d; color: #000; }
