:root {
  --bg: #fbfaf7;
  --surface: #fffefa;
  --surface-2: #f6f1ff;
  --surface-3: #fff9f4;
  --ink: #211d2c;
  --muted: #756f82;
  --line: #e7deea;
  --line-strong: #d9cee0;
  --accent: #6656f2;
  --accent-strong: #5041d8;
  --accent-bright: #9c84ff;
  --accent-soft: #eeeaff;
  --blue: #5f7cff;
  --blue-soft: #edf1ff;
  --warm: #ffad5b;
  --warm-soft: #fff0df;
  --rose: #e879a8;
  --rose-soft: #fdeaf3;
  --peach: #ff8f78;
  --peach-soft: #ffebe6;
  --danger: #a73e49;
  --danger-soft: #fdebed;
  --ok: #34bf8e;
  --ok-strong: #198462;
  --ok-bright: #72dfb6;
  --ok-soft: #e8fff6;
  --shadow-sm: 0 8px 24px rgba(29, 49, 40, .07);
  --shadow: 0 20px 55px rgba(29, 49, 40, .10);
  --shadow-lg: 0 28px 80px rgba(29, 49, 40, .13);
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 30px;
  --max: 1080px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 3%, rgba(255, 190, 105, .12), transparent 29rem),
    radial-gradient(circle at 95% 8%, rgba(110, 99, 255, .12), transparent 31rem),
    radial-gradient(circle at 55% 100%, rgba(114, 223, 182, .07), transparent 28rem),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image:
    radial-gradient(circle, rgba(85, 73, 232, .12) 1px, transparent 1.35px);
  background-size: 18px 18px;
  mask-image: linear-gradient(135deg, rgba(0,0,0,.86), transparent 38%, transparent 74%, rgba(0,0,0,.32));
}

body::after {
  content: "";
  position: fixed;
  right: -5rem;
  top: 7rem;
  width: 22rem;
  height: 22rem;
  pointer-events: none;
  opacity: .055;
  background:
    repeating-conic-gradient(from 215deg at 50% 50%, var(--accent) 0deg 1.3deg, transparent 1.3deg 7deg);
  mask-image: radial-gradient(circle, black 0 26%, transparent 68%);
}

button, input, select { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(88, 111, 232, .30);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 1rem;
  z-index: 99;
  padding: .75rem 1rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.skip-link:focus { left: 1rem; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 28px, var(--max));
  margin: 0 auto;
  padding: 18px 0 64px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 226, 219, .82);
  border-radius: 18px;
  background: rgba(255, 254, 250, .80);
  box-shadow: 0 8px 30px rgba(29, 49, 40, .06);
  backdrop-filter: blur(18px) saturate(1.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
  letter-spacing: -.025em;
}

.brand-home {
  display: inline-grid;
  flex: 0 0 auto;
  border-radius: 13px;
  text-decoration: none;
}

.brand-home:hover .brand-mark {
  transform: translateY(-1px) rotate(-2deg);
  box-shadow: 0 13px 28px rgba(85, 73, 232, .28);
}

.brand-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  font-size: 1.15rem;
  background:
    linear-gradient(145deg, rgba(255,255,255,.22), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 25px rgba(85, 73, 232, .24);
  transition: transform .16s ease, box-shadow .16s ease;
}

.teacher-chip {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
  padding: .5rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
}

.teacher-preview-nav {
  position: sticky;
  top: 72px;
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 16px;
  padding: 9px 11px;
  border: 1px solid rgba(217, 206, 224, .88);
  border-radius: 15px;
  background: rgba(255, 254, 250, .88);
  box-shadow: 0 7px 22px rgba(66,52,104,.06);
  backdrop-filter: blur(16px);
}

.teacher-preview-label {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.teacher-preview-links {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.teacher-preview-links a {
  flex: 0 0 auto;
  padding: .48rem .68rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 800;
}

.teacher-preview-links a:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.teacher-preview-links a.current {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.card {
  overflow: hidden;
  border: 1px solid rgba(203, 212, 204, .92);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,254,250,.96)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  padding: clamp(26px, 5vw, 58px);
}

.hero::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -72px;
  top: -72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110,99,255,.12), transparent 68%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 24px;
  width: 66px;
  height: 18px;
  pointer-events: none;
  opacity: .42;
  background:
    linear-gradient(90deg, var(--rose) 0 30%, transparent 30% 38%, var(--warm) 38% 67%, transparent 67% 75%, var(--accent) 75%);
  clip-path: polygon(0 42%, 100% 0, 100% 26%, 0 68%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .085em;
  font-size: .76rem;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-bright), var(--blue));
}

