/* ==========================================================================
   ms-hub.css — Middle School Success Center
   Hub page sections + the shared game shell used by all five resource games.
   --------------------------------------------------------------------------
   Every class here is `ms-` prefixed. This file consumes the tokens declared
   in /assets/css/y2-tokens.css and never redefines them, so the hub inherits
   any future palette change for free. It deliberately does not touch y2-,
   cc-, sv-, sc-, pc- or demo- selectors.

   Two audiences share one stylesheet. The hub sections (ms-hero, ms-why,
   ms-resources, ms-bridge, ms-signup) are parent-facing and stay flat and
   typographic. The game shell (ms-game-*) is student-facing and is allowed
   more play — bigger radii, emoji, a progress rail — but only ever inside the
   same three-colour palette. There is no second theme here.

   Contrast notes, measured against WCAG 2.1:
     ink   #14264C on paper #FBFAF6  → 13.9:1
     ink   #14264C on pencil #F5B91E →  7.6:1   (chips, buttons, badges)
     white #FFFFFF on ink #14264C    → 14.4:1
     ink-60 #5A6785 on paper         →  5.6:1
   Pencil yellow is NEVER used as a text colour on paper or white — it fails
   at every size. It is a surface colour only, always carrying ink text.
   ========================================================================== */

/* --------------------------------------------------------------------------
   PAGE BASE
   -------------------------------------------------------------------------- */

/* The game pages load ONLY y2-tokens.css (which emits no rules) and this
   file — they deliberately skip the legacy styles.css, which is where the
   rest of the site happens to get its border-box reset. Without this, every
   padded container measures content + padding and a 375px viewport scrolls
   sideways. Scoped to .ms-page so it cannot reach any other surface. */
.ms-page,
.ms-page *,
.ms-page *::before,
.ms-page *::after { box-sizing: border-box; }

.ms-page {
  margin: 0;
  background: var(--y2-paper);
  color: var(--y2-ink);
  font-family: var(--y2-body);
  font-size: var(--y2-t-body);
  line-height: var(--y2-lh-body);
  -webkit-font-smoothing: antialiased;
}

.ms-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--y2-ink);
  color: #fff;
  font-family: var(--y2-body);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--y2-radius-sm) 0;
}
.ms-skip:focus {
  left: 0;
}

.ms-container {
  width: 100%;
  max-width: var(--y2-maxw);
  margin-inline: auto;
  padding-inline: var(--y2-s-3);
}

.ms-section {
  padding-block: var(--y2-section-y);
}
.ms-section--tight { padding-block: var(--y2-s-6); }
.ms-section--white { background: var(--y2-white); }

.ms-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--y2-s-2);
  font-family: var(--y2-body);
  font-size: var(--y2-t-eyebrow);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--y2-ink-60);
}
.ms-eyebrow::before {
  content: "";
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: var(--y2-pencil);
}

.ms-h1,
.ms-h2,
.ms-h3 {
  font-family: var(--y2-display);
  color: var(--y2-ink);
  margin: 0;
  font-optical-sizing: auto;
}
.ms-h1 {
  font-size: var(--y2-t-hero);
  font-weight: 650;
  line-height: var(--y2-lh-tight);
  letter-spacing: -0.02em;
}
.ms-h2 {
  font-size: var(--y2-t-h2);
  font-weight: 650;
  line-height: var(--y2-lh-head);
  letter-spacing: -0.01em;
}
.ms-h3 {
  font-size: var(--y2-t-h3);
  font-weight: 600;
  line-height: var(--y2-lh-head);
}

.ms-lede {
  font-size: 1.1875rem;
  line-height: 1.65;
  color: var(--y2-ink-60);
  max-width: 60ch;
  margin: var(--y2-s-2) 0 0;
}
.ms-body { color: var(--y2-ink-60); margin: var(--y2-s-2) 0 0; }
.ms-small { font-size: var(--y2-t-small); color: var(--y2-ink-60); }

/* --------------------------------------------------------------------------
   BUTTONS — same geometry as y2-btn, re-declared under ms- so the hub never
   depends on a component file it does not own.
   -------------------------------------------------------------------------- */

.ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font-family: var(--y2-body);
  font-size: var(--y2-t-body);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--y2-radius-sm);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease,
              border-color 180ms ease, transform 180ms ease;
}
.ms-btn:active { transform: translateY(1px); }
.ms-btn--primary {
  background: var(--y2-pencil);
  color: var(--y2-ink);
}
.ms-btn--primary:hover { background: #e0a70f; }
.ms-btn--secondary {
  background: transparent;
  color: var(--y2-ink);
  border-color: var(--y2-ink);
}
.ms-btn--secondary:hover { background: var(--y2-ink); color: #fff; }
.ms-btn--ghost {
  background: transparent;
  color: var(--y2-ink);
  border-color: transparent;
  padding-inline: 0.5rem;
}
.ms-btn--ghost:hover { background: rgba(20, 38, 76, 0.06); }
.ms-btn[disabled],
.ms-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.ms-on-ink .ms-btn--secondary { border-color: #fff; color: #fff; }
.ms-on-ink .ms-btn--secondary:hover { background: #fff; color: var(--y2-ink); }

/* One focus ring for everything interactive on the hub and in the games.
   Two-tone so it stays visible on paper, on white cards and on the navy
   band — a single-colour ring disappears against one of the three. */
.ms-page :is(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--y2-ink);
  outline-offset: 2px;
  border-radius: var(--y2-radius-sm);
}
.ms-on-ink :is(a, button, input, select, [tabindex]):focus-visible {
  outline-color: var(--y2-pencil);
}

/* --------------------------------------------------------------------------
   HERO
   -------------------------------------------------------------------------- */

.ms-hero {
  position: relative;
  background: var(--y2-paper);
  padding-block: var(--y2-s-8) var(--y2-s-6);
  overflow: hidden;
}
/* A single soft wash rather than a pattern. Anything busier competes with the
   card grid directly below it. */
.ms-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -60% 40%;
  height: 480px;
  background: radial-gradient(closest-side, rgba(245, 185, 30, 0.16), transparent);
  pointer-events: none;
}
.ms-hero__inner { position: relative; z-index: 1; max-width: 46rem; }
.ms-hero__name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  margin-bottom: var(--y2-s-3);
  background: var(--y2-ink);
  color: #fff;
  border-radius: 999px;
  font-size: var(--y2-t-small);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ms-hero__name b { color: var(--y2-pencil); font-weight: 700; }
.ms-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--y2-s-2);
  margin-top: var(--y2-s-4);
}
.ms-hero__trust {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--y2-s-3);
  font-size: var(--y2-t-small);
  font-weight: 600;
  color: var(--y2-ink-60);
}
.ms-hero__trust::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--y2-pencil);
}
.ms-textlink {
  color: var(--y2-ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.ms-textlink:hover { text-decoration-thickness: 2px; }

/* --------------------------------------------------------------------------
   WHY — three parent-facing columns
   -------------------------------------------------------------------------- */

.ms-why__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--y2-s-4);
  margin-top: var(--y2-s-6);
}
.ms-why__item {
  padding-top: var(--y2-s-3);
  border-top: 3px solid var(--y2-pencil);
}
.ms-why__item h3 { margin: 0 0 0.5rem; font-size: 1.1875rem; }
.ms-why__item p { margin: 0; color: var(--y2-ink-60); }

/* --------------------------------------------------------------------------
   RESOURCE CARD GRID
   -------------------------------------------------------------------------- */

.ms-resources__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--y2-s-2);
}
.ms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--y2-s-3);
  margin-top: var(--y2-s-6);
}

.ms-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--y2-s-3);
  background: var(--y2-white);
  border: 1px solid var(--y2-line);
  border-radius: var(--y2-radius);
  text-decoration: none;
  color: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
a.ms-card:hover {
  transform: translateY(-3px);
  border-color: rgba(20, 38, 76, 0.24);
  box-shadow: var(--y2-shadow-lg);
}
/* The whole card is the hit area; the title carries the accessible name so
   screen readers announce something better than the emoji. */
.ms-card__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  border-radius: 12px;
  background: var(--y2-paper);
}
.ms-card__title { font-family: var(--y2-display); font-size: 1.25rem; font-weight: 600; margin: 0; }
.ms-card__desc { margin: 0; font-size: var(--y2-t-small); color: var(--y2-ink-60); }
.ms-card__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ms-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--y2-line);
  font-size: var(--y2-t-small);
}
.ms-card__time { color: var(--y2-ink-60); }
.ms-card__go { font-weight: 700; color: var(--y2-ink); }
a.ms-card:hover .ms-card__go { text-decoration: underline; text-underline-offset: 0.2em; }

