/* The frame around the paper.
 *
 * THESIS (docs/DESIGN.md): smrtr is a marked page. The learner works on ruled
 * paper and the margin answers back. Everything here is drawn from the anatomy
 * of a worked-and-marked worksheet: the printed grid, the graphite of the
 * work, and one correcting hand out in the margin.
 *
 * Three inks, and each one means something (round two, 2026-10-26). Navy is
 * the printing: every label, rule, reference and action the sheet came with.
 * Graphite is the learner's own work. Crimson is the teacher's mark, so it
 * appears on a wrong answer and nowhere else, and green appears on a right
 * answer and nowhere else. The violet of the September build is gone; the
 * reason it was ever here is recorded in docs/DESIGN.md.
 *
 * The INFORMATION ARCHITECTURE is still ttrd's: a masthead on every signed-in
 * page, the learner's mark in the corner doubling as the account and family
 * menu, a footer that closes every page, one content column.
 *
 * The rules from practice.css still hold. Nothing in this file renders a
 * score, a streak, or a count of right answers.
 */

:root {
  /* The paper. Named for the material, not the role. Values and the family
   * survey that ruled out cream and blue-white are in docs/DESIGN.md. */
  --pulp: #e5eae0;        /* the ground: the pale leaf of a quadrille pad */
  --pulp-deep: #d7ded1;   /* gutters, insets, the shadow side of a fold */
  --card: #f6f9f4;        /* a panel laid on the ground */
  --sheet: #fcfcf9;       /* the leaf that gets written on */

  --graphite: #20231e;    /* ink. Pencil black, never #000 */
  --graphite-2: #4a5147;
  --graphite-3: #585e53;

  /* The printing: the ink the worksheet came printed in, which is also the
   * ink of every action. The same navy as the marketing page's, so the front
   * door and the product share an ink. Measured 11.2:1 on the sheet and
   * 9.4:1 on the ground; white on it is 11.5:1. */
  --navy: #1e3a5f;
  --navy-deep: #152a46;                 /* pressed: a hover, an active */
  --navy-soft: #cfd8e3;                 /* a selection, a visited rule */
  --navy-wash: rgb(30 58 95 / 7%);      /* a hover ground, a flash */

  /* Every border is the ink at low alpha, never a grey of its own. */
  --hair: rgb(32 35 30 / 14%);
  --hair-hard: rgb(32 35 30 / 24%);

  /* Semantic, and only semantic: the teacher's crimson, on a wrong answer
   * and the mark beside it. --correct is defined in practice.css beside the
   * note explaining why it matches the lesson whiteboard. Nothing that is
   * not a wrong answer may be crimson, and nothing that is not a right answer
   * may be green. */
  --miss: #8b1e2d;

  --f-display: Newsreader, Georgia, serif;
  --f-ui: "Instrument Sans", system-ui, sans-serif;
  /* A worksheet's labels were typed. Every kicker, count, outline reference
   * and margin label is typewritten, which is most of what makes the app read
   * as paperwork rather than as a dashboard. */
  --f-type: "Courier Prime", ui-monospace, "SFMono-Regular", monospace;

  --shadow: 0 6px 18px rgb(32 35 30 / 7%);
  --shadow-lift: 0 16px 38px rgb(32 35 30 / 12%);

  /* Two eases and no more. Everything that comes to rest uses the first; the
   * second belongs to the correcting hand alone (a caret, an annotation
   * arriving) and must not spread to ordinary hovers. */
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-mark: cubic-bezier(0.34, 1.4, 0.64, 1);

  --col: 74rem;
  --margin-col: 9.5rem;   /* the width of the margin, where annotation lives */
  --measure: 64ch;

  /* One height for everything that can sit in a row together: text inputs,
   * selects and buttons. Set in one place so a new control cannot arrive half
   * a centimetre short of its neighbours. */
  --control-h: 2.85rem;

  /* The figure renderer (prototypes/figures.js + figures.css) asks for three
   * colors of its own. Mapping them here is the only place the app tells a
   * figure what ink to draw in. The renderer's own fills are navy and crimson
   * at low alpha, so these are the inks it was drawn for. */
  --fig-ink: var(--navy);
  --fig-mark: var(--miss);
  --fig-label: var(--graphite-3);

  color-scheme: light;
}

html { min-height: 100%; }
body { min-height: 100vh; }

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  font-family: var(--f-ui);
  font-size: clamp(0.95rem, 0.9rem + 0.16vw, 1.03rem);
  color: var(--graphite);
  background: var(--pulp);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* A page pulled off a drum never printed evenly. One grain layer, fixed, over
 * the whole ground: the thing that stops a flat fill reading as a flat fill.
 * pointer-events none and aria-hidden, so it is texture and nothing else. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

::selection { background: var(--navy-soft); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb {
  background: var(--graphite-3);
  border: 3px solid var(--pulp);
  border-radius: 8px;
}
::-webkit-scrollbar-track { background: var(--pulp); }

/* ——— the margin ———
 *
 * The signature. Every page is a narrow column and a wide one: the narrow one
 * holds what a margin holds (a typed label, an outline reference, a caret, an
 * annotation) and the wide one holds the work. Nothing structural lives in the
 * margin, so folding it above the body at 900px loses nothing.
 *
 * It is a COLUMN and never a border-left. A colored stripe down the edge of a
 * card is banned (developer.md) and the old "carry on with" card had one. */
.ruled {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  gap: 0 clamp(1rem, 2.5vw, 2rem);
  align-items: start;
}

.ruled > .margin {
  margin: 0;
  padding-top: 0.35rem;
  font-family: var(--f-type);
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  text-align: right;
}

.margin .margin-note {
  display: block;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--graphite-3);
}

/* The caret: the proofreader's insertion mark from the wordmark, doing its
 * real job. It points from the margin at the line it is about. */
.margin-caret {
  display: block;
  width: 0.95rem;
  height: 0.5rem;
  margin: 0 0 0.3rem auto;
  color: var(--navy);
}

.margin-caret svg { display: block; width: 100%; height: 100%; overflow: visible; }
.margin-caret path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 56rem) {
  .ruled { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
  .ruled > .margin { text-align: left; padding-top: 0; }
  .margin-caret { margin-inline: 0; transform: rotate(90deg); }
}

.col {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding-inline: clamp(1rem, 3.5vw, 2.4rem);
}

/* Every page is ruled. The narrow column is the margin and holds what a
 * margin holds; everything else lines up against the same rule, whether it is
 * a heading, a list of decks or a row of actions. Blocks that carry their own
 * margin (a page head, a panel, the carry-on card) span both tracks and lay
 * out their own. */
.page {
  flex: 1;
  padding-block: clamp(1.5rem, 4vw, 2.75rem);
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  column-gap: clamp(1rem, 2.5vw, 2rem);
  align-content: start;
}

.page > * { grid-column: 2; min-width: 0; }

/* The margin beside a panel is empty, and that is what a margin is. Panels
 * were numbered down the page in September (01 Your decks, 02 Math) to give
 * the gutter something to hold; Derick, 2026-10-26: "We shouldn't have things
 * numbered unless they need to be numbered." A heading carries its section by
 * itself (design-director, section 5), and the margin holds only what a
 * margin holds: the page's kicker, the carry-on label, a caret, an
 * annotation. */

.page > .page-head,
.page > .panel,
.page > .resume,
.page > .practice-layout,
.page > .gate,
.page > .sheet,
.page > .flash,
.page > .actions.centered,
.page > .deck-form { grid-column: 1 / -1; }

/* The desk's pages are a sheet with prose above and below it, and all of it
 * lines up on the sheet's own left edge rather than on the body column's.
 * ⚠ justify-self, never `margin: 0 auto`: an auto margin on a grid item
 * overrides the default stretch, so the block shrinks to fit its content.
 * That is how the explanation block came out 288px wide in a 702px column
 * while the facts block beside it came out 702. */
/* One column the width of the sheet, so the prose above and below it starts
 * on the sheet's own left edge. Centering each child instead left the
 * narrow prose at the container's edge and the sheet in the middle of it,
 * 140px apart. */
.page > .desk-page {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 52rem;
  justify-self: center;
  /* Room for the sticky line to rest below the last thing on the page. */
  padding-bottom: 4rem;
}

@media (max-width: 56rem) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .page > * { grid-column: 1; }
}

/* ——— masthead ———
 *
 * The head of a worksheet: the name of the thing, a typed line saying whose
 * paper this is, and a hard rule under it. The old one was a frosted white
 * bar with three pill tabs, which is every SaaS app's header. */

.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--pulp) 90%, transparent);
  border-bottom: 1px solid var(--hair-hard);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.masthead .col {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 2rem);
  padding-block: 0.72rem;
}

/* The carets hang below the baseline, so the context line under them needs
 * the room or they sit on top of it. */
.brand { display: flex; flex-direction: column; gap: 0.1rem; flex-shrink: 0; min-width: 0; }
.brand .wordmark { padding-bottom: 0.58rem; }

