/* The test runner. Same type as the study screens with the colour switched off: ink, paper and
   greys. Submit is the only solid button. On a phone the passage sits above the questions and
   each half scrolls on its own. */

.exam {
  --pick: var(--ink); --pick-ink: var(--on-fill);
  background: var(--exam-bg);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden;
}
.exam :focus-visible { outline-color: var(--ink); }
/* Our own plain look (runner-start.js, STORY-03.13), on CELPIP and IELTS General Writing in exam mode
   (exams.js `plainLook`): the exam screen (.exam--plain), and the dialog and message the page draws outside
   it (body.exam-plain). An ordinary system typeface for every line, and only the ink and exam greys of
   tokens.css (light on ink is the exam paper colour, not a white of its own; an outline, not a shadow);
   no test owner's colours, logos, artwork or type. */
.exam--plain, body.running.exam-plain .dialog, body.running.exam-plain #toast {
  --display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --text: var(--display); --pick-ink: var(--exam-bg);
  font-family: var(--text);
}
.exam--plain h1, .exam--plain h2, .exam--plain h3, body.running.exam-plain .dialog h2 { letter-spacing: 0; }
.exam--plain .btn--exam:not(.btn--exam-plain), body.running.exam-plain .dialog .btn:not(.btn--plain) { --on: var(--exam-bg); }
.exam--plain .exam-timer__t.critical { color: var(--exam-bg); }
body.running.exam-plain .dialog { box-shadow: 0 0 0 1px var(--exam-line); }
body.running.exam-plain #toast { color: var(--exam-bg); box-shadow: none; }
/* A writing task's level badge (the batch 5+6 walk, m1): its "i" bubble in the exam greys too. */
.exam--plain .exam-bar .lvl-tip { color: var(--exam-bg); }

/* ---------- Top bar (STORY-04.13) ----------
   One slim row: no control sets its height. A control in the bar keeps a 44 px tap area and shows a compact
   32 px face (the owner's UX principle 4). The title stays on one line, ending in "…" when it is too long (a
   screen reader reads it whole); "[skill] · [where]" under it in small type; the "Sample" tag beside it. */
