/* Answerbox stylesheet, direction "Friendly classroom". Every colour is a
   --ge-* token of section 1; dark mode comes from the device setting through
   the media query there. Every url() with a double-quoted path names a file
   under static/ and is versioned when the app loads its assets. */

/* 0. Fonts */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/AtkinsonHyperlegibleNext-latin.woff2?v=18b2a1a3") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 1. Tokens */

:root {
  color-scheme: light dark;

  --ge-bg: #f4f5ee;
  --ge-surface: #ffffff;
  --ge-sunken: #e9ede3;
  --ge-line: #d6ddd2;
  --ge-edge: #788a80;
  --ge-ink: #17251e;
  --ge-muted: #4b5b52;
  --ge-brand: #17694a;
  --ge-brand-strong: #0f5238;
  --ge-brand-soft: #dcefe2;
  --ge-on-brand: #ffffff;
  --ge-gold: #f4b73c;
  --ge-gold-ink: #7a4f00;
  --ge-gold-soft: #fdeec8;
  --ge-on-gold: #17251e;
  --ge-danger: #b3361f;
  --ge-danger-strong: #8f2a17;
  --ge-danger-soft: #fbe5df;
  --ge-on-danger: #ffffff;
  --ge-closed-bg: #e5e8e2;
  --ge-closed-ink: #3c4740;
  --ge-board: #1d4f3b;
  --ge-chalk: #fbf6e4;
  --ge-chalk-muted: #cfe0d3;
  --ge-chalk-strong: #ffffff;
  --ge-chalk-line: rgb(251 246 228 / 0.25);
  --ge-chalk-wash: rgb(251 246 228 / 0.12);
  --ge-tile-shadow: rgb(0 0 0 / 0.22);
  --ge-focus: #0f5238;
  --ge-band: #17251e;
  --ge-band-ink: #e8eee8;
  --ge-band-muted: #a7b6ad;
  --ge-band-line: #33473c;
  --ge-band-code: #0f1a14;
  --ge-band-link: #8fe0b9;
  --ge-scrim: rgb(0 0 0 / 0.5);
  --ge-shadow: 0 1px 0 rgb(23 37 30 / 0.06), 0 6px 18px -10px rgb(23 37 30 / 0.25);
  --ge-shadow-lift: 0 14px 30px -16px rgb(0 0 0 / 0.55);

  --ge-font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --ge-font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ge-font-student: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ge-font-mono: ui-monospace, "Cascadia Mono", "Roboto Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --ge-text-sm: 0.875rem;
  --ge-text-base: 1rem;
  --ge-text-md: 1.0625rem;
  --ge-text-lg: 1.125rem;
  --ge-text-xl: 1.25rem;
  --ge-text-2xl: 1.5rem;
  --ge-text-3xl: 2.25rem;

  --ge-space-1: 4px;
  --ge-space-2: 8px;
  --ge-space-3: 12px;
  --ge-space-4: 16px;
  --ge-space-5: 24px;
  --ge-space-6: 32px;
  --ge-space-7: 48px;
  --ge-r-sm: 10px;
  --ge-r-md: 14px;
  --ge-r-lg: 20px;
  --ge-r-xl: 24px;
  --ge-r-pill: 999px;
  --ge-touch: 44px;
  --ge-bar: 64px;
  --ge-lang-room: 52px;
  --ge-transition: 120ms ease;

  --ge-i-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
  --ge-i-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M6 13l6 6 6-6'/%3E%3C/svg%3E");
  --ge-i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --ge-i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --ge-i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E");
  --ge-i-person: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
  --ge-i-resume: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 2.4-5.7'/%3E%3Cpath d='M4 4v4.5h4.5'/%3E%3Cpath d='M10.5 9.5v5l4-2.5z'/%3E%3C/svg%3E");
  --ge-i-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5v13l10.5-6.5z'/%3E%3C/svg%3E");
  --ge-i-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3C/svg%3E");
  --ge-i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3'/%3E%3C/svg%3E");
  --ge-i-screen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M12 16v4M8 20h8'/%3E%3C/svg%3E");
  --ge-i-chart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20V11M12 20V5M19 20v-6M3 20h18'/%3E%3C/svg%3E");
  --ge-i-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E");
  --ge-i-history: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7'/%3E%3Cpath d='M3 4v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
  --ge-i-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
  --ge-i-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7 9l5-5 5 5M5 15v5h14v-5'/%3E%3C/svg%3E");
  --ge-i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --ge-i-archive: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='4' rx='1'/%3E%3Cpath d='M5 8v11h14V8M10 12h4'/%3E%3C/svg%3E");
  --ge-i-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  --ge-i-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M4 10h16M9 3v4M15 3v4M9 14.5l2 2 4-4'/%3E%3C/svg%3E");
  --ge-i-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --ge-i-table: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 10h16M4 15h16M10 10v10'/%3E%3C/svg%3E");
  /* languages: the "languages" icon of Lucide (ISC licence), in the stroke of the others. */
  --ge-i-languages: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l6 6M4 14l6-6 2-3M2 5h12M7 2h1M22 22l-5-10-5 10M14 18h6'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --ge-bg: #111a15;
    --ge-surface: #18231d;
    --ge-sunken: #0d140f;
    --ge-line: #2c3a32;
    --ge-edge: #71847a;
    --ge-ink: #e8eee8;
    --ge-muted: #a7b6ad;
    --ge-brand: #62cf9c;
    --ge-brand-strong: #8fe0b9;
    --ge-brand-soft: #1b3b2c;
    --ge-on-brand: #08200f;
    --ge-gold: #f5c24f;
    --ge-gold-ink: #f5c24f;
    --ge-gold-soft: #3a2d0d;
    --ge-on-gold: #241a00;
    --ge-danger: #ff9480;
    --ge-danger-strong: #ffb3a4;
    --ge-danger-soft: #3d1a12;
    --ge-on-danger: #2b0f08;
    --ge-closed-bg: #26302a;
    --ge-closed-ink: #c3cfc7;
    --ge-board: #173a2b;
    --ge-chalk: #fbf6e4;
    --ge-chalk-muted: #b9d0c1;
    --ge-chalk-strong: #ffffff;
    --ge-chalk-line: rgb(251 246 228 / 0.25);
    --ge-chalk-wash: rgb(251 246 228 / 0.12);
    --ge-tile-shadow: rgb(0 0 0 / 0.22);
    --ge-focus: #f5c24f;
    --ge-band: #0a110d;
    --ge-band-ink: #e8eee8;
    --ge-band-muted: #a7b6ad;
    --ge-band-line: #2c3a32;
    --ge-band-code: #141f19;
    --ge-band-link: #8fe0b9;
    --ge-scrim: rgb(0 0 0 / 0.65);
    --ge-shadow: 0 1px 0 rgb(0 0 0 / 0.4);
    --ge-shadow-lift: 0 14px 30px -16px rgb(0 0 0 / 0.7);
  }
}

/* 2. Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ge-bg);
  color: var(--ge-ink);
  font-family: var(--ge-font-ui);
  font-size: var(--ge-text-base);
  line-height: 1.5;
}

/* Student-facing text: the student pages, and question and option text
   wherever a teacher page shows it. */
#landing,
.exam-header,
#exam,
#result,
.question-body,
.option-body,
.section-head,
.accepted-answers,
.typed-text {
  font-family: var(--ge-font-student);
}

h1,
h2,
h3 {
  margin: 0 0 var(--ge-space-4);
  font-family: var(--ge-font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

:is(#landing, .exam-header, #exam, #result, .section-head) :is(h1, h2, h3) {
  font-family: var(--ge-font-student);
}

h1 {
  font-size: var(--ge-text-3xl);
}

h2 {
  font-size: var(--ge-text-2xl);
}

h3 {
  font-size: var(--ge-text-lg);
}

* + h2 {
  margin-top: var(--ge-space-6);
}

p,
ul,
ol,
dl,
pre,
table,
form,
fieldset,
blockquote,
figure {
  margin: 0 0 var(--ge-space-4);
}

ul,
ol {
  padding-left: var(--ge-space-5);
}

nav ul,
.nav-grid {
  margin: 0;
  padding: 0;
  list-style: none;
}

small {
  font-size: var(--ge-text-sm);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--ge-brand);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ge-brand-strong);
}

code,
kbd,
pre,
samp {
  font-family: var(--ge-font-mono);
  font-size: 0.9em;
}

code {
  padding: 0 var(--ge-space-1);
  border-radius: 6px;
  background: var(--ge-sunken);
}

pre {
  overflow-x: auto;
  padding: var(--ge-space-3) var(--ge-space-4);
  border-radius: var(--ge-r-sm);
  background: var(--ge-sunken);
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

blockquote {
  padding-left: var(--ge-space-4);
  border-left: 4px solid var(--ge-line);
  color: var(--ge-muted);
}

/* Question, option and section text: prose with its own paragraphs, lists
   and code. */
.question-body,
.option-body,
.section-body {
  font-size: var(--ge-text-lg);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.question-body p,
.option-body p,
.section-body p {
  margin: 0 0 var(--ge-space-3);
}

.question-body ul,
.question-body ol,
.option-body ul,
.option-body ol,
.section-body ul,
.section-body ol {
  margin: 0 0 var(--ge-space-3);
  padding-left: var(--ge-space-5);
}

.question-body pre,
.option-body pre,
.section-body pre {
  margin: 0 0 var(--ge-space-3);
  font-size: var(--ge-text-sm);
}

.question-body > :last-child,
.option-body > :last-child,
.section-body > :last-child {
  margin-bottom: 0;
}

:focus-visible {
  outline: 3px solid var(--ge-focus);
  outline-offset: 3px;
}

/* A chalkboard surface: the student's exam bar. */
.on-board {
  background: var(--ge-board);
  color: var(--ge-chalk);
}

.on-board a {
  color: var(--ge-chalk);
}

/* On a board and in the developer band of / the ring is gold. */
.on-board :focus-visible,
.tech :focus-visible {
  outline-color: var(--ge-gold);
}

/* A light card on a board (the monitor banner) takes the page's ring. */
.on-board .banner :focus-visible {
  outline-color: var(--ge-focus);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}

.numeric,
#timer,
#score {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.75rem;
  }
}

/* 3. Layout */

/* The page column is the window up to 1280 px. */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--ge-space-5);
}

main.container {
  padding-block: var(--ge-space-6) var(--ge-space-7);
}

.narrow {
  max-width: 520px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3) var(--ge-space-5);
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--ge-space-5);
}

.page-head h1 {
  margin: 0;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3);
  margin: 0;
}

.back {
  margin: 0 0 var(--ge-space-2);
}