/* "smrtr" — smarter with the vowels edited out, two carets marking where they
 * went. The carets are the product's argument in two glyphs: a correction,
 * made in the margin, in the ink the page was printed with. They tuck into the
 * letter gaps below the baseline and must never spread the word apart. */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.62rem;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--graphite);
}

/* The carets are proof marks and have to read as proof marks at the size the
 * masthead sets them (round two, rule 3: "those little correction markers
 * are too small"). 0.36em wide at 1.62rem is 9px; they were 0.3em, 7px, and
 * read as specks under the word. */
.wordmark .caret {
  display: inline-block;
  width: 0.36em;
  height: 0.3em;
  margin: 0 -0.15em;
  align-self: flex-end;
  transform: translateY(78%) rotate(-3deg);
}

.wordmark .caret:last-of-type { transform: translateY(78%) rotate(4deg); }

.wordmark .caret svg { display: block; width: 100%; height: 100%; overflow: visible; }

.wordmark .caret path {
  fill: none;
  stroke: var(--navy);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Says what this is, on every page — arriving cold should not leave you
 * guessing whether these are grade 6 topics. Typed, like the rest of the
 * paperwork, and hidden on a phone where the name has to have the width. */
.brand-context {
  margin: 0;
  font-family: var(--f-type);
  font-size: 0.64rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite-3);
  white-space: nowrap;
}

.tabs { display: flex; flex: 1; gap: clamp(0.4rem, 1.6vw, 1.4rem); align-items: center; }

/* Not pills. A tab is a typed word with room under it for the rule that marks
 * the one you are on, which is how a marked page says "here". */
.tab {
  position: relative;
  padding: 0.35rem 0.1rem;
  font-family: var(--f-type);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
  text-decoration: none;
  transition: color 0.15s ease;
}

.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  height: 2px;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease-settle);
}

.tab:hover { color: var(--graphite); }
.tab:hover::after { transform: scaleX(1); transform-origin: left; }
.tab.on { color: var(--navy); }
.tab.on::after { transform: scaleX(1); }

/* ——— the learner's mark, which is also the account menu ——— */

.learner-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  background: var(--sheet);
  border: 1px solid var(--hair-hard);
  border-radius: 50%;
}

.who-menu { position: relative; flex-shrink: 0; }

.who-menu summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
}

.who-menu summary:hover { border-color: var(--hair); background: var(--card); }
.who-menu summary::-webkit-details-marker { display: none; }

.who-name-inline { font-weight: 600; font-size: 0.9rem; color: var(--graphite); }

.who-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 70;
  min-width: 14rem;
  padding: 0.4rem;
  background: var(--sheet);
  border: 1px solid var(--hair-hard);
  border-radius: 0.3rem;
  box-shadow: var(--shadow-lift);
}

.drop-label {
  margin: 0;
  padding: 0.3rem 0.55rem 0.1rem;
  font-family: var(--f-type);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

.drop-current {
  margin: 0 0 0.35rem;
  padding: 0 0.55rem 0.45rem;
  font-family: var(--f-display);
  font-weight: 600;
  border-bottom: 1px solid var(--hair);
}

.drop-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  color: var(--graphite);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 0.2rem;
  cursor: pointer;
}

.drop-item:hover { background: var(--navy-wash); color: var(--navy); }

/* ——— footer ———
 *
 * The bottom of the sheet: a hard rule, the strapline, and a typed run of
 * metadata. "keep going" is set in the display italic because it is the one
 * handwritten thing on the page. */

.footplate {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--hair-hard);
  padding: 1.7rem 0 2.2rem;
  background: var(--pulp-deep);
}

.footplate .col {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  gap: 0.55rem clamp(1rem, 2.5vw, 2rem);
  align-items: baseline;
  font-size: 0.86rem;
  color: var(--graphite-2);
}

.foot-script {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--navy);
  text-align: right;
}

.foot-line { margin: 0; max-width: var(--measure); text-wrap: pretty; }

.foot-meta {
  grid-column: 2;
  margin: 0;
  font-family: var(--f-type);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

@media (max-width: 56rem) {
  .footplate .col { grid-template-columns: minmax(0, 1fr); }
  .foot-script { text-align: left; }
  .foot-meta { grid-column: 1; }
}

/* ——— page furniture ——— */

/* The head of every page is the margin device: the typed kicker out in the
 * margin, the heading and the lede in the body column. */
.page-head {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  gap: 0 clamp(1rem, 2.5vw, 2rem);
  margin: 0 0 clamp(1.8rem, 4vw, 2.8rem);
}

.page-head h1 {
  grid-column: 2;
  margin: 0;
  font-family: var(--f-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem);
  letter-spacing: -0.028em;
  line-height: 1.02;
  text-wrap: balance;
  color: var(--graphite);
}

.page-head h1 em { font-style: italic; color: var(--navy); }

.page-head .lede {
  grid-column: 2;
  margin: 0.7rem 0 0;
  font-size: 1.02rem;
  color: var(--graphite-2);
  max-width: var(--measure);
  line-height: 1.6;
  text-wrap: pretty;
}

/* The kicker sits in the margin, typed, right-aligned against the rule the
 * heading starts at. */
.eyebrow {
  grid-column: 1;
  grid-row: 1;
  margin: 0.5rem 0 0;
  font-family: var(--f-type);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  text-align: right;
  line-height: 1.4;
}

.eyebrow a { color: inherit; }

.page-head .pencil { grid-column: 1; grid-row: 1; justify-self: end; }

@media (max-width: 56rem) {
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-head h1, .page-head .lede, .eyebrow { grid-column: 1; }
  .eyebrow { grid-row: auto; margin: 0 0 0.5rem; text-align: left; }
  .page-head .pencil { grid-row: auto; justify-self: start; margin-bottom: 0.5rem; }
}

/* Centered heads (the way in: sign in, who is practicing) keep one column.
 * A margin beside a 34rem card would be a margin beside nothing. */
.page-head.centered {
  display: block;
  text-align: center;
}
.page-head.centered .lede { margin-inline: auto; }
.page-head.centered .eyebrow { text-align: center; margin: 0 0 0.6rem; }

.flash {
  margin: 0 0 1.25rem;
  padding: 0.7rem 1rem 0.7rem 1.1rem;
  background: var(--navy-wash);
  border: 1px solid var(--hair);
  border-radius: 0.3rem;
  font-size: 0.95rem;
}

/* Something went wrong — a password that didn't match, a link already used.
 * The red pencil, because it is the color the rest of the product marks a
 * miss with, and a miss here is no more alarming than one on the paper. */
.flash.bad {
  background: color-mix(in srgb, var(--miss) 7%, transparent);
  color: var(--miss);
}

/* ——— links and buttons ——— */

a { color: inherit; text-decoration: none; }

/* An underline that draws in from the left, rather than a color change. */
.page a:not(.check-link):not(.tab):not(.deck-name a):not(.quiet-link) { color: var(--navy); }
.page a:not(.check-link):not(.tab):hover { color: var(--navy-deep); text-decoration: underline; text-underline-offset: 0.18em; }

button { font: inherit; cursor: pointer; }

.check, .check-link, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0.55rem 1.3rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 0.25rem;
  border: 1px solid var(--hair-hard);
  background: var(--sheet);
  color: var(--graphite);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s var(--ease-settle), box-shadow 0.18s ease,
              border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.check, .check-link {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 4px 14px rgb(30 58 95 / 22%);
}

.check:hover, .check-link:hover {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgb(30 58 95 / 28%);
}

.quiet:hover { border-color: var(--navy); color: var(--navy); transform: translateY(-1px); }

/* The small variants share a shorter height with each other, for the same
 * reason the full-size ones share theirs. */
.check-link.small { min-height: 2.3rem; padding: 0.35rem 0.9rem; font-size: 0.88rem; }
.check.wide { width: 100%; }
.quiet { min-height: var(--control-h); padding: 0.4rem 1rem; font-size: 0.9rem; }
.deck-actions .quiet, .member-actions .quiet { min-height: 2.3rem; }

.quiet-link {
  font-family: var(--f-type);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
}
.quiet-link:hover { color: var(--navy); }

.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; margin: 1.75rem 0 0; }
.actions.centered { justify-content: center; }

/* ——— panels and cards ——— */

/* A panel is a section of the page, not a box on it. Its heading starts at
 * the body column and a hard rule runs the full width of the page under it,
 * margin included: section grammar by hairline rather than by card. */
.panel {
  margin: 0 0 clamp(2rem, 5vw, 3.4rem);
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  column-gap: clamp(1rem, 2.5vw, 2rem);
  align-content: start;
}

.panel > * { grid-column: 2; min-width: 0; }
.panel > .pick-head { grid-column: 1 / -1; }

@media (max-width: 56rem) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .panel > * { grid-column: 1; }
}

.panel-head {
  margin: 0;
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--graphite);
}

.pick-head {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  gap: 0.25rem clamp(1rem, 2.5vw, 2rem);
  margin: 0 0 1.3rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--hair-hard);
}

