/*
 * Creability Solutions — Career Compass
 *
 * Colour tokens come from /brand.css, which the server generates from
 * src/brand.js. Do not hard-code brand hex values in this file: the PDF reads
 * the same tokens, and the two must never drift apart.
 *
 * Type: Cormorant Garamond for display, Inter for everything else — the pairing
 * used on creabilitysolutions.com. Both are self-hosted in brand/fonts so the
 * test works in a school lab with no internet.
 */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: 'Inter';
  src: url('/brand/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/brand/fonts/cormorant-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/brand/fonts/cormorant-var-italic.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------- foundation */

:root {
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  /* Layered shadows read as real depth; a single flat blur reads as a template. */
  --shadow-sm: 0 1px 2px rgba(16, 35, 59, .05), 0 1px 3px rgba(16, 35, 59, .04);
  --shadow-md: 0 2px 4px rgba(16, 35, 59, .04), 0 8px 20px -6px rgba(16, 35, 59, .10);
  --shadow-lg: 0 4px 8px rgba(16, 35, 59, .04), 0 20px 44px -12px rgba(16, 35, 59, .16);
  --shadow-gold: 0 4px 16px -4px rgba(217, 164, 65, .40);

  --ease: cubic-bezier(.22, .68, .34, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--c-body);
  background: var(--c-cream);
  /* A faint warm wash rather than flat grey — it is a long test to look at. */
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(79, 195, 247, .07), transparent 62%),
    radial-gradient(880px 460px at 92% 4%, rgba(217, 164, 65, .08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /*
   * Force lining figures everywhere.
   *
   * Cormorant Garamond defaults to old-style figures, where "1" is drawn as a
   * short serifed glyph exactly as wide as a capital I — measured, both 33.2px
   * at 100px type. Students read the question counter "16 / 29" as "I6" and
   * asked why there was a letter in it. Worse, the same font sets the question
   * stem, so digits inside a numerical-reasoning item were ambiguous too.
   *
   * lining-nums brings the digits to cap height and full width (the "1" grows
   * to 39.1px, so it can no longer be mistaken for an I). The property is
   * inherited, so one declaration here covers every display-font context,
   * including any added later. Inter is unaffected — its figures are already
   * lining.
   */
  font-variant-numeric: lining-nums;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--c-navy);
  line-height: 1.15;
  margin: 0 0 .4em;
  letter-spacing: -.005em;
}
h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.12rem; font-weight: 600; font-family: var(--font-body); letter-spacing: -.01em; }
p { margin: 0 0 .9em; }
a { color: var(--c-sky-deep); }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 22px; }
.wrap-wide { max-width: 1380px; margin: 0 auto; padding: 0 24px; }
.wrap-landing { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

.muted { color: var(--c-muted); }
.faint { color: var(--c-faint); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; line-height: 1.5; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Small caps label used above headings. */
.eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-gold-deep);
}

.card {
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 34px;
}

/* -------------------------------------------------------------- brand mark */

.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark .tile {
  width: 42px; height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--c-navy-deep);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.brandmark .tile img { width: 78%; height: 78%; object-fit: contain; display: block; }
