/* ==========================================================================
   Révise — Component styles. Built on design/tokens.css (imported first).
   No hardcoded colors/sizes: everything maps to the design tokens.
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font-family: inherit;
}

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

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: calc(var(--safe-top) + var(--sp-2));
  transform: translateY(-200%);
  background: var(--surface);
  color: var(--accent-text);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  z-index: 50;
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  transform: translateY(0);
}

/* --- Common top bar (single global chrome; mirrors the course `.lnav`) --- */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: calc(56px + var(--safe-top));
  padding: var(--safe-top) var(--sp-4) 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  backdrop-filter: saturate(170%) blur(18px);
  border-bottom: 1px solid var(--separator);
}
.app-nav__brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3125rem; /* 21px — matches course .lnav__brand */
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.app-nav__brand:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}
.app-nav__chip {
  font-family: var(--font-mono);
  font-size: var(--fs-footnote);
  font-weight: var(--fw-bold);
  background: var(--marker);
  color: var(--marker-ink);
  padding: 2px 7px;
  border-radius: 7px;
}
.app-nav__tabs {
  display: flex;
  gap: var(--sp-1);
  flex: 1;
  min-width: 0;
  margin-left: auto;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  padding-inline: var(--sp-2);
}
.app-nav__tabs::-webkit-scrollbar {
  display: none;
}
.app-nav__tab {
  flex: none;
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-callout);
  line-height: 1;
  padding: 9px 13px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.app-nav__tab:hover {
  color: var(--text);
}
.app-nav__tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.app-nav__tab--active {
  background: var(--text);
  color: var(--bg);
  font-weight: var(--fw-medium);
}
.app-nav__theme {
  flex: none;
  appearance: none;
  min-height: 2.25rem;
  min-width: 2.25rem;
  padding: var(--sp-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--separator-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-footnote);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.app-nav__theme:hover {
  background: var(--surface-hover);
}
.app-nav__theme:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --- Layout -------------------------------------------------------------- */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-5) calc(var(--safe-bottom) + var(--sp-6));
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .view {
    padding-top: var(--sp-7);
  }
}

/* Full-bleed views (the embedded course) escape the readable column and take
   the whole page under the common top bar. */
.view--bleed {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Entrance animation for view swaps */
.view-enter {
  animation: viewIn var(--dur-base) var(--ease-out);
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Typography helpers -------------------------------------------------- */
.app-title {
  font-size: var(--fs-title1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
}
.app-subtitle {
  font-size: var(--fs-callout);
  color: var(--text-secondary);
  margin-top: var(--sp-2);
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  appearance: none;
  border: none;
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-pill);
  font-size: var(--fs-headline);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-standard), opacity var(--dur-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-primary:active:not(:disabled) {
  background: var(--accent-active);
  transform: scale(0.97);
}
.btn-secondary {
  background: transparent;
  color: var(--accent-text);
  border: 1px solid var(--separator-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}
.btn-secondary:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}

/* --- Home / module picker ------------------------------------------------ */
.home-header {
  margin-bottom: var(--sp-6);
}
.module-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.module-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  color: inherit;
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-standard);
}
.module-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.module-card:active {
  transform: scale(0.99);
}
.module-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.module-card__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.module-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-pill);
  background: var(--accent); /* per-module accent fill */
  color: var(--text-on-accent); /* white (light) / ink (dark) — §8.3 */
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--fs-footnote);
}
.module-card__title {
  font-size: var(--fs-title3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
}
.module-card__desc {
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}
.module-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--separator);
}
.chip--new {
  color: var(--text-tertiary);
}
.chip--score {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
  font-weight: var(--fw-semibold);
}
.module-progress {
  margin-top: var(--sp-4);
}

/* Linear progress bar */
.progress {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--separator);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  width: 0%;
  transition: width var(--dur-base) var(--ease-out);
}

/* --- Quiz ---------------------------------------------------------------- */
.quiz-topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--separator);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  min-height: var(--touch-min);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.icon-btn:hover {
  background: var(--surface-hover);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.quiz-progress-wrap {
  flex: 1;
}
.quiz-progress-label {
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
  display: block;
}
.module-tag {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.question-text {
  font-size: var(--fs-title1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  margin: var(--sp-4) 0 var(--sp-6);
}
@media (min-width: 600px) {
  .question-text {
    font-size: var(--fs-large);
  }
}

.options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: 0;
  border: none;
}
.option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  font-size: var(--fs-callout);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast),
    transform var(--dur-fast) var(--ease-spring);
}
.option:hover:not([data-locked="true"]) {
  background: var(--surface-hover);
}
.option:active:not([data-locked="true"]) {
  transform: scale(0.99);
}
.option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.option__marker {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--separator-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  transition: background var(--dur-fast), border-color var(--dur-fast),
    color var(--dur-fast);
}
.option__text {
  flex: 1;
}
.option__status {
  flex: none;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-footnote);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