.exam-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--s5);
  min-height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--s5) 0; border-bottom: 1px solid var(--exam-line); background: var(--exam-bg);
}
.exam-bar__id { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.exam-bar__titles { min-width: 0; flex: 0 1 auto; }
.exam-exit {
  display: grid; place-items: center; width: 44px; height: 44px; margin-inline-start: -10px; flex: none;
  border: 0; border-radius: 12px; background: none; color: var(--ink-2);
}
@media (hover: hover) and (pointer: fine) { .exam-exit:hover { background: var(--exam-fill); color: var(--ink); } }
.exam-bar__head { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.exam-bar__section, .exam-bar__where { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-bar__section { font-family: var(--display); font-weight: 700; font-size: var(--fs-l); line-height: 1.25; }
.exam-bar__where { font-size: var(--fs-s); color: var(--ink-2); line-height: 1.3; font-variant-numeric: tabular-nums; }
.exam-bar__tag { flex: none; display: flex; }
.exam-bar__tag:empty, .exam-bar__part:empty, .exam-bar__skill:empty, .exam-bar__skill:empty + .exam-bar__sep, .exam-bar__sep:has(+ .exam-bar__part:empty) { display: none; }
.exam-bar__tag .pill { min-height: 0; padding: 1px var(--s2); font-size: var(--fs-xs); background: none; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-2); }
.exam-bar .btn--exam {
  position: relative; isolation: isolate; min-height: 44px; padding: 0 var(--s3);
  background: none; box-shadow: none; font-size: var(--fs-s); font-weight: 700; white-space: nowrap;
}
.exam-bar .btn--exam::before { content: ""; position: absolute; inset: 6px 0; z-index: -1; border-radius: var(--r-s); background: var(--face); }
.exam-bar .btn--exam-plain::before { box-shadow: inset 0 0 0 1px var(--line-strong); }
/* The part's level badge in the line (STORY-04.36, the approved mock-up's choice 3 A): "Part 3 of 6 · about CLB 7", then the
   question range. The button is 44 px tall but takes no more height in the line than the text (negative margins), so the
   bar keeps its height; the dashed outline is drawn 20 px high inside it. The line clips sideways only, so the button's
   tap area is not cut; its bubble opens under the bar. The line's own text keeps the range (hidden here). */
.exam-bar:has(.exam-bar__lvl:not(:empty)) { position: relative; z-index: 4; }
.exam-bar__where:has(.exam-bar__lvl:not(:empty)) { overflow-x: clip; overflow-y: visible; }
.exam-bar__part:has(+ .exam-bar__lvl:not(:empty)) .exam-bar__src { display: none; }
/* With no badge, on a phone, the range goes when the line would be cut (skill-pill.js barFit; the batch 5+6 walk, m2). */
.exam-bar__where--tight .exam-bar__src { display: none; }
.exam-bar__where .spill--level { height: 44px; min-height: 0; margin-block: -14px; padding: 0 2px; border: 0; vertical-align: middle; font-size: var(--fs-xs); line-height: 1; color: var(--ink-2); }
.exam-bar__where .spill--level::after { content: none; }
.exam-bar__where .lvl-face { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.exam-bar__where .spill--level[aria-expanded="true"] .lvl-face { border-style: solid; border-color: var(--teal); }
.exam-bar__where .spill--level .i { width: 12px; height: 12px; }
.exam-bar__where .spill--level .lvl-i { color: var(--ink); }
.exam-bar__where .tip-wrap { display: inline; position: static; }
.exam-bar__lvl.lvl-tight .lvl-glyph, .exam-bar__lvl.lvl-tighter .lvl-i { display: none; }
.exam-bar__lvl.lvl-tightest .lvl-face { padding: 0 2px; }
.exam-bar__lvl.lvl-tightest .tip-wrap { margin-left: 0; }
.exam-bar .lvl-tip { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: var(--s4); right: auto; width: min(340px, calc(100vw - 32px)); flex-basis: auto; color: var(--surface); font-size: var(--fs-s); }
/* The part markers open from "Parts" as a menu (a popover over the page), so they never squeeze the title: the 11
   parts of TEF Canada's listening once made the bar 731 px tall. Each marker reads "Part n of m" and its title. */
.exam-parts { flex: none; gap: var(--s1); }
.exam-bar__id:not(:has(.parts > li)) .exam-parts { display: none; }
.parts { position: fixed; inset: auto; margin: 0; padding: var(--s2); border: 0; border-radius: var(--r-s); min-width: 260px; max-width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 96px); overflow-y: auto; background: var(--exam-bg); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong), 0 8px 24px var(--shade-18); }
.parts li { list-style: none; }
.parts button {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: var(--s3); width: 100%; min-height: 44px;
  padding: var(--s1) var(--s3); border: 0; border-radius: var(--r-s); background: none; color: var(--ink); text-align: start; font-size: var(--fs-s);
}
.parts button::before { content: ""; height: 6px; border-radius: 3px; background: var(--exam-line); }
.parts button::after { content: attr(aria-label) " · " attr(title); }
.parts .is-done::before { background: var(--line-strong); }
.parts .is-now { background: var(--exam-pane); font-weight: 700; }
.parts .is-now::before { background: var(--ink); }
/* Each part's plain level badge at the right of its row, under a head that says they are estimates (STORY-04.36, choice 4 A). */
.parts:has(.parts__lvl) { max-width: min(540px, calc(100vw - 32px)); }
.parts button:has(.parts__lvl) { grid-template-columns: 28px minmax(0, 1fr) auto; }
.parts button:has(.parts__lvl)::before { grid-column: 1; grid-row: 1; }
.parts button:has(.parts__lvl)::after { grid-column: 2; grid-row: 1; }
.parts .parts__lvl { grid-column: 3; grid-row: 1; padding-left: var(--s2); }
.parts .parts__lvl .spill--level { min-height: 22px; font-size: var(--fs-xs); font-weight: 600; }
.parts__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s1) var(--s3) var(--s2); font-size: var(--fs-s); color: var(--ink-2); }
.parts__head b { color: var(--ink); }
.parts__est { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .parts button:hover { background: var(--exam-fill); } }
/* A browser without popovers keeps the markers in the bar, as before. */
@supports not selector(:popover-open) {
  .exam-parts { display: none; }
  .parts { position: static; display: flex; gap: 4px; padding: 0; min-width: 0; box-shadow: none; background: none; }
  .parts button { width: 44px; height: 44px; padding: 0; grid-template-columns: 1fr; }
  .parts button::after { content: none; }
}
.exam-timer { grid-column: 2; display: flex; align-items: center; gap: var(--s2); color: var(--ink); }
.exam-timer .i { color: var(--ink-2); }
.exam-timer__t {
  font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; padding: 3px 0; border-radius: 6px;
}
.exam-timer__t.low { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.exam-timer__t.critical { background: var(--ink); color: var(--on-fill); padding: 3px 8px; text-decoration: none; }
.exam-timer__l { font-size: var(--fs-s); color: var(--ink-2); }
.exam-bar__end { grid-column: 3; display: flex; justify-content: end; align-items: center; gap: var(--s4); min-width: 0; }
.exam-bar__count { font-size: var(--fs-s); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-bar__count:empty { display: none; }
.exam-bar__actions { display: flex; gap: var(--s2); }
/* The frame's bar on a laptop (STORY-04.43, the journey style of prototype version 10): ×, the skill's icon, the title
   "[Skill] · [set name]" with the line saying what kind of run it is, the Part menu naming the part on screen, then at the
   right the count, the clock and Submit. A phone keeps the bar of STORY-04.13: no icon, no mode line, the clock in the middle. */
.exam-bar__icon, .exam-bar__mode, .exam-bar__msep { display: none; }
@media (min-width: 861px) {
  .exam-bar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .exam-bar__icon { display: grid; place-items: center; flex: none; color: var(--ink); }
  .exam-bar__mode, .exam-bar__msep { display: inline; }
  .exam-bar__mode:empty, .exam-bar__mode:empty + .exam-bar__msep, .exam-bar__msep:has(~ .exam-bar__part:empty) { display: none; }
  .exam-bar__where > .exam-bar__skill, .exam-bar__where > .exam-bar__skill + .exam-bar__sep { display: none; }
  /* With a Part menu, the menu names the part and the questions card its range: the line keeps the mode and the level badge. */
  .exam-bar__id:has(.parts > li) :is(.exam-bar__where > .exam-bar__part, .exam-bar__msep, .exam-bar__qs) { display: none; }
  .exam-bar__id:has(.parts > li) .exam-bar__titles { padding-inline-end: var(--s4); border-inline-end: 1px solid var(--exam-line); }
  /* The button names the part's place in full ("Part 1 of 6 · Section 1 of 3", STORY-04.55 N8): never cut. */
  .exam-parts { flex: none; }
  .exam-parts__now { white-space: nowrap; }
}
/* Full screen (run-writing.js): the bar keeps Close, the clock and "Exit full screen". */
.exam--full .exam-bar__titles, .exam--full .exam-parts, .exam--full .exam-bar__count { display: none; }

/* ---------- The box (STORY-04.13; the owner's UX principles 5 and 7) ----------
   A reusable card for a task, a passage, a question pane or an answer box, raised above the pane colour. Its own
   controls sit on it: `.box-tool`, its size button in the top-right corner, whose face follows the box's size
   (data-glyph="max": make it bigger, "restore": back to the shared layout); `.box-grip`, a resize handle in the
   bottom-right corner; `.box-label`, a slim label along its bottom edge (the word count). The faces are drawn here,
   so any screen can use them. */
.box-card {
  position: relative; min-width: 0; min-height: 0; border-radius: var(--r-m); background: var(--exam-bg);
  box-shadow: 0 0 0 1px var(--exam-line), 0 2px 4px var(--shade-06), 0 6px 16px var(--shade-08);
}
.box-tool, .box-grip { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-s); background: none; color: var(--ink-2); }
.box-tool { position: absolute; top: 0; inset-inline-end: 0; z-index: 2; }
.box-tool::before, .box-grip::before { content: ""; width: 16px; height: 16px; }
.box-tool[data-glyph="max"]::before {
  background:
    linear-gradient(currentColor 0 0) left top / 6px 2px, linear-gradient(currentColor 0 0) left top / 2px 6px,
    linear-gradient(currentColor 0 0) right top / 6px 2px, linear-gradient(currentColor 0 0) right top / 2px 6px,
    linear-gradient(currentColor 0 0) left bottom / 6px 2px, linear-gradient(currentColor 0 0) left bottom / 2px 6px,
    linear-gradient(currentColor 0 0) right bottom / 6px 2px, linear-gradient(currentColor 0 0) right bottom / 2px 6px;
  background-repeat: no-repeat;
}
.box-tool[data-glyph="restore"]::before {
  background:
    linear-gradient(currentColor 0 0) 0 4px / 6px 2px, linear-gradient(currentColor 0 0) 4px 0 / 2px 6px,
    linear-gradient(currentColor 0 0) 100% 4px / 6px 2px, linear-gradient(currentColor 0 0) calc(100% - 4px) 0 / 2px 6px,
    linear-gradient(currentColor 0 0) 0 calc(100% - 4px) / 6px 2px, linear-gradient(currentColor 0 0) 4px 100% / 2px 6px,
    linear-gradient(currentColor 0 0) 100% calc(100% - 4px) / 6px 2px, linear-gradient(currentColor 0 0) calc(100% - 4px) 100% / 2px 6px;
  background-repeat: no-repeat;
}
.box-grip { flex: none; margin: -8px calc(-1 * var(--s1)) -8px auto; cursor: ns-resize; touch-action: none; }
.box-grip::before { width: 14px; height: 14px; background: linear-gradient(135deg, transparent 0 46%, currentColor 46% 56%, transparent 56% 70%, currentColor 70% 80%, transparent 80%); }
@media (hover: hover) and (pointer: fine) { .box-tool:hover, .box-grip:hover { color: var(--ink); background: var(--exam-fill); } }
.box-label { display: flex; align-items: center; gap: var(--s2); min-height: 28px; padding: 0 var(--s1) 0 var(--s4); border-top: 1px solid var(--exam-line); font-size: var(--fs-xs); color: var(--ink-2); }

/* ---------- Working area ---------- */
.exam-main { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.exam-main > * { min-height: 0; min-width: 0; }
.speak { display: grid; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.exam-body { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); gap: var(--s4); padding: var(--s4); min-height: 0; background: var(--exam-pane); }
.exam-body.is-single { grid-template-columns: minmax(0, 1fr); }
.exam-body--writing { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Each pane is the positioning parent of the hidden legends and inputs inside it, so they stay
   inside the pane instead of stretching the page behind it. */
.passage, .questions { position: relative; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.passage:focus-visible, .questions:focus-visible { outline-offset: -3px; border-radius: 0; }
.passage { padding: var(--s6) var(--s6) var(--s7); }
/* The panes have the box's raised look (STORY-04.13); the reading list that pulls up over its text keeps its own
   layout (run-reading.js; STORY-04.22's drawer). */
.exam-body > .passage, .exam-body > .questions { border-radius: var(--r-m); background: var(--exam-bg); box-shadow: 0 0 0 1px var(--exam-line), 0 2px 4px var(--shade-06), 0 6px 16px var(--shade-08); }
.exam-main > .exam-body.pu-body { padding: 0; background: var(--exam-bg); }
.exam-body.pu-body > .passage { border-radius: 0; box-shadow: none; }
/* Our plain look has outlines, not shadows (only the exam greys of tokens.css). */
.exam--plain .box-card, .exam--plain .exam-body > .passage, .exam--plain .exam-body > .questions, .exam--plain .parts { box-shadow: 0 0 0 1px var(--exam-line); }
.exam--plain .questions--essay:has(.essay:focus-visible) { box-shadow: 0 0 0 2px var(--ink); }
.passage__in { max-width: 66ch; margin-inline: auto; }
.passage__in > * + * { margin-top: var(--s5); }
.passage__kicker { font-size: var(--fs-s); color: var(--ink-2); max-width: 60ch; }
.passage__in > h1, .questions__head h1 { font-size: 2rem; margin-top: var(--s1); letter-spacing: -0.015em; }
.passage__body { font-size: var(--fs-xl); line-height: 1.75; }
.passage__body > * + * { margin-top: var(--s5); }
.passage__body p + p { margin-top: var(--s4); }
.passage__note { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-m); color: var(--ink-2); }
.transcripts:empty { display: none; }
.transcripts > * + * { margin-top: var(--s3); }

.questions { background: var(--exam-bg); padding: var(--s6) var(--s6) var(--s7); }
.questions__in { max-width: 600px; margin-inline: auto; display: grid; gap: var(--s6); }
.is-single .questions__in { max-width: 720px; }
.questions__head { padding-bottom: var(--s5); border-bottom: 1px solid var(--exam-line); }
.q-wrap + .q-wrap { padding-top: var(--s6); border-top: 1px solid var(--exam-line); }
.q-check { margin-top: var(--s4); padding-inline-start: 44px; }
.q--block + .q-check { padding-inline-start: 0; }
.exam details.helper { background: var(--exam-pane); box-shadow: inset 0 0 0 1px var(--exam-line); }
.exam .questions details.helper { background: var(--exam-pane); }

/* ---------- Question palette ---------- */
.palette {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s5);
  min-height: 68px; padding: var(--s2) var(--s5) calc(var(--s2) + env(safe-area-inset-bottom)); border-top: 1px solid var(--exam-line); background: var(--exam-bg);
}
.palette__mid { display: flex; align-items: center; justify-content: center; gap: var(--s6); min-width: 0; }
/* The strip's padding is room for the ring and the right/wrong mark; the negative margin keeps the
   boxes and the bar's height where they were. */
.palette__mid nav { min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px; margin: -2px; }
/* As wide as its boxes, so the strip's padding keeps the last box's ring in view when scrolled. */
.pal { display: flex; gap: var(--s2); width: max-content; }
.pal button {
  position: relative; display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 var(--s2);
  border: 0; border-radius: var(--r-s);
  box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--exam-bg);
  font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Answered: solid, with a tick under the number. Current: a 2px ring outside the box, worn over
   either look, so "current" and "answered" show at once. */
.pal .is-answered { padding-bottom: 12px; background: var(--pick); color: var(--pick-ink); box-shadow: none; }
.pal__tick { position: absolute; inset-inline: 0; bottom: 5px; width: 14px; height: 14px; margin-inline: auto; stroke-width: 3.5; }
.pal .is-current { box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 2px var(--exam-bg), 0 0 0 4px var(--ink); }
.pal .is-answered.is-current { box-shadow: 0 0 0 2px var(--exam-bg), 0 0 0 4px var(--ink); }
/* Keyboard focus: a dashed ring inside the box, so it differs from the solid "current" ring
   outside it by shape, and never reaches the next box. */
.pal button:focus-visible { outline: 2px dashed currentColor; outline-offset: -5px; }
.pal__mark { position: absolute; top: -5px; inset-inline-end: -5px; width: 18px; height: 18px; padding: 3px; border-radius: 50%; stroke-width: 3; }
.pal .is-right, .pal .is-wrong { padding-bottom: 0; }
.pal .is-right .pal__mark { background: var(--teal); color: var(--on-fill); }
.pal .is-wrong .pal__mark { background: var(--coral-deep); color: var(--on-fill); }

/* ---------- Cards inside the exam screen: section intro, microphone check ---------- */
.exam-center { overflow-y: auto; padding: var(--s7) var(--s5) var(--s8); background: var(--exam-pane); }
.exam-card {
  max-width: 640px; margin-inline: auto; padding: var(--s6);
  background: var(--exam-bg); border: 1px solid var(--exam-line); border-radius: var(--r-m);
}
.exam-card > * + * { margin-top: var(--s4); }
.exam-card h2 { font-size: 1.75rem; }
.exam-card__icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-m);
  background: var(--exam-fill); color: var(--ink);
}
.exam-card__text { color: var(--ink-2); }
.exam-card__h { font-size: var(--fs-base); }
.exam-card__actions { display: flex; flex-wrap: wrap; gap: var(--s3); padding-top: var(--s3); }
.facts { display: grid; gap: var(--s2); }
.facts li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: var(--s3); align-items: start; }
.facts .i { margin-top: 4px; color: var(--ink-2); }
.mic-check { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-s); background: var(--exam-pane); justify-items: start; }