.ms-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ms-chip--math    { background: var(--y2-ink);    color: #fff; }
.ms-chip--english { background: var(--y2-pencil); color: var(--y2-ink); }
.ms-chip--grade   { background: var(--y2-paper);  color: var(--y2-ink-60); border: 1px solid var(--y2-line); }

/* Coming-soon state. Greyed, not hidden — it is the newsletter hook. */
.ms-card--soon {
  background: transparent;
  border-style: dashed;
  border-color: rgba(20, 38, 76, 0.22);
}
.ms-card--soon .ms-card__icon { background: rgba(20, 38, 76, 0.05); filter: grayscale(1); opacity: 0.75; }
.ms-card--soon .ms-card__title { color: var(--y2-ink-60); }
.ms-badge-soon {
  align-self: flex-start;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(20, 38, 76, 0.08);
  color: var(--y2-ink-60);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   BRIDGE — navy full-width band
   -------------------------------------------------------------------------- */

.ms-bridge {
  background: var(--y2-ink);
  color: #fff;
  padding-block: var(--y2-s-8);
}
.ms-bridge .ms-h2 { color: #fff; }
.ms-bridge p { color: rgba(255, 255, 255, 0.84); }
.ms-bridge__inner { max-width: 52rem; }
.ms-bridge__path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: var(--y2-s-4) 0 0;
  padding: 0;
  list-style: none;
}
.ms-bridge__path li {
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  font-size: var(--y2-t-small);
  font-weight: 600;
}
.ms-bridge__path li[aria-current="step"] {
  background: var(--y2-pencil);
  border-color: var(--y2-pencil);
  color: var(--y2-ink);
}
.ms-bridge__actions { display: flex; flex-wrap: wrap; gap: var(--y2-s-2); margin-top: var(--y2-s-4); }

/* --------------------------------------------------------------------------
   SIGNUP + INQUIRY
   -------------------------------------------------------------------------- */

.ms-signup__card {
  max-width: 34rem;
  padding: var(--y2-s-4);
  background: var(--y2-white);
  border: 1px solid var(--y2-line);
  border-radius: var(--y2-radius-lg);
  box-shadow: var(--y2-shadow);
}
.ms-field { display: flex; flex-direction: column; gap: 0.4rem; margin-top: var(--y2-s-2); }
.ms-field label { font-size: var(--y2-t-small); font-weight: 600; }
.ms-field input,
.ms-field select {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  font-family: var(--y2-body);
  font-size: var(--y2-t-body);
  color: var(--y2-ink);
  background: var(--y2-white);
  border: 1px solid var(--y2-line-strong);
  border-radius: var(--y2-radius-sm);
}
.ms-field input[aria-invalid="true"],
.ms-field select[aria-invalid="true"] { border-color: #B3261E; }
.ms-field__error { font-size: 0.85rem; font-weight: 600; color: #B3261E; }
/* Honeypot. Off-screen rather than display:none — some bots skip hidden
   fields but happily fill positioned ones. */
.ms-hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.ms-formnote { margin-top: var(--y2-s-2); font-size: 0.85rem; color: var(--y2-ink-60); }
.ms-formstatus { margin-top: var(--y2-s-2); font-size: var(--y2-t-small); font-weight: 600; }
.ms-formstatus--ok { color: #1B5E20; }
.ms-formstatus--err { color: #B3261E; }

.ms-inquiry__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--y2-s-3);
  margin-top: var(--y2-s-4);
}
.ms-inquiry__item {
  padding: var(--y2-s-3);
  background: var(--y2-white);
  border: 1px solid var(--y2-line);
  border-radius: var(--y2-radius);
}
.ms-inquiry__item h3 { margin: 0 0 0.35rem; font-size: 1.0625rem; font-family: var(--y2-display); }
.ms-inquiry__item p { margin: 0; font-size: var(--y2-t-small); color: var(--y2-ink-60); }
.ms-inquiry__item a { color: var(--y2-ink); font-weight: 600; }

/* ==========================================================================
   GAME SHELL — shared by math-lab-escape, number-ninja, word-detective,
   reading-sprint and library-lockdown.
   ========================================================================== */

.ms-game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--y2-paper);
}

.ms-game-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--y2-s-2);
  padding: 0.75rem var(--y2-s-3);
  background: var(--y2-ink);
  color: #fff;
}
.ms-game-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  color: #fff;
  font-size: var(--y2-t-small);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--y2-radius-sm);
}
.ms-game-bar__back:hover { background: rgba(255, 255, 255, 0.12); }
.ms-game-bar__title {
  font-family: var(--y2-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}
.ms-game-bar__count {
  font-variant-numeric: tabular-nums;
  font-size: var(--y2-t-small);
  font-weight: 700;
  color: var(--y2-pencil);
  white-space: nowrap;
}

/* At 375px the three bar items wrap onto two lines each and the header eats
   a third of the screen. Shrink the type and stop the wrapping rather than
   dropping any of the three — the back link is the only way out of a game,
   and the counter is the only progress cue when the dots scroll off. */
@media (max-width: 479px) {
  .ms-game-bar { padding-inline: 0.75rem; gap: 0.5rem; }
  .ms-game-bar__back { padding-inline: 0.25rem; font-size: 0.8125rem; white-space: nowrap; }
  .ms-game-bar__title {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ms-game-bar__count { font-size: 0.8125rem; }
}

.ms-progress {
  height: 6px;
  background: rgba(20, 38, 76, 0.12);
  overflow: hidden;
}
.ms-progress__fill {
  height: 100%;
  width: 0;
  background: var(--y2-pencil);
  transition: width 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-game-main {
  flex: 1;
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding: var(--y2-s-4) var(--y2-s-3) var(--y2-s-8);
}

.ms-panel {
  padding: var(--y2-s-4);
  background: var(--y2-white);
  border: 1px solid var(--y2-line);
  border-radius: var(--y2-radius-lg);
  box-shadow: var(--y2-shadow);
}
.ms-panel + .ms-panel { margin-top: var(--y2-s-3); }
.ms-panel[hidden] { display: none; }

.ms-q__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--y2-s-2);
}
.ms-q__slot {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--y2-ink-60);
}
.ms-q__std {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--y2-paper);
  border: 1px solid var(--y2-line);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--y2-ink-60);
}
.ms-q__prompt {
  font-family: var(--y2-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 var(--y2-s-2);
}
.ms-q__stem { margin: 0 0 var(--y2-s-3); color: var(--y2-ink-60); }
.ms-q__math {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--y2-ink);
}