.back a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 640px) {
  .container {
    padding-inline: var(--ge-space-4);
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 4. Actions: primary, secondary, quiet, destructive. */

/* A button without a class, and a.button without .secondary, is the view's
   one primary action. */
button,
.button {
  display: inline-flex;
  gap: var(--ge-space-2);
  align-items: center;
  justify-content: center;
  min-height: var(--ge-touch);
  margin: 0;
  padding: 0 18px;
  border: 2px solid transparent;
  border-radius: var(--ge-r-md);
  background: var(--ge-brand);
  color: var(--ge-on-brand);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--ge-brand-strong);
  color: var(--ge-on-brand);
  text-decoration: none;
}

button.secondary,
.button.secondary {
  border-color: var(--ge-brand);
  background: var(--ge-surface);
  color: var(--ge-brand);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
}

button.quiet,
.quiet {
  padding: 0 var(--ge-space-3);
  border-color: transparent;
  border-radius: var(--ge-r-md);
  background: transparent;
  color: var(--ge-brand);
  font-weight: 700;
  text-decoration: none;
}

a.quiet {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
}

button.quiet:hover,
.quiet:hover,
.quiet:focus-visible {
  border-color: transparent;
  background: var(--ge-sunken);
  color: var(--ge-brand-strong);
}

.account .quiet,
.account .quiet:hover {
  color: var(--ge-ink);
}

button.danger {
  background: var(--ge-danger);
  color: var(--ge-on-danger);
}

button.danger:hover {
  background: var(--ge-danger-strong);
  color: var(--ge-on-danger);
}

/* A quiet trigger stays quiet: without this, button.danger (declared later,
   same specificity as button.quiet) would fill it. */
button.quiet.danger {
  background: transparent;
}

button.quiet.danger:hover {
  background: var(--ge-sunken);
}

.quiet.danger,
.quiet.danger:hover,
a.danger-link,
a.danger-link:hover {
  color: var(--ge-danger);
}

a.danger-link {
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* On a board: the filled action is chalk, the others are chalk outlines. */
.on-board button:not([class]),
.on-board a.button:not(.secondary) {
  background: var(--ge-chalk);
  color: var(--ge-board);
}

.on-board button:not([class]):hover,
.on-board a.button:not(.secondary):hover {
  background: var(--ge-chalk-strong);
  color: var(--ge-board);
}

.on-board .secondary {
  border-color: var(--ge-chalk-muted);
  background: transparent;
  color: var(--ge-chalk);
}

.on-board .secondary:hover {
  background: var(--ge-chalk-wash);
  color: var(--ge-chalk);
}

/* 5. Forms */

label {
  display: block;
  margin-bottom: var(--ge-space-1);
}

input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0 0 var(--ge-space-4);
  padding: var(--ge-space-2) 14px;
  border: 2px solid var(--ge-edge);
  border-radius: var(--ge-r-md);
  background: var(--ge-surface);
  color: var(--ge-ink);
  font: inherit;
  font-size: max(16px, 1rem);
  font-weight: 400;
  line-height: 1.5;
  accent-color: var(--ge-brand);
}

:is(#landing, #exam) input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])) {
  min-height: 56px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ge-brand);
}

[aria-invalid="true"] {
  border-color: var(--ge-danger);
  box-shadow: inset 0 0 0 1px var(--ge-danger);
}

label > input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])),
label > select {
  margin-top: var(--ge-space-1);
}

textarea {
  resize: vertical;
}

::placeholder {
  color: var(--ge-muted);
  opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 var(--ge-space-2) 0 0;
  vertical-align: -0.25em;
  accent-color: var(--ge-brand);
}

input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 var(--ge-space-4);
  color: var(--ge-muted);
  font: inherit;
  accent-color: var(--ge-brand);
}

::file-selector-button {
  min-height: var(--ge-touch);
  margin-right: var(--ge-space-3);
  padding: 0 var(--ge-space-4);
  border: 2px solid var(--ge-edge);
  border-radius: var(--ge-r-md);
  background: var(--ge-surface);
  color: var(--ge-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

::file-selector-button:hover {
  border-color: var(--ge-brand);
  background: var(--ge-brand-soft);
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

form small {
  display: block;
  margin: 0 0 var(--ge-space-4);
  color: var(--ge-muted);
}

input + small {
  margin-top: calc(-1 * var(--ge-space-3));
}

legend {
  margin-bottom: var(--ge-space-2);
  padding: 0;
  font-weight: 700;
}

/* A fold: its summary is a 52 px row with a chevron that turns when open. */
details {
  margin: 0 0 var(--ge-space-4);
}

details > summary {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin: 0 4px 0 2px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg);
}

details[open] > summary::before {
  transform: rotate(45deg);
}

dialog {
  width: 100%;
  max-width: min(28rem, 100vw - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ge-ink);
}

dialog::backdrop {
  background: var(--ge-scrim);
}

dialog > article h2 {
  margin-top: 0;
}

/* 6. Tables */

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: var(--ge-space-4) 10px;
  border-bottom: 1px solid var(--ge-line);
  text-align: left;
}

th {
  padding-block: 14px;
  background: var(--ge-sunken);
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
  font-weight: 700;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: var(--ge-space-5);
}

th:last-child,
td:last-child {
  padding-right: var(--ge-space-5);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--ge-brand-soft) 35%, transparent);
}

/* The table card. Positioned, so a visually hidden header cell stays inside
   the scroller instead of widening the page. */
.overflow-auto {
  position: relative;
  overflow-x: auto;
  margin-bottom: var(--ge-space-4);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

.overflow-auto table {
  margin-bottom: 0;
}

/* The actions wrap between buttons and links, never inside one. */
.row-actions button,
.row-actions a {
  white-space: nowrap;
}

.row-actions form {
  display: inline-block;
  margin: var(--ge-space-1) var(--ge-space-3) var(--ge-space-1) 0;
}

.row-actions button {
  padding: 0 14px;
}

.row-actions a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  margin-right: var(--ge-space-3);
}

.row-actions a:last-child {
  margin-right: 0;
}

.zone-note {
  margin: 14px var(--ge-space-1) 0;
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
}

.empty {
  color: var(--ge-muted);
}

/* 7. Feedback. A status is a word plus a shape; colour comes third. */

.badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  padding: 2px 12px 2px 10px;
  border-radius: var(--ge-r-pill);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.badge::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
}

/* Open, Submitted: a filled dot. */
.badge-ok {
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
}

.badge-ok::before {
  border-radius: 50%;
  background: currentColor;
}

/* In progress: a triangle pointing right. */
.badge-warn {
  background: var(--ge-gold-soft);
  color: var(--ge-gold-ink);
}

.badge-warn::before {
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Closed, Timed out, Admin: a ring. */
.badge-muted {
  background: var(--ge-closed-bg);
  color: var(--ge-closed-ink);
}

.badge-muted::before {
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px currentColor;
}

/* Archived: an outline and a small square. */
.badge-archived {
  color: var(--ge-muted);
  box-shadow: inset 0 0 0 1.5px var(--ge-edge);
}

.badge-archived::before {
  border-radius: 2px;
  background: currentColor;
}

/* Alerts: ink on the danger tint, a danger bar and the alert icon. */
.alert,
.banner-danger {
  position: relative;
  padding: var(--ge-space-3) var(--ge-space-4) var(--ge-space-3) 46px;
  border-left: 6px solid var(--ge-danger);
  border-radius: var(--ge-r-md);
  background: var(--ge-danger-soft);
  color: var(--ge-ink);
  font-weight: 700;
}

.alert {
  margin-bottom: var(--ge-space-4);
}

.alert::before,
.banner-danger::before {
  content: "";
  position: absolute;
  top: calc(var(--ge-space-3) + 0.1em);
  left: var(--ge-space-3);
  width: 1.25em;
  height: 1.25em;
  background: var(--ge-danger);
  -webkit-mask: var(--ge-i-alert) center / contain no-repeat;
  mask: var(--ge-i-alert) center / contain no-repeat;
}

/* Notices: ink on the gold tint with a gold bar. */
.frozen-notice,
.banner-warn {
  padding: var(--ge-space-3) var(--ge-space-4);
  border-left: 6px solid var(--ge-gold);
  border-radius: var(--ge-r-md);
  background: var(--ge-gold-soft);
  color: var(--ge-ink);
  font-weight: 600;
}

.banner {
  max-width: 720px;
  margin: var(--ge-space-3) auto;
}

.banner a {
  color: inherit;
}

/* 8. Paper: cards, bubbles, question parts, previews, marks. */

.question,
.review-question,
.preview-question,
.detail-question,
.score-block,
.format-help,
#question-nav,
dialog > article {
  padding: 22px var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

dialog > article {
  border-radius: var(--ge-r-xl);
}

@media (max-width: 640px) {
  .question,
  .review-question,
  .preview-question,
  .detail-question,
  .score-block,
  .format-help,
  #question-nav,
  dialog > article {
    padding: var(--ge-space-4);
  }
}

/* The answer-sheet bubble: empty ring = open, filled = answered or picked. */
.bubble {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--ge-edge);
  border-radius: 50%;
  background: var(--ge-surface);
  color: var(--ge-ink);
  font-size: var(--ge-text-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-decoration: none;
}

.bubble[data-answered="true"] {
  border-color: var(--ge-brand);
  background: var(--ge-brand);
  color: var(--ge-on-brand);
}

.eyebrow {
  margin-bottom: var(--ge-space-2);
  color: var(--ge-brand);
  font-size: 0.9375rem;
  font-weight: 800;
}

/* Sections: a heading between question cards with a gold bar instead of a
   card, so it does not read as a question. */
.section-head {
  min-width: 0;
  margin: var(--ge-space-6) 0 var(--ge-space-4);
  padding: var(--ge-space-1) 0 var(--ge-space-1) var(--ge-space-4);
  border-left: 6px solid var(--ge-gold);
  overflow-wrap: anywhere;
}

.section-head:first-child {
  margin-top: var(--ge-space-4);
}

.section-title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
}

.section-body {
  margin-top: var(--ge-space-1);
  color: var(--ge-ink);
  font-size: var(--ge-text-md);
}

.preview-question {
  margin-bottom: var(--ge-space-5);
}

/* Options in two columns, each with its letter in a bubble; the right one
   filled. */
ol.preview-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ge-space-2);
  margin: var(--ge-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.preview-options li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) 10px;
  align-items: center;
  padding: var(--ge-space-2) var(--ge-space-3);
  border: 1.5px solid var(--ge-line);
  border-radius: var(--ge-r-md);
  counter-increment: list-item;
}

.preview-options li::before {
  content: counter(list-item, upper-alpha);
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ge-edge);
  border-radius: 50%;
  font-size: var(--ge-text-sm);
  font-weight: 700;
}

.preview-options .option-body {
  flex: 1 1 8rem;
  min-width: 0;
  font-size: var(--ge-text-base);
}

.preview-options li[data-correct="true"] {
  border-color: var(--ge-brand);
  background: var(--ge-brand-soft);
  font-weight: 700;
}

.preview-options li[data-correct="true"]::before {
  border-color: var(--ge-brand);
  background: var(--ge-brand);
  color: var(--ge-on-brand);
}

.preview-answers {
  margin-top: var(--ge-space-3);
}

.correct-mark {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 2px 10px;
  border-radius: var(--ge-r-pill);
  background: var(--ge-surface);
  color: var(--ge-brand-strong);
  font-size: var(--ge-text-sm);
  font-weight: 700;
  white-space: nowrap;
}

.accepted-label {
  margin: 0 0 var(--ge-space-2);
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
  font-weight: 700;
}