.pick-head .panel-head { grid-column: 2; }

.pick-note {
  grid-column: 2;
  margin: 0;
  font-size: 0.9rem;
  color: var(--graphite-3);
  max-width: var(--measure);
  line-height: 1.55;
}

@media (max-width: 56rem) {
  .pick-head { grid-template-columns: minmax(0, 1fr); }
  .pick-head .panel-head, .pick-note { grid-column: 1; }
}

/* Carry on where you left off — the biggest thing on the home page, because it
 * is the thing most likely to be wanted. Drawn on the question paper itself,
 * so it reads as "your sheet, still open".
 *
 * It used to carry a 4px crimson border-left. That is the banned accent spine
 * (developer.md); the label now does the job the stripe was doing. */
.resume {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr) auto;
  gap: 0.2rem clamp(1rem, 2.5vw, 2rem);
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  padding: 1.3rem clamp(1.1rem, 2.5vw, 1.6rem);
  color: var(--graphite);
  background:
    repeating-linear-gradient(var(--rule) 0 1px, transparent 1px var(--square)),
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--square)),
    var(--sheet);
  border: 1px solid var(--hair-hard);
  border-radius: 0.3rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s var(--ease-settle), box-shadow 0.18s ease;
}

.resume:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.resume-label {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 0.5rem;
  font-family: var(--f-type);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  text-align: right;
}

.resume-name {
  grid-column: 2;
  display: block;
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2.05rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--graphite);
}

.resume-go {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-type);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  white-space: nowrap;
}

.resume:hover .resume-go .arrow { transform: translateX(0.25rem); }
.resume-go .arrow { transition: transform 0.25s var(--ease-settle); }

.resume-meta {
  grid-column: 2;
  display: block;
  margin-top: 0.35rem;
  font-family: var(--f-type);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--graphite-3);
}

@media (max-width: 56rem) {
  .resume { grid-template-columns: minmax(0, 1fr); }
  .resume-label { grid-column: 1; grid-row: auto; padding-top: 0; text-align: left; }
  .resume-name, .resume-meta, .resume-go { grid-column: 1; grid-row: auto; margin-top: 0.7rem; }
}

/* ——— the deck and domain grids ———
 *
 * A fixed set of cards never uses auto-fill: the count decides the columns, or
 * the last row comes out ragged (developer.md). These lists are generated, so
 * the count is not known here — but the card is wide enough that three columns
 * only happen when there is room, and a trailing card stretches to fill rather
 * than leaving a hole. */
.deck-grid, .who-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-grid > *, .domain-grid > *, .who-grid > * { min-width: 0; }

@media (max-width: 52rem) {
  .deck-grid, .who-grid { grid-template-columns: minmax(0, 1fr); }
}

.deck-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.25rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 0.3rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease-settle);
}

.deck-card:hover { border-color: var(--hair-hard); box-shadow: var(--shadow); transform: translateY(-2px); }

.deck-name {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.15;
  text-wrap: balance;
}

.deck-name a { color: var(--graphite); }
.deck-name a:hover { color: var(--navy); }

.deck-meta {
  margin: 0.4rem 0 0;
  font-family: var(--f-type);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--graphite-3);
}

.deck-skills {
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--graphite-2);
  text-wrap: pretty;
}

/* Three controls side by side at three widths read as three different kinds
 * of control: Practice 86px, Read back 104, Remove 89 (catalog A1, measured
 * 2026-10-26). One width for the group, from the widest label, and the row
 * stacks rather than squeezing when the card is narrow. The account page's
 * pair was already fixed this way; the deck card was missed. */
.deck-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(max-content, 1fr);
  justify-content: start;
  gap: 0.6rem;
  align-items: center;
  margin-top: auto;
  padding-top: 1.1rem;
}
.deck-actions > * { text-align: center; }
@media (max-width: 26rem) {
  .deck-actions { grid-auto-flow: row; grid-auto-columns: auto; }
}

/* A table of contents, so full-width rows and not a card grid: the name on
 * the left, what is in it on the right, one rule per line. Two columns of
 * these left a hole wherever the count was odd, and read as five cards that
 * had lost their boxes. */
.domain-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.domain-grid > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--hair);
}

.domain-grid > li:first-child { border-top: 1px solid var(--hair); }

.domain-grid > li.visited { border-bottom-color: var(--navy-soft); }

.domain-link {
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--graphite);
}

.domain-link:hover { color: var(--navy); }

.domain-meta {
  font-family: var(--f-type);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--graphite-3);
  white-space: nowrap;
}

.domain-grid.big > li { padding-block: 1rem; }

/* On a phone the meta goes under the name on every row. Left to wrap on its
 * own, four rows folded and "Geometry" kept its meta beside it because it was
 * short enough, which is repeating rows with two different shapes. */
@media (max-width: 42rem) {
  .domain-grid > li { gap: 0.15rem 0; }
  .domain-meta { flex-basis: 100%; }
}

/* ——— the deck builder, full page ———
 *
 * The one page where the margin is already part of the content: the outline
 * references (I.1.A) are exactly what a margin holds, and they were here
 * before the system was. The form takes the page's own ruling so the tree
 * lines up with the heading above it. */

.deck-form {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  column-gap: clamp(1rem, 2.5vw, 2rem);
  align-content: start;
}

.deck-form > * { grid-column: 2; min-width: 0; }
.deck-form > .pick-head, .deck-form > .deck-name-row, .deck-form > .deck-foot { grid-column: 1 / -1; }

@media (max-width: 56rem) {
  .deck-form { grid-template-columns: minmax(0, 1fr); }
  .deck-form > * { grid-column: 1; }
}

.deck-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin: 0 0 2.25rem;
}

.deck-name-row .grow { flex: 1; min-width: 18rem; }

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--graphite-3);
}

/* Long enough to hold the example. A 14rem field cut off "Fractions before the
 * test", which reads as a length limit that is not there. */
.written.wide, select.written {
  width: 100%;
  max-width: 100%;
  height: var(--control-h);
  padding: 0.55rem 0.8rem;
  font-family: var(--f-ui);
  font-size: 1.02rem;
  color: var(--graphite);
  background: var(--sheet);
  border: 1px solid var(--hair-hard);
  border-radius: 0.25rem;
}

.written.wide:focus {
  border-color: var(--navy);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 12%, transparent);
}

.deck-name-row .check { margin-top: 0; }

.domain-block { margin: 0 0 2.25rem; }

/* The red pencil is for a miss, and nothing on this page is wrong. */
.domain-name {
  margin: 0 0 0.85rem;
  padding-bottom: 0.4rem;
  font-family: var(--f-type);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--graphite);
  border-bottom: 1px solid var(--hair-hard);
}

.category-block { margin: 0 0 1.4rem; }

.category-name {
  margin: 0 0 0.45rem;
  font-family: var(--f-display);
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--graphite);
}

/* Two columns, so 159 skills are not a mile of single-file list. */
.skills { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2.5rem; }

.skills li { break-inside: avoid; padding: 0.08rem 0; }

.skills label, .skills.linked a, .skills.linked .empty {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.3rem 0.5rem;
  font-size: 0.95rem;
  border-radius: 0.25rem;
  color: var(--graphite);
  cursor: pointer;
}

.skills label:hover, .skills.linked a:hover { background: color-mix(in srgb, var(--navy) 6%, transparent); }

/* Skill, group and area names are content, different on every row, so a
 * widow cannot be fixed by choosing the break: the browser has to avoid it.
 * `balance`, not `pretty`, for these short labels: Chromium's `pretty` only
 * rescues a short last word, and left "repeated / subtraction" and
 * "unlike / denominators" alone at 390 (wrapcheck); balanced lines put two
 * words on each. Running prose keeps `pretty`. */
.skills .skill-name { flex: 1; text-wrap: balance; }
.domain-link, .rail-skill-name, .category-name, .skills.linked .skill-name { text-wrap: balance; }
/* Not the typed area heading in the builder: balanced, "Capitalization,
 * Punctuation & Spelling" put "Capitalization," alone on its first line; left
 * to wrap, with the ampersand glued to "Spelling" (nb_amp), it breaks after
 * "Punctuation" and both lines carry two words. */
.lesson-offer, .review-answer, .pick-note, .plan-terms, .plan-note,
.verdict, .misconception, .passage p { text-wrap: pretty; }
.skills label.empty, .skills .empty { opacity: 0.4; cursor: default; }

.count { font-family: var(--f-type); font-size: 0.74rem; font-variant-numeric: tabular-nums; color: var(--graphite-3); }

.deck-foot {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hair);
}

.deck-foot .check { margin-top: 0; }

@media (max-width: 40rem) { .skills { columns: 1; } }

/* ——— account, family, learner picker ——— */

/* ——— the way in ———
 *
 * Sign in, who is practicing, reset a password. One card, centered, with the
 * sheet's own paper under it: the first thing anyone sees should be the
 * material the product is made of. */