/* ---------- Writing (STORY-04.13) ----------
   The task and the answer are two box cards. `.is-full`: the answer has the screen and the task is one line;
   `.is-task`: the whole task, with the answer folded to its word count. */
.exam-tabs { display: flex; gap: var(--s1); margin: calc(-1 * var(--s2)) 0 var(--s2); border-bottom: 1px solid var(--exam-line); overflow-x: auto; scrollbar-width: none; }
.exam-tab {
  display: grid; justify-items: start; gap: 0; min-height: 44px; padding: var(--s1) var(--s3) var(--s1);
  border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink-2);
  font-weight: 700; font-size: var(--fs-s); white-space: nowrap; text-align: start;
}
.exam-tab small { font-weight: 400; font-size: var(--fs-xs); }
.exam-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.task-card { display: flex; flex-direction: column; overflow: hidden; }
.task-card > .passage { flex: 1 1 auto; padding-top: var(--s5); }
.task-card .passage__in > :first-child { margin-inline-end: var(--s7); }
.task-next { justify-self: start; }
.task-summary { display: none; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s8) 0 var(--s4); border: 0; background: none; color: var(--ink); text-align: start; font-size: var(--fs-s); }
.task-summary > span:first-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-summary__open { display: inline-flex; align-items: center; gap: var(--s1); font-weight: 700; white-space: nowrap; }
.exam-body > .questions--essay { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.questions--essay > .passage__note, .questions--essay > .accents { margin: var(--s3) var(--s7) 0 var(--s4); }
.questions--essay:has(.essay:focus-visible) { box-shadow: 0 0 0 2px var(--ink), 0 2px 4px var(--shade-06), 0 6px 16px var(--shade-10); }
.essay {
  flex: 1 1 auto; height: 100%; min-height: 0; padding: var(--s4) var(--s7) var(--s2) var(--s4); resize: none;
  border: 0; background: none; box-shadow: none; border-radius: var(--r-m) var(--r-m) 0 0;
  font-size: var(--fs-xl); line-height: 1.75;
}
.essay:focus-visible { outline: none; }
.essay-foot { flex: none; }
.essay-foot .box-grip { display: none; }
.exam-body--writing.is-full, .exam-body--writing.is-task { grid-template-columns: minmax(0, 1fr); }
.exam-body--writing.is-full { grid-template-rows: auto minmax(0, 1fr); }
.exam-body--writing.is-task { grid-template-rows: minmax(0, 1fr) auto; }
.is-full > .task-card > .passage { display: none; }
.is-full > .task-card > .task-summary { display: flex; }
.is-task > .questions--essay > :not(.essay-foot):not(.box-tool) { display: none; }
.is-task > .questions--essay .essay-foot { min-height: 44px; border-top: 0; padding-inline-end: var(--s8); }
.is-full .essay-foot .box-grip, .is-task .essay-foot .box-grip { display: none; }
.wordcount { display: inline-flex; align-items: center; gap: var(--s1); min-width: 0; font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordcount.is-good { color: var(--ink); font-weight: 700; }
.wordcount.is-long { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.accents { display: flex; flex: none; flex-wrap: wrap; gap: var(--s1); } /* a flex item of the answer card: it never shrinks below its keys */
.accent {
  min-width: 36px; height: 36px; padding: 0 var(--s2); border: 0; border-radius: 8px;
  background: var(--exam-bg); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: var(--fs-l);
}
.task-prompt { font-size: var(--fs-xl); line-height: 1.7; }
.task-prompt p + p { margin-top: var(--s3); }

/* ---------- Speaking: player.css (STORY-04.20) ---------- */

/* ================= Responsive ================= */
@media (max-width: 1180px) {
  .exam-bar__count { display: none; }
}

@media (max-width: 860px) {
  /* At most 48 px tall (STORY-04.13): one row, its controls 44 px. */
  .exam-bar { grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s3); padding: env(safe-area-inset-top) var(--s2) 0 var(--s1); min-height: calc(48px + env(safe-area-inset-top)); }
  .exam-exit { margin-inline: 0 calc(-1 * var(--s2)); }
  .exam-bar__id { gap: var(--s2); }
  .exam-parts, .exam-timer__l, .exam-timer .i { display: none; }
  .exam-bar__section { font-size: var(--fs-m); }
  .exam-bar__where { font-size: var(--fs-xs); }
  /* With a part's badge the phone's line is "Part 3 of 6 · about CLB 7": the title names the skill, and the range would be cut. */
  .exam-bar__where:has(.exam-bar__lvl:not(:empty)) :is(.exam-bar__skill, .exam-bar__skill + .exam-bar__sep, .exam-bar__qs) { display: none; }
  /* The badge's outline parts it from "Part 3 of 6" (the mock-up): the dot is read, not shown. */
  .exam-bar__lvl > .exam-bar__sep { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .exam-bar__lvl .tip-wrap { margin-left: 2px; }
  .exam-bar__where .lvl-face { gap: 3px; padding: 0 4px; }
  .exam-bar .lvl-tip { top: calc(52px + env(safe-area-inset-top)); left: var(--s2); width: calc(100vw - 2 * var(--s2)); }
  .exam-timer__t { font-size: 1.125rem; padding: 2px 0; }
  /* An untimed practice set keeps the clock's words on a phone, under the time (run-steps.js). The
     bar's columns sit closer, so the words take no room from the title. */
  .exam-bar--labelled { column-gap: var(--s2); }
  .exam-timer--labelled { flex-direction: column; gap: 0; }
  .exam-timer--labelled .exam-timer__l { display: block; font-size: var(--fs-xs); line-height: 1.2; white-space: nowrap; }
  .btn--exam { padding: 0 var(--s4); }
  .exam-bar__actions .btn--exam { padding: 0 var(--s3); }

  .exam-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 46fr) minmax(0, 54fr); gap: var(--s2); padding: var(--s2); }
  .exam-body.is-single { grid-template-rows: minmax(0, 1fr); }
  /* A recording's card (STORY-04.20, choice 3) is as tall as its words and the player, up to the same 46%; the questions
     take the rest. A part with a text to read (.has-text) keeps its split. */
  .exam-body:not(.is-single):not(.has-text):not(.exam-body--speaking):has(> .passage .block-audio) { grid-template-rows: fit-content(46%) minmax(0, 1fr); }
  /* Writing on a phone: the task takes what the box leaves (at least 60 px, run-writing.js TASK_LEAST); the box
     starts at 4 lines and grows with the text (run-writing.js fit), its handle in the corner. */
  .exam-body--writing { grid-template-rows: minmax(60px, 1fr) auto; }
  .essay-foot .box-grip { display: grid; }
  .passage { padding: var(--s4) var(--s4) var(--s6); }
  .passage__in > h1, .questions__head h1 { font-size: 1.5rem; }
  .passage__in > * + * { margin-top: var(--s4); }
  .passage__body, .task-prompt { font-size: var(--fs-l); line-height: 1.7; }
  .questions { padding: var(--s5) var(--s4) var(--s6); }
  .questions__in { gap: var(--s5); }
  .q-wrap + .q-wrap { padding-top: var(--s5); }
  .q-check { padding-inline-start: 0; }

  .palette { gap: var(--s2); padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom)); min-height: 60px; }
  /* Hidden from sight only, so a screen reader still says "Previous part" and "Next part". */
  .palette:not(.palette--steps) > .btn span:not(.sr) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .palette > .btn { padding: 0; width: 44px; }
  .palette > .btn:not(:has(.i)) { width: auto; padding: 0 var(--s3); }
  .palette__mid { justify-content: start; }
  .pal { gap: 6px; }
  .pal button { min-width: 44px; }
  .accent { min-width: 44px; height: 44px; }

  .exam-center { padding: var(--s5) var(--s4) var(--s7); }
  .exam-card { padding: var(--s5) var(--s4); }
  .exam-card h2 { font-size: 1.5rem; }
  .exam-card__actions .btn { flex: 1 1 100%; white-space: normal; min-height: 48px; }
  .task-card > .passage { padding-top: var(--s3); }
  .essay { padding: var(--s3) var(--s7) var(--s2) var(--s4); font-size: var(--fs-l); }
  .accents { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}