.accepted-answers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.accepted-answers li {
  padding: var(--ge-space-1) var(--ge-space-3);
  border-radius: var(--ge-r-sm);
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Settings (exam page, revision, attempt summary): label on the left, value
   on the right, one ruled row each. */
dl.settings {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 0;
  margin: 0 0 var(--ge-space-6);
}

.settings dt,
.settings dd {
  display: flex;
  align-items: center;
  min-height: var(--ge-touch);
  margin: 0;
  padding: var(--ge-space-2) 0;
  border-top: 1px solid var(--ge-line);
}

.settings dt {
  padding-right: var(--ge-space-4);
  color: var(--ge-muted);
}

.settings dd {
  justify-content: flex-end;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.settings dt:first-of-type,
.settings dd:first-of-type {
  border-top: 0;
}

@media (max-width: 640px) {
  ol.preview-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A narrow column: the label small above its value, so a long label never
   squeezes the value. */
@media (max-width: 480px) {
  dl.settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings dt {
    min-height: 0;
    padding: 10px 0 0;
    font-size: var(--ge-text-sm);
  }

  .settings dd {
    justify-content: flex-start;
    min-height: 0;
    padding: 2px 0 10px;
    border-top: 0;
    text-align: left;
  }
}

/* 9. Headers */

.admin-header,
.brand-header {
  border-bottom: 1px solid var(--ge-line);
  background: var(--ge-surface);
}

.admin-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--ge-space-6);
  align-items: center;
  min-height: 68px;
}

.brand-header {
  padding: 0 max(var(--ge-space-5), calc((100% - 1280px) / 2 + var(--ge-space-5)));
}

.brand {
  display: inline-flex;
  flex: none;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  color: var(--ge-ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ge-ink);
}

.mark {
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
}

.mark-box {
  fill: var(--ge-brand);
}

.mark-tick {
  fill: none;
  stroke: var(--ge-on-brand);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.on-board .mark-box {
  fill: var(--ge-chalk);
}

.on-board .mark-tick {
  stroke: var(--ge-board);
}

.wordmark {
  font-family: var(--ge-font-display);
  font-size: 1.3125rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: var(--ge-space-1);
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  padding: 0 14px;
  border-radius: var(--ge-r-sm);
  color: var(--ge-muted);
  font-weight: 600;
  text-decoration: none;
}

.nav-links a:hover {
  background: var(--ge-sunken);
  color: var(--ge-ink);
}

.nav-links a[aria-current="page"] {
  color: var(--ge-ink);
  font-weight: 800;
}

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: var(--ge-space-3);
  bottom: var(--ge-space-1);
  left: var(--ge-space-3);
  height: 5px;
  border-radius: 3px;
  background: var(--ge-gold);
}

.account {
  display: flex;
  flex: 0 1 auto;
  gap: var(--ge-space-2);
  align-items: center;
  min-width: 0;
  margin-left: auto;
}

/* A long email is cut with an ellipsis instead of widening the page. */
.signed-in-as {
  min-width: 0;
  max-width: 18rem;
  overflow: hidden;
  color: var(--ge-muted);
  font-size: 0.9375rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  flex: none;
  margin: 0;
}

@media (max-width: 640px) {
  .admin-header nav {
    gap: 0 var(--ge-space-4);
    min-height: 0;
  }

  .brand-header {
    padding: 0 var(--ge-space-4);
  }

  .brand {
    min-height: 56px;
  }

  .account {
    flex: 1 1 0;
    justify-content: flex-end;
  }

  .nav-links {
    flex-basis: 100%;
    order: 3;
    margin-left: calc(-1 * var(--ge-space-3));
  }
}

/* The language switch, top right of every page (it scrolls away with it):
   an icon button on the header row that opens a small menu. The headers
   keep --ge-lang-room free for the button. */
.lang-switch {
  position: absolute;
  top: 12px;
  right: max(var(--ge-space-4), calc((100% - 1280px) / 2 + var(--ge-space-5)));
  z-index: 20;
  margin: 0;
}

.lang-switch > summary {
  justify-content: center;
  width: var(--ge-touch);
  min-height: var(--ge-touch);
  border-radius: var(--ge-r-md);
  color: var(--ge-muted);
}

.lang-switch > summary::before {
  width: 18px;
  height: 18px;
  margin: 0;
  border: 0;
  background: currentColor;
  -webkit-mask: var(--ge-i-languages) center / contain no-repeat;
  mask: var(--ge-i-languages) center / contain no-repeat;
}

/* Not the fold's chevron: the icon never turns. */
.lang-switch > summary::before,
.lang-switch[open] > summary::before {
  transform: none;
}

.lang-switch > summary:hover,
.lang-switch[open] > summary {
  background: var(--ge-sunken);
  color: var(--ge-ink);
}

/* The menu: a card below the button, right-aligned. */
.lang-switch form {
  position: absolute;
  top: calc(100% + var(--ge-space-1));
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  margin: 0;
  padding: var(--ge-space-1);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-md);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

.lang-switch form button.quiet {
  justify-content: flex-start;
  width: 100%;
  min-height: var(--ge-touch);
  font-family: var(--ge-font-ui);
  font-size: var(--ge-text-base);
}

.lang-switch form button[aria-current="true"] {
  color: var(--ge-ink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--ge-gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.admin-header nav {
  padding-inline-end: calc(var(--ge-space-5) + var(--ge-lang-room));
}

.brand-header {
  padding-inline-end: calc(max(var(--ge-space-5), calc((100% - 1280px) / 2 + var(--ge-space-5))) + var(--ge-lang-room));
}

/* Phones: the teacher header wraps, so only its first row (the brand and
   the account) keeps the room. */
@media (max-width: 640px) {
  .lang-switch {
    top: 6px;
  }

  .admin-header nav {
    padding-inline-end: var(--ge-space-4);
  }

  .account {
    margin-inline-end: var(--ge-lang-room);
  }

  .brand-header {
    padding-inline-end: calc(var(--ge-space-4) + var(--ge-lang-room));
  }
}

/* Narrow phones: the brand and the email on the first row, the page links
   and Log out on the second. */
@media (max-width: 480px) {
  .account {
    display: contents;
  }

  .signed-in-as {
    flex: 1 1 0;
    margin-inline-end: var(--ge-lang-room);
    text-align: end;
  }

  .admin-header nav::after {
    content: "";
    flex-basis: 100%;
    order: 2;
  }

  .nav-links {
    flex: 1 1 auto;
  }

  .logout-form {
    order: 4;
  }
}

/* On plain / below 761 px the top of the page is the chalkboard. */
@media (max-width: 760px) {
  :is(.landing-split, .landing-more) ~ .lang-switch > summary {
    color: var(--ge-chalk);
  }

  :is(.landing-split, .landing-more) ~ .lang-switch > summary:hover,
  :is(.landing-split, .landing-more) ~ .lang-switch[open] > summary {
    background: var(--ge-chalk-wash);
    color: var(--ge-chalk);
  }

  :is(.landing-split, .landing-more) ~ .lang-switch > summary:focus-visible {
    outline-color: var(--ge-gold);
  }
}

/* 10. Student: landing, sign-in, error */

/* The whole of / in every state uses the student font. */
.landing-page {
  font-family: var(--ge-font-student);
  font-size: var(--ge-text-md);
}

.landing-page :is(h1, h2, h3) {
  font-family: var(--ge-font-student);
}

.landing-page .wordmark {
  font-family: inherit;
}

.landing-page a {
  font-weight: 700;
}

/* Plain /: the entry on the board (7/12), the teacher block beside it. */
.landing-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

main.landing.on-board {
  display: grid;
  align-content: start;
  padding: 64px var(--ge-space-7) 56px;
}

/* On a desktop the first view fills the window, and the student column
   is centred in the board as the teacher column is beside it. Phones keep
   their natural height. */
@media (min-width: 761px) {
  .landing-split {
    min-height: 100vh;
    min-height: 100svh;
  }

  main.landing.on-board {
    align-content: center;
    padding-block: 56px;
  }
}

/* As wide as it may be, so the column keeps its place whichever tab is
   open. */
.entry-col {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* A link to an exam or a refusal: one centred column on the page. */
.landing-page:not(.landing-split) main.landing {
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.brandline {
  display: flex;
  gap: var(--ge-space-3);
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brandline:hover {
  color: inherit;
}

.brandline .mark {
  width: 40px;
  height: 40px;
}

.brandline .landing-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1;
}

.landing-lead {
  margin: var(--ge-space-3) 0 0;
  font-size: var(--ge-text-xl);
  line-height: 1.4;
}

.landing-brand {
  margin: 0;
}

.landing-brand .brandline {
  display: inline-flex;
  min-height: var(--ge-touch);
}

.landing-brand .mark {
  width: 32px;
  height: 32px;
}

.landing-brand .wordmark {
  font-size: var(--ge-text-xl);
}

.landing-brand + .landing-title {
  margin: 22px 0 0;
  font-size: 2rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.landing-code {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-1) var(--ge-space-4);
  align-items: center;
  margin: 14px 0 0;
}

.landing-code .code {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 calc(12px - 0.16em) 0 12px;
  border-radius: var(--ge-r-sm);
  background: var(--ge-board);
  color: var(--ge-chalk);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.landing-code a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
}

.landing-code + .entry-modes {
  margin-top: 22px;
}

/* The entry card: a light card on the board and on the page alike. */
.entry {
  margin-top: 22px;
  padding: var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-xl);
  background: var(--ge-surface);
  color: var(--ge-ink);
  box-shadow: var(--ge-shadow);
}

.on-board .entry {
  border-color: transparent;
  box-shadow: var(--ge-shadow-lift);
}

.on-board .entry :focus-visible {
  outline-color: var(--ge-focus);
}

/* Join and Resume: two tabs over the entry card. */
.entry-modes .landing-lead {
  margin-bottom: 20px;
}

.tablist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: end;
}

.tab {
  position: relative;
  display: flex;
  gap: var(--ge-space-2);
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin: 0 0 -1px;
  padding: 0 var(--ge-space-3);
  border: 1px solid var(--ge-line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--ge-sunken);
  color: var(--ge-ink);
  font: inherit;
  font-size: var(--ge-text-md);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.tab::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
}

.tab-join::before {
  -webkit-mask: var(--ge-i-arrow) center / contain no-repeat;
  mask: var(--ge-i-arrow) center / contain no-repeat;
}

.tab-resume::before {
  -webkit-mask: var(--ge-i-resume) center / contain no-repeat;
  mask: var(--ge-i-resume) center / contain no-repeat;
}

.tab:not([aria-selected="true"]):hover {
  background: var(--ge-line);
  color: var(--ge-ink);
}

/* The open tab is the card's own colour and runs into it, with a brand
   bar along its top. */
#tab-join-r:checked ~ .tablist .tab-join,
#tab-resume-r:checked ~ .tablist .tab-resume,
.tab[aria-selected="true"] {
  z-index: 1;
  min-height: 58px;
  background: var(--ge-surface);
  box-shadow: inset 0 4px 0 var(--ge-brand);
  cursor: default;
}

#tab-join-r:checked ~ .tablist .tab-join::before,
#tab-resume-r:checked ~ .tablist .tab-resume::before,
.tab[aria-selected="true"]::before {
  background: var(--ge-brand);
}

/* The ring sits inside the tab, so it is drawn on the tab's own colour. */
#tab-join-r:focus-visible ~ .tablist .tab-join,
#tab-resume-r:focus-visible ~ .tablist .tab-resume,
.tab:focus-visible {
  outline: 3px solid var(--ge-focus);
  outline-offset: -7px;
}

.entry-modes .entry {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* On the board: the closed tab is a chalk wash, the open one is the card. */
.on-board .tab {
  border: 0;
  background: var(--ge-chalk-wash);
  color: var(--ge-chalk);
}

.on-board .tab:not([aria-selected="true"]):hover {
  background: var(--ge-chalk-line);
  color: var(--ge-chalk);
}

.on-board #tab-join-r:checked ~ .tablist .tab-join,
.on-board #tab-resume-r:checked ~ .tablist .tab-resume,
.on-board .tab[aria-selected="true"] {
  background: var(--ge-surface);
  color: var(--ge-ink);
}

.on-board .tab:not([aria-selected="true"]):focus-visible,
.on-board #tab-join-r:not(:checked):focus-visible ~ .tablist .tab-join,
.on-board #tab-resume-r:not(:checked):focus-visible ~ .tablist .tab-resume {
  outline-color: var(--ge-gold);
}

/* Without scripts the checked radio shows its panel and its lead line. */
.tab-panel,
#lead-resume {
  display: none;
}

#tab-join-r:checked ~ .entry #panel-join,
#tab-resume-r:checked ~ .entry #panel-resume,
#tab-resume-r:checked ~ #lead-resume {
  display: block;
}

#tab-resume-r:checked ~ #lead-join {
  display: none;
}

/* With entry.js the radios are gone and [hidden] does the same. */
.entry-modes.is-live .tab-panel,
.entry-modes.is-live #lead-resume {
  display: block;
}

/* On a desktop the two leads share one grid cell and the two panels
   another; the closed one keeps its room but is hidden from sight, the
   tab order and the accessibility tree. So picking a tab moves nothing
   in the centred column. Phones keep the closed one out of the flow. */
@media (min-width: 761px) {
  .entry-modes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-modes .landing-lead {
    grid-area: 1 / 1;
  }

  .entry-modes .tablist {
    grid-row: 2;
  }

  .entry-modes .entry {
    display: grid;
    grid-row: 3;
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-modes .tab-panel {
    grid-area: 1 / 1;
  }

  .tab-panel,
  #lead-resume,
  #tab-resume-r:checked ~ #lead-join {
    display: block;
  }

  #tab-join-r:checked ~ #lead-resume,
  #tab-resume-r:checked ~ #lead-join,
  #tab-join-r:checked ~ .entry #panel-resume,
  #tab-resume-r:checked ~ .entry #panel-join {
    visibility: hidden;
  }

  .entry-modes.is-live :is(.tab-panel, .landing-lead)[hidden] {
    display: block !important;
    visibility: hidden;
  }
}