.gate-head { max-width: 36rem; margin-inline: auto; }

.gate {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(1.4rem, 3.5vw, 2rem);
  background:
    repeating-linear-gradient(var(--rule) 0 1px, transparent 1px var(--square)),
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--square)),
    var(--sheet);
  border: 1px solid var(--hair-hard);
  border-radius: 0.3rem;
  box-shadow: var(--shadow-lift);
}

.who-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 30rem) { .who-grid { grid-template-columns: minmax(0, 1fr); } }

/* A name on a class list: the mark, the name, what is waiting. */
.who-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 0.95rem;
  text-align: left;
  background: color-mix(in srgb, var(--pulp) 55%, transparent);
  border: 1px solid var(--hair);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.18s var(--ease-settle);
}

.who-card:hover {
  border-color: var(--navy);
  background: var(--navy-wash);
  transform: translateY(-1px);
}

.who-card-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who-card-name {
  font-family: var(--f-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--graphite);
}
.who-card-meta {
  font-family: var(--f-type);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--graphite-3);
}

/* The sign-in, reset and confirm forms. Stacked rather than in a row: these are
 * the only screens in the app where a person types more than one thing before
 * pressing anything, and side-by-side fields read as optional. */
.gate-form { display: flex; flex-direction: column; gap: 1rem; }
.gate-form .field { display: flex; flex-direction: column; gap: 0.3rem; }
.gate-form .written { width: 100%; box-sizing: border-box; }

/* Sign-up's honeypot: off screen, out of the tab order, and never announced.
 * Not display:none, which some scripts skip and some browsers refuse to
 * submit. app/lib/signup_guard.rb says what it is for. */
.hp-field {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The sentence a visitor arriving through a Tor exit sees above the form. */
.tor-notice { margin: 0 0 1.25rem; }

.gate-whom {
  margin: 0;
  font-size: 0.9rem;
  color: var(--graphite-3);
}

.gate-alt {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--hair);
  font-size: 0.9rem;
}

.gate-alt a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
.gate-alt a:hover { color: var(--navy-deep); }

/* One link on its own under a page head, rather than the row of two under a
 * form: nothing to spread apart, and no rule above it to close a form off. */
.gate-alt.bare { justify-content: center; margin-top: 1.5rem; padding-top: 0; border-top: 0; }

/* ——— adding somebody to the family ———
 *
 * One row, three labelled controls, their boxes on one line. A grid rather
 * than a flex row so each control has a column of its own: the name takes
 * what is left, the grade takes its own width, Add takes the width of the
 * word. The labels sit above, which is what tells you the grade belongs to
 * the person you are adding. */
/* Two ways to start, as a pair: same height, same shape, "or" between them.
 * See shared/_start_practice. */
.start-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.start-pair .or {
  font-family: var(--f-type);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

.add-learner { border-top: 1px solid var(--hair); padding-top: 1.25rem; }
.add-learner-head {
  margin: 0 0 0.6rem;
  font-family: var(--f-ui);
  font-size: 1rem;
  font-weight: 600;
}
.add-learner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 0.75rem;
  /* end, so the three boxes line up along their bottoms whatever height
   * their labels come out. */
  align-items: end;
}
.add-learner-row .written { width: 100%; }
.add-learner-row .listbox { flex: none; }

/* Three controls in a row need about 30rem before the name field starts
 * losing characters; below that they stack. They pushed the card past the
 * viewport at 390 and the page scrolled sideways. */
@media (max-width: 34rem) {
  .add-learner-row { grid-template-columns: minmax(0, 1fr); }
  .add-learner-go { justify-self: start; }
  .add-learner-row .listbox { width: 100%; }
}

.inline-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
.inline-add.centered { max-width: 36rem; margin: 0 auto; }
.inline-add .written { flex: 1; min-width: 12rem; }
.inline-add .grow { flex: 1; min-width: 14rem; }

.family { list-style: none; margin: 0 0 1.25rem; padding: 0; }

.family li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--hair);
}

.family li.is-me { font-weight: 600; }
.family-name { font-family: var(--f-display); font-size: 1.05rem; }
.family-meta { font-size: 0.85rem; color: var(--graphite-3); margin-right: auto; }

@media (max-width: 62rem) { .brand-context { display: none; } }

@media (max-width: 46rem) {
  .masthead .col { flex-wrap: wrap; gap: 0.6rem; }
  .tabs { order: 3; flex-basis: 100%; }
  .who-name-inline { display: none; }
  /* The mark belongs in the corner. Without this it sits against the
   * wordmark, because the tabs that used to push it right have wrapped
   * onto their own line. */
  .who-menu { margin-left: auto; }
}

/* "Next question" is a button_to inside the sheet, so it needs the same
 * treatment as every other primary button rather than a flat blue slab. */
.next {
  min-height: 2.8rem;
  padding: 0.55rem 1.3rem;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--navy);
  border-radius: 0.25rem;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 14px rgb(30 58 95 / 22%);
  transition: transform 0.18s var(--ease-settle), box-shadow 0.18s ease, background 0.15s ease;
}

.next:hover {
  background: var(--navy-deep);
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgb(30 58 95 / 28%);
}

/* The sheet sits in the page column now, not alone on a bare background. */
.page .sheet { box-shadow: var(--shadow); }

/* The sheet's own top line: a way back, then where you are. They ran together
 * as "DONE FRACTIONS I KEEP MISSING" without something between them. */
.topic .quiet-link { margin-right: 0.6rem; padding-right: 0.6rem; border-right: 1px solid var(--hair); }

/* ——— the pencil ——— */
/* "Grade 6 · Math" written down the barrel. It carries the context that used
 * to sit under the wordmark in the masthead, where it was easy to miss and
 * cramped against the logo. */

.pencil {
  display: inline-flex;
  align-items: stretch;
  height: 1.9rem;
  margin: 0 0 0.9rem;
  filter: drop-shadow(0 2px 3px rgb(32 35 30 / 14%));
}

.pencil-eraser {
  width: 0.7rem;
  background: #e3928f;
  border-radius: 0.35rem 0.1rem 0.1rem 0.35rem;
}

.pencil-ferrule {
  width: 0.55rem;
  background: repeating-linear-gradient(90deg, #b9c0c8 0 2px, #9aa3ad 2px 4px);
}

.pencil-barrel {
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  background: linear-gradient(180deg, #f0c04a 0%, #e0a92f 55%, #c9922a 100%);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5a3d0c;
  white-space: nowrap;
}

/* The sharpened cone, then the graphite. Clip-paths so the point stays sharp
 * whatever the label length or font size. */
.pencil-wood {
  width: 0.85rem;
  background: linear-gradient(180deg, #eddcc0 0%, #dcc49c 60%, #c9ae83 100%);
  clip-path: polygon(0 0, 100% 42%, 100% 58%, 0 100%);
}

.pencil-lead {
  width: 0.4rem;
  background: #3a3f45;
  clip-path: polygon(0 42%, 100% 50%, 0 58%);
}

/* ——— outline references ——— */
/* Every row has an address — I.1.A — so a skill can be pointed at rather than
 * described. */

.ref {
  flex-shrink: 0;
  min-width: 3.2rem;
  font-family: var(--f-type);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  /* Typed in the printing's own ink, like every other label on the page.
   * It was set in the red pencil, which says a miss, and an address is not
   * a miss. */
  color: var(--navy);
}

.domain-name .ref { min-width: 2rem; font-size: inherit; }
.category-name .ref { min-width: 2.6rem; font-size: 0.85rem; }
.skills .ref { min-width: 3.4rem; }

/* ——— gated buttons ——— */
/* A control that cannot act says so, rather than failing quietly when pressed. */

.check:disabled, .check[disabled] {
  background: var(--card);
  border-color: var(--hair);
  color: var(--graphite-3);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.check:disabled:hover { transform: none; box-shadow: none; background: var(--card); color: var(--graphite-3); }

.tally { margin-left: 0.5rem; font-weight: 700; color: var(--navy); }

/* ——— the answer row ——— */
/* The Check button matches the height of the box it sits beside, with room
 * between them. */

.answer-row { display: flex; align-items: flex-end; gap: 0.9rem; margin-top: 0.5rem; }

/* The answer goes on a line, the way it does on paper: no fill, no box, a
 * ruled line under it and the answer written in the sheet's own serif at the
 * size a person writes. The boxed version was the one control on the sheet
 * that still looked like a form on a website. */
.answer-row .written {
  flex: 1;
  max-width: 15rem;
  height: var(--control-h);
  padding: 0.35rem 0.35rem 0.3rem;
  font-family: Charter, "Bitstream Charter", Cambria, serif;
  font-size: 1.5rem;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--graphite);
  border-radius: 0;
}

.answer-row .written:focus { outline: none; border-bottom-color: var(--navy); }
.answer-row .written:focus-visible { outline: none; box-shadow: 0 2px 0 0 var(--navy); }
.answer-row .written::placeholder { color: var(--graphite-3); }

.answer-row .check { min-height: var(--control-h); margin-top: 0; }

/* What the box still needs before Check will send ("a number", "something to
 * send"): guidance before an answer, not a mark on one, so not crimson. */
.answer-hint { margin: 0.5rem 0 0; min-height: 1.2rem; font-size: 0.88rem; color: var(--graphite-2); }

.next-row { display: flex; align-items: center; gap: 0.9rem; margin-top: 1.5rem; outline: none; }
.next-row .next { margin-top: 0; }
.next-hint { font-size: 0.85rem; color: var(--graphite-3); }

/* A focus ring in crimson reads as an error on a text box. Navy for inputs;
 * crimson stays for things that are actually wrong. */
input:focus-visible, .written:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--navy) 45%, transparent);
  outline-offset: 2px;
}