.ms-answer { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.ms-answer__input {
  flex: 1 1 12rem;
  min-height: 52px;
  padding: 0.7rem 0.9rem;
  font-family: var(--y2-body);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  color: var(--y2-ink);
  background: var(--y2-white);
  border: 2px solid var(--y2-line-strong);
  border-radius: var(--y2-radius-sm);
}
.ms-answer__input:focus { border-color: var(--y2-ink); }

/* Multiple-choice options are real radios, visually replaced. Keeping the
   input in the DOM is what makes arrow-key selection and the required-group
   semantics work without a single line of keyboard JS. */
.ms-options { display: grid; gap: 0.6rem; margin: 0 0 var(--y2-s-3); padding: 0; border: 0; }
.ms-option { position: relative; display: block; }
.ms-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.ms-option span {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  background: var(--y2-white);
  border: 2px solid var(--y2-line-strong);
  border-radius: var(--y2-radius-sm);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.ms-option span::before {
  content: attr(data-key);
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--y2-paper);
  border: 1px solid var(--y2-line-strong);
  font-size: 0.8rem;
  font-weight: 700;
}
.ms-option:hover span { border-color: var(--y2-ink-60); }
.ms-option input:checked + span {
  border-color: var(--y2-ink);
  background: rgba(20, 38, 76, 0.04);
}
.ms-option input:checked + span::before {
  background: var(--y2-ink);
  border-color: var(--y2-ink);
  color: #fff;
}
.ms-option input:focus-visible + span {
  outline: 3px solid var(--y2-ink);
  outline-offset: 2px;
}
.ms-option input:disabled + span { cursor: default; }
/* Post-answer marking. Colour is never the only signal — the ::after glyph
   carries the same information for anyone who cannot distinguish the hues. */
.ms-option--right span { border-color: #1B5E20; background: rgba(27, 94, 32, 0.07); }
.ms-option--right span::after { content: "✓"; margin-left: auto; font-weight: 700; color: #1B5E20; }
.ms-option--wrong span { border-color: #B3261E; background: rgba(179, 38, 30, 0.06); }
.ms-option--wrong span::after { content: "✕"; margin-left: auto; font-weight: 700; color: #B3261E; }

.ms-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--y2-s-3); }

/* Feedback block. One element, three states, driven by a data attribute so
   the aria-live announcement and the visual state can never disagree. */
.ms-feedback {
  margin-top: var(--y2-s-3);
  padding: var(--y2-s-2) var(--y2-s-3);
  border-radius: var(--y2-radius-sm);
  border-left: 4px solid var(--y2-line-strong);
  background: var(--y2-paper);
  font-size: var(--y2-t-small);
}
.ms-feedback:empty { display: none; }
.ms-feedback[data-state="right"] { border-left-color: #1B5E20; background: rgba(27, 94, 32, 0.07); }
.ms-feedback[data-state="hint"]  { border-left-color: var(--y2-pencil); background: rgba(245, 185, 30, 0.14); }
.ms-feedback[data-state="wrong"] { border-left-color: #B3261E; background: rgba(179, 38, 30, 0.06); }
.ms-feedback b { display: block; margin-bottom: 0.25rem; color: var(--y2-ink); }

/* Per-slot progress dots. Three states: pending, solved, solved-with-help. */
.ms-dots { display: flex; gap: 0.4rem; list-style: none; margin: 0 0 var(--y2-s-3); padding: 0; }
.ms-dots li {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 38, 76, 0.08);
  border: 2px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--y2-ink-60);
}
.ms-dots li[data-state="current"] { border-color: var(--y2-ink); color: var(--y2-ink); }
.ms-dots li[data-state="solved"]  { background: var(--y2-ink); color: #fff; }
.ms-dots li[data-state="helped"]  { background: var(--y2-pencil); color: var(--y2-ink); }

/* Completion screen */
.ms-done { text-align: center; }
.ms-done__emoji { font-size: 56px; line-height: 1; }
.ms-done__score {
  font-family: var(--y2-display);
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 650;
  line-height: 1;
  margin: var(--y2-s-2) 0 0.25rem;
}
.ms-done__list {
  margin: var(--y2-s-3) 0 0;
  padding: var(--y2-s-3);
  background: var(--y2-paper);
  border-radius: var(--y2-radius-sm);
  text-align: left;
  font-size: var(--y2-t-small);
}
.ms-done__list ul { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--y2-ink-60); }
.ms-done__list li { margin-bottom: 0.25rem; }
.ms-done__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: var(--y2-s-4); }
.ms-done__parent {
  margin-top: var(--y2-s-4);
  padding-top: var(--y2-s-3);
  border-top: 1px solid var(--y2-line);
  font-size: var(--y2-t-small);
  color: var(--y2-ink-60);
}

/* Belt / passage pickers share one chooser pattern. */
.ms-choice { display: grid; gap: 0.75rem; margin-top: var(--y2-s-3); }
.ms-choice__btn {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  min-height: 64px;
  padding: 0.9rem 1.1rem;
  text-align: left;
  background: var(--y2-white);
  border: 2px solid var(--y2-line-strong);
  border-radius: var(--y2-radius);
  font-family: var(--y2-body);
  font-size: var(--y2-t-body);
  color: var(--y2-ink);
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease;
}
.ms-choice__btn:hover { border-color: var(--y2-ink); transform: translateY(-2px); }
.ms-choice__btn b { display: block; font-family: var(--y2-display); font-size: 1.125rem; font-weight: 600; }
.ms-choice__btn small { display: block; color: var(--y2-ink-60); font-size: var(--y2-t-small); }
.ms-choice__dot {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--y2-ink);
}
.ms-choice__dot--white { background: #fff; }
.ms-choice__dot--yellow { background: var(--y2-pencil); }
.ms-choice__dot--black { background: var(--y2-ink); }

/* Soft timer. Visual only — it never fails anyone out, and reduced-motion
   users get the number without the sweeping bar. */
.ms-timer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--y2-s-2);
  font-size: var(--y2-t-small);
  font-variant-numeric: tabular-nums;
  color: var(--y2-ink-60);
}
.ms-timer__track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(20, 38, 76, 0.1);
  overflow: hidden;
}
.ms-timer__bar {
  height: 100%;
  width: 100%;
  background: var(--y2-pencil);
  transform-origin: left center;
}