.panel-text {
  margin: 0 0 var(--ge-space-4);
  color: var(--ge-muted);
}

#panel-resume .alert {
  margin: 0 0 var(--ge-space-4);
}

#start-form,
#resume-form {
  margin: 0;
}

.entry .field + .field {
  margin-top: 18px;
}

.entry label {
  margin-bottom: 6px;
  font-size: var(--ge-text-lg);
  font-weight: 700;
}

.entry input {
  margin: 0;
  padding: 0 var(--ge-space-4);
  font-size: var(--ge-text-xl);
  font-weight: 600;
}

/* The code boxes: one normal input with a mask drawn behind its text.
   The input keeps the size, border and radius of every other input; its
   background moves to the wrapper so the mask shows through. Mask and
   input share font, size and letter-spacing, and the mask repeats the
   typed text invisibly, so the rest of the mask lands right after it in
   any font. */
.mask-field {
  position: relative;
  border-radius: var(--ge-r-md);
  background: var(--ge-surface);
}

#landing .mask-input,
.mask-field .mask {
  font-family: var(--ge-font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.42em;
}

#landing .mask-input {
  position: relative;
  z-index: 1;
  min-height: 56px;
  padding: 0 var(--ge-space-4);
  background: transparent;
  line-height: 1.5;
  text-transform: uppercase;
}

#landing .mask-input::placeholder {
  font-weight: 400;
}

.mask-field .mask {
  position: absolute;
  inset: 2px;
  display: none;
  align-items: center;
  padding: 0 0 0 var(--ge-space-4);
  overflow: hidden;
  color: var(--ge-muted);
  font-weight: 400;
  line-height: 1.5;
  white-space: pre;
  pointer-events: none;
}

/* Only entry.js fills the mask; without it the placeholder shows. */
.mask-field.is-live .mask {
  display: flex;
}

.mask .typed {
  color: transparent;
  font-weight: 700;
}

/* The fixed dash of the resume code, and the slot the next character
   goes into while the box has focus. */
.mask .fixed {
  color: var(--ge-ink);
  font-weight: 700;
}

.mask .next {
  color: var(--ge-brand);
  font-weight: 700;
}

/* The refusal hint from entry.js: polite, gold, gone when empty. */
.code-msg {
  margin: 0;
}

.code-msg:not(:empty) {
  display: flex;
  gap: var(--ge-space-2);
  align-items: flex-start;
  margin-top: var(--ge-space-2);
  padding: var(--ge-space-2) var(--ge-space-3);
  border-radius: var(--ge-r-sm);
  background: var(--ge-gold-soft);
  color: var(--ge-gold-ink);
  font-size: 0.9375rem;
  font-weight: 700;
}

.code-msg:not(:empty)::before {
  content: "";
  flex: none;
  width: 1.2em;
  height: 1.2em;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--ge-i-alert) center / contain no-repeat;
  mask: var(--ge-i-alert) center / contain no-repeat;
}

.landing-hint {
  margin: 6px 0 0;
  color: var(--ge-muted);
  font-size: 0.9375rem;
}

/* Start exam and Continue exam: each the one primary of its panel, also
   on the board. */
:is(#start-form, #resume-form) button,
:is(#start-form, #resume-form) button:hover {
  color: var(--ge-on-brand);
}

:is(#start-form, #resume-form) button {
  gap: 10px;
  width: 100%;
  min-height: 60px;
  margin-top: 22px;
  border-radius: 16px;
  background: var(--ge-brand);
  font-size: var(--ge-text-xl);
}

:is(#start-form, #resume-form) button:hover {
  background: var(--ge-brand-strong);
}

:is(#start-form, #resume-form) button::after,
.tech-source::after {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-arrow) center / contain no-repeat;
  mask: var(--ge-i-arrow) center / contain no-repeat;
}

.landing-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 0;
  color: var(--ge-muted);
  font-size: 0.9375rem;
}

.landing-note::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: 2px;
  background: var(--ge-gold-ink);
  -webkit-mask: var(--ge-i-clock) center / contain no-repeat;
  mask: var(--ge-i-clock) center / contain no-repeat;
}

.last-result {
  margin: var(--ge-space-4) 0 0;
}

.last-result a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
}

/* The teacher block beside the board: type only. */
section.about {
  display: grid;
  align-content: center;
  padding: 64px 56px;
}

.teacher-block {
  max-width: 440px;
}

.kicker {
  margin: 0;
  color: var(--ge-brand);
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

section.about h2 {
  margin: 14px 0 0;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.hero-line {
  display: block;
}

.hl {
  text-decoration: underline 0.2em var(--ge-gold);
  text-decoration-skip-ink: none;
  text-underline-offset: 0.1em;
}

section.about .hl {
  text-underline-offset: 0.08em;
}

.hero-sub {
  margin: 18px 0 0;
  color: var(--ge-muted);
  font-size: var(--ge-text-xl);
  line-height: 1.45;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3) var(--ge-space-4);
  align-items: center;
  margin: 30px 0 0;
}

.hero-cta .button {
  padding: 0 var(--ge-space-5);
}

.learn-more {
  display: inline-flex;
  gap: var(--ge-space-2);
  align-items: center;
  min-height: var(--ge-touch);
  padding: 0 var(--ge-space-2);
  border-radius: var(--ge-r-md);
  text-decoration: none;
}

.learn-more:hover {
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
}

.learn-more::after {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-down) center / contain no-repeat;
  mask: var(--ge-i-down) center / contain no-repeat;
}

/* The product sections below the first view. */
.landing-wrap {
  max-width: 1136px;
  margin: 0 auto;
  padding: 0 var(--ge-space-6);
}

.why h2,
.features h2,
.tech h2 {
  margin: 0;
  font-size: var(--ge-text-3xl);
  letter-spacing: -0.02em;
}

.section-intro {
  max-width: 36em;
  margin: 10px 0 0;
  color: var(--ge-muted);
  font-size: var(--ge-text-lg);
}

.why {
  padding: 88px 0 72px;
  border-top: 1px solid var(--ge-line);
}

.pros {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 56px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.pro {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: var(--ge-space-1) 18px;
  align-content: start;
}

.pro .bubble {
  grid-row: span 2;
  width: 56px;
  height: 56px;
  border: 0;
  background: var(--ge-brand);
  color: var(--ge-on-brand);
  font-size: 1.375rem;
}

.pro h3 {
  margin: 6px 0 0;
  font-size: 1.3125rem;
  line-height: 1.25;
}

.pro p {
  margin: 0;
  color: var(--ge-muted);
}

.figure {
  color: var(--ge-ink);
  font-weight: 800;
  white-space: nowrap;
}

.features {
  padding: 72px 0 88px;
  border-block: 1px solid var(--ge-line);
  background: var(--ge-surface);
}

/* "How it works": the three groups share the width, each in its own soft
   card. */
.feature-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ge-space-5);
  margin-top: 40px;
}

.feature-group {
  padding: var(--ge-space-5) var(--ge-space-5) 10px;
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-bg);
}

.feature-group h3 {
  margin: 0 0 var(--ge-space-4);
  padding-left: var(--ge-space-3);
  border-left: 5px solid var(--ge-gold);
  font-size: var(--ge-text-lg);
  line-height: 1.3;
}

.feature-list {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: contents;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
}

.feature-icon::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  background: currentColor;
}

.icon-pencil::before {
  -webkit-mask: var(--ge-i-pencil) center / contain no-repeat;
  mask: var(--ge-i-pencil) center / contain no-repeat;
}

.icon-calendar::before {
  -webkit-mask: var(--ge-i-calendar) center / contain no-repeat;
  mask: var(--ge-i-calendar) center / contain no-repeat;
}

.icon-screen::before {
  -webkit-mask: var(--ge-i-screen) center / contain no-repeat;
  mask: var(--ge-i-screen) center / contain no-repeat;
}

.icon-eye::before {
  -webkit-mask: var(--ge-i-eye) center / contain no-repeat;
  mask: var(--ge-i-eye) center / contain no-repeat;
}

.icon-table::before {
  -webkit-mask: var(--ge-i-table) center / contain no-repeat;
  mask: var(--ge-i-table) center / contain no-repeat;
}

.icon-history::before {
  -webkit-mask: var(--ge-i-history) center / contain no-repeat;
  mask: var(--ge-i-history) center / contain no-repeat;
}

.feature-text {
  margin: 0;
  padding: 2px 0 14px;
}

.feature-text strong {
  display: block;
}

.feature-text span {
  color: var(--ge-muted);
}

/* The developer band. */
.tech {
  padding: 72px 0 80px;
  background: var(--ge-band);
  color: var(--ge-band-ink);
}

.tech .kicker {
  color: var(--ge-gold);
  font-family: var(--ge-font-mono);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.tech h2 {
  margin-top: var(--ge-space-2);
  font-size: 2rem;
}

.tech .section-intro {
  max-width: 40em;
  color: var(--ge-band-muted);
  font-size: var(--ge-text-md);
}

.tech-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ge-space-6);
  margin-top: 36px;
}

.tech-cols h3 {
  margin: 0 0 10px;
  color: var(--ge-gold);
  font: 700 0.9375rem var(--ge-font-mono);
}

.tech-cols ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tech-cols li {
  position: relative;
  padding: 0 0 10px 18px;
}

.tech-cols li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 8px;
  height: 8px;
  border: 2px solid var(--ge-band-muted);
  border-radius: 50%;
}

.tech code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--ge-band-code);
  color: var(--ge-band-ink);
}

.tech-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--ge-space-5);
  align-items: end;
  margin-top: 28px;
}

.tech-label {
  margin: 0 0 var(--ge-space-2);
  color: var(--ge-band-muted);
  font-size: 0.9375rem;
}

.tech-run pre {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--ge-band-line);
  border-radius: var(--ge-r-md);
  background: var(--ge-band-code);
  color: var(--ge-band-ink);
  font: 500 0.9375rem/1.6 var(--ge-font-mono);
}

.tech pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.tech a {
  color: var(--ge-band-link);
}

.tech a:hover {
  color: var(--ge-band-ink);
}

.tech-source {
  display: inline-flex;
  gap: var(--ge-space-2);
  align-items: center;
  min-height: var(--ge-touch);
}

.site-foot {
  padding: 28px 0 36px;
}

.site-foot .landing-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) 28px;
  align-items: center;
}

.foot-brand {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-1) 10px;
  align-items: center;
  margin: 0;
  font-weight: 800;
}

.foot-brand .mark {
  width: 28px;
  height: 28px;
}

.foot-brand span {
  color: var(--ge-muted);
  font-weight: 400;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-1) 20px;
  margin-left: auto;
}

.site-foot nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
}

@media (max-width: 760px) {
  .landing-split {
    grid-template-columns: minmax(0, 1fr);
  }

  main.landing.on-board {
    padding: var(--ge-space-5) var(--ge-space-4) 20px;
  }

  .brandline .landing-title {
    font-size: 1.875rem;
  }

  .landing-lead {
    margin-top: var(--ge-space-2);
    font-size: var(--ge-text-lg);
  }

  .entry {
    margin-top: var(--ge-space-4);
    padding: 18px var(--ge-space-4) 20px;
  }

  .landing-brand + .landing-title {
    font-size: 1.75rem;
  }

  section.about {
    padding: 40px 20px 52px;
  }

  section.about h2 {
    font-size: 2.125rem;
  }

  .hero-sub {
    font-size: var(--ge-text-lg);
  }

  .landing-wrap {
    padding: 0 20px;
  }

  .why {
    padding: 56px 0 48px;
  }

  .why h2,
  .features h2 {
    font-size: 1.75rem;
  }

  .pros {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .pro {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 2px 14px;
  }

  .pro .bubble {
    width: 48px;
    height: 48px;
    font-size: var(--ge-text-xl);
  }

  .pro h3 {
    margin-top: 2px;
    font-size: 1.1875rem;
  }

  .features {
    padding: 52px 0 56px;
  }

  .feature-groups {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--ge-space-4);
    margin-top: 28px;
  }

  .feature-group {
    padding: 20px 20px 6px;
  }

  .entry-modes .landing-lead {
    margin-bottom: var(--ge-space-4);
  }

  .tab {
    gap: 6px;
    padding: 0 6px;
    font-size: var(--ge-text-base);
  }

  .tech {
    padding: 52px 0 56px;
  }

  .tech h2 {
    font-size: 1.625rem;
  }

  .tech-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 28px;
  }

  .tech-run {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--ge-space-3);
  }

  .tech-run pre {
    padding: 14px 10px;
    font-size: 0.8125rem;
  }

  .site-foot nav {
    margin-left: 0;
  }
}