/* The heading refs need to sit beside their titles, not against them. The
 * skill rows are already flex; these two were not, so min-width did nothing
 * and "I.1" ran straight into "Ratio concepts and language". */
.domain-name, .category-name {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

/* ——— family management ——— */

.members { list-style: none; margin: 0 0 1.75rem; padding: 0; }

.member {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  /* Inset on both edges. The row used to run flush to the container, so the
   * learner's mark touched the left edge and Save touched the right. */
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--hair);
  border-radius: 0.35rem;
}

.member.is-me { background: color-mix(in srgb, var(--navy) 4%, transparent); }

.member .learner-mark { grid-row: span 3; }

/* Name, the year of school, and a level per subject. Wrapping, because the
 * number of subjects is content and not a layout decision: a third subject
 * must find its own line rather than squeeze the name to nothing. Aligned on
 * the bottom of the boxes, so the labels above them can be any height. */
.member-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.member-form .field { flex: 0 0 auto; }
.member-form .field:first-child { flex: 1 1 12rem; min-width: 0; }
.member-name { width: 100%; }
.member-grade { flex: 0 0 auto; width: auto; min-width: 14rem; }
.member-save { flex-shrink: 0; }
.member-form .field-label { white-space: nowrap; }

.member-meta { margin: 0; font-size: 0.85rem; color: var(--graphite-3); }

/* Side by side, the pair shares one width (the wider one's), so "Practice as
 * Holden" and "Remove" read as a pair rather than a long button and a short
 * one (wrapcheck, catalog A1: 160 and 89px). A max-content grid with 1fr
 * tracks gives every track the widest item's width without a hardcoded
 * number. */
.member-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.6rem;
  width: max-content;
  max-width: 100%;
}

.member-actions form, .member-actions .quiet { width: 100%; }

/* On a phone the member row is 318px wide and two 160px buttons with their
 * gap do not fit, so the pair stacks: one max-content column, which is the
 * wider label's width, and both buttons fill it. A label never wraps; the
 * buttons give way (wrapcheck caught "Practice as / Holden" at 390). */
@media (max-width: 34rem) {
  .member-actions { grid-auto-flow: row; grid-template-columns: max-content; width: auto; }
}

/* On a phone the mark cannot hold a column of its own: it left the name, the
 * grade and Save stacking in a 12rem gutter beside it. The mark goes on the
 * same line as the first field and everything below runs the full width. */
@media (max-width: 34rem) {
  .member { grid-template-columns: minmax(0, 1fr); padding-inline: 0; }
  .member .learner-mark { grid-row: auto; }
  .member-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55rem; }
  .member-form .field { flex: none; }
  .member-form .listbox { width: 100%; }
  .member-save { justify-self: start; }
  .member-grade { width: 100%; min-width: 0; }
  .listbox { flex: 1 1 auto; width: 100%; }
}

/* "No questions at grade 9 yet" is a fact about the shelves, not a mark on
 * anyone's work, so it is not crimson. The words carry it. */
.warn { color: var(--graphite-2); font-weight: 600; }

/* Remove is a quiet button like its neighbors. It was crimson, which in this
 * system means a wrong answer; the confirm dialog is what protects the
 * action, and the word says what it does. */
.quiet.danger { color: var(--graphite-2); }
.quiet.danger:hover { border-color: var(--graphite-2); color: var(--graphite); }

.inline-add .grow { flex: 1; min-width: 14rem; }

/* ——— plan and billing ——— */
/* An honest empty state. Nothing here pretends to be a card on file. */

.plan-card {
  padding: 1.4rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 0.35rem;
  box-shadow: var(--shadow);
}

.plan-state { margin: 0 0 0.75rem; font-size: 1rem; }

/* Called a flag, not a badge. ConstitutionTest bans the word outright and is
 * right to: a billing pill does not need the one noun that must never get a
 * foothold in a product for children.
 *
 * Typed, in the printing's ink, like every other label. It carried the red
 * pencil and, when active, a green: both are reserved for an answer, and a
 * plan is not an answer. The word on the flag does the telling. */
.plan-flag {
  display: inline-block;
  margin-right: 0.6rem;
  padding: 0.2rem 0.6rem;
  font-family: var(--f-type);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--navy-wash);
  border-radius: 0.25rem;
}

.plan-note { margin: 0 0 1.25rem; font-size: 0.92rem; color: var(--graphite-2); line-height: 1.6; }

.plan-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
  margin: 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--hair);
}

.plan-facts dt {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

/* The household's own facts, written in: graphite, the way a filled-in value
 * is. In navy they read as four links that went nowhere. */
.plan-facts dd { margin: 0.25rem 0 0; font-family: var(--f-display); font-size: 1.02rem; color: var(--graphite); text-wrap: balance; }

/* A plan change that has not happened yet. Quieter than the plan itself, which
 * is still the true answer to "what am I on"; loud enough that a parent who
 * just switched in the portal can see their click landed. */
.plan-pending {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--f-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--graphite-3);
}

/* The flag's moods, in words rather than in color: "Active" is the printing's
 * navy like every other label, and a plan that is ending or has ended is the
 * same flag in the ink of a note. A green here would say "right answer" and
 * an amber would be a fourth color with a meaning nobody was taught. */
.plan-flag.is-warn,
.plan-flag.is-off  { color: var(--graphite-2); background: var(--hair); }

/* ——— the plan chooser ——— */

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

/* The yearly plan is marked, not preselected. A default that quietly costs six
 * times more is a dark pattern wearing a helpful face. */
.plan.is-best { border-color: var(--navy); }

.plan-tag {
  position: absolute;
  top: -0.65rem;
  left: 1.4rem;
  margin: 0;
  padding: 0.15rem 0.55rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--navy);
  border-radius: 0.25rem;
}

.plan-name {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

.plan-price { margin: 0; display: flex; align-items: baseline; gap: 0.4rem; }

.plan-amount {
  font-family: var(--f-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--navy);
  /* The sheet's lining figures, so $50 does not render with the dropped figures
   * that took three rounds to get out of the question paper. */
  font-variant-numeric: lining-nums tabular-nums;
}

.plan-per { font-size: 0.92rem; color: var(--graphite-3); }

.plan-terms {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--graphite-2);
}

.plan form { margin-top: auto; }
.plan .check, .plan .quiet { width: 100%; }

/* ——— charge history ——— */

.charges { list-style: none; margin: 0; padding: 0; }

.charge {
  display: grid;
  grid-template-columns: minmax(0, 12rem) 1fr auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--hair);
}

.charge-date { font-size: 0.92rem; color: var(--graphite-2); }
.charge-kind { font-size: 0.82rem; color: var(--graphite-3); text-transform: uppercase; letter-spacing: 0.08em; }

.charge-amount {
  font-family: var(--f-display);
  font-size: 1.02rem;
  color: var(--graphite);
  font-variant-numeric: lining-nums tabular-nums;
}

/* Money going back to the family, not a warning. */
.charge-amount.is-back { color: var(--graphite-3); }

.charge-link a { font-size: 0.88rem; color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 34rem) {
  .charge { grid-template-columns: 1fr auto; row-gap: 0.3rem; }
  .charge-kind { grid-row: 2; }
}

/* ——— the listbox ———
 *
 * A native select's option menu belongs to the operating system: no CSS
 * reaches it, which is why the grade menu kept rendering in the system font
 * however carefully the closed control was styled. The real select is still in
 * the DOM and still submits; it is just not what you look at.
 */

.listbox { position: relative; flex: 0 0 14rem; width: 14rem; }

/* Present for the form and for a browser without JS, absent from view. */
.listbox-native {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.listbox-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  height: var(--control-h);
  padding: 0 0.8rem;
  font-family: var(--f-ui);
  font-size: 0.95rem;
  color: var(--graphite);
  text-align: left;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 0.35rem;
  cursor: pointer;
}

.listbox-button:hover { border-color: var(--navy); }

.listbox-button[aria-expanded="true"] {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 12%, transparent);
}

.listbox-chevron { display: flex; flex-shrink: 0; width: 0.75rem; color: var(--navy); }
.listbox-chevron svg { width: 100%; }
.listbox-chevron path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.listbox-button[aria-expanded="true"] .listbox-chevron { transform: rotate(180deg); }