/* ---------- The laptop split beyond the runners (STORY-04.43; SN Test screens, DECIDED) ----------
   Review's "Try again" (run-one.js) and Today's five (run-five.js): from 861 px a question with a passage or a recording
   is two cards, the text on the left and the question on the right, each scrolling on its own; one column under it. */
.one__side { display: grid; gap: var(--s4); min-width: 0; align-content: start; }
.five-frame > .five { max-width: 760px; margin-inline: auto; }
@media (min-width: 861px) {
  .one-run .exam-main:has(.one__text), .five-frame:has(> .five[data-split]) { display: grid; overflow: hidden; padding: var(--s4); background: var(--exam-pane); }
  .one-run .exam-main > .one__card:has(> .one__text), .five-frame > .five[data-split] {
    width: 100%; max-width: none; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
    display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--s4);
  }
  .five-frame > .five[data-split] > * + * { margin-top: 0; }
  .one__card:has(> .one__text) > .one__lede, .five[data-split] > .five__top { grid-column: 1 / -1; }
  .one__card > .one__text, .one__card:has(> .one__text) > .one__side, .five[data-split] > .five__text, .five[data-split] > .five__side {
    min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s5); border-radius: var(--r-m); background: var(--exam-bg);
    box-shadow: 0 0 0 1px var(--exam-line), 0 2px 4px var(--shade-06), 0 6px 16px var(--shade-08);
  }
}