/* Sign-in, signed-in and error: one card on the page under the brand
   header. */
main.login,
main.error-page,
#signed-in {
  width: auto;
  margin: var(--ge-space-6) auto var(--ge-space-7);
  padding: var(--ge-space-6) 28px;
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-xl);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

:is(main.login, main.error-page, #signed-in) > :last-child {
  margin-bottom: 0;
}

#google-sign-in {
  width: 100%;
  min-height: 56px;
  margin-bottom: var(--ge-space-4);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-4);
  align-items: center;
}

@media (max-width: 640px) {
  main.login,
  main.error-page,
  #signed-in {
    margin: var(--ge-space-5) var(--ge-space-4) var(--ge-space-6);
    padding: var(--ge-space-5) 20px;
  }
}

/* 11. Student: exam. Designed at 412 px, then two columns from 992 px. */

.exam-header,
#exam {
  --ge-column: 720px;
}

.exam-header {
  background: var(--ge-surface);
}

/* The mark spans two rows; the title and the name share the other column,
   where a long title or name wraps and the mark keeps its size. */
.exam-header-inner {
  display: grid;
  max-width: var(--ge-column);
  margin: 0 auto;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px var(--ge-space-3);
  align-items: center;
  padding: 14px var(--ge-space-4) var(--ge-space-3);
  /* Room for the language switch. */
  padding-inline-end: calc(var(--ge-space-4) + var(--ge-lang-room));
}

.exam-header-inner .mark {
  grid-row: span 2;
  width: 34px;
  height: 34px;
}

.exam-title {
  margin: 0;
  font-size: var(--ge-text-lg);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* A name breaks between words; only a word wider than the column breaks. */
.student-name {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  margin: 0;
  color: var(--ge-muted);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.student-name::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-person) center / contain no-repeat;
  mask: var(--ge-i-person) center / contain no-repeat;
}

/* Sticky top bar, a chalkboard: timer, save state, navigator toggle; one
   row of --ge-bar. */
.exam-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  align-items: center;
  height: var(--ge-bar);
  padding: 0 max(10px, calc((100% - var(--ge-column)) / 2 + 10px));
}

.timer-box {
  display: flex;
  flex: none;
  margin: 0;
}

/* A chalk pill; every level keeps its 2 px chalk border so the pill stands
   off the board. */
#timer {
  display: inline-flex;
  gap: var(--ge-space-1);
  align-items: center;
  min-height: var(--ge-touch);
  padding: 0 10px;
  border: 2px solid var(--ge-chalk);
  border-radius: var(--ge-r-md);
  background: var(--ge-chalk);
  color: var(--ge-board);
  font-size: 1.3125rem;
  font-weight: 800;
  line-height: 1;
}

#timer::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-clock) center / contain no-repeat;
  mask: var(--ge-i-clock) center / contain no-repeat;
}

#timer[data-level="warn"] {
  background: var(--ge-gold);
  color: var(--ge-on-gold);
}

#timer[data-level="danger"] {
  background: var(--ge-danger);
  color: var(--ge-on-danger);
}

#save-state {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--ge-text-sm);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#save-state[data-state="saved"] {
  color: var(--ge-chalk);
}

#save-state[data-state="saving"] {
  color: var(--ge-chalk-muted);
}

#save-state[data-state="error"] {
  flex: 0 1 auto;
  padding: 2px 10px;
  border: 2px solid var(--ge-chalk);
  border-radius: var(--ge-r-pill);
  background: var(--ge-danger);
  color: var(--ge-on-danger);
  font-weight: 700;
}

#nav-toggle {
  flex: none;
  margin-left: auto;
  padding: 0 10px;
  font-size: 0.9375rem;
}

/* A 360 px phone keeps "✓ All answers saved" on one line: no clock, tighter
   gaps and paddings, a smaller save text. */
@media (max-width: 400px) {
  .exam-bar {
    gap: var(--ge-space-1);
    padding: 0 var(--ge-space-2);
  }

  #timer {
    padding: 0 var(--ge-space-2);
    font-size: 1.1875rem;
  }

  #timer::before {
    display: none;
  }

  #save-state {
    font-size: 0.8125rem;
  }

  #nav-toggle {
    padding: 0 var(--ge-space-2);
  }
}

/* The monitor warning hangs under the sticky exam bar and overlays the page:
   it takes no layout space, so showing or hiding it never moves a question.
   While it is shown, exam.js sets --ge-monitor-offset to how far it reaches
   below the bar, and jump targets and the sticky navigator move below it once
   the bar is stuck at the top of the window; at the very top of the page it
   briefly covers the first question's heading and the navigator's top. */
#monitor-banner {
  position: absolute;
  top: calc(100% + 1px + var(--ge-space-2));
  right: 0;
  left: 0;
  margin: 0 auto;
}

.exam-layout {
  max-width: var(--ge-column);
  margin: 0 auto;
}

#question-nav {
  display: block;
  margin: var(--ge-space-4) var(--ge-space-3);
  padding: var(--ge-space-4);
}

#answered-count {
  margin-bottom: var(--ge-space-3);
  font-size: 0.9375rem;
  font-weight: 700;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--ge-touch), 1fr));
  gap: var(--ge-space-2) var(--ge-space-1);
}

.nav-grid li {
  display: flex;
  justify-content: center;
}

.nav-grid .bubble {
  width: 40px;
  height: 40px;
  position: relative;
}

/* 44 px hit area around the 40 px bubble. */
.nav-grid .bubble::after {
  content: "";
  position: absolute;
  inset: -4px;
}

/* Without exam.js the navigator stays open; with it, the phone panel opens
   from the toggle and sits under the top bar. */
@media (max-width: 991.98px) {
  html.js #question-nav[data-open="false"] {
    display: none;
  }

  html.js #question-nav[data-open="true"] {
    position: sticky;
    top: calc(var(--ge-bar) + var(--ge-monitor-offset, 0px));
    z-index: 9;
    max-height: calc(100vh - var(--ge-bar) - var(--ge-monitor-offset, 0px));
    margin-top: 0;
    overflow-y: auto;
    border-top: 0;
    border-radius: 0 0 var(--ge-r-lg) var(--ge-r-lg);
  }
}

.exam-questions {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--ge-space-3) var(--ge-space-6);
}

.question {
  scroll-margin-top: calc(var(--ge-bar) + var(--ge-space-2) + var(--ge-monitor-offset, 0px));
  margin: 0 0 14px;
  padding: 18px var(--ge-space-4) var(--ge-space-4);
}

.exam-questions > .question:first-child {
  margin-top: var(--ge-space-4);
}

/* With the monitor on, a long-press must not select text or open Chrome's
   search sheet on Android; tapping an option still works. */
main[data-monitor="on"] .exam-questions {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.question-head {
  display: flex;
  gap: var(--ge-space-2);
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

.question-head .eyebrow {
  margin: 0;
}

/* Saved: a chip with a check; Saving: muted words; Not saved: a danger
   chip with the alert icon; idle: nothing. */
.q-state {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--ge-r-pill);
  font-size: var(--ge-text-sm);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.q-state[data-state="saved"]::before,
.q-state[data-state="error"]::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-check) center / contain no-repeat;
  mask: var(--ge-i-check) center / contain no-repeat;
}

.q-state[data-state="saved"] {
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
}

.q-state[data-state="saving"] {
  color: var(--ge-muted);
  font-weight: 600;
}

.q-state[data-state="error"] {
  background: var(--ge-danger-soft);
  color: var(--ge-danger);
}

.q-state[data-state="error"]::before {
  -webkit-mask-image: var(--ge-i-alert);
  mask-image: var(--ge-i-alert);
}

.q-state[data-state="idle"] {
  display: none;
}

#exam .question-body {
  margin: 10px 0 var(--ge-space-4);
  font-size: 1.3125rem;
  font-weight: 500;
  line-height: 1.45;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.option {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 10px 14px 10px 10px;
  border: 2px solid var(--ge-line);
  border-radius: 16px;
  background: var(--ge-surface);
  font-size: var(--ge-text-xl);
  cursor: pointer;
}

.option:hover {
  border-color: var(--ge-edge);
}

/* The native radio stays focusable and announced, but is not drawn: the
   bubble draws it. */
.option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.option .bubble {
  width: 44px;
  height: 44px;
  font-size: var(--ge-text-lg);
}

/* Room on the right for the check of a picked option. */
.option .option-body {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 40px;
  font-size: var(--ge-text-xl);
  font-weight: 600;
  line-height: 1.4;
}

/* Works without :has(): the three cues a student needs. */
.option input:checked ~ .bubble {
  border-color: var(--ge-brand);
  background: var(--ge-brand);
  color: var(--ge-on-brand);
}

.option input:checked ~ .option-body {
  font-weight: 800;
}

.option input:checked ~ .option-body::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  background: var(--ge-brand);
  -webkit-mask: var(--ge-i-check) center / contain no-repeat;
  mask: var(--ge-i-check) center / contain no-repeat;
}

.option input:focus-visible ~ .bubble {
  outline: 3px solid var(--ge-focus);
  outline-offset: 3px;
}

.option input:disabled ~ .bubble,
.option input:disabled ~ .option-body {
  opacity: 0.7;
}

/* Adds the row tint where :has() exists. */
.option:has(input:checked) {
  border-color: var(--ge-brand);
  background: var(--ge-brand-soft);
  box-shadow: inset 0 0 0 1px var(--ge-brand);
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--ge-focus);
  outline-offset: 3px;
}

.option:has(input:focus-visible) .bubble {
  outline: none;
}

.option:has(input:disabled) {
  cursor: not-allowed;
}

@media (prefers-reduced-motion: no-preference) {
  .option {
    transition: background-color var(--ge-transition), border-color var(--ge-transition);
  }
}

/* Fill-in: a visible label over one text box the full width of the
   question, with a heavier edge so it reads as a place to type. 16px or more
   keeps phones from zooming in on focus. */
.answer-box {
  margin: 0;
}

.answer-label {
  margin: 0 0 var(--ge-space-2);
  font-weight: 700;
}

#exam .answer-text {
  min-height: 56px;
  margin: 0;
  padding: 0 var(--ge-space-4);
  border: 2px solid var(--ge-edge);
  border-radius: var(--ge-r-md);
  background: var(--ge-surface);
  font-size: 1.375rem;
  font-weight: 600;
}

#exam .answer-text:focus {
  border-color: var(--ge-brand);
}

/* The box stays editable under the monitor's user-select: none above. */
main[data-monitor="on"] .exam-questions .answer-text {
  -webkit-user-select: text;
  user-select: text;
}

.exam-footer {
  margin-top: 22px;
  padding: 18px var(--ge-space-4);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

.answered-summary {
  margin: 0 0 14px;
  font-size: var(--ge-text-lg);
  font-weight: 800;
}

#submit-form {
  margin: 0;
}

#submit-open {
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  font-size: var(--ge-text-lg);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3);
  justify-content: flex-end;
}

.dialog-actions button {
  flex: 1 1 auto;
}