/* Streak counter (Word Detective) */
.ms-streak {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--y2-paper);
  border: 1px solid var(--y2-line);
  font-size: var(--y2-t-small);
  font-weight: 700;
}

/* Reading passage typography */
.ms-passage {
  max-width: 62ch;
  font-size: 1.0625rem;
  line-height: 1.75;
}
.ms-passage p { margin: 0 0 1rem; }
.ms-passage p:last-child { margin-bottom: 0; }
.ms-passage__title { font-family: var(--y2-display); font-size: 1.5rem; font-weight: 650; margin: 0 0 0.25rem; }
.ms-passage__by { font-size: 0.85rem; color: var(--y2-ink-60); margin: 0 0 var(--y2-s-3); }

/* Progressive reveal (Problem of the Week) */
.ms-reveal { margin-top: var(--y2-s-3); border-top: 1px solid var(--y2-line); }
.ms-reveal__step { border-bottom: 1px solid var(--y2-line); }
.ms-reveal__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.9rem 0.25rem;
  background: none;
  border: 0;
  font-family: var(--y2-body);
  font-size: var(--y2-t-body);
  font-weight: 600;
  color: var(--y2-ink);
  text-align: left;
  cursor: pointer;
}
.ms-reveal__btn::after {
  content: "+";
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--y2-pencil);
  color: var(--y2-ink);
  font-size: 1.1rem;
  font-weight: 700;
}
.ms-reveal__btn[aria-expanded="true"]::after { content: "−"; }
.ms-reveal__body { padding: 0 0 var(--y2-s-3); color: var(--y2-ink-60); }
.ms-reveal__body[hidden] { display: none; }

