/* Lex Engineering Lab
 *
 * Design notes
 *   The neutral base stays quiet so the three mode colors carry meaning:
 *   green = Learning, amber = Practice, red = Assessment (from the product spec).
 *   Ultramarine is the one brand accent and never doubles as a mode color.
 *   The signature element is the five-segment mastery gauge, with a visible
 *   break before segment three: the line between "with help" and "alone".
 */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --ink: #131a2a;
  --muted: #566074;
  --line: #d5dae4;
  --accent: #2a47c9;
  --accent-ink: #ffffff;
  --accent-soft: #e4e9fb;
  --gauge-low: #8794bd;

  --learning: #1b7347;
  --learning-soft: #e2f3e9;
  --practice: #8a5800;
  --practice-soft: #fbefd4;
  --assessment: #b0261e;
  --assessment-soft: #fbe5e3;

  --code-bg: #f5f6fa;
  --code-ink: #131a2a;
  --code-active: #eceef5;
  --code-selection: #cfd8fa;
  --code-keyword: #2a47c9;
  --code-string: #1b7347;
  --code-number: #9a4a00;
  --code-comment: #6c7689;
  --code-function: #8a2a6b;
  --code-operator: #566074;
  --code-size: 0.9375rem;

  --font-display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.9531rem;
  --step-4: 2.4414rem;

  --radius: 6px;
  --radius-large: 12px;
  --gutter: 1rem;
  --measure: 44rem;
  --tabbar: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --surface: #161c2c;
    --ink: #e8ecf5;
    --muted: #9ba5ba;
    --line: #2b3348;
    --accent: #93a7ff;
    --accent-ink: #0e1320;
    --accent-soft: #1e2748;
    --gauge-low: #5d6a94;

    --learning: #62cf96;
    --learning-soft: #12301f;
    --practice: #ebb650;
    --practice-soft: #33270b;
    --assessment: #ff8f85;
    --assessment-soft: #3a1614;

    --code-bg: #111727;
    --code-ink: #e8ecf5;
    --code-active: #182036;
    --code-selection: #2c3a6e;
    --code-keyword: #93a7ff;
    --code-string: #7fd9a8;
    --code-number: #f0b46a;
    --code-comment: #717c94;
    --code-function: #e58fcf;
    --code-operator: #9ba5ba;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}
h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
}
h3 {
  font-size: var(--step-1);
}
p {
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--step--1);
}

/* --- page frame ----------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand span {
  color: var(--accent);
}
.topnav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.topnav a,
.linklike {
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: none;
  border: 0;
  cursor: pointer;
}
.topnav a:hover,
.linklike:hover {
  color: var(--ink);
  background: var(--bg);
}
.topnav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: grid;
  place-items: center;
  min-height: var(--tabbar);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.tabbar a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 3px 0 var(--accent);
}

main {
  padding: 1.5rem 0 3rem;
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }
  body {
    padding-bottom: 0;
    font-size: 1.0625rem;
  }
  .topnav {
    display: flex;
  }
  .tabbar {
    display: none;
  }
  main {
    padding-top: 2.5rem;
  }
  h1 {
    font-size: var(--step-4);
  }
}

/* --- buttons and forms ---------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
.button:hover {
  border-color: var(--ink);
}
.button-primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.button-primary:hover {
  filter: brightness(1.08);
  border-color: var(--accent);
}
.button-quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
  font-weight: 500;
}
.button-quiet:hover {
  color: var(--ink);
  border-color: var(--line);
}
.button[disabled],
.button[aria-busy="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

label {
  font-weight: 500;
}
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
textarea {
  min-height: 6rem;
  resize: vertical;
}
.mono-input {
  font-family: var(--font-mono);
  font-size: var(--code-size);
}
.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field-hint {
  font-size: var(--step--1);
  color: var(--muted);
  font-weight: 400;
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.notice-error {
  border-color: var(--assessment);
  background: var(--assessment-soft);
}
.notice-success {
  border-color: var(--learning);
  background: var(--learning-soft);
}
.notice-info {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* --- mastery gauge -------------------------------------------------------- */