.listbox-list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 15rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 0.35rem;
  box-shadow: var(--shadow-lift);
}

.listbox-option {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.5rem 0.6rem;
  font-family: var(--f-ui);
  font-size: 0.92rem;
  color: var(--graphite);
  border-radius: 0.25rem;
  cursor: pointer;
}

.listbox-option:hover, .listbox-option.active { background: color-mix(in srgb, var(--navy) 8%, transparent); color: var(--navy); }

.listbox-option[aria-selected="true"] { font-weight: 700; color: var(--navy); }

/* The accent, not the red pencil: a tick on the chosen option is not a miss. */
.listbox-tick { width: 0.9rem; flex-shrink: 0; color: var(--navy); opacity: 0; }
.listbox-option[aria-selected="true"] .listbox-tick { opacity: 1; }

/* .written.wide is width:100% because the deck-name field wants the whole row.
 * Inside a member row it has neighbours, so it has to yield — otherwise every
 * field claims a full line and one person takes half the screen. */
/* min-width: 0 on both the grid cell and the flex child. Without it a grid
 * item defaults to min-content width, the row refuses to shrink, and Save
 * overflows the padding that was just added. */
.member-form { align-items: center; min-width: 0; }
.member-form .written { width: auto; }
.member-name { flex: 1 1 10rem; min-width: 0; }

/* Inset on both edges: the mark used to touch the left edge and Save the
 * right. Overrides nothing — this is the row's only padding declaration. */
.member { padding: 1rem 1.25rem; gap: 0.45rem 0.9rem; }
.member .learner-mark { align-self: center; }

/* ——— the practice page, using the width ———
 *
 * The sheet and, beside it, the table of contents for the set. The rail is
 * not a readout about the student: no score, no accuracy, no streak, and
 * "left" counts questions not yet seen. */

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  /* Two things side by side share their height (developer.md), which here is
   * also what makes the rail's hairline read as the page's own margin rule
   * rather than as a stray 120px line beside the sheet. */
  align-items: stretch;
  /* A question is short and a window is tall. Centering the row in what is
   * left of the viewport puts the sheet on the desk instead of pinning it to
   * the top with a screen of nothing under it. */
  align-content: center;
  min-height: calc(100vh - 15rem);
}

/* An auto inline margin on a grid item makes it shrink to fit instead of
 * filling its track, so the sheet was coming out 654px wide in a 795px
 * column and sitting off-center against the rail. */
.practice-layout > .sheet { margin-inline: 0; }

/* The rail is a slip clipped to the sheet, not a card: no fill, one hairline
 * down its inner edge, and everything in it typed. */
.rail {
  padding: 0.2rem 0 0 clamp(1rem, 2vw, 1.5rem);
  border-left: 1px solid var(--hair-hard);
  font-size: 0.9rem;
}

.rail-block + .rail-block { margin-top: 1.4rem; padding-top: 1.3rem; border-top: 1px solid var(--hair); }

.rail-label {
  margin: 0 0 0.35rem;
  font-family: var(--f-type);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
}

.rail-title {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  color: var(--graphite);
  text-wrap: balance;
}

.rail-meta {
  margin: 0.4rem 0 0;
  font-family: var(--f-type);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--graphite-3);
}

.rail-skills { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }

.rail-skills li {
  padding: 0.35rem 0 0.35rem 0.95rem;
  line-height: 1.4;
}

/* Where you are in the set. A marker, not a measurement, and a dash rather
 * than a stripe down the edge (the accent spine is banned). */
.rail-skills li.here { font-weight: 600; position: relative; }

.rail-skills li.here::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 0.6rem;
  height: 2px;
  background: var(--navy);
}

.rail-skills li.here .rail-skill-name { color: var(--navy); }

.rail-skill-name { display: block; color: var(--graphite-2); }

.rail-lesson {
  display: inline-block;
  margin-top: 0.15rem;
  font-family: var(--f-type);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
}

.rail-out { font-size: 0.9rem; }

@media (max-width: 60rem) {
  .practice-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .rail { border-left: 0; border-top: 1px solid var(--hair); padding: 1.25rem 0 0; }
}

/* ——— reading back through a deck ———
 *
 * A record to read, not a marked paper. Each entry says in the margin whether
 * it was right or missed, typed, the same way the result sheet does — the old
 * version marked a miss with a red stripe down the left edge, which is the
 * banned accent spine and also said nothing a word could not say. */
.review-list { list-style: none; margin: 0; padding: 0; }

.review-item {
  display: grid;
  grid-template-columns: minmax(0, var(--margin-col)) minmax(0, 1fr);
  gap: 0.25rem clamp(1rem, 2.5vw, 2rem);
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--hair);
}

.review-item > * { grid-column: 2; }
.review-item > :first-child { grid-row: 1; }
.review-item:last-child { border-bottom: 0; }

.review-item .verdict-tag {
  grid-column: 1;
  grid-row: 1;
  margin: 0.2rem 0 0.15rem;
  font-family: var(--f-type);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
  color: var(--correct);
}

.review-item.wrong .verdict-tag { color: var(--miss); }

.review-item .topic {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  text-align: right;
  color: var(--graphite-3);
}

.review-item .stem.restated { font-size: 1.06rem; margin: 0 0 0.5rem; font-weight: 500; }

.review-answer { margin: 0 0 0.7rem; font-size: 0.95rem; color: var(--graphite-2); }
.review-answer strong { font-weight: 600; }
.review-item.wrong .review-answer strong:last-of-type { color: var(--correct); }

@media (max-width: 56rem) {
  .review-item { grid-template-columns: minmax(0, 1fr); }
  .review-item > *, .review-item .topic, .review-item .verdict-tag { grid-column: 1; }
  .review-item .topic, .review-item .verdict-tag { grid-row: auto; text-align: left; }
}

/* ——— password fields, and the eye that reveals them ———
 *
 * The button sits inside the field's box rather than beside it, so the row
 * keeps the same height as every other control (see the form-controls rule in
 * ~/Developer/config/developer.md). `.has-reveal` buys the right padding the
 * icon needs — without it the last characters of a revealed password run
 * underneath it, which is the one moment you are looking at them. */
.password-row { position: relative; display: block; }

.written.has-reveal { padding-right: 3rem; }

.reveal {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: var(--control-h);
  padding: 0;
  color: var(--graphite-3);
  background: none;
  border: 0;
  border-radius: 0 0.35rem 0.35rem 0;
  cursor: pointer;
}

.reveal:hover { color: var(--graphite); }

/* Explicit, because `hidden` alone loses to whatever is giving svg a display
 * of its own — the attribute was set and the icon still drew. Both icons
 * visible at once is the state this rule exists to prevent. */
.reveal svg[hidden] { display: none; }

.reveal svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reveal:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: -2px;
}

/* ---------- dev sign-in block (DEVELOPMENT ONLY) ----------
 *
 * The view gates this on Rails.env.development?; nothing here can reach a
 * production page. Ported from Task Happens and Rostr so the three read the
 * same, and drawn in smrtr's own navy rather than transplanted.
 *
 * Three signals that it is absent from production, all conventional rather than
 * invented: a dashed accent border (dashed means provisional), 45-degree hazard
 * piping, and the words themselves on a label strip laid across the piping.
 *
 * Additive by construction — a sibling of .gate, which is top-anchored, so
 * nothing a real user sees moves. One column definition drives the header and
 * every row, so "Sign in as" sits over the names rather than near them.
 */
.dev-cast {
  --dev-col: 7rem;
  --dev-gap: 0.9rem;
  --dev-pad: 0.7rem;
  --dev-stripe: color-mix(in srgb, var(--navy) 12%, transparent);

  max-width: 34rem;
  margin: 1.25rem auto 1rem;
  overflow: hidden;
  background: var(--card);
  border: 2px dashed color-mix(in srgb, var(--navy) 55%, transparent);
  border-radius: 0.5rem;
}

.dev-cast-tape {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.4rem 0.7rem;
  font-family: var(--f-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
  background: repeating-linear-gradient(
    45deg,
    var(--dev-stripe) 0 8px,
    transparent 8px 16px
  );
}

.dev-cast-tape-top { border-bottom: 2px dashed color-mix(in srgb, var(--navy) 45%, transparent); }
.dev-cast-tape-bottom { border-top: 2px dashed color-mix(in srgb, var(--navy) 45%, transparent); }

/* Edges left and right only: a strip laid across the tape, not a card on it.
 * The two phrases are flex items that wrap as whole units, so a phone shows
 * them on two centered lines rather than breaking one of them mid-phrase. */
.dev-cast-tape-label {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.55rem;
  padding: 0.5rem 1.15rem;
  text-align: center;
  background: var(--card);
  color: var(--navy);
  border-left: 2px dashed color-mix(in srgb, var(--navy) 45%, transparent);
  border-right: 2px dashed color-mix(in srgb, var(--navy) 45%, transparent);
}

/* The separator between the phrases is drawn, not typed, so it goes away with
 * the dots when the label wraps onto two lines. */
.dev-cast-tape-label .u + .u::before { content: "· "; }

@media (max-width: 32rem) {
  .dev-cast-tape-label::before, .dev-cast-tape-label::after { display: none; }
  .dev-cast-tape-label .u + .u::before { content: none; }
}

.dev-cast-tape-label::before,
.dev-cast-tape-label::after {
  content: "";
  flex: none;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--navy);
}