/* Selected (pre-validate) */
.option[aria-checked="true"]:not([data-state]) {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--accent-soft);
}
.option[aria-checked="true"]:not([data-state]) .option__marker {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

/* Post-validate states */
/* Correct answer = signature lime MARKER reveal, ink text (14.55:1 both
   themes, §8.2 #11) — never white. Icon + label + color (not color-alone). */
.option[data-state="correct"] {
  border-color: var(--marker);
  background: var(--marker);
  color: var(--marker-ink);
}
.option[data-state="correct"] .option__text {
  color: var(--marker-ink);
  font-weight: var(--fw-semibold);
}
.option[data-state="correct"] .option__marker {
  background: var(--marker-ink);
  border-color: var(--marker-ink);
  color: var(--marker);
}
.option[data-state="correct"] .option__status {
  color: var(--marker-ink);
}
.option[data-state="incorrect"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.option[data-state="incorrect"] .option__marker {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-on-accent);
}
.option[data-state="incorrect"] .option__status {
  color: var(--danger);
}
.option[data-state="muted"] {
  opacity: 0.55;
}
.option[data-locked="true"] {
  cursor: default;
}

/* Feedback / explanation block */
.feedback {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--separator);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
  animation: feedbackIn var(--dur-base) var(--ease-out);
}
@keyframes feedbackIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.feedback__status {
  font-weight: var(--fw-semibold);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.feedback__status--ok {
  color: var(--success);
}
.feedback__status--ko {
  color: var(--danger);
}
.feedback__explain {
  font-size: var(--fs-callout);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.feedback__source {
  margin-top: var(--sp-3);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* Quiz action area — sticky bottom on phones */
.quiz-actions {
  margin-top: auto;
  padding-top: var(--sp-4);
}
@media (max-width: 599px) {
  .quiz-actions {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(var(--safe-bottom) + var(--sp-3));
    background: linear-gradient(
      to top,
      var(--bg) 60%,
      transparent
    );
  }
}

/* --- Results ------------------------------------------------------------- */
.results {
  text-align: center;
  align-items: center;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
}
.score-ring {
  position: relative;
  width: 200px;
  height: 200px;
  margin: var(--sp-5) auto var(--sp-5);
}
.score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.score-ring__track {
  fill: none;
  stroke: var(--separator);
}
.score-ring__fill {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out);
}
.score-ring__fill--pass {
  stroke: var(--success);
}
.score-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-ring__pct {
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}
.score-ring__frac {
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
  margin-top: var(--sp-2);
}
.results__headline {
  font-size: var(--fs-title1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--sp-2);
}
.results__sub {
  font-size: var(--fs-callout);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}
.results__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  max-width: 20rem;
}

/* --- Review list (optional) --------------------------------------------- */
.review {
  width: 100%;
  margin-top: var(--sp-6);
  text-align: left;
}
.review summary {
  cursor: pointer;
  font-size: var(--fs-footnote);
  color: var(--accent-text);
  font-weight: var(--fw-medium);
  padding: var(--sp-2) 0;
}
.review__item {
  border-top: 1px solid var(--separator);
  padding: var(--sp-3) 0;
  font-size: var(--fs-footnote);
}
.review__q {
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-1);
}
.review__a {
  color: var(--text-secondary);
}
.review__a--ok {
  color: var(--success);
}
.review__a--ko {
  color: var(--danger);
}

/* --- Footer / offline badge ---------------------------------------------- */
.home-footer {
  margin-top: var(--sp-7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

/* --- Error state --------------------------------------------------------- */
.error-state {
  text-align: center;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  align-items: center;
}

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--sp-5));
  transform: translateX(-50%) translateY(0);
  background: var(--text);
  color: var(--bg);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-footnote);
  z-index: 40;
  max-width: calc(100vw - 2 * var(--sp-5));
  animation: toastIn var(--dur-base) var(--ease-out);
}
.toast[hidden] {
  display: none;
}
.toast button {
  appearance: none;
  background: var(--accent);
  border: none;
  color: var(--text-on-accent);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  margin-left: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  min-height: 2rem;
}
.toast button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==========================================================================
   v2 — large-bank UX: session setup, chips, segmented control, sheet, resume
   Reuses existing tokens only (no new color tokens).
   ========================================================================== */

.btn-text {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--accent-text);
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  border-radius: var(--radius-pill);
  min-height: var(--touch-min);
}
.btn-text:hover {
  background: var(--surface-hover);
}
.btn-text:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.meta-line {
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
}

/* Home card radius bump + mastery metric (v2.1 "plus propre") */
.module-card {
  border-radius: var(--radius-xl);
}
.home-header {
  margin-bottom: var(--sp-7);
}