@media (min-width: 992px) {
  .exam-header,
  #exam {
    --ge-column: calc(220px + var(--ge-space-6) + 720px);
  }

  /* The mark, the timer and the navigator share one left edge. */
  .exam-header-inner {
    padding-inline: 0 var(--ge-lang-room);
  }

  .exam-bar {
    padding-inline: max(10px, calc((100% - var(--ge-column)) / 2));
  }

  .banner {
    max-width: var(--ge-column);
  }

  .exam-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 720px);
    gap: var(--ge-space-6);
    align-items: start;
  }

  .exam-questions {
    width: 100%;
    padding-inline: 0;
  }

  #question-nav {
    position: sticky;
    top: calc(var(--ge-bar) + var(--ge-space-4) + var(--ge-monitor-offset, 0px));
    max-height: calc(100vh - var(--ge-bar) - var(--ge-space-5) - var(--ge-monitor-offset, 0px));
    margin: var(--ge-space-4) 0;
    overflow-y: auto;
  }

  #nav-toggle {
    display: none;
  }
}

/* 12. Student: result */

main.result {
  max-width: 720px;
  padding-top: var(--ge-space-6);
  padding-bottom: var(--ge-space-7);
}

main.result h1 {
  margin-bottom: var(--ge-space-1);
}

.result-meta {
  color: var(--ge-muted);
  font-size: var(--ge-text-md);
  font-weight: 600;
}

.result-recorded {
  font-size: var(--ge-text-lg);
}

/* The outcome leads the page: the score card, centred, before the review. */
.score-block {
  margin: var(--ge-space-5) 0 var(--ge-space-6);
  text-align: center;
}

#score {
  margin: 0;
  color: var(--ge-brand-strong);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.score-caption {
  margin: var(--ge-space-1) 0 0;
  color: var(--ge-muted);
  font-weight: 600;
}

.result-home {
  margin: var(--ge-space-5) 0 0;
}

.review-heading {
  margin: var(--ge-space-6) 0 var(--ge-space-3);
}

.review-question {
  margin: 0 0 14px;
  padding: 18px var(--ge-space-4) var(--ge-space-4);
}

.review-question .eyebrow {
  margin: 0;
}

.review-question .question-body {
  margin: 10px 0 var(--ge-space-4);
  font-size: 1.3125rem;
  font-weight: 500;
  line-height: 1.45;
}

/* Never colour alone: the words "No answer" carry the state. */
.no-answer {
  margin: 0 0 var(--ge-space-3);
  color: var(--ge-danger);
  font-weight: 700;
}

.review-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

/* A row like the exam's options: picked = filled bubble; right = tinted row
   with a mark chip; wrong pick = danger row with the mark in danger. */
.review-option,
.review-typed {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) 14px;
  align-items: center;
  min-height: 56px;
  margin: 0;
  padding: var(--ge-space-2) 14px var(--ge-space-2) 10px;
  border: 2px solid var(--ge-line);
  border-radius: 16px;
  background: var(--ge-surface);
  list-style: none;
}

.review-option .bubble {
  width: 36px;
  height: 36px;
  font-size: var(--ge-text-base);
}

.review-option .option-body {
  flex: 1 1 6rem;
  font-size: var(--ge-text-xl);
  font-weight: 600;
  line-height: 1.4;
}

.review-option[data-picked="true"] .bubble {
  border-color: var(--ge-brand);
  background: var(--ge-brand);
  color: var(--ge-on-brand);
}

.review-mark {
  margin-left: auto;
  font-size: var(--ge-text-sm);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.review-option[data-correct="true"],
.review-fill-in[data-correct="true"] .review-typed {
  border-color: var(--ge-brand);
  background: var(--ge-brand-soft);
}

.review-option[data-correct="true"] .review-mark,
.review-fill-in[data-correct="true"] .review-typed .review-mark {
  padding: 3px 10px;
  border-radius: var(--ge-r-pill);
  background: var(--ge-surface);
  color: var(--ge-brand-strong);
}

.review-option[data-picked="true"][data-correct="false"],
.review-fill-in[data-correct="false"] .review-typed {
  border-color: var(--ge-danger);
  background: var(--ge-danger-soft);
}

.review-option[data-picked="true"][data-correct="false"] .review-mark,
.review-fill-in[data-correct="false"] .review-typed .review-mark {
  color: var(--ge-danger);
}

.review-fill-in {
  margin: 0;
}

.review-typed {
  margin: 0 0 var(--ge-space-3);
  padding-left: 14px;
}

.typed-text {
  flex: 1 1 6rem;
  font-size: var(--ge-text-xl);
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* 13. Teacher: exams list */

#import-link::before,
#new-exam::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
}

#import-link::before {
  -webkit-mask: var(--ge-i-upload) center / contain no-repeat;
  mask: var(--ge-i-upload) center / contain no-repeat;
}

#new-exam::before {
  -webkit-mask: var(--ge-i-plus) center / contain no-repeat;
  mask: var(--ge-i-plus) center / contain no-repeat;
}

#exams td:first-child {
  min-width: 220px;
}

#exams td:first-child a {
  color: var(--ge-ink);
  font-size: var(--ge-text-md);
  font-weight: 700;
  text-decoration-color: var(--ge-line);
  text-decoration-thickness: 1.5px;
}

#exams td:first-child a:hover {
  color: var(--ge-brand-strong);
  text-decoration-color: currentColor;
}

#exams td.code {
  font-family: var(--ge-font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

#exams td.owner {
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
}

#exams td:nth-last-child(4) {
  white-space: nowrap;
}

#exams small.schedule {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 6px;
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#exams small.schedule::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.175em;
  background: var(--ge-gold-ink);
  -webkit-mask: var(--ge-i-clock) center / contain no-repeat;
  mask: var(--ge-i-clock) center / contain no-repeat;
}

/* Questions and Attempts. */
#exams th:nth-last-child(3),
#exams th:nth-last-child(2),
#exams td:nth-last-child(3),
#exams td:nth-last-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#exams td:nth-last-child(3),
#exams td:nth-last-child(2) {
  font-size: var(--ge-text-md);
  font-weight: 600;
}

/* A row's Open or Close and Results stay on one line on a wide screen. */
#exams th:last-child,
#exams td.row-actions {
  text-align: right;
  white-space: nowrap;
}

#exams td.row-actions form {
  margin: 0 var(--ge-space-2) 0 0;
  vertical-align: middle;
}

#exams td.row-actions a {
  margin-left: var(--ge-space-2);
  font-weight: 700;
  vertical-align: middle;
}

.list-filter {
  margin: 0 var(--ge-space-1);
  text-align: right;
}

.list-filter a,
.exams-page > .empty a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  font-weight: 700;
}

.exams-page > .empty {
  margin: 0 0 var(--ge-space-4);
  padding: var(--ge-space-6) var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
  text-align: center;
}

.import {
  margin: var(--ge-space-7) 0 0;
  padding: 28px;
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

/* "Import from file" jumps here; the outline shows where it landed. */
#import:target {
  outline: 3px solid var(--ge-brand);
  outline-offset: var(--ge-space-2);
}

.import h2 {
  margin: 0;
}

.import-lede {
  margin: 6px 0 20px;
  color: var(--ge-muted);
}

.import label {
  font-weight: 700;
}

/* The drop area: the upload icon on a marigold tile, the file input, then
   Import exam. The tile is ::before, its icon ::after on top of it. */
.upload-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3) 18px;
  align-items: center;
  padding: 20px;
  border: 2px dashed var(--ge-edge);
  border-radius: var(--ge-r-lg);
  background: var(--ge-bg);
}

.upload-row::before {
  content: "";
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--ge-gold-soft);
}

.upload-row::after {
  content: "";
  position: absolute;
  top: 33px;
  left: 33px;
  width: 26px;
  height: 26px;
  background: var(--ge-gold-ink);
  -webkit-mask: var(--ge-i-upload) center / contain no-repeat;
  mask: var(--ge-i-upload) center / contain no-repeat;
}

.upload-row input[type="file"] {
  flex: 1 1 14rem;
  width: auto;
  min-width: 0;
  margin: 0;
}

/* The format fold sits inside the import card, under a rule. */
.import .format-help {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--ge-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.format-help pre {
  border: 1px solid var(--ge-line);
  font-size: var(--ge-text-sm);
}

.format-help ul {
  margin-bottom: var(--ge-space-2);
}

@media (min-width: 641px) {
  .exams-page .page-head h1 {
    font-size: 2.5rem;
  }

  /* The title and the status take the free width; every other column is as
     wide as its content. */
  #exams th:not(:first-child, :nth-last-child(4)),
  #exams td:not(:first-child, :nth-last-child(4)) {
    width: 1%;
  }

  /* An email is one line, never broken inside a word. A long one ends in an
     ellipsis; the cell's title holds it whole. */
  #exams td.owner {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A schedule line may wrap between its words when the table is short of
     room; the status column keeps room for the label and the date. */
  #exams td:nth-last-child(4) {
    min-width: 11rem;
  }

  #exams small.schedule {
    white-space: normal;
  }
}

/* Phones: each exam is a card. Title; code and status on one line; owner;
   then the actions. Questions and Attempts are on the exam page. */
@media (max-width: 640px) {
  .exams-page .overflow-auto {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #exams,
  #exams tbody {
    display: block;
  }

  .overflow-auto #exams {
    background: transparent;
  }

  #exams thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    white-space: nowrap;
  }

  #exams tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ge-space-2) var(--ge-space-3);
    margin-bottom: var(--ge-space-3);
    padding: var(--ge-space-4);
    border: 1px solid var(--ge-line);
    border-radius: var(--ge-r-lg);
    background: var(--ge-surface);
    box-shadow: var(--ge-shadow);
  }

  #exams tbody tr:hover td {
    background: none;
  }

  #exams td {
    display: block;
    flex: 1 1 100%;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  #exams td:first-child {
    order: 1;
  }

  #exams td.code {
    flex: 0 0 auto;
    order: 2;
  }

  #exams td:nth-last-child(4) {
    flex: 1 1 auto;
    order: 3;
  }

  #exams td.owner {
    order: 4;
    overflow-wrap: anywhere;
  }

  #exams td:nth-last-child(2),
  #exams td:nth-last-child(3) {
    display: none;
  }

  #exams td.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ge-space-2);
    order: 5;
    text-align: left;
    white-space: normal;
  }

  #exams td.row-actions form {
    margin: 0;
  }

  #exams td.row-actions a {
    margin-left: 0;
  }

  #exams td.row-actions form + a {
    margin-left: var(--ge-space-1);
  }

  .import {
    padding: var(--ge-space-4);
  }
}

/* 14. Teacher: exam page, projector */

.exam-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3);
  align-items: center;
  margin-bottom: var(--ge-space-4);
}

.exam-head h1 {
  margin: 0;
}

.exam-detail .exam-head h1 {
  font-size: 2.25rem;
}

.exam-detail .exam-head .badge {
  min-height: 32px;
  font-size: 1rem;
}

.exam-detail > .frozen-notice {
  margin-bottom: var(--ge-space-4);
}

/* The live band: what students can do right now beside the code board. */
.exam-live {
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
  border-radius: var(--ge-r-xl);
  box-shadow: var(--ge-shadow);
}

.exam-live > * {
  min-width: 0;
}

.exam-state {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--ge-line);
  border-right: 0;
  border-radius: var(--ge-r-xl) 0 0 var(--ge-r-xl);
  background: var(--ge-surface);
}

.exam-state > * {
  margin: 0;
}

.state-label {
  color: var(--ge-muted);
  font-family: var(--ge-font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0;
}

.state-now {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ge-ink);
  font-family: var(--ge-font-display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
}

/* A ring while students cannot join; a filled dot with a halo when they can. */
.state-now::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--ge-muted);
}

.state-now[data-open="true"] {
  color: var(--ge-brand-strong);
}

.state-now[data-open="true"]::before {
  background: var(--ge-brand);
  box-shadow: 0 0 0 5px var(--ge-brand-soft);
}

.state-explain {
  color: var(--ge-muted);
}

.exam-state .exam-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.exam-actions form {
  margin: 0;
}

.exam-actions button {
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  font-size: 1.125rem;
}

.exam-actions form[action$="/open"] button::before,
.exam-actions form[action$="/close"] button::before,
#copy-link::before,
#projector-link::before,
.results-entry > a::before,
#edit-link::before,
#history-link::before,
#download-link::before,
#copy-form button::before,
#archive-link::before,
.replace .frozen-notice::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
}

.exam-actions form[action$="/open"] button::before {
  -webkit-mask: var(--ge-i-play) center / contain no-repeat;
  mask: var(--ge-i-play) center / contain no-repeat;
}