.gauge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}
.gauge i {
  width: 1.15rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--line);
}
/* The break before segment three marks the move from "with help" to "alone". */
.gauge i:nth-child(3) {
  margin-left: 5px;
}
.gauge[data-level="1"] i:nth-child(-n + 1),
.gauge[data-level="2"] i:nth-child(-n + 2) {
  background: var(--gauge-low);
}
.gauge[data-level="3"] i:nth-child(-n + 3),
.gauge[data-level="4"] i:nth-child(-n + 4),
.gauge[data-level="5"] i:nth-child(-n + 5) {
  background: var(--accent);
}
.gauge-large i {
  width: 2rem;
  height: 0.8rem;
}
.level-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}
.level-text {
  font-weight: 500;
}

/* --- mode tags ------------------------------------------------------------ */

.mode-tag {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  font-size: var(--step--1);
  font-weight: 600;
  border-radius: 999px;
}
.mode-learning {
  color: var(--learning);
  background: var(--learning-soft);
}
.mode-practice {
  color: var(--practice);
  background: var(--practice-soft);
}
.mode-assessment {
  color: var(--assessment);
  background: var(--assessment-soft);
}

/* --- dashboard ------------------------------------------------------------ */

.dash {
  display: grid;
  gap: 2rem;
}
.next {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius-large);
  padding: 1.5rem 1.25rem;
  display: grid;
  gap: 1rem;
}
.next-lead {
  color: var(--muted);
  font-weight: 500;
}
.next-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.next-target {
  display: grid;
  gap: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  margin: 0;
}
.figures div {
  padding: 1rem;
  min-width: 0;
}
.figures div + div {
  border-left: 1px solid var(--line);
}
.figures dt {
  font-size: var(--step--1);
  color: var(--muted);
}
.figures dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-2);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.figures .figure-note {
  display: block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.25rem;
}

.section-title {
  font-size: var(--step-1);
  margin-bottom: 0.75rem;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.rows > li {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.row-title {
  font-weight: 600;
  color: var(--ink);
}
a.row-title {
  text-decoration: none;
}
a.row-title:hover {
  text-decoration: underline;
}
.empty {
  padding: 1rem 0;
  color: var(--muted);
}

@media (min-width: 62rem) {
  .dash {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
    gap: 2.5rem 3rem;
  }
  .dash-main,
  .dash-side {
    display: grid;
    gap: 2.5rem;
  }
  .next {
    padding: 2rem;
  }
}
@media (max-width: 61.99rem) {
  /* One column on small screens: next step, standing, then the lists. */
  .dash-main,
  .dash-side {
    display: contents;
  }
  .dash-standing {
    order: -1;
  }
  .next {
    order: -2;
  }
}

/* --- tracks and the skill tree -------------------------------------------- */

.page-head {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 2rem;
  max-width: var(--measure);
}
.crumbs {
  font-size: var(--step--1);
  color: var(--muted);
}
.crumbs a {
  color: var(--muted);
}

.split {
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 62rem) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 3rem;
    align-items: start;
  }
}