/* ---------- Try it in the frame (run-try.js; step-try.js draws the prompt and the answer area as two halves) ----------
   One column on a phone and outside the frame; from 861 px in the frame the prompt on the left, the answer on the right. */
.tr-prompt, .tr-answer { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); min-width: 0; align-content: start; }
.tr-prompt > .lp-blocks > :first-child { margin-top: 0; }
.try-frame { padding-bottom: 0; }
.try-frame .lp { margin-inline: auto; padding-bottom: var(--s4); }
.try-frame .lp-nav { bottom: 0; background: var(--exam-pane); }
@media (min-width: 861px) {
  .try-frame .lp { max-width: 1200px; }
  .try-frame .tr-try { grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); align-items: start; gap: var(--s5); }
  .try-frame .tr-try > .tr-prompt { position: sticky; top: 0; max-height: calc(100dvh - 120px); overflow-y: auto; }
  .try-frame .tr-try > .tr-prompt, .try-frame .tr-try > .tr-answer {
    padding: var(--s5); border-radius: var(--r-m); background: var(--exam-bg);
    box-shadow: 0 0 0 1px var(--exam-line), 0 2px 4px var(--shade-06), 0 6px 16px var(--shade-08);
  }
}

/* ---------- A result in the frame (STORY-04.47) ----------
   A finished test's result, and a result opened again, in the same full-screen frame as the test (SN Inside the journey,
   DECIDED, item 19): the bar (×, the skill's icon, "[Skill] · [Set] · Result" as the page's heading, the line under it and
   the result's menu), the result scrolling in the middle, and a foot with the result in one line and its actions. The app's
   side bar and bottom bar step aside, as in a test (shell.css body.running), but the page is not a running test. */