h1, h2, h3 {
  letter-spacing: -.04em;
  line-height: 1.06;
  text-wrap: balance;
}

h1 {
  max-width: 12ch;
  margin: 0 0 18px;
  font-size: clamp(2.45rem, 8vw, 5.6rem);
  font-weight: 930;
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 3.35rem);
  font-weight: 900;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.22rem;
  font-weight: 860;
}

p { line-height: 1.65; }

.lead {
  max-width: 66ch;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: clamp(1.04rem, 2.25vw, 1.27rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 24px;
}

.btn {
  min-height: 48px;
  padding: .84rem 1.18rem;
  border: 0;
  border-radius: 14px;
  font-weight: 850;
  letter-spacing: -.012em;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease,
    background .16s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: white;
  background:
    linear-gradient(145deg, rgba(255,255,255,.11), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 11px 26px rgba(85, 73, 232, .22);
}

.btn-primary:hover {
  box-shadow: 0 14px 30px rgba(85, 73, 232, .28);
}

.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.78);
  box-shadow: 0 5px 14px rgba(29,49,40,.04);
}

.btn-secondary:hover {
  border-color: #b7c4ba;
  background: #fff;
}

.btn-ghost {
  color: var(--accent-strong);
  border: 1px solid rgba(110, 99, 255, .24);
  background: rgba(238, 234, 255, .50);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: .46;
  transform: none;
  box-shadow: none;
}

.prehome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr);
  gap: clamp(24px, 5vw, 54px);
  align-items: center;
}

.prehome-grid h1 {
  position: relative;
}

.prehome-grid h1::after {
  content: "";
  display: block;
  width: 88px;
  height: 8px;
  margin-top: 15px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-bright), var(--blue));
}

.qr-placeholder {
  aspect-ratio: 1;
  width: min(100%, 322px);
  margin-inline: auto;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border: 10px solid #fff;
  border-radius: 30px;
  background: #fff;
  box-shadow:
    0 24px 55px rgba(29, 49, 40, .13),
    0 0 0 1px rgba(203, 212, 204, .8);
  transform: rotate(1deg);
}

.qr-placeholder::before {
  content: "";
  position: absolute;
  inset: -35%;
  background: conic-gradient(from 80deg, transparent, rgba(110,99,255,.10), transparent 30%, rgba(232,121,168,.09), transparent 54%, rgba(255,173,91,.08), transparent 72%);
  animation: qrGlow 14s linear infinite;
}

.qr-image {
  width: 82%;
  aspect-ratio: 1;
  display: block;
  position: relative;
  z-index: 1;
  image-rendering: pixelated;
}

.qr-label {
  position: absolute;
  z-index: 2;
  inset: auto 10% 8%;
  padding: .72rem .82rem;
  text-align: center;
  border: 1px solid rgba(220,226,219,.9);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255,255,255,.94);
  box-shadow: 0 6px 18px rgba(29,49,40,.08);
  font-size: .83rem;
  font-weight: 850;
}

.progress-strip {
  display: flex;
  gap: 7px;
  margin: 12px 2px 22px;
  padding: 0 4px;
}

.progress-dot {
  flex: 1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5df;
}

.progress-dot.done {
  background: linear-gradient(90deg, var(--ok), var(--ok-bright));
}

.progress-dot.current {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 0 3px rgba(110,99,255,.11);
}

.path {
  position: relative;
  display: grid;
  gap: 13px;
  margin-top: 24px;
}

.path-step {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255,255,255,.62);
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease;
}

.path-step.available:hover {
  transform: translateY(-2px);
  border-color: #d2cae6;
  box-shadow: var(--shadow-sm);
}

.path-step.available {
  background: rgba(255,255,255,.88);
}