.tree-group {
  margin-bottom: 1.5rem;
}
.tree-group h3 {
  font-size: var(--step-0);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
}
/* Drawn like the skill map in the spec: a trunk with a branch to each skill. */
.tree {
  list-style: none;
  margin: 0.4rem 0 0 0.45rem;
  padding: 0;
}
.tree li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.5rem;
  border-left: 2px solid var(--line);
}
.tree li:last-child {
  border-left-color: transparent;
}
.tree li::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0;
  width: 1.1rem;
  height: 1.15rem;
  border-left: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  border-bottom-left-radius: 6px;
}
.tree-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem 1rem;
}
.tree-row a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.tree-row a:hover {
  text-decoration: underline;
}
.tree-level {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  color: var(--muted);
  min-width: 13.5rem;
}
.tree-level .level-name {
  min-width: 6.2rem;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.track-list li {
  display: grid;
  gap: 0.3rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.track-number {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.5rem;
}
.planned {
  font-size: var(--step--1);
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  padding: 1.25rem;
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* --- lesson --------------------------------------------------------------- */

.lesson-head {
  max-width: var(--measure);
  margin: 0 auto 2rem;
  display: grid;
  gap: 0.75rem;
}
.lesson-body {
  display: grid;
  gap: 2.5rem;
}
.lesson-body > *,
.dash > *,
.dash-main > *,
.dash-side > *,
.split > *,
.stack > *,
.stack-large > * {
  min-width: 0;
}
.block-text {
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
}
.block-text h2 {
  margin-bottom: 0.75rem;
}

.prose > * + * {
  margin-top: 0.9rem;
}
.prose ul,
.prose ol {
  padding-left: 1.3rem;
  margin-bottom: 0;
}
.prose li + li {
  margin-top: 0.3rem;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.3em;
}
.prose strong {
  font-weight: 600;
}
.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  max-width: 100%;
  font-size: var(--step--1);
}
.prose th,
.prose td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

pre.code,
.output-text,
.test-message {
  font-family: var(--font-mono);
  font-size: var(--code-size);
  line-height: 1.55;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}
pre.code {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
pre.code code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
/* Pygments token classes, mapped onto the same variables the editor uses. */
pre.code .k,
pre.code .kn,
pre.code .kc,
pre.code .kd,
pre.code .ow {
  color: var(--code-keyword);
}
pre.code .s,
pre.code .s1,
pre.code .s2,
pre.code .sa,
pre.code .sd,
pre.code .si,
pre.code .se {
  color: var(--code-string);
}
pre.code .mi,
pre.code .mf {
  color: var(--code-number);
}
pre.code .c,
pre.code .c1 {
  color: var(--code-comment);
  font-style: italic;
}
pre.code .nf,
pre.code .nc,
pre.code .fm {
  color: var(--code-function);
}
pre.code .o {
  color: var(--code-operator);
}

/* --- items ---------------------------------------------------------------- */

.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-width: 4px;
  border-radius: var(--radius-large);
  padding: 1.25rem 1rem;
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
}
.item[data-mode="learning"] {
  border-top-color: var(--learning);
}
.item[data-mode="practice"] {
  border-top-color: var(--practice);
}
.item[data-mode="assessment"] {
  border-top-color: var(--assessment);
}
.item-head {
  display: grid;
  gap: 0.4rem;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  font-size: var(--step--1);
  color: var(--muted);
}
.item-done {
  color: var(--learning);
  font-weight: 600;
}
/* Grid children refuse to shrink below their content by default. Wide code
   blocks would then push a column over its neighbor, so allow shrinking. */
.item > *,
.item-brief > *,
.item-work > * {
  min-width: 0;
}
.item-work {
  display: grid;
  gap: 1rem;
  min-width: 0;
  align-content: start;
}
.item-brief {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}
.editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  min-height: 9rem;
}
.editor .cm-editor {
  min-height: 9rem;
  max-height: 32rem;
}
.editor-plain {
  display: block;
  width: 100%;
  min-height: 12rem;
  border: 0;
  border-radius: 0;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: var(--code-size);
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
}
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.help-field {
  display: grid;
  gap: 0.3rem;
  font-size: var(--step--1);
}
.help-field select {
  max-width: 22rem;
}
.output-label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.output-label-error {
  color: var(--assessment);
  margin-top: 0.75rem;
}
.output-text {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  max-height: 16rem;
  overflow: auto;
}
.output-error {
  border-color: var(--assessment);
  white-space: pre-wrap;
}
.tests {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.test {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.2rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.test-state {
  font-size: var(--step--1);
  font-weight: 600;
}
.test-pass .test-state {
  color: var(--learning);
}
.test-fail .test-state {
  color: var(--assessment);
}
.test-message {
  grid-column: 2;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: var(--step--1);
}
.hint,
.solution {
  border-left: 3px solid var(--practice);
  padding: 0.25rem 0 0.25rem 1rem;
}
.solution {
  border-left-color: var(--accent);
}
.hint + .hint {
  margin-top: 0.75rem;
}
.hint-label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
}
.outcome {
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.3rem;
  border: 1px solid;
}
.outcome-pass {
  border-color: var(--learning);
  background: var(--learning-soft);
}
.outcome-fail {
  border-color: var(--assessment);
  background: var(--assessment-soft);
}
.outcome-title {
  font-weight: 600;
}
.outcome-xp,
.outcome-level {
  font-weight: 600;
}
.outcome-explanation {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
[data-feedback] > .button {
  margin-top: 0.75rem;
}
.choices {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.choices label,
.rubric-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 400;
  cursor: pointer;
}
.choices input,
.rubric-row input {
  margin-top: 0.3rem;
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}
.rubric {
  border: 0;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.rubric legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.5rem;
}

/* On wide screens a coding task uses the room: brief on the left, editor on the right. */
@media (min-width: 68rem) {
  .item-code {
    max-width: none;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    column-gap: 2rem;
    padding: 1.75rem;
  }
  .item-code .item-head {
    grid-column: 1 / -1;
  }
}
@media (min-width: 48rem) {
  .item {
    padding: 1.5rem;
  }
}

.finish {
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1rem;
}

/* --- assessment ----------------------------------------------------------- */

.clock {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.clock .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  min-height: 3rem;
}
.clock-time {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  font-variant-numeric: tabular-nums;
}
.clock-low .clock-time {
  color: var(--assessment);
}
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.steps button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.steps button[data-answered="true"] {
  color: var(--ink);
  border-color: var(--ink);
}
.steps button[aria-current="step"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.step-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: var(--measure);
  margin: 1.5rem auto 0;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
}
.result-table th,
.result-table td {
  text-align: left;
  padding: 0.7rem 0.5rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.result-table th {
  font-size: var(--step--1);
  color: var(--muted);
  font-weight: 500;
}
.state-passed {
  color: var(--learning);
  font-weight: 600;
}
.state-failed,
.state-unanswered,
.state-unchecked {
  color: var(--assessment);
  font-weight: 600;
}

/* --- login and simple pages ----------------------------------------------- */

.narrow {
  max-width: 26rem;
  margin: 0 auto;
}
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-content: center;
  padding: 2rem var(--gutter);
}
.login h1 {
  font-size: var(--step-3);
  margin-bottom: 0.5rem;
}
.login form {
  margin-top: 1.5rem;
}
.login form .notice {
  margin-bottom: 1rem;
}
.account {
  max-width: 32rem;
  margin: 0 auto;
}
.page-head-tight {
  margin-bottom: 0;
}
.editor-loading {
  padding: 0.75rem 1rem;
}
.stack {
  display: grid;
  gap: 1rem;
}
.stack-large {
  display: grid;
  gap: 2.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .topnav a {
    transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
  }
}

/* --- small helpers used by templates -------------------------------------- */

.prose-list {
  margin: 0;
  padding-left: 1.3rem;
}
.prose-list li + li {
  margin-top: 0.4rem;
}
.before-list {
  margin-bottom: 0.75rem;
}
.after-list {
  margin-top: 0.75rem;
}
.level-note {
  margin-top: 0.75rem;
}
.python-status {
  margin-bottom: 0.75rem;
}
.step-count {
  margin-bottom: 0.5rem;
}
.stdin-field {
  margin-bottom: 0;
}
.stdin-field textarea {
  min-height: 4.5rem;
}

/* Empty live regions should not take up space or add gaps. */
[data-feedback]:empty,
[data-output]:empty,
[data-hints]:empty,
[data-solution-box]:empty,
[data-review]:empty {
  display: none;
}
.steps {
  scroll-margin-top: 4.5rem;
}