.ms-parentnote {
  margin-top: var(--y2-s-3);
  padding: var(--y2-s-2) var(--y2-s-3);
  border-left: 4px solid var(--y2-pencil);
  background: rgba(245, 185, 30, 0.1);
  border-radius: 0 var(--y2-radius-sm) var(--y2-radius-sm) 0;
  font-size: var(--y2-t-small);
  color: var(--y2-ink);
}

/* Cross-links strip at the foot of every game */
.ms-crosslinks {
  display: grid;
  gap: 0.75rem;
  margin-top: var(--y2-s-4);
}
.ms-crosslink {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--y2-white);
  border: 1px solid var(--y2-line);
  border-radius: var(--y2-radius-sm);
  text-decoration: none;
  color: var(--y2-ink);
  font-weight: 600;
  font-size: var(--y2-t-small);
}
.ms-crosslink:hover { border-color: var(--y2-ink); }
.ms-crosslink span:first-child { font-size: 20px; }
.ms-crosslink span:last-child { margin-left: auto; }

/* --------------------------------------------------------------------------
   FOOTER

   This duplicates the shape of the legacy .footer from styles.css rather than
   reusing it. That is deliberate. styles.css is 38KB, render-blocking, and
   over 90% of it went unused on this page — it was being loaded for the
   footer and nothing else. Restating ~40 lines here removes the largest
   blocking stylesheet on the page. The visual result is the same footer.
   -------------------------------------------------------------------------- */

.ms-footer {
  background: var(--y2-ink);
  color: rgba(255, 255, 255, 0.82);
  padding-block: var(--y2-s-8) 0;
  font-size: var(--y2-t-small);
}
.ms-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--y2-s-4);
}
.ms-footer h4 {
  margin: 0 0 0.75rem;
  font-family: var(--y2-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: #fff;
}
.ms-footer p { margin: 0 0 0.6rem; line-height: 1.6; }
.ms-footer ul { margin: 0; padding: 0; list-style: none; }
.ms-footer li { margin-bottom: 0.4rem; }
.ms-footer a { color: rgba(255, 255, 255, 0.88); text-decoration: none; }
.ms-footer a:hover { color: var(--y2-pencil); text-decoration: underline; }
.ms-footer strong { color: #fff; }
.ms-footer__bottom {
  margin-top: var(--y2-s-6);
  padding-block: var(--y2-s-2);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.64);
}
.ms-footer__bottom p { margin: 0; }

@media (min-width: 640px) {
  .ms-footer__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .ms-footer__grid { grid-template-columns: repeat(4, 1fr); }
}

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

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
  .ms-grid { grid-template-columns: repeat(2, 1fr); }
  .ms-inquiry__grid { grid-template-columns: repeat(3, 1fr); }
  .ms-crosslinks { grid-template-columns: repeat(2, 1fr); }
  .ms-game-bar__title { font-size: 1.0625rem; }
}

@media (min-width: 900px) {
  .ms-why__grid { grid-template-columns: repeat(3, 1fr); }
  .ms-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   MOTION
   The escape animation, the card lift, the timer sweep and the progress fill
   are all decorative. Under reduced-motion every one of them becomes an
   instant state change — no transitions, no transforms, nothing that moves.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ms-page *,
  .ms-game-shell * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  a.ms-card:hover,
  .ms-choice__btn:hover,
  .ms-btn:active { transform: none; }
  .ms-timer__track { display: none; }
}