.path-step.done {
  border-color: rgba(52,191,142,.28);
  background: linear-gradient(135deg, #eafff7, #f7fffc);
}

.path-step.locked {
  opacity: .58;
  filter: saturate(.75);
}

.step-num {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 950;
}

.path-step.done .step-num {
  color: #103f31;
  background: linear-gradient(135deg, var(--ok-bright), #43ca9a);
  box-shadow: 0 7px 18px rgba(52,191,142,.20);
}

.step-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: .88rem;
}

.pill,
.question-domain {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .42rem .7rem;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: .78rem;
  font-weight: 850;
}

.pill.ok {
  color: var(--ok-strong);
  background: var(--ok-soft);
}

.pill.warm {
  color: #95571f;
  background: var(--warm-soft);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
  margin: 22px 0;
}

.info-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.82), rgba(248,250,247,.78));
  box-shadow: 0 5px 16px rgba(29,49,40,.035);
  transition:
    transform .16s ease,
    border-color .16s ease,
    box-shadow .16s ease;
}

.info-tile:hover {
  transform: translateY(-2px);
  border-color: #d7cee5;
  box-shadow: var(--shadow-sm);
}

.info-tile p {
  margin-bottom: 0;
  color: var(--muted);
}

.micro-examples {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.micro-examples span {
  padding: .42rem .58rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #554b67;
  background: rgba(255,255,255,.82);
  font-size: .76rem;
  font-weight: 780;
}

.use-case-example {
  grid-column: 2;
  display: inline-flex;
  width: fit-content;
  margin-top: 12px;
  padding: .48rem .65rem;
  border-radius: 10px;
  color: #554b67;
  background: rgba(255,255,255,.82);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: .82rem;
  font-weight: 800;
}

.course-word {
  grid-column: 2;
  margin-top: 8px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 720;
}

.simple-goal {
  font-size: 1rem;
}

.use-case {
  display: grid;
  grid-template-columns: 46px 1fr;
  column-gap: 14px;
  align-items: start;
}

.use-case h3,
.use-case p {
  grid-column: 2;
}

.use-case-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #b44f3d;
  background: var(--peach-soft);
  box-shadow: inset 0 0 0 1px rgba(255,143,120,.12);
  font-size: .86rem;
  font-weight: 950;
  letter-spacing: -.03em;
}

.use-case:nth-child(2) .use-case-icon {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.use-case:nth-child(3) .use-case-icon {
  color: #a25f21;
  background: var(--warm-soft);
}

.use-case:nth-child(4) .use-case-icon {
  color: #a34f79;
  background: var(--rose-soft);
}

.identity-card {
  max-width: 38rem;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(246,241,255,.56));
  box-shadow: 0 8px 22px rgba(66,52,104,.05);
}

.identity-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 15px;
}

.identity-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.identity-badge {
  flex: 0 0 auto;
  padding: .42rem .68rem;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: .75rem;
  font-weight: 850;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.identity-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.identity-grid label:last-child {
  grid-column: 1 / -1;
}

.identity-grid input {
  min-width: 0;
  min-height: 48px;
  width: 100%;
  padding: .74rem .88rem;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255,255,255,.96);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.identity-grid input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px rgba(102,86,242,.11);
}

.identity-card > small {
  color: var(--muted);
  line-height: 1.45;
}

.unknown-answer {
  min-height: 38px;
  padding: .48rem .72rem;
  border: 1px dashed #d2c6df;
  border-radius: 11px;
  color: var(--muted);
  background: #fffafd;
  font-size: .78rem;
  font-weight: 800;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

.unknown-answer:hover,
.unknown-answer.selected {
  color: #8e456b;
  border-color: #e8a5c2;
  background: var(--rose-soft);
  transform: translateY(-1px);
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.module-card p {
  flex: 1;
}

.module-open {
  margin-top: 14px;
}

.module-page > .lead {
  max-width: 72ch;
}

.module-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.module-context {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 5px 15px rgba(66,52,104,.035);
}

.module-context > span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 11px;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 1.15rem;
}

.module-context:nth-child(2) > span {
  background: var(--warm-soft);
}

.module-context:nth-child(3) > span {
  background: var(--ok-soft);
}

.module-context strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

.module-context p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.module-rule {
  border-color: rgba(102,86,242,.16);
  background: linear-gradient(135deg, rgba(238,234,255,.78), rgba(255,255,255,.9));
}

.learning-lab {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid #d8ceec;
  border-radius: 21px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.88), transparent 42%),
    linear-gradient(145deg, #f4f0ff, #fff9f3);
  box-shadow: 0 12px 32px rgba(75,60,126,.08);
}