.brandmark .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--c-navy);
  line-height: 1.1;
}
.brandmark .sub {
  font-size: .66rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--c-gold-deep);
  font-weight: 600;
}
.brandmark.on-dark .name { color: #fff; }
.brandmark.on-dark .sub { color: var(--c-gold-light); }
.brandmark.on-dark .tile { background: #fff; }

/* --------------------------------------------------------------- controls */

button, .btn {
  font: inherit;
  font-weight: 600;
  font-size: .96rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 12px 22px;
  cursor: pointer;
  background: var(--c-navy);
  color: #fff;
  transition: background .16s var(--ease), transform .12s var(--ease), box-shadow .16s var(--ease);
  box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--c-navy-soft); box-shadow: var(--shadow-md); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

button.gold { background: var(--c-gold); color: var(--c-navy-deep); box-shadow: var(--shadow-gold); }
button.gold:hover { background: var(--c-gold-light); }
button.secondary { background: #fff; color: var(--c-navy); border-color: var(--c-rule); box-shadow: none; }
button.secondary:hover { background: var(--c-sand); }
button.ghost { background: transparent; color: var(--c-sky-deep); box-shadow: none; padding: 7px 12px; }
button.ghost:hover { background: var(--c-sky-mist); }
button.danger { background: var(--c-danger); }
button.small-btn { padding: 7px 14px; font-size: .84rem; }
button.big { width: 100%; padding: 17px; font-size: 1.05rem; }

:focus-visible {
  outline: 3px solid var(--c-sky);
  outline-offset: 2px;
  border-radius: 4px;
}

label { display: block; font-size: .82rem; font-weight: 600; color: var(--c-navy); margin-bottom: 6px; }
.req { color: var(--c-danger); font-weight: 700; margin-left: 1px; }

input, select {
  font: inherit;
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--c-sand-deep);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--c-ink);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:hover, select:hover { border-color: var(--c-faint); }
input:focus, select:focus {
  border-color: var(--c-sky-deep);
  box-shadow: 0 0 0 4px var(--c-sky-mist);
  outline: none;
}
input::placeholder { color: #b9bec7; }

.field { margin-bottom: 20px; }
.field .err { color: var(--c-danger); font-size: .79rem; margin-top: 6px; display: none; font-weight: 500; }
.field.invalid input, .field.invalid select { border-color: var(--c-danger); background: var(--c-danger-mist); }
.field.invalid .err { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
/* Class, Section and Roll are all short. Stacking them on a phone added three
   full field heights for no benefit, so they stay side by side. */
@media (max-width: 640px) {
  .grid-3 { gap: 0 10px; }
  /* Narrower columns, so the type comes down with them — otherwise "Class 10"
     is clipped inside a 63px select. */
  .grid-3 input, .grid-3 select { padding: 12px 8px; font-size: .93rem; }
  .grid-3 label { font-size: .75rem; white-space: nowrap; }
}

/* -------------------------------------------------------- subject picker */

/*
 * Spans the full grid width on its own row under the intro and the form (see
 * the grid-column rule further down). Confining it to the 596px left column
 * was tried and is worse: the chip runs wrap far more and the panel grows to
 * 835px. Full width keeps all 28 subjects visible without hiding one.
 */
#subject-picker {
  margin-top: 20px;
  padding: 18px 20px 16px;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.subject-top {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 12px;
}
.subject-top > div { flex: 1; }

/*
 * One full-width column, with the chips themselves flowing across it. Splitting
 * the groups into newspaper columns looked tidier in theory but made each
 * column too narrow for a chip, so every subject dropped onto its own row and
 * the panel grew to 867px. Letting the chips run wide packs the same 28 options
 * into about a third of that.
 */
#subject-groups { margin-top: 4px; }

/* Quick-pick shortcut. It sits above the full list, never replaces it. */
.presets-row {
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--c-rule);
}
.presets-label {
  font-size: .68rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-faint);
  flex: none;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.preset {
  background: #fff;
  color: var(--c-navy);
  border: 1.5px solid var(--c-sand-deep);
  border-radius: var(--r-full);
  padding: 7px 13px;
  font-size: .82rem;
  font-weight: 600;
  box-shadow: none;
}
.preset:hover { background: var(--c-sky-mist); border-color: var(--c-sky); color: var(--c-navy); }
.preset.active {
  background: var(--c-navy);
  border-color: var(--c-navy);
  color: #fff;
}

.subject-chosen {
  font-size: .79rem;
  color: var(--c-muted);
  line-height: 1.45;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-rule);
}
.subject-chosen strong { color: var(--c-navy); }

/* The error lives outside a .field, so it needs its own hidden default —
   without this it was visible before the student had touched anything. */
/* On a phone the panel is a single narrow column, so the chips have to shrink
   to keep three on a row rather than two. */
@media (max-width: 620px) {
  #subject-picker { padding: 16px 14px 14px; }
  .chip { padding: 6px 10px; font-size: .8rem; gap: 5px; }
  .chip .tick { width: 13px; height: 13px; }
  .chips { gap: 5px; }
  .subject-group { margin-bottom: 11px; }
}

#subject-err { display: none; margin-top: 8px; }
#subject-picker.invalid #subject-err { display: block; }
#subject-picker.invalid { border-color: var(--c-danger); background: #fffdfd; }

.subject-group { margin-bottom: 13px; }
.subject-group > .glabel {
  font-size: .65rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-faint);
  margin-bottom: 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/*
 * Above phone width the group name moves into a fixed gutter beside its chips
 * instead of sitting on its own line above them. Stacked, each group cost a
 * label row plus a chip row -- a 78px pitch for 36px of chip. Side by side the
 * pitch drops to ~44px and the panel loses 87px without dropping an option.
 * The gutter is 104px: the two long names ("Mathematics & Computing",
 * "Humanities & Social Sciences") wrap to two lines there, which still clears
 * the 36px chip row, and 104px leaves the chips enough width that no group
 * gains a row from the narrower run.
 */
@media (min-width: 621px) {
  .subject-group {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 8px;
  }
  .subject-group > .glabel {
    flex: 0 0 104px;
    text-align: right;
    margin-bottom: 0;
    line-height: 1.35;
  }
  .subject-group > .chips { flex: 1; }
}

/* Checkbox styled as a chip: faster to scan and to tap than a list of boxes. */
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--c-sand-deep);
  border-radius: var(--r-full);
  background: #fff;
  font-size: .84rem; font-weight: 500;
  color: var(--c-body);
  cursor: pointer;
  user-select: none;
  transition: border-color .14s var(--ease), background .14s var(--ease), color .14s var(--ease);
}
.chip input {
  position: absolute; opacity: 0;
  width: 1px; height: 1px; margin: 0;
}
.chip .tick {
  width: 15px; height: 15px;
  flex: none;
  border-radius: 4px;
  border: 1.5px solid var(--c-sand-deep);
  background: #fff;
  display: grid; place-items: center;
  transition: all .14s var(--ease);
}
.chip .tick svg { width: 10px; height: 10px; stroke: #fff; opacity: 0; transition: opacity .14s var(--ease); }
.chip:hover { border-color: var(--c-sky); background: var(--c-sky-mist); }
.chip:has(input:checked) {
  border-color: var(--c-navy);
  background: var(--c-navy);
  color: #fff;
}
.chip:has(input:checked) .tick { background: var(--c-gold); border-color: var(--c-gold); }
.chip:has(input:checked) .tick svg { opacity: 1; stroke: var(--c-navy-deep); }
.chip:has(input:focus-visible) { outline: 3px solid var(--c-sky); outline-offset: 2px; }

#subject-picker.invalid .chips { outline: 2px solid var(--c-danger); outline-offset: 6px; border-radius: var(--r-sm); }
#subject-picker.invalid .err { display: block; }

/* ----------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge.good { background: var(--c-success-mist); color: var(--c-success); }
.badge.warn { background: var(--c-warn-mist); color: var(--c-warn); }
.badge.bad { background: var(--c-danger-mist); color: var(--c-danger); }
.badge.info { background: var(--c-sky-mist); color: var(--c-sky-deep); }
.badge.neutral { background: var(--c-sand); color: var(--c-muted); }

/* ------------------------------------------------------------- notes/callouts */

.note {
  border-left: 3px solid var(--c-sky-deep);
  background: var(--c-sky-mist);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 14px 18px;
  font-size: .92rem;
}
.note.warn { border-color: var(--c-warn); background: var(--c-warn-mist); }
.note.good { border-color: var(--c-success); background: var(--c-success-mist); }
.note.bad { border-color: var(--c-danger); background: var(--c-danger-mist); }
.note.gold { border-color: var(--c-gold); background: var(--c-gold-mist); }

.checklist { list-style: none; padding: 0; margin: 0 0 20px; }
.checklist li { padding: 9px 0 9px 30px; position: relative; font-size: .94rem; }
.checklist li::before {
  content: "";
  position: absolute; left: 4px; top: 17px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 0 3px var(--c-gold-mist);
}

/* ======================================================== STUDENT: shell */

.site-head {
  background: rgba(252, 250, 246, .88);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--c-rule);
  position: sticky; top: 0; z-index: 40;
}
.site-head-inner {
  max-width: 780px; margin: 0 auto;
  padding: 14px 22px;
  display: flex; align-items: center; gap: 16px;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(252, 250, 246, .93);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--c-rule);
}
.topbar-inner {
  max-width: 820px; margin: 0 auto;
  padding: 12px 22px;
  display: flex; align-items: center; gap: 18px;
}
.topbar .tile { width: 34px; height: 34px; border-radius: 10px; }

.progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: .68rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--c-faint);
}
.progress {
  height: 8px;
  background: var(--c-sand-deep);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress > i {
  display: block; height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-sky-deep), var(--c-sky));
  transition: width .5s var(--ease);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: .95rem;
  color: var(--c-muted);
  min-width: 56px;
  text-align: right;
  padding: 5px 11px;
  border-radius: var(--r-full);
  background: var(--c-sand);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.timer.urgent {
  color: #fff;
  background: var(--c-danger);
  animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: .62; } }

main { padding: 40px 0 90px; }

/* ---------------------------------------------------------------- landing */

/*
 * Two columns so the form is visible without scrolling. The previous stacked
 * layout pushed the first input roughly a screen and a half down the page,
 * behind an intro and eight numbered rules — a student had to read an essay
 * before they could type their name.
 */
.landing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 0 40px;
  align-items: start;
}
/* Explicit placement so the subject panel can span both columns regardless of
   where it sits in the markup. */
.landing-intro { grid-column: 1; grid-row: 1; }
.landing-form { grid-column: 2; grid-row: 1; }
#subject-picker { grid-column: 1 / -1; grid-row: 2; }
/* The landing is a single task, so it does not need the roomy page padding
   the test screens use — that alone was pushing a 768px laptop over a screen. */