.dev-cast-body { padding: 0.45rem; }

.dev-cast-head,
.dev-cast-row {
  display: grid;
  grid-template-columns: var(--dev-col) 1fr 1.25rem;
  column-gap: var(--dev-gap);
  width: 100%;
  padding: 0.6rem var(--dev-pad);
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  text-align: left;
  font: inherit;
  font-family: var(--f-ui);
  color: inherit;
  cursor: pointer;
}

.dev-cast-head { align-items: center; padding-block: 0.5rem; }
.dev-cast-row { align-items: start; }

.dev-cast-head:hover,
.dev-cast-row:hover { background: var(--pulp-deep); border-color: var(--hair); }

.dev-cast-head-title { font-size: 0.85rem; font-weight: 700; color: var(--graphite); }

@media (max-width: 32rem) { .dev-cast-head-sub { display: none; } }

.dev-cast-head-sub {
  min-width: 0;
  font-size: 0.78rem;
  color: var(--graphite-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dev-cast-chevron { display: grid; place-items: center; color: var(--graphite-3); }
.dev-cast-chevron svg { display: block; transition: transform 180ms ease; }
.dev-cast.is-collapsed .dev-cast-chevron svg { transform: rotate(180deg); }

/* 0fr to 1fr is the only way to transition to a content-determined height
 * without measuring it in JavaScript; the child needs min-height:0 to shrink. */
.dev-cast-panel {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 180ms ease, opacity 140ms ease, visibility 0s;
}

.dev-cast-panel > .dev-cast-table { min-height: 0; overflow: hidden; }

.dev-cast.is-collapsed .dev-cast-panel {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 180ms ease, opacity 140ms ease, visibility 0s 180ms;
}

.dev-cast-table {
  display: grid;
  gap: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--hair);
}

.dev-cast-who { display: grid; gap: 0.1rem; }
.dev-cast-name { font-weight: 700; font-size: 0.9rem; color: var(--graphite); }
.dev-cast-role { font-size: 0.72rem; color: var(--graphite-3); letter-spacing: 0.02em; }
.dev-cast-blurb { font-size: 0.82rem; line-height: 1.45; color: var(--graphite-2); }

@media (prefers-reduced-motion: reduce) {
  .dev-cast-panel,
  .dev-cast-chevron svg { transition: none; }
}

@media (max-width: 32rem) {
  .dev-cast-head,
  .dev-cast-row { grid-template-columns: 1fr 1.25rem; }
  .dev-cast-row { row-gap: 0.25rem; }
  .dev-cast-blurb { grid-column: 1 / -1; }
  .dev-cast-who {
    grid-auto-flow: column;
    justify-content: start;
    gap: 0.45rem;
    align-items: baseline;
  }
}

/* ——— the subject switch ———
 *
 * Math and language arts, on the browse surface. Underlined tabs rather than
 * the pill tabs in the masthead: those are the app's sections and this is a
 * filter inside one of them, so it must not read as a fourth section.
 *
 * Rendered only when more than one subject is stocked at the learner's grade.
 * A tab strip with one tab is a control that cannot do anything.
 */
.subject-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--hair);
}

.subject-tab {
  padding: 0.55rem 0.95rem;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--graphite-3);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.subject-tab:hover { color: var(--navy); }

.subject-tab.on {
  color: var(--navy);
  /* The accent, not the red pencil: red on this page would say something was
   * wrong with the subject you are looking at. */
  border-bottom-color: var(--navy);
}

/* The subject heading in the deck builder, where both trees are on one page
 * because a deck is allowed to mix them. */
.subject-head {
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  font-family: var(--f-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--navy);
  border-bottom: 2px solid var(--hair);
}

.subject-head:first-of-type { margin-top: 1rem; }

/* Operator ledger (/admin/errors): a wide table scrolls inside its own box,
   the page never scrolls sideways; times and paths never wrap. */
.table-scroll { overflow-x: auto; }
.ledger { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.ledger th, .ledger td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--hair); }
.ledger .nowrap { white-space: nowrap; }
.ledger pre { white-space: pre-wrap; font-size: 0.8rem; margin: 0.3rem 0 0; }

/* Legal pages: running prose at a reading measure, headings that group. */
/* ——— the legal pages ———
 *
 * Still a sheet, because they are part of the same product, but a page of
 * continuous prose is the one place the grid stops being a design decision
 * and starts being a reason to give up. The rules stay visible under a wash
 * and the printed margin comes off: there is no margin column here to print
 * one beside. */
.legal {
  max-width: 66ch;
  min-height: 0;
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1.4rem, 3.5vw, 2.6rem);
  background-image:
    linear-gradient(var(--wash), var(--wash)),
    repeating-linear-gradient(var(--rule) 0 1px, transparent 1px var(--square)),
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--square));
  font-family: var(--f-ui);
  font-variant-numeric: normal;
}

.legal h1 {
  margin: 0 0 0.6rem;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2rem, 1.5rem + 1.8vw, 2.6rem);
  letter-spacing: -0.028em;
  line-height: 1.05;
}

.legal .lede {
  margin: 0 0 2rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--hair-hard);
  font-size: 1rem;
  color: var(--graphite-2);
  line-height: 1.6;
}

/* The date is its own sentence, so it gets its own line rather than
   breaking the lede mid-phrase on a phone (wrapcheck). */
.legal .lede .updated { display: block; }

.legal h2 {
  margin: 2.2rem 0 0.6rem;
  font-family: var(--f-type);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
}

.legal p {
  margin: 0 0 0.9rem;
  font-size: 0.98rem;
  line-height: 1.72;
  color: var(--graphite);
  text-wrap: pretty;
}

/* ——— the error ledger ———
 *
 * A table, not paperwork. The paper and the printed margin come off: a grid
 * behind a grid of rows is two grids fighting, and a rule down the middle of
 * a When column is just wrong. */
.sheet:not(:has(> .topic)):not(.legal) {
  min-height: 0;
  /* 100%, never none. A sheet carries `margin: 0 auto`, and an auto inline
   * margin makes a grid item size to fit its content: with no max-width the
   * ledger's widest row set the sheet's width and the page scrolled sideways
   * at 390. Same trap that made the practice sheet 654px in a 795px column. */
  max-width: 100%;
  background: var(--card);
  background-image: none;
  font-family: var(--f-ui);
  font-variant-numeric: normal;
}

.sheet:not(:has(> .topic)):not(.legal) h1 {
  margin: 0 0 0.5rem;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  letter-spacing: -0.024em;
}

.ledger th {
  font-family: var(--f-type);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
}

.ledger td.nowrap { font-family: var(--f-type); font-size: 0.78rem; }
.legal h2 { margin: 1.6rem 0 0.4rem; font-size: 1.1rem; }
.legal p { margin: 0 0 0.75rem; }
.foot-meta a { color: inherit; }

/* A phrase kept whole, so a line breaks where the copy chose (wrapcheck). */
.u { white-space: nowrap; }

/* ——— the desk, and the two things it puts on a learner's page ——————————
 *
 * The desk is Derick reading the content and saying it is right. Its pages
 * are the app's own paper: no second visual language for an admin area,
 * because an admin area that looks like a different product is a place you
 * forget to look after.
 */

.desk-tally {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem 2rem;
  margin: 1.5rem 0 2rem;
  padding: 0 0 1.2rem;
  border-bottom: 1px solid var(--hair);
}

.desk-tally div { margin: 0; }
.desk-tally dt {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.7rem;
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--navy);
}
.desk-tally dd { margin: 0; font-size: 0.92rem; color: var(--graphite-3); }

.desk-note { margin: 0 0 1rem; font-size: 0.95rem; color: var(--graphite-3); max-width: var(--measure); }

.desk-list, .desk-queue { margin: 0 0 2rem; padding: 0; list-style: none; }
.desk-queue { counter-reset: queue; }
.desk-list > li, .desk-queue > li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--hair);
}
.desk-queue > li { counter-increment: queue; }

.desk-who, .desk-skill, .desk-step-id {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
}

.desk-said { margin: 0 0 0.3rem; max-width: var(--measure); }
.desk-stem { margin: 0; max-width: var(--measure); }
.desk-reply { margin: 0.3rem 0 0; color: var(--navy); max-width: var(--measure); }
.desk-crumb { margin: 0 0 1.2rem; font-size: 0.9rem; color: var(--graphite-3); }
.desk-warn { color: var(--miss); font-weight: 600; }

/* The boxes. They save themselves, so they look like the text they hold
 * rather than like a form: the border is there to say where the box ends. */