.exam-actions form[action$="/close"] button::before {
  -webkit-mask: var(--ge-i-stop) center / contain no-repeat;
  mask: var(--ge-i-stop) center / contain no-repeat;
}

/* The code board. */
.exam-board {
  padding: 28px 32px;
}

.join h2 {
  margin: 0 0 14px;
  color: var(--ge-chalk-muted);
  font-family: var(--ge-font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* Six chalk tiles. They stay inline boxes, so the element's text is the
   plain code, and shrink with the line so all six fit from 360 px. */
.exam-code {
  --tile-gap: clamp(6px, 1.6vw, 12px);
  margin: 0 0 20px;
  font-family: var(--ge-font-mono);
  font-size: clamp(1.75rem, 9vw, 4rem);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.exam-code span {
  display: inline-grid;
  place-items: center;
  width: min(88px, calc((100% - 5 * var(--tile-gap)) / 6));
  aspect-ratio: 88 / 104;
  margin-right: var(--tile-gap);
  border-radius: 14px;
  background: var(--ge-chalk);
  color: var(--ge-board);
  box-shadow: 0 4px 0 var(--ge-tile-shadow);
  vertical-align: top;
}

.exam-code span:last-child {
  margin-right: 0;
}

.student-link {
  margin: 0 0 16px;
  color: var(--ge-chalk-muted);
  font-size: 0.9375rem;
}

.student-link a {
  color: var(--ge-chalk);
  font-family: var(--ge-font-mono);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.join-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0;
}

#copy-link::before {
  -webkit-mask: var(--ge-i-copy) center / contain no-repeat;
  mask: var(--ge-i-copy) center / contain no-repeat;
}

#projector-link::before {
  -webkit-mask: var(--ge-i-screen) center / contain no-repeat;
  mask: var(--ge-i-screen) center / contain no-repeat;
}

.copy-status {
  color: var(--ge-chalk);
  font-weight: 700;
}

.join-note {
  margin: 14px 0 0;
  color: var(--ge-chalk-muted);
}

/* Results with the attempt counts, then the quiet links. */
.exam-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 20px 0 36px;
}

/* One outlined block that is a link as a whole: the link's ::after covers
   it, so a click on the counts opens the results too. */
.results-entry {
  position: relative;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  min-height: 56px;
  padding: 0 18px;
  border: 2px solid var(--ge-brand);
  border-radius: 16px;
  background: var(--ge-surface);
}

.results-entry:hover {
  background: var(--ge-brand-soft);
}

.results-entry > a.button,
.results-entry > a.button:hover {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ge-brand);
  font-size: 1.125rem;
}

.results-entry:hover > a.button {
  color: var(--ge-brand-strong);
}

.results-entry > a::before {
  -webkit-mask: var(--ge-i-chart) center / contain no-repeat;
  mask: var(--ge-i-chart) center / contain no-repeat;
}

.results-entry > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

/* The ring goes round the whole block, the link's real target. */
.results-entry > a:focus-visible {
  outline: 0;
}

.results-entry:has(> a:focus-visible) {
  outline: 3px solid var(--ge-focus);
  outline-offset: 3px;
}

.attempt-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin: 0;
  color: var(--ge-muted);
}

.count-total {
  padding: 2px 10px;
  border-radius: var(--ge-r-pill);
  background: var(--ge-brand-soft);
  color: var(--ge-brand-strong);
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.count {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--ge-ink);
  font-size: 0.9375rem;
  white-space: nowrap;
}

.count::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
}

.count-live::before {
  background: var(--ge-gold-ink);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.count-done::before {
  border-radius: 50%;
  background: var(--ge-brand);
}

.count-out::before {
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--ge-closed-ink);
}

#edit-link,
#history-link {
  min-height: 56px;
  font-size: 1.125rem;
}

#edit-link::before {
  -webkit-mask: var(--ge-i-pencil) center / contain no-repeat;
  mask: var(--ge-i-pencil) center / contain no-repeat;
}

#history-link::before {
  -webkit-mask: var(--ge-i-history) center / contain no-repeat;
  mask: var(--ge-i-history) center / contain no-repeat;
}

/* Side cards (schedule, settings, more actions) beside the preview. */
.exam-cols {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

.exam-cols > * {
  min-width: 0;
}

.exam-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.exam-side > section {
  padding: 22px var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

.exam-side > section > :last-child {
  margin-bottom: 0;
}

.exam-side h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

#schedule-times {
  margin-bottom: var(--ge-space-2);
  color: var(--ge-muted);
}

#schedule-details {
  margin-bottom: 0;
}

#schedule-form {
  margin-top: var(--ge-space-2);
}

.schedule-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--ge-space-4);
}

.schedule-fields label {
  flex: 0 1 16rem;
  min-width: 0;
}

#schedule-form button {
  margin-bottom: var(--ge-space-3);
}

.more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 0 -12px;
}

.more-actions form {
  margin: 0;
}

#download-link,
#archive-link {
  gap: var(--ge-space-2);
}

#download-link::before {
  -webkit-mask: var(--ge-i-download) center / contain no-repeat;
  mask: var(--ge-i-download) center / contain no-repeat;
}

#copy-form button::before {
  -webkit-mask: var(--ge-i-copy) center / contain no-repeat;
  mask: var(--ge-i-copy) center / contain no-repeat;
}

#archive-link::before {
  -webkit-mask: var(--ge-i-archive) center / contain no-repeat;
  mask: var(--ge-i-archive) center / contain no-repeat;
}

.replace {
  margin-top: 18px;
}

.replace h3 {
  margin: 0 0 var(--ge-space-2);
  font-family: var(--ge-font-ui);
  font-size: 1rem;
  letter-spacing: 0;
}

.replace .frozen-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
}

.replace .frozen-notice::before {
  margin-top: 0.2em;
  -webkit-mask: var(--ge-i-lock) center / contain no-repeat;
  mask: var(--ge-i-lock) center / contain no-repeat;
}

.exam-preview h2 {
  margin: 0;
  font-size: 1.5rem;
}

.preview-lede {
  margin: 4px 0 16px;
  color: var(--ge-muted);
}

/* Projector: the board fills the window under the header. */
.brand-header:has(> .quiet) {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--ge-space-4);
  align-items: center;
  justify-content: space-between;
}

.projector {
  display: flex;
  flex-direction: column;
  gap: var(--ge-space-6);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - 69px);
  padding: var(--ge-space-7) var(--ge-space-4);
  text-align: center;
}

.projector > * {
  max-width: 100%;
  margin: 0;
}

.projector-title {
  font-size: 2.25rem;
  overflow-wrap: anywhere;
}

.projector-step {
  font-size: clamp(1.25rem, 3vw, 2.5rem);
  line-height: 1.3;
}

.projector-host {
  color: var(--ge-chalk);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.projector-code {
  --tile-gap: clamp(6px, 2vw, 28px);
  width: 100%;
  max-width: 92vw;
  font-size: clamp(4rem, 13vw, 13rem);
}

.projector-code span {
  width: min(16vw, calc((100% - 5 * var(--tile-gap)) / 6));
}

.projector-link {
  color: var(--ge-chalk-muted);
  overflow-wrap: anywhere;
}

@media (max-width: 992px) {
  .exam-live,
  .exam-cols {
    grid-template-columns: 1fr;
  }

  .exam-state {
    border-right: 1px solid var(--ge-line);
    border-bottom: 0;
    border-radius: var(--ge-r-xl) var(--ge-r-xl) 0 0;
  }
}

@media (max-width: 640px) {
  .exam-detail .exam-head h1 {
    font-size: 1.75rem;
  }

  .exam-state {
    padding: 20px;
  }

  .exam-board {
    padding: 20px;
  }

  .exam-links {
    flex-direction: column;
    align-items: stretch;
  }

  .results-entry {
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 10px 18px;
  }

  .attempt-counts {
    flex-basis: 100%;
  }

  .exam-side > section {
    padding: var(--ge-space-4);
  }
}

/* 15. Teacher: results, attempt */

/* The page head: "RESULTS" sits right above the exam title. */
.attempts-page .eyebrow {
  margin: 0 0 var(--ge-space-1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* One wrapping row: the name filter on the left, Export CSV on the right. */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3) var(--ge-space-5);
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.name-filter {
  display: flex;
  flex: 1 1 20rem;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: 0;
}

.name-filter input[type="search"] {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
  max-width: 18rem;
  margin: 0;
}

.name-filter button {
  flex: none;
}

#filter-clear {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  font-weight: 700;
}

#export-csv::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-download) center / contain no-repeat;
  mask: var(--ge-i-download) center / contain no-repeat;
}

/* Shown by results.js only: a brand dot, then the sentence. */
.live-note {
  display: flex;
  gap: var(--ge-space-2);
  align-items: center;
  margin: 0 0 var(--ge-space-2);
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
}

.live-note::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ge-brand);
}

.counts {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#results-live .zone-note {
  margin-bottom: var(--ge-space-3);
}

/* Dense attempts table: compact cells so the nine columns and the section
   columns fit the page column. Times and scores never break mid-value, the
   two-word headers may break, section titles wrap at 10rem. */
#attempts th,
#attempts td {
  padding: var(--ge-space-3) var(--ge-space-2);
}

#attempts th:first-child,
#attempts td:first-child {
  padding-left: var(--ge-space-4);
}

#attempts th:last-child,
#attempts td:last-child {
  padding-right: var(--ge-space-4);
}

#attempts td {
  font-size: var(--ge-text-sm);
}

#attempts td.numeric {
  white-space: nowrap;
}

#attempts th.wrap {
  white-space: normal;
}

#attempts th.section-score {
  max-width: 10rem;
}

#attempts th[aria-sort] {
  color: var(--ge-ink);
}

#attempts .sort-link {
  display: inline-flex;
  gap: var(--ge-space-1);
  align-items: center;
  min-height: var(--ge-touch);
  color: var(--ge-ink);
  font-weight: 700;
}

/* View and Delete side by side in every row. */
#attempts td.row-actions {
  white-space: nowrap;
}

#attempts td.row-actions a {
  margin-right: var(--ge-space-3);
  font-weight: 700;
}

#attempts td.row-actions a:last-child {
  margin-right: 0;
}

code.resume-code {
  padding: 2px var(--ge-space-2);
  border-radius: var(--ge-r-sm);
  background: var(--ge-sunken);
  font-family: var(--ge-font-mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

#attempts td.flags:not([data-flags="0"]) {
  color: var(--ge-gold-ink);
  font-weight: 800;
}

/* No attempts yet, or none match the filter: a card with a centred line. */
.attempts-page .empty {
  margin: 0;
  padding: var(--ge-space-6) var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
  color: var(--ge-muted);
  text-align: center;
}

#no-match {
  margin-top: var(--ge-space-4);
}

/* Phone: Started and Finished are left out (the attempt page has both) and
   the name stays in place while the other columns scroll. Separate borders
   move with the pinned cell; collapsed ones stay behind. */
@media (max-width: 640px) {
  #attempts {
    border-collapse: separate;
  }

  #attempts th:nth-child(2),
  #attempts th:nth-child(3),
  #attempts td:nth-child(2),
  #attempts td:nth-child(3) {
    display: none;
  }

  #attempts th:first-child,
  #attempts td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    max-width: 9rem;
    border-right: 1px solid var(--ge-line);
    background: var(--ge-surface);
  }

  #attempts th:first-child {
    background: var(--ge-sunken);
  }
}

/* The attempt page: the student's name and its chip, as on the exam page. */
.attempt-detail .exam-head h1 {
  font-size: var(--ge-text-3xl);
}

.attempt-detail .exam-head .badge {
  font-size: var(--ge-text-base);
}

/* The summary in a card of settings rows. */
dl.attempt-summary {
  max-width: 520px;
  margin-bottom: var(--ge-space-3);
  padding: var(--ge-space-2) var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

/* The label above; the box and Rename on one row. */
.rename-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: var(--ge-space-5) 0;
}

.rename-form label {
  flex: 0 0 100%;
  margin: 0;
  font-weight: 700;
}