#screen-register main { padding: 26px 0 40px; }
@media (max-width: 900px) { #screen-register main { padding: 20px 0 32px; } }
/* Both columns start on the same line: the eyebrow's top edge meets the card's. */
.landing-intro { padding-top: 0; }
.landing-intro .eyebrow { margin-bottom: 6px; }
.landing-intro h1 { font-size: 2.6rem; margin-bottom: .16em; }
.landing-intro .lede {
  font-size: 1.02rem;
  color: var(--c-muted);
  max-width: 42ch;
  margin-bottom: 22px;
}
/* Keeps the form in view while the rules are read. */
.landing-form { position: sticky; top: 88px; }
/*
 * ...but only when nothing sits beneath it. The subject panel spans both
 * columns on row 2, so a pinned form slides straight over its right-hand end:
 * Sociology, Philosophy, Physical Education, Fine Arts, Entrepreneurship and
 * Informatics Practices all ended up under the card, and a click on them hit
 * the start button instead. Class 9 and 10 never render the panel and their
 * page is one screen anyway, so sticky costs them nothing.
 */
.wrap-landing:has(#subject-picker:not(.hidden)) .landing-form { position: static; }
.landing-form .card { padding: 26px 26px 24px; }

@media (max-width: 900px) {
  /*
   * On a phone the two columns stack, and eight rules above the form would push
   * the first input a full screen down again. So the order changes: headline,
   * form, then rules underneath as reference. Nothing is lost by moving them —
   * every section restates its own rules on its intro screen before it starts.
   */
  .landing {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .landing-intro { display: contents; }
  .landing-intro > .eyebrow { order: 1; }
  .landing-intro > h1 { order: 2; font-size: 2.05rem; margin-bottom: .1em; }
  .landing-intro > .lede { order: 3; margin-bottom: 0; }
  .landing-form { order: 4; position: static; }
  #subject-picker { order: 5; margin-top: 0; }
  .rules-strip { order: 6; margin-bottom: 0; }
  .landing-intro > .tiny { order: 7; }
}

/* Status and its toggle side by side; stacks when there is no room. */
.window-row {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.window-row > button { flex: none; }

/* Shown in place of the whole landing grid when the testing window is shut. */
.closed-card {
  grid-column: 1 / -1;
  max-width: 30rem;
  margin: 4vh auto 0;
  padding: 40px 34px 36px;
  text-align: center;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.closed-mark {
  width: 54px; height: 54px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  color: var(--c-gold-deep);
  background: var(--c-gold-mist, #FBF4E4);
  border-radius: 50%;
}
.closed-mark svg { width: 26px; height: 26px; }
.closed-card h1 { font-size: 1.5rem; margin-bottom: .5em; }
.closed-card p { color: var(--c-muted); margin-bottom: 14px; }
.closed-card p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ rules */

/*
 * Only the four rules that change what a student does while taking the test.
 * The rest ("not an exam", "you can resume") are one quiet line underneath, and
 * every section restates its own rules on its intro screen anyway. Eight
 * numbered paragraphs here read as a document to skip past.
 */
.rules-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.rules-strip li {
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-left: 2.5px solid var(--c-gold);
  border-radius: var(--r-sm);
  padding: 10px 13px;
}
.rules-strip b {
  display: block;
  font-size: .85rem;
  font-weight: 650;
  color: var(--c-navy);
  line-height: 1.3;
}
.rules-strip span {
  display: block;
  font-size: .76rem;
  color: var(--c-muted);
  line-height: 1.35;
  margin-top: 1px;
}

@media (max-width: 420px) {
  .rules-strip { grid-template-columns: 1fr; gap: 8px; }
}

/* ------------------------------------------------------------ stepper */

.stepper {
  display: flex; gap: 5px;
  margin-bottom: 26px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.stepper .dot {
  width: 26px; height: 5px;
  border-radius: var(--r-full);
  background: var(--c-sand-deep);
  transition: background .35s var(--ease), width .35s var(--ease);
}
.stepper .dot.done { background: var(--c-gold); }
.stepper .dot.current { background: var(--c-sky-deep); width: 44px; }

/* ------------------------------------------------------------ questions */

.qhead {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.qhead .badge-num {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700;
  color: var(--c-gold-deep);
  background: var(--c-gold-mist);
  border-radius: var(--r-full);
  min-width: 42px; height: 30px;
  display: grid; place-items: center;
  padding: 0 11px;
}
.qhead .qsection {
  font-size: .7rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--c-faint);
}

/* Countdown ring — the per-question clock, on the question itself rather than
   hidden in the header bar. Colour escalates as the time runs down. */
.countdown {
  position: relative;
  width: 44px; height: 44px;
  flex: none;
  display: grid; place-items: center;
}
.countdown svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 3.5; }
.cd-track { stroke: var(--c-sand-deep); }
.cd-value {
  stroke: var(--c-sky-deep);
  stroke-linecap: round;
  /* 2 * pi * r, r = 19 */
  stroke-dasharray: 119.38;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .3s linear, stroke .4s var(--ease);
}
.cd-num {
  position: relative;
  font-size: .84rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-navy);
}
.countdown.low .cd-value { stroke: var(--c-warn); }
.countdown.low .cd-num { color: var(--c-warn); }
.countdown.critical .cd-value { stroke: var(--c-danger); }
.countdown.critical .cd-num { color: var(--c-danger); }
.countdown.critical { animation: pulse 1s infinite; }

/* Speeded block: a whole-block bar reads better than a per-question ring. */
.speed-bar {
  height: 6px;
  background: var(--c-sand-deep);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: 18px;
}
.speed-bar > i {
  display: block; height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-sky-deep), var(--c-sky));
  transition: width .3s linear, background .4s var(--ease);
}
.speed-bar.low > i { background: var(--c-warn); }
.speed-bar.critical > i { background: var(--c-danger); }

.stem {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--c-navy);
  line-height: 1.32;
  margin-bottom: 26px;
  white-space: pre-wrap;
}
@media (max-width: 600px) { .stem { font-size: 1.32rem; } }

.opts { display: grid; gap: 11px; }
.opts.figural { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .opts.figural { grid-template-columns: repeat(2, 1fr); } }

.opt {
  display: flex; align-items: center; gap: 15px;
  width: 100%; text-align: left;
  background: #fff;
  color: var(--c-ink);
  border: 1.5px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-weight: 500;
  font-size: 1.02rem;
  box-shadow: none;
  transition: border-color .14s var(--ease), background .14s var(--ease),
              transform .14s var(--ease), box-shadow .14s var(--ease);
}
.opt:hover {
  border-color: var(--c-sky);
  background: #fff;
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.opt.chosen {
  border-color: var(--c-sky-deep);
  background: var(--c-sky-mist);
  transform: none;
}
.opt .kbd {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--c-sand);
  border: 1px solid var(--c-sand-deep);
  font-size: .8rem; font-weight: 700;
  color: var(--c-muted);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.opt:hover .kbd { background: var(--c-sky-mist); color: var(--c-sky-deep); border-color: var(--c-sky); }
.opt.chosen .kbd { background: var(--c-sky-deep); color: #fff; border-color: var(--c-sky-deep); }
.opts.figural .opt { flex-direction: column; padding: 14px 10px; gap: 10px; }

/* Likert: a colour ramp from disagree to agree reads faster than five identical boxes. */
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
@media (max-width: 660px) { .likert { grid-template-columns: 1fr; } }
.likert .opt {
  flex-direction: column; text-align: center;
  gap: 11px; padding: 20px 10px;
  font-size: .87rem; font-weight: 500;
}
.likert .dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--c-sand-deep);
  background: #fff;
  transition: all .16s var(--ease);
}
.likert .opt:nth-child(1) .dot { border-color: #d9a6a2; }
.likert .opt:nth-child(2) .dot { border-color: #ddc0a0; }
.likert .opt:nth-child(3) .dot { border-color: #cfd2d8; }
.likert .opt:nth-child(4) .dot { border-color: #a8cbb6; }
.likert .opt:nth-child(5) .dot { border-color: #7fb99b; }
.likert .opt.chosen .dot {
  background: var(--c-sky-deep);
  border-color: var(--c-sky-deep);
  box-shadow: inset 0 0 0 4px #fff;
  transform: scale(1.14);
}
@media (max-width: 660px) {
  .likert .opt { flex-direction: row; text-align: left; justify-content: flex-start; }
}

/* Perceptual speed pair */
.pair {
  display: flex; align-items: center; justify-content: center; gap: 30px;
  font-family: ui-monospace, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 2.5rem; font-weight: 700;
  letter-spacing: .2em;
  color: var(--c-navy);
  background: linear-gradient(180deg, var(--c-white), var(--c-sand));
  border: 1px solid var(--c-sand-deep);
  border-radius: var(--r-md);
  padding: 34px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.pair .vs {
  font-size: .82rem; letter-spacing: .1em;
  color: var(--c-faint);
  font-family: var(--font-body);
  text-transform: uppercase;
}
@media (max-width: 600px) { .pair { font-size: 1.6rem; gap: 14px; flex-direction: column; } }
.pair-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair-btns .opt { justify-content: center; font-size: 1.1rem; font-weight: 650; padding: 22px; }

/* Figures */
.figure { width: 100%; height: auto; max-height: 190px; display: block; }
.stimulus {
  background: linear-gradient(180deg, #fff, var(--c-sand));
  border: 1px solid var(--c-sand-deep);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.stimulus .figure { max-height: 215px; }
/* Figure ink. Rounded joins and a single consistent stroke weight are what
   make hand-built diagrams look drawn rather than plotted. */
svg.figure { stroke-linejoin: round; stroke-linecap: round; }

.fig-fill { fill: #3d5182; stroke: #1e2c4d; stroke-width: 1.8; }
.fig-outline { fill: #fff; stroke: #3d5182; stroke-width: 1.8; }
.fig-fold { stroke: var(--c-gold-deep); stroke-width: 1.6; stroke-dasharray: 6 3.5; }
.fig-punch { fill: #fff; stroke: #1e2c4d; stroke-width: 1.6; }

.blk-top { fill: #9fadcd; stroke: #26334f; stroke-width: 1.1; }
.blk-left { fill: #4e5d86; stroke: #26334f; stroke-width: 1.1; }
.blk-right { fill: #6d7da6; stroke: #26334f; stroke-width: 1.1; }

.fig-gear { fill: #b9c3da; stroke: #26334f; stroke-width: 1.5; }
.fig-gear-inner { fill: #d5dcea; stroke: #26334f; stroke-width: 1.2; }
.fig-hole { fill: #fff; stroke: #26334f; stroke-width: 1.2; }
.fig-shaft { stroke: #26334f; stroke-width: 2.2; }

.fig-beam-bar { fill: #4e5d86; stroke: #26334f; stroke-width: 1.2; }
.fig-fulcrum { fill: #8b96b4; stroke: #26334f; stroke-width: 1.4; }
.fig-pivot { fill: #fff; stroke: #26334f; stroke-width: 1.4; }
.fig-ground { stroke: #26334f; stroke-width: 2.4; }
.fig-hatch { stroke: #8b96b4; stroke-width: 1.3; }
.fig-dim { stroke: var(--c-gold-deep); stroke-width: 1.2; }

.fig-weight { fill: #5a6a95; stroke: #26334f; stroke-width: 1.3; }
.fig-rope { stroke: #4a515e; stroke-width: 2; }

.fig-arrow { fill: none; stroke: var(--c-danger); stroke-width: 2.4; }
.fig-arrow-head { fill: var(--c-danger); }
.fig-arrow-label { font: 700 11px var(--font-body); fill: var(--c-danger); }

.fig-label { font: 600 12px var(--font-body); fill: var(--c-ink); }
.fig-label-lg { font: 700 13px var(--font-body); fill: #fff; }
.fig-label-sm { font: 600 10px var(--font-body); fill: var(--c-muted); }

/* Data-interpretation table */
table.stim { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.stim th, table.stim td { border: 1px solid var(--c-sand-deep); padding: 10px 14px; text-align: left; }
table.stim th {
  background: var(--c-navy); color: #fff;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
}
table.stim tr:nth-child(even) td { background: rgba(255, 255, 255, .6); }

/* Entering animation — items should feel like they arrive, not blink in. */
.enter { animation: enter .34s var(--ease) both; }
@keyframes enter {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .enter { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ completion */

.finish-mark {
  width: 86px; height: 86px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--c-success-mist);
  display: grid; place-items: center;
  color: var(--c-success);
  animation: pop .5s var(--ease) both;
}
@keyframes pop {
  0% { transform: scale(.5); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ========================================================= ADMIN panel */

.admin-head {
  background: var(--c-navy-deep);
  background-image:
    radial-gradient(700px 300px at 88% -40%, rgba(79, 195, 247, .18), transparent 60%),
    radial-gradient(420px 240px at 8% 130%, rgba(217, 164, 65, .16), transparent 60%);
  color: #fff;
  padding: 20px 0;
  border-bottom: 3px solid var(--c-gold);
}
.admin-head .wrap-wide { display: flex; align-items: center; gap: 20px; }
.admin-head h1 { color: #fff; margin: 0; font-size: 1.3rem; }
.admin-head .sub { color: #9fb0d0; font-size: .8rem; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--c-rule); margin-bottom: 24px; }
.tabs button {
  background: transparent; color: var(--c-muted);
  border: none; border-bottom: 2.5px solid transparent;
  border-radius: 0; padding: 12px 18px;
  font-weight: 600; font-size: .93rem; box-shadow: none;
}
.tabs button:hover { background: var(--c-sand); color: var(--c-navy); }
.tabs button.active { color: var(--c-navy); border-bottom-color: var(--c-gold); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 15px; margin-bottom: 24px; }
.stat {
  background: #fff;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c-gold);
}
.stat .n {
  font-family: var(--font-display);
  font-size: 2.1rem; font-weight: 700;
  color: var(--c-navy); line-height: 1;
}
.stat .k {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--c-faint); font-weight: 700; margin-top: 6px;
}

.filters { display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filters .field { margin-bottom: 0; min-width: 152px; }
.filters input, .filters select { padding: 9px 12px; font-size: .9rem; }

table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .89rem; }
table.data th {
  text-align: left; padding: 12px 14px;
  background: var(--c-sand);
  border-bottom: 1px solid var(--c-sand-deep);
  font-size: .69rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--c-muted); font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--c-rule); vertical-align: middle; }
table.data tr:hover td { background: var(--c-gold-mist); }
.table-scroll {
  max-height: 62vh; overflow: auto;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.bar-row { display: flex; align-items: center; gap: 13px; margin-bottom: 10px; font-size: .87rem; }
.bar-row .lbl { width: 195px; flex: none; color: var(--c-ink); font-weight: 500; }
.bar-row .track { flex: 1; height: 10px; background: var(--c-sand); border-radius: var(--r-full); overflow: hidden; }
.bar-row .track > i {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-navy-soft), var(--c-sky-deep));
  transition: width .6s var(--ease);
}
.bar-row .val { width: 44px; text-align: right; font-weight: 700; color: var(--c-navy); font-variant-numeric: tabular-nums; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(10, 23, 40, .62);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 26px; z-index: 60;
  animation: enter .2s var(--ease) both;
}
.overlay .card { max-width: 600px; width: 100%; max-height: 88vh; overflow: auto; }