.desk-h { margin: 1.6rem 0 0.4rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-wrap: balance; color: var(--graphite-3); }
.desk-edit textarea {
  display: block;
  width: 100%;
  max-width: var(--measure);
  padding: 0.6rem 0.75rem;
  font: inherit;
  line-height: 1.55;
  color: var(--graphite);
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 3px;
  resize: vertical;
}
.desk-edit textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: transparent; }

.desk-step { margin: 1.2rem 0; padding: 0.9rem 0 0; border-top: 1px solid var(--hair); }
.desk-step textarea + textarea { margin-top: 0.4rem; }

.desk-pool { margin: 0.4rem 0 0; max-width: var(--measure); }
.desk-pool div { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 0.2rem 1rem; padding: 0.35rem 0; border-top: 1px solid var(--hair); }

/* On a phone the two columns leave the box about four characters wide and
   the reason breaks a letter at a time ("answe / red / with"). The option
   goes above its reason instead. */
@media (max-width: 44rem) {
  .desk-pool div { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
}
.desk-pool dt { margin: 0; font-weight: 600; }
.desk-pool dt.is-answer { color: var(--navy); }
.desk-pool dd { margin: 0; font-size: 0.95rem; color: var(--graphite-3); }

.desk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 1.8rem 0 0; }

/* The one line that says whether a save happened, kept on screen. The boxes
 * run down a long page and a save that says nothing reads exactly like a
 * save that failed. */
.desk-actions.is-sticky {
  position: sticky;
  bottom: 0;
  z-index: 40;
  padding: 0.7rem 0;
  background: color-mix(in srgb, var(--pulp) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--hair);
}
.desk-state { margin: 0; font-size: 0.92rem; color: var(--graphite-3); }

.desk-report { padding: 0.9rem 0; border-top: 1px solid var(--hair); }
.desk-answer { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.desk-answer input[type="text"] { flex: 1 1 16rem; min-width: 0; padding: 0.5rem 0.7rem; font: inherit; border: 1px solid var(--hair); border-radius: 3px; background: var(--sheet); }

.desk-link { margin: 0.4rem 0 0; font-size: 0.88rem; }

/* On a learner's own page: what Derick has said, and how to say it back.
 * Both are quiet. A worksheet does not wear a badge. */
.checked {
  margin: 1.2rem 0 0;
  font-size: 0.85rem;
  color: var(--graphite-3);
}
.checked.is-checked { color: var(--navy); }
.checked-mark { font-weight: 700; }

.report { margin: 0.4rem 0 0; }
.report-mine { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--graphite-3); }
.report-reply { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--navy); }
.report-open {
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--graphite-3);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.report-open:hover { color: var(--navy); }
.report-form { display: grid; gap: 0.5rem; max-width: 34rem; margin-top: 0.6rem; }
.report-form label { font-size: 0.85rem; color: var(--graphite-3); }
.report-form textarea { padding: 0.6rem 0.7rem; font: inherit; border: 1px solid var(--hair); border-radius: 3px; background: var(--sheet); resize: vertical; }
.report-form input[type="submit"] { justify-self: start; }

/* A shared passage, shown and not edited. Pre, because the blank line
 * between paragraphs is the only markup a passage has. */
.desk-passage {
  max-width: var(--measure);
  margin: 0;
  padding: 0.6rem 0.75rem;
  font: inherit;
  line-height: 1.55;
  white-space: pre-wrap;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 3px;
}

/* ——— the desk's own sheet ———
 *
 * The question as a learner meets it, with every piece of prose on it a box.
 * Derick, 2026-10-27: "If that's what I'm vetting is the question, it should
 * look like the question, and then I should be able to edit in place anything
 * that I see there."
 *
 * So the box is not a box. It inherits the font, the size and the color of
 * the thing it replaces and carries one dotted line underneath to say it can
 * be typed in. The old page's bordered grey textareas under uppercase labels
 * were a form about a question rather than the question. */
/* ⚠ width, because .sheet centers itself with `margin: 0 auto` and an auto
 * margin on a grid item turns off the default stretch: the sheet then takes
 * its fit-content width. On the practice page it is inside .practice-layout
 * and fills it; here it is a grid item, and a question whose options are "1",
 * "2", "3" and "4" shrank the paper to 535px and broke the stem across two
 * lines. The paper is a leaf of paper whatever is written on it. */
.desk-sheet { width: 100%; }

.desk-how { max-width: var(--measure); margin: 0 0 1.6rem; }
.desk-how ul { margin: 0; padding-left: 1.1rem; }
.desk-how li {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--graphite-3);
}

.desk-sheet .ink {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 0 0.1rem;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--hair-hard);
  border-radius: 0;
  /* Sized to its own text by the desk controller, so a stem never scrolls
   * inside a box three lines tall. resize is off for the same reason: the
   * height is the text's, not a thing to drag. */
  resize: none;
  overflow: hidden;
}
.desk-sheet .ink:hover { border-bottom-color: var(--navy); }
.desk-sheet .ink:focus {
  outline: 0;
  border-bottom: 1px solid var(--navy);
  background: var(--navy-wash);
}

/* What the learner actually reads, when the box cannot show it: a template's
 * numbers, a stacked fraction, an exponent. */
.desk-as-read {
  max-width: var(--measure);
  margin: 0.3rem 0 1rem;
  font-size: 0.95rem;
  color: var(--graphite-3);
}
.desk-as-read-label {
  margin-right: 0.4rem;
  font-family: "Courier Prime", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The options, each carrying the reason it is wrong. The list is the
 * learner's list; the reason is the desk's. */
/* The options a learner is shown, lettered the way they are on the sheet,
 * each with the reason it is wrong written under it. One list and not two:
 * a page that prints the options at the top and again at the bottom beside
 * their reasons is a page where the two can disagree.
 *
 * Deliberately not the .options class. Those rules letter a <label>, and the
 * only label here is the reason box, so reusing them put the A, B, C on the
 * reasons and left the options unlettered. */
.desk-options {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  counter-reset: opt;
}
.desk-options li { counter-increment: opt; margin: 0 0 0.6rem; }
.desk-options .opt-row {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  margin: 0;
  padding: 0.6rem 0.95rem;
  font-size: 1.04rem;
  line-height: 1.45;
  text-wrap: pretty;
  background: var(--wash);
  border: 1px solid var(--hair);
  border-radius: 3px;
}
.desk-options .opt-row::before {
  content: counter(opt, upper-alpha);
  display: grid;
  place-items: center;
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  align-self: center;
  font-family: var(--f-type);
  font-size: 0.78rem;
  line-height: 1;
  color: var(--graphite-3);
  border: 1.5px solid var(--hair-hard);
  border-radius: 50%;
  background: var(--sheet);
}
.desk-options .opt { flex: 1; min-width: 0; }
.desk-options .opt-absent { color: var(--graphite-3); font-style: italic; }
.desk-options .is-answer .opt-row { border-color: var(--correct); }
.desk-options .is-answer .opt-row::before { border-color: var(--correct); color: var(--correct); }
.desk-options .opt-tag {
  flex: none;
  font-family: "Courier Prime", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--correct);
}
/* The reason hangs under its option, lined up with the option's text rather
 * than with its bubble: 1.6rem of bubble and 0.8rem of gap, plus the row's
 * own padding. */
.desk-options .opt-why {
  display: block;
  margin: 0.35rem 0 0;
  padding-left: calc(1.6rem + 0.8rem + 0.95rem);
}
.desk-options .opt-why-label {
  display: block;
  font-family: "Courier Prime", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
}
.desk-options .opt-why .ink { font-size: 0.95rem; color: var(--graphite-3); }
@media (max-width: 34rem) {
  .desk-options .opt-why { padding-left: 0; }
}

.desk-written-answer { max-width: var(--measure); }

/* Everything below the sheet: what they read after a miss, the facts about
 * this one, what has been reported. */
.desk-block { margin: 2rem 0 0; }
.desk-miss { max-width: var(--measure); }
.desk-miss-lead { margin: 0 0 0.6rem; font-size: 1.05rem; }
.desk-miss-full { margin: 0 0 0.6rem; }
.desk-block .ink {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 0 0.1rem;
  font: inherit;
  color: inherit;
  line-height: 1.55;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--hair-hard);
  border-radius: 0;
  resize: none;
  overflow: hidden;
}
.desk-block .ink:hover { border-bottom-color: var(--navy); }
.desk-block .ink:focus {
  outline: 0;
  border-bottom: 1px solid var(--navy);
  background: var(--navy-wash);
}

.desk-facts { margin: 0; max-width: var(--measure); }
.desk-facts div {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.2rem 1rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--hair);
}
.desk-facts dt {
  margin: 0;
  font-family: "Courier Prime", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-3);
  align-self: center;
}
.desk-facts dd { margin: 0; }
@media (max-width: 44rem) {
  .desk-facts div { grid-template-columns: minmax(0, 1fr); }
}

.desk-aside {
  max-width: var(--measure);
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--graphite-3);
}
.desk-aside code { word-break: break-all; }