.rename-form input[type="text"] {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
  max-width: 24rem;
  margin: 0;
}

.rename-form button {
  flex: none;
}

#events td {
  font-size: 0.9375rem;
}

.answers-heading {
  margin: var(--ge-space-6) 0 var(--ge-space-4);
}

.detail-question {
  margin-bottom: var(--ge-space-5);
}

/* The options in one column, the picked one with a heavier border; a wrong
   pick in the danger colours. */
ol.detail-options {
  grid-template-columns: minmax(0, 1fr);
}

.detail-options li[data-picked="true"] {
  border-width: 2px;
}

.detail-options li[data-picked="true"][data-correct="false"] {
  border-color: var(--ge-danger);
  background: var(--ge-danger-soft);
}

.option-marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: 0 0 0 auto;
}

.option-marks .correct-mark {
  margin-left: 0;
}

.pick-mark {
  font-size: var(--ge-text-sm);
  font-weight: 700;
  white-space: nowrap;
}

.detail-options li[data-correct="false"] .pick-mark {
  color: var(--ge-danger);
}

/* A fill-in answer with its marks and the teacher's mark buttons, in the
   right and wrong colours of the option list. */
.detail-fill-in {
  margin: var(--ge-space-4) 0 0;
}

.typed-answer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: 0 0 var(--ge-space-3);
  padding: var(--ge-space-2) var(--ge-space-3);
  border: 2px solid var(--ge-danger);
  border-radius: var(--ge-r-md);
  background: var(--ge-danger-soft);
}

.detail-fill-in[data-correct="true"] .typed-answer {
  border-color: var(--ge-brand);
  background: var(--ge-brand-soft);
}

.typed-text {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.auto-mark,
.override-mark {
  margin: var(--ge-space-1) 0 0;
  font-size: var(--ge-text-sm);
  font-weight: 700;
}

.auto-mark[data-auto="true"],
.override-mark[data-override="true"] {
  color: var(--ge-brand-strong);
}

.auto-mark[data-auto="false"],
.override-mark[data-override="false"] {
  color: var(--ge-danger);
}

.override-mark time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* "Mark this answer:" then the mark buttons, on one wrapping row. */
.override-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: var(--ge-space-3) 0 0;
}

.override-label {
  color: var(--ge-muted);
  font-size: var(--ge-text-sm);
  font-weight: 700;
}

/* 16. Teacher: editor */

/* Editor list: the head holds the one primary, Add question, with a plus. */
#add-question::before {
  content: "";
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  -webkit-mask: var(--ge-i-plus) center / contain no-repeat;
  mask: var(--ge-i-plus) center / contain no-repeat;
}

/* The revision note sits right under the head. */
.editor-page > .zone-note {
  margin: calc(-1 * var(--ge-space-3)) var(--ge-space-1) 20px;
}

/* The quiet actions under a section's title and instructions; the negative
   margin lines their text up with the title. */
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--ge-space-2);
  margin: var(--ge-space-2) 0 0 calc(-1 * var(--ge-space-3));
}

.editor-page .preview-question {
  margin-bottom: 14px;
}

/* Each card ends in one action row. Edit leads, the quiet actions follow,
   Remove sits at the row's end. */
.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2);
  align-items: center;
  margin-top: var(--ge-space-4);
  padding-top: var(--ge-space-4);
  border-top: 1px solid var(--ge-line);
}

.question-actions form {
  margin: 0;
}

.question-actions .remove-question {
  margin-left: auto;
}

.list-end {
  margin: 20px 0 0;
}

/* Forms: the fields in one card. The section form has no wrapper around its
   fields, so the form itself is the card. */
.question-fields,
.settings-fields,
#section-form {
  padding: var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

:is(.question-fields, .settings-fields, #section-form) label {
  margin-bottom: 6px;
  font-weight: 700;
}

:is(.question-fields, .settings-fields, #section-form) label > :is(input, select) {
  margin-top: 6px;
}

/* The help folds away inside the card: flat, the card's last part. */
:is(.question-fields, #section-form) .format-help {
  margin: 0;
  box-shadow: none;
}

#question-text {
  min-height: 9rem;
}

/* Settings: two columns from 641 px, the title and Monitor across both. */
.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--ge-space-5);
}

.settings-fields .settings-title,
.settings-fields .settings-monitor {
  grid-column: 1 / -1;
}

.settings-monitor {
  display: flex;
  align-items: center;
  min-height: var(--ge-touch);
  margin: 0;
}

/* The kind: a muted label, the kind itself, then the switch. */
.question-kind {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: 0 0 var(--ge-space-4);
}

.kind-label {
  color: var(--ge-muted);
}

.question-kind strong {
  font-weight: 800;
}

.option-list legend,
.answer-list legend {
  font-size: var(--ge-text-md);
  font-weight: 700;
}

/* The rows share one set of columns, so every text box has the same width
   whichever buttons its row holds. */
.option-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin: var(--ge-space-2) 0 0;
}

/* Correct radio, the text box taking the free width, then the quiet buttons. */
.option-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: start;
  padding: var(--ge-space-3) 0;
  border-top: 1px solid var(--ge-line);
}

.option-row .option-correct {
  display: inline-flex;
  gap: var(--ge-space-2);
  align-items: center;
  min-height: var(--ge-touch);
  margin: 0;
}

.option-row .option-correct input {
  margin: 0;
}

.option-row textarea {
  margin: 0;
}

.option-buttons {
  display: flex;
  gap: var(--ge-space-1);
  justify-content: flex-end;
}

.option-add,
.answer-add {
  margin: var(--ge-space-3) 0 var(--ge-space-5);
}

.answer-list {
  margin: var(--ge-space-2) 0 var(--ge-space-5);
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  padding: var(--ge-space-3) 0;
  border-top: 1px solid var(--ge-line);
}

.answer-row input {
  margin: 0;
}

.answer-list .answer-add {
  margin-bottom: var(--ge-space-3);
}

.answer-list small,
#question-image-note,
#section-image-note {
  font-size: var(--ge-text-sm);
}

.answer-list small {
  margin: var(--ge-space-3) 0 0;
}

/* A notice: the image did not survive a refused save. */
.image-dropped {
  margin: 0 0 var(--ge-space-4);
  padding: var(--ge-space-3) var(--ge-space-4);
  border-left: 6px solid var(--ge-gold);
  border-radius: var(--ge-r-md);
  background: var(--ge-gold-soft);
  color: var(--ge-ink);
  font-weight: 600;
}

/* The save row: the form's primary button and Cancel. */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-2) var(--ge-space-3);
  align-items: center;
  margin: 20px 0 0;
}

/* From 641 px it stays in view at the bottom of a long form, as an opaque
   band; not below, where the on-screen keyboard is. The scroll padding keeps
   the focused control above the band. */
@media (min-width: 641px) {
  html:has(.form-actions) {
    scroll-padding-bottom: 96px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: var(--ge-space-3) 0;
    border-top: 1px solid var(--ge-line);
    background: var(--ge-bg);
  }

  /* Inside the section card the band is the card's colour, edge to edge,
     and closes the card. */
  #section-form {
    padding-bottom: 0;
  }

  #section-form .form-actions {
    margin-inline: calc(-1 * var(--ge-space-5));
    padding: var(--ge-space-3) var(--ge-space-5) 20px;
    border-radius: 0 0 var(--ge-r-lg) var(--ge-r-lg);
    background: var(--ge-surface);
  }
}

@media (max-width: 640px) {
  .question-fields,
  .settings-fields,
  #section-form {
    padding: var(--ge-space-4);
  }

  /* Remove starts its own line once the row wraps. */
  .question-actions::after {
    content: "";
    flex-basis: 100%;
  }

  .question-actions .remove-question {
    order: 1;
    margin-left: 0;
  }

  .settings-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The radio on its own line, the text box across the card, the buttons
     under it. */
  .option-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .option-buttons {
    justify-content: flex-start;
    margin-left: calc(-1 * var(--ge-space-3));
  }

  .answer-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .answer-row button {
    justify-self: start;
  }
}

/* 17. Teacher: confirm, teachers, history, revision */

/* Confirmation page: one card on the page background with the question, what
   follows from it in muted notes, the question a removal takes away, then
   the confirm button and Cancel. */
main.confirm {
  width: calc(100% - 2 * var(--ge-space-5));
  margin: 40px auto var(--ge-space-7);
  padding: 28px;
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-xl);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

.confirm h1 {
  font-size: 1.75rem;
}

.confirm-question {
  margin-bottom: var(--ge-space-2);
  font-size: var(--ge-text-xl);
  font-weight: 700;
}

.confirm-note {
  margin-bottom: var(--ge-space-2);
  color: var(--ge-muted);
}

.confirm .preview-question {
  margin: var(--ge-space-5) 0 0;
  box-shadow: none;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3);
  align-items: center;
  margin-top: var(--ge-space-5);
}

.confirm-actions form {
  margin: 0;
}

/* Teachers: a card with the label above the email box and Add teacher. */
#add-teacher-form {
  margin-bottom: var(--ge-space-5);
  padding: 22px var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

#add-teacher-form label {
  margin-bottom: var(--ge-space-2);
  font-weight: 700;
}

.add-teacher-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ge-space-3);
  align-items: center;
}

.add-teacher-row input {
  flex: 1 1 16rem;
  max-width: 24rem;
  margin: 0;
}

.add-teacher-row button {
  flex: none;
}

/* Admin is a label, not a status: no marker. */
#teachers .badge::before {
  content: none;
}

#teachers td:nth-child(3) {
  white-space: nowrap;
}

/* History: the summary takes the free width; the other columns fit their
   content. */
#revisions th:not(:nth-child(4)),
#revisions td:not(:nth-child(4)) {
  width: 1%;
}

#revisions td.numeric {
  white-space: nowrap;
}

#revisions td:last-child a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ge-touch);
  font-weight: 700;
}

/* No revision yet: a notice. */
#no-revision {
  padding: var(--ge-space-3) var(--ge-space-4);
  border-left: 6px solid var(--ge-gold);
  border-radius: var(--ge-r-md);
  background: var(--ge-gold-soft);
  color: var(--ge-ink);
  font-weight: 600;
}

/* Revision: the saved line, the settings in a card, then the previews. */
.revision-page > .zone-note {
  margin: 0 0 var(--ge-space-5);
  font-size: var(--ge-text-base);
}

.revision-page dl.settings {
  max-width: 520px;
  padding: var(--ge-space-2) var(--ge-space-5);
  border: 1px solid var(--ge-line);
  border-radius: var(--ge-r-lg);
  background: var(--ge-surface);
  box-shadow: var(--ge-shadow);
}

@media (max-width: 640px) {
  main.confirm {
    width: calc(100% - 2 * var(--ge-space-4));
    margin-top: var(--ge-space-5);
    padding: 20px;
  }

  .confirm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .confirm-actions button,
  .confirm-actions .button {
    width: 100%;
  }

  #add-teacher-form,
  .revision-page dl.settings {
    padding-inline: var(--ge-space-4);
  }

  .add-teacher-row {
    flex-direction: column;
    align-items: stretch;
  }

  .add-teacher-row input {
    flex: none;
    max-width: none;
  }

  /* The email breaks anywhere but keeps a readable width; the table card
     scrolls sideways instead of the page. */
  #teachers td:first-child {
    min-width: 10rem;
    overflow-wrap: anywhere;
  }

  #revisions td:nth-child(4) {
    min-width: 14rem;
  }
}

/* 18. Motion */

/* Colour changes ease in only for those who have not asked for less motion,
   and the in-page links of / scroll smoothly; nothing else moves. Smooth
   scrolling stays off the other pages: there a script's or a jump link's
   scroll lands at once (the exam page's scroll-position rules rely on it). */
@media (prefers-reduced-motion: no-preference) {
  html:has(#landing) {
    scroll-behavior: smooth;
  }

  a,
  button,
  .button,
  .bubble,
  input,
  select,
  textarea,
  ::file-selector-button {
    transition: background-color var(--ge-transition), border-color var(--ge-transition), color var(--ge-transition);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