.lab-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.lab-heading p {
  max-width: 44ch;
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.time-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.time-controls label {
  padding: 15px;
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 15px;
  background: rgba(255,255,255,.65);
}

.time-controls label > span,
.time-controls label > strong {
  display: block;
}

.time-controls label > span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.time-controls label > strong {
  margin: 5px 0 12px;
  color: var(--accent-strong);
  font-size: 1.3rem;
}

.learning-lab input[type="range"] {
  width: 100%;
  height: 7px;
  appearance: none;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.learning-lab input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  appearance: none;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(85,73,232,.24);
}

.learning-lab input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(85,73,232,.24);
}

.time-equation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 11px;
  margin: 22px 0 14px;
  font-size: clamp(1.15rem, 4vw, 1.8rem);
  font-weight: 850;
}

.time-equation b {
  color: var(--muted);
}

.time-equation strong {
  color: var(--accent-strong);
  font-size: 1.2em;
}

.time-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  box-shadow: inset 0 0 0 1px var(--line);
}

.time-track-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warm), var(--rose), var(--accent));
  transition: width .18s ease;
}

.method-card {
  margin: 24px 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
}

.method-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin: 16px 0;
}

.method-steps > div {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.method-steps span {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 9px;
  color: white;
  background: var(--accent);
  font-size: .78rem;
  font-weight: 950;
}

.method-steps p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

.worked-example {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border: 1px solid #f3d9bd;
  border-radius: 14px;
  background: var(--warm-soft);
}

.worked-example > * {
  padding: .35rem .52rem;
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}

.practice-block {
  margin-top: 26px;
}

.feedback-lines {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.proportion-lab {
  display: grid;
  grid-template-columns: minmax(230px,.72fr) minmax(0,1.28fr);
  gap: 16px;
}

.compact-recipe {
  align-self: stretch;
}

.recipe-simple-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.recipe-simple-row:last-child {
  border-bottom: 0;
}

.proportion-range {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.84), transparent 40%),
    linear-gradient(145deg, #f0ecff, #ffeedd);
  border-color: #ded3ec;
}

.big-number small {
  font-size: .32em;
  letter-spacing: 0;
}

.portion-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 17px 0 4px;
}

.portion-comparison > div:not(.portion-arrow) {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 12px;
  background: rgba(255,255,255,.62);
  text-align: center;
}

.portion-comparison span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
}

.portion-comparison strong {
  font-size: 1.28rem;
}

.portion-arrow {
  color: var(--accent-strong);
  font-weight: 900;
  white-space: nowrap;
}

.percent-lab,
.stats-lab {
  display: grid;
  grid-template-columns: minmax(230px,.82fr) minmax(0,1.18fr);
  gap: 18px;
  align-items: stretch;
}

.percent-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0,1fr));
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  aspect-ratio: 1;
}

.percent-grid span {
  border-radius: 4px;
  background: #eeeaf5;
  box-shadow: inset 0 0 0 1px rgba(97,79,145,.05);
  transition: background .12s ease, transform .12s ease;
}

.percent-grid span.filled {
  background: linear-gradient(145deg, var(--accent), var(--rose));
  transform: scale(.96);
}

.percent-equivalence {
  margin: 16px 0;
  padding: 13px 14px;
  border: 1px solid rgba(102,86,242,.18);
  border-radius: 13px;
  background: rgba(255,255,255,.72);
  color: var(--accent-strong);
  font-weight: 900;
  text-align: center;
}

.percent-range,
.stats-range {
  min-height: 100%;
}

.stats-chart-wrap {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}

.stats-chart {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 10px;
  align-items: end;
  min-height: 255px;
  padding: 12px 6px 0;
}

.stats-bar-col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  align-items: end;
  height: 220px;
  text-align: center;
}

.stats-bar-value {
  color: var(--accent-strong);
  font-size: .82rem;
  font-weight: 900;
}