/* Resume banner */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.resume-banner__text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.resume-banner__meta {
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
}
.resume-banner__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Icon close button (lighter top bar) */
.icon-btn--close {
  min-width: var(--touch-min);
  padding: var(--sp-2);
  font-size: var(--fs-title3);
  line-height: 1;
  color: var(--text-secondary);
}

/* Streak counter */
.streak {
  flex: none;
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}
.streak--hot {
  color: var(--warning);
}

/* Setup screen */
.setup-heading {
  font-size: var(--fs-title1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin: var(--sp-2) 0 var(--sp-5);
}
.setup-section {
  margin-bottom: var(--sp-6);
}
.setup-label {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-3);
}
.setup-hint {
  font-size: var(--fs-footnote);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-4);
}

/* Segmented control (session length) */
.segmented {
  display: flex;
  gap: var(--sp-1);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--sp-1);
}
.segment {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-callout);
  font-weight: var(--fw-medium);
  min-height: 2.5rem;
  border-radius: calc(var(--radius-md) - 4px);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
    color var(--dur-fast), box-shadow var(--dur-fast);
}
.segment[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}
.segment:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Category chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.chip-toggle {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--separator);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: var(--sp-2) var(--sp-3);
  min-height: 2.25rem;
  font-size: var(--fs-footnote);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast),
    color var(--dur-fast);
}
.chip-toggle:hover {
  background: var(--surface-hover);
}
.chip-toggle--on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text); /* ink on accent-soft/marker tint — §8.4 gate */
  font-weight: var(--fw-semibold);
}
.chip-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Mode toggles (switch-like) */
.mode-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  min-height: var(--touch-min);
  font-size: var(--fs-callout);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.mode-toggle__dot {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--separator-strong);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.mode-toggle--on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mode-toggle--on .mode-toggle__dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface);
}
.mode-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Bottom sheet (quit confirm) */
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  animation: scrimIn var(--dur-fast) var(--ease-standard);
}
@keyframes scrimIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.sheet {
  width: 100%;
  max-width: var(--content-max);
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  padding: var(--sp-5) var(--sp-5) calc(var(--safe-bottom) + var(--sp-5));
  animation: sheetUp var(--dur-base) var(--ease-out);
}
@media (min-width: 600px) {
  .sheet-scrim { align-items: center; }
  .sheet { border-radius: var(--radius-xl); margin: 0 var(--sp-4); }
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet__title {
  font-size: var(--fs-title3);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-2);
}
.sheet__body {
  font-size: var(--fs-callout);
  color: var(--text-secondary);
  margin-bottom: var(--sp-5);
}
.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.sheet-danger {
  color: var(--danger);
  border-color: var(--danger);
}

/* ==========================================================================
   v3 — Course integration + editorial re-skin (Phase 1)
   New: theme toggle, eyebrows, Cours nav + index, 2-action module card,
   in-app course view (iframe chrome + sticky CTA), quiz eyebrow.
   Tokens only — per-module accent inherited via [data-module] ancestor.
   ========================================================================== */

/* Editorial display headings (Barlow Condensed where the family is available,
   graceful system fallback otherwise). */
.app-title,
.setup-heading,
.question-text,
.results__headline {
  font-family: var(--font-display);
  letter-spacing: 0;
}

/* --- Eyebrow / kicker ---------------------------------------------------- */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.eyebrow--accent {
  color: var(--accent-text); /* accent text on paper/surface — §8.1 #5 */
}

/* --- Theme toggle icon (the button itself lives in the .app-nav bar) ----- */
.theme-toggle__icon { font-size: var(--fs-footnote); line-height: 1; }

/* --- Module card: two actions (quiz-first) ------------------------------ */
.module-card { cursor: default; }
.module-card:hover { transform: none; box-shadow: var(--shadow-sm); }
.module-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.module-card__actions .btn { flex: 1 1 auto; }
/* the two secondary actions share a row; the quiz is full-width below */
.module-card__actions .btn-secondary {
  flex: 1 1 40%;
  padding-inline: var(--sp-3);
  font-size: var(--fs-footnote);
}
.module-card__actions .btn-primary { flex: 1 0 100%; }

/* --- In-app course view (iframe + chrome) ------------------------------- */
.course-view {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100dvh - 56px - var(--safe-top));
}
.course-frame {
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
  background: var(--bg);
  min-height: 60vh;
}
/* Floating CTA — overlays the course so the page itself stays full-bleed. */
.course-cta {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--sp-4));
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: var(--sp-2);
  max-width: calc(100% - var(--sp-5) * 2);
}
.course-cta .btn {
  width: auto;
  box-shadow: var(--shadow-lg);
}

/* --- Quiz eyebrow (module · category above the question) ---------------- */
.quiz-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-text); /* per-module accent on paper — §8.1 #5 */
  margin: var(--sp-2) 0 0;
}

/* Source tag + score fraction in editorial mono */
.feedback__source,
.score-ring__frac,
.module-tag { font-family: var(--font-mono); }