body.framed .topbar, body.framed .appfoot, body.framed .help-fab, body.framed .tabbar, body.framed .topscrim { display: none; }
body.framed .main { padding: 0; }
body.framed.save-failed .save-notice { padding: var(--s2) var(--s4); }
/* The page itself scrolls (the bar and the foot stay in view), so a result reads and prints as the page it was. What is
   scrolled to (a focused control, a part picked from the menu) stops clear of the bar and the foot, never under them. */
html:has(body.framed) { scroll-padding-top: 72px; scroll-padding-bottom: 96px; }
.exam.rf { display: flex; flex-direction: column; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; background: var(--exam-pane); }
.rf-bar { position: sticky; top: 0; z-index: 5; }
.rf-title { margin: 0; letter-spacing: 0; }
.rf-main { display: block; flex: 1 0 auto; padding: var(--s5) var(--s5) var(--s7); background: var(--exam-pane); }
.rf-main:focus { outline: none; }
.rf-col { display: flex; flex-direction: column; gap: var(--s4); }
.rf-col > * { margin-block: 0; }
.rf-prize { display: flex; justify-content: flex-end; }
.rf-prize:empty { display: none; }
.rf-parts button::before { content: none; }
.rf-parts button::after { content: none; }
.rf-parts button { grid-template-columns: minmax(0, 1fr); }
.rf-foot {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s5) calc(var(--s3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--exam-line); background: var(--exam-bg);
}
.rf-foot__line { display: grid; min-width: 0; line-height: 1.3; }
.rf-foot__line b { font-family: var(--display); font-size: var(--fs-m); }
.rf-foot__line span { font-size: var(--fs-s); color: var(--ink-2); }
.rf-foot__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s3); }
.rf-foot .btn { min-height: 44px; }
@media (max-width: 860px) {
  html:has(body.framed) { scroll-padding-bottom: 160px; }
  .rf-main { padding: var(--s4) var(--s4) var(--s6); }
  .rf-foot { flex-direction: column; align-items: stretch; gap: var(--s2); padding: var(--s2) var(--s4) calc(var(--s2) + env(safe-area-inset-bottom)); }
  .rf-foot__actions { flex-wrap: nowrap; }
  .rf-foot__actions .btn { flex: 1 1 0; min-width: 0; padding-inline: var(--s3); font-size: var(--fs-s); white-space: normal; }
}