.stats-bar-track {
  display: flex;
  align-items: end;
  width: 100%;
  height: 165px;
  overflow: hidden;
  border-radius: 10px 10px 6px 6px;
  background: #f0edf5;
}

.stats-bar {
  display: block;
  width: 100%;
  min-height: 8%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  transition: height .2s ease;
}

.stats-bar-col strong {
  font-size: .78rem;
}

.stats-average {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--warm-soft);
  color: var(--muted);
  font-size: .84rem;
}

.stats-average strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.question-list {
  display: grid;
  gap: 17px;
  margin-top: 24px;
  counter-reset: question;
}

.question {
  position: relative;
  min-inline-size: 0;
  margin: 0;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(248,250,247,.90));
  box-shadow: 0 6px 18px rgba(29,49,40,.04);
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease;
}

.question:hover {
  transform: translateY(-1px);
  border-color: #d9d0e6;
  box-shadow: var(--shadow-sm);
}

.question legend {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 0;
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.42;
}

.question-index {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: -3px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(135deg, var(--blue), #7b8af0);
  box-shadow: 0 6px 14px rgba(88,111,232,.20);
  font-size: .82rem;
  font-weight: 950;
}

.question-domain {
  margin-bottom: 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.question:nth-child(3n + 1) .question-index {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  box-shadow: 0 6px 14px rgba(110,99,255,.20);
}

.question:nth-child(3n + 2) .question-index {
  color: #54283f;
  background: linear-gradient(135deg, #f7b2ca, #ed91b7);
  box-shadow: 0 6px 14px rgba(232,121,168,.18);
}

.question:nth-child(3n) .question-index {
  color: #5e3514;
  background: linear-gradient(135deg, #ffd08f, #ffb45d);
  box-shadow: 0 6px 14px rgba(243,155,66,.18);
}

.question:nth-child(3n + 2) .question-domain {
  color: #9f4c74;
  background: var(--rose-soft);
}

.question:nth-child(3n) .question-domain {
  color: #98591e;
  background: var(--warm-soft);
}

.answer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.answer-row input,
.answer-row select,
.info-tile select {
  min-height: 48px;
  min-width: 170px;
  max-width: 100%;
  padding: .74rem .88rem;
  border: 1px solid #cdd6cf;
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255,255,255,.96);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  transition:
    border-color .16s ease,
    box-shadow .16s ease,
    background .16s ease;
}

.answer-row input:hover,
.answer-row select:hover,
.info-tile select:hover {
  border-color: #b6c4ba;
}

.answer-row input:focus,
.answer-row select:focus,
.info-tile select:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(88,111,232,.10);
}

.answer-row input[type="number"] { width: 180px; }

.form-error {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid #f2cdd1;
  border-radius: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 800;
}

.result-summary {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 22px;
  align-items: center;
  padding: 23px;
  margin: 22px 0;
  border: 1px solid rgba(110,99,255,.14);
  border-radius: 21px;
  background: linear-gradient(135deg, #f0edff, #fff5f9);
}

.result-score {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 8px solid rgba(110,99,255,.18);
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--surface);
  box-shadow: 0 10px 25px rgba(110,99,255,.10);
  font-size: 1.7rem;
  font-weight: 950;
}

.result-score {
  align-content: center;
  gap: 1px;
}

.result-score small {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .03em;
}

.domain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.correction {
  position: relative;
  overflow: hidden;
  padding: 17px 19px 17px 22px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255,255,255,.70);
}

.correction.ok {
  border-left-color: var(--ok);
  background: linear-gradient(90deg, rgba(232,255,246,.92), rgba(255,255,255,.80) 34%);
}

.correction.retry {
  border-left-color: var(--warm);
  background: linear-gradient(90deg, rgba(255,240,221,.66), rgba(255,255,255,.75) 32%);
}

.correction p { margin: 7px 0; }

.challenge-board {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(280px,.9fr);
  gap: 18px;
  margin: 22px 0;
}

.recipe-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-sm);
}

.recipe-card h3::before {
  content: "FICHE";
  display: inline-block;
  margin-right: 8px;
  padding: .3rem .5rem;
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  vertical-align: .13em;
  font-size: .65rem;
  letter-spacing: .07em;
}

.recipe-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
}

.recipe-table th,
.recipe-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.recipe-table th {
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.recipe-table th:last-child,
.recipe-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.range-wrap {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid #f0d8bd;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.76), transparent 42%),
    linear-gradient(145deg, #fff1de, #fbe6cb);
  box-shadow: 0 9px 24px rgba(161,94,31,.08);
}

.range-wrap input[type="range"] {
  width: 100%;
  height: 7px;
  appearance: none;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, var(--warm), #f4b66e);
}

.range-wrap input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  appearance: none;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 4px 12px rgba(161,94,31,.25);
}

.range-wrap input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 4px 12px rgba(161,94,31,.25);
}

.big-number {
  margin: 12px 0;
  color: #9a591f;
  font-size: clamp(2.2rem, 7vw, 4.25rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.05em;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
  margin-top: 16px;
}

.mini-stat {
  padding: 13px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 14px;
  background: rgba(255,255,255,.64);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  color: #7e4718;
  font-size: 1.16rem;
}

.callout {
  padding: 18px 20px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    linear-gradient(135deg, rgba(238,241,235,.94), rgba(248,250,247,.94));
}

.callout strong {
  color: var(--accent-strong);
}

.fraction-demo {
  margin-top: 17px;
  padding: 17px;
  border: 1px solid rgba(88,111,232,.14);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-soft), rgba(255,255,255,.85));
}

.fraction-parts {
  display: grid;
  gap: 6px;
  height: 76px;
  margin: 14px 0;
}

.fraction-part {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: background .18s ease, transform .18s ease;
}

.fraction-part.filled {
  border-color: var(--blue);
  background: linear-gradient(135deg, var(--blue), #8090ef);
  box-shadow: 0 6px 16px rgba(88,111,232,.15);
}

.fraction-actions { margin-top: 0; }

.fraction-label {
  margin-bottom: 0;
  color: #4056c8;
  font-weight: 900;
}

.footer-note {
  margin-top: 28px;
  color: var(--muted);
  font-size: .86rem;
}

.hidden { display: none !important; }

@keyframes qrGlow {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, var(--max));
    padding-top: 8px;
  }

  .topbar {
    top: 6px;
    margin-bottom: 12px;
  }

  .brand {
    font-size: .92rem;
  }

  .teacher-chip { display: none; }

  .teacher-preview-nav {
    top: 62px;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .teacher-preview-links {
    width: 100%;
  }

  body::after,
  .hero::after {
    display: none;
  }

  .prehome-grid,
  .challenge-board,
  .lesson-grid,
  .result-summary,
  .module-context-grid,
  .time-controls,
  .method-steps,
  .proportion-lab,
  .percent-lab,
  .stats-lab {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 23px 20px 26px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(2.3rem, 13vw, 4rem);
  }

  h2 {
    font-size: clamp(1.9rem, 10vw, 2.7rem);
  }

  .prehome-grid {
    gap: 28px;
  }

  .identity-grid {
    grid-template-columns: 1fr;
  }

  .identity-grid label:last-child {
    grid-column: auto;
  }

  .identity-heading {
    display: block;
  }

  .identity-badge {
    display: inline-flex;
    margin-top: 10px;
  }

  .qr-placeholder {
    width: min(88vw, 290px);
    transform: none;
  }

  .path-step {
    grid-template-columns: 44px 1fr;
    padding: 16px;
  }

  .path-step .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .question {
    padding: 19px 16px 17px;
  }

  .question legend {
    gap: 10px;
  }

  .answer-row input,
  .answer-row select,
  .info-tile select {
    width: 100%;
    min-width: 0;
  }

  .answer-row > span {
    font-weight: 800;
  }

  .result-score {
    margin-inline: auto;
  }

  .mini-stats {
    grid-template-columns: 1fr 1fr;
  }

  .actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 460px) {
  .topbar {
    padding: 9px 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .lesson-grid {
    gap: 11px;
  }

  .info-tile {
    padding: 17px;
  }

  .use-case {
    grid-template-columns: 42px 1fr;
  }

  .use-case-example,
  .course-word {
    grid-column: 2;
  }

  .use-case-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .mini-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body {
    background: white;
  }

  body::before,
  .topbar,
  .actions,
  .btn,
  .progress-strip {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .card,
  .question,
  .recipe-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
