:root {
  color-scheme: only light;
  --sje-primary: #034ea2;
  --sje-primary-hover: #063e80;
  --sje-primary-deep: #0b2c5f;
  --sje-primary-soft: #eaf3ff;
  --sje-brand-yellow: #ffc20f;
  --sje-brand-yellow-soft: #fff8d6;
  --sje-ok: #137a3c;
  --sje-ok-soft: #edf9f1;
  --sje-review: #a44b00;
  --sje-review-soft: #fff4e5;
  --sje-learning: #6d3fc0;
  --sje-learning-soft: #f4efff;
  --sje-danger: #b91c1c;
  --sje-danger-soft: #fff1f2;
  --sje-ink: #0f172a;
  --sje-ink-soft: #334155;
  --sje-muted: #53657c;
  --sje-bg: #f4f7fc;
  --sje-surface: #ffffff;
  --sje-line: #d8e2ef;
  --sje-shadow-sm: 0 4px 14px rgba(15, 38, 71, .06);
  --sje-shadow-md: 0 16px 40px rgba(15, 38, 71, .14);
  --sje-radius: 16px;
  --sje-focus: 0 0 0 3px rgba(255, 194, 15, .82), 0 0 0 5px rgba(3, 78, 162, .42);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--sje-ink);
  background: radial-gradient(circle at 100% 0, rgba(3, 78, 162, .07), transparent 26rem), var(--sje-bg);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid rgba(216, 226, 239, .9);
  backdrop-filter: blur(12px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-top: env(safe-area-inset-top);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 9px;
  color: var(--sje-primary);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
}
.wordmark .dot {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  background: var(--sje-brand-yellow);
  box-shadow: 0 0 0 5px var(--sje-brand-yellow-soft);
}
.btn, .btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  color: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}
.btn-primary { color: #fff; background: var(--sje-primary); box-shadow: 0 8px 18px rgba(3, 78, 162, .2); }
.btn-primary:hover { background: var(--sje-primary-hover); }
.btn-ghost, .btn-login { color: var(--sje-primary); background: #fff; border-color: #b9cbe0; }
.btn-ghost:hover, .btn-login:hover { color: var(--sje-primary-deep); border-color: var(--sje-primary); background: var(--sje-primary-soft); }
.btn:active, .btn-login:active { transform: translateY(1px); }
.btn:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; }

/* Page introduction */
.crumbs { padding-top: 16px; color: var(--sje-muted); font-size: 13px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; margin-inline: -5px; padding-inline: 5px; color: var(--sje-muted); text-underline-offset: 3px; }
.crumbs a:hover { color: var(--sje-primary); }
.page-hero { padding: 17px 0 10px; }
.hero-kicker, .session-eyebrow { color: var(--sje-primary); font-size: 12px; font-weight: 900; letter-spacing: .085em; text-transform: uppercase; }
.page-hero h1 { max-width: 760px; color: var(--sje-ink); font-size: clamp(27px, 7vw, 42px); line-height: 1.12; letter-spacing: -.035em; }
.hero-kicker + h1 { margin-top: 7px; }
.page-hero > p, .hero-copy { max-width: 720px; margin-top: 10px; color: var(--sje-muted); font-size: 15px; }
.hero-actions, .session-actions, .result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero-actions .btn, .session-actions .btn, .result-actions .btn { flex: 1 1 145px; }
.level-help, .storage-note { display: flex; align-items: flex-start; gap: 8px; color: var(--sje-muted); font-size: 13px; }
.level-help { margin-top: 14px; }
.storage-note { margin: 14px 0 4px; }
.level-help::before, .storage-note::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 50%;
  color: var(--sje-primary);
  background: var(--sje-primary-soft);
  font-size: 12px;
  font-weight: 900;
}

/* Level and topic choices */
.level-grid, .topic-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0 40px; }
.level-card, .topic-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 126px;
  flex-direction: column;
  overflow: hidden;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  background: var(--sje-surface);
  border: 1px solid var(--sje-line);
  border-radius: var(--sje-radius);
  box-shadow: var(--sje-shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.level-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--level-accent, var(--sje-primary)); }
.level-card:hover, .topic-card:hover, .level-card.active:hover { border-color: #86acd6; box-shadow: 0 13px 28px rgba(15, 38, 71, .12); transform: translateY(-2px); }
.level-card.active { border-color: #b8cbe2; }
.level-card.locked { opacity: .68; }
.level-card h2, .level-card h3, .topic-card h2, .topic-card h3 { color: var(--sje-ink); font-size: 17px; line-height: 1.28; letter-spacing: -.015em; }
.level-card p, .topic-card p { margin-top: 6px; color: var(--sje-muted); font-size: 13px; }
.level-a1 { --level-accent: #16855b; --level-soft: #e9f8f2; }
.level-a2 { --level-accent: #087c97; --level-soft: #e9f8fb; }
.level-b1 { --level-accent: var(--sje-primary); --level-soft: var(--sje-primary-soft); }
.level-b2 { --level-accent: #6744b8; --level-soft: #f2effb; }
.level-c1 { --level-accent: #a34665; --level-soft: #fbeff3; }
.level-code {
  display: inline-flex;
  width: fit-content;
  min-width: 46px;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 9px;
  color: var(--level-accent, var(--sje-primary));
  background: var(--level-soft, var(--sje-primary-soft));
  font-size: 14px;
  font-weight: 900;
}
.level-card-cta, .topic-card-cta { display: inline-flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 14px; color: var(--sje-primary); font-size: 13px; font-weight: 800; }
.level-card.recommended { border-color: #e8b000; background: linear-gradient(145deg, #fff 35%, var(--sje-brand-yellow-soft)); }
.level-recommendation, .topic-recommendation {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  padding: 4px 9px;
  color: #654900;
  background: #ffe176;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.35;
}
.topic-card { min-height: 148px; }
.topic-card.recommended { border-color: #e8b000; background: linear-gradient(145deg, #fff 25%, var(--sje-brand-yellow-soft)); }
.topic-icon { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; margin-bottom: 12px; border-radius: 12px; color: var(--sje-primary); background: var(--sje-primary-soft); font-size: 20px; line-height: 1; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 7px; color: var(--sje-muted); font-size: 12px; font-weight: 700; }
.badge-soon { position: absolute; top: 14px; right: 14px; padding: 4px 9px; color: var(--sje-muted); background: var(--sje-bg); border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-count { display: inline-flex; width: fit-content; align-items: center; min-height: 28px; margin-top: 10px; padding: 4px 10px; color: var(--sje-primary); background: var(--sje-primary-soft); border-radius: 999px; font-size: 12px; font-weight: 800; }

/* Short-session start and progress */
.session-card {
  position: relative;
  display: grid;
  gap: 16px;
  margin: 18px 0;
  overflow: hidden;
  padding: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--sje-primary-deep), var(--sje-primary));
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(3, 78, 162, .22);
}
.session-card::after { content: ""; position: absolute; width: 190px; height: 190px; top: -110px; right: -65px; border: 28px solid rgba(255, 194, 15, .16); border-radius: 50%; pointer-events: none; }
.session-card .session-eyebrow { color: #ffe78a; }
.session-card h2, .session-card h3 { margin-top: 5px; font-size: clamp(21px, 6vw, 28px); line-height: 1.18; letter-spacing: -.025em; }
.session-copy { max-width: 620px; color: #dcecff; font-size: 14px; }
.session-copy > p:last-child { margin-top: 7px; }
.session-summary { color: #dcecff; font-size: 13px; font-weight: 700; }
.session-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.session-metric { min-width: 0; padding: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); border-radius: 12px; color: #dcecff; font-size: 11px; }
.session-metric strong, .session-metric dd { display: block; overflow: hidden; margin-top: 2px; color: #fff; font-size: 19px; font-weight: 900; line-height: 1.25; text-overflow: ellipsis; }
.session-card .session-actions { position: relative; z-index: 1; margin-top: 0; }
.session-card .btn-primary { color: var(--sje-primary-deep); background: var(--sje-brand-yellow); box-shadow: 0 8px 18px rgba(0, 0, 0, .18); }
.session-card .btn-primary:hover { background: #ffcf3f; }
.session-card .btn-ghost { color: #fff; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .6); }
.session-card .storage-note { margin: 0; color: #dcecff; }
.session-card .storage-note::before { color: #fff; background: rgba(255, 255, 255, .14); }
.progress-panel { margin: 16px 0; padding: 16px; background: #fff; border: 1px solid var(--sje-line); border-radius: var(--sje-radius); box-shadow: var(--sje-shadow-sm); }
.progress-panel h2, .progress-panel h3 { font-size: 16px; }
.progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress-line { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; }
.progress-track { height: 10px; flex: 1; overflow: hidden; background: #e5edf6; border-radius: 999px; }
.progress-fill { width: 0%; height: 100%; background: linear-gradient(90deg, var(--sje-primary), #1582d4); border-radius: 999px; transition: width .3s ease; }
.progress-text { color: var(--sje-muted); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* Family filters and list */
.filter-bar { display: flex; gap: 8px; margin: 16px -16px 0; padding: 4px 16px 8px; overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity; }
.filter-chip { display: inline-flex; min-height: 44px; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px; padding: 9px 14px; color: var(--sje-ink-soft); background: #fff; border: 1px solid var(--sje-line); border-radius: 999px; font-size: 13px; font-weight: 800; cursor: pointer; scroll-snap-align: start; }
.filter-chip:hover { border-color: #86acd6; }
.filter-chip.active, .filter-chip[aria-pressed="true"] { color: #fff; background: var(--sje-primary); border-color: var(--sje-primary); }
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 14px 0 40px; }
.family-chip {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 86px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  color: var(--sje-ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--sje-line);
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(15, 38, 71, .035);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.family-chip:hover { border-color: #7aa7d7; box-shadow: var(--sje-shadow-sm); transform: translateY(-1px); }
.family-chip .fw { max-width: 100%; overflow-wrap: anywhere; color: var(--sje-ink); font-size: 14px; font-weight: 800; line-height: 1.3; }
.family-chip .fp { margin-top: 3px; color: var(--sje-muted); font-size: 12px; line-height: 1.35; }
.family-chip .fc, .family-state { margin-top: 6px; color: var(--sje-muted); font-size: 11px; font-weight: 800; }
.family-count { color: var(--sje-muted); font-size: 11px; font-weight: 700; }
.family-chip.new { border-color: var(--sje-line); }
.family-chip.learning { background: var(--sje-learning-soft); border-color: #bca7eb; }
.family-chip.learning .family-state, .family-chip.learning .fc { color: var(--sje-learning); }
.family-chip.review { background: var(--sje-review-soft); border-color: #e7af73; }
.family-chip.review .family-state, .family-chip.review .fc { color: var(--sje-review); }
.family-chip.mastered, .family-chip.done { background: var(--sje-ok-soft); border-color: #86c99e; }
.family-chip.mastered .family-state, .family-chip.mastered .fc, .family-chip.done .family-state, .family-chip.done .fc { color: var(--sje-ok); }
.list-more { display: flex; justify-content: center; margin: -24px 0 40px; }
.list-more .btn { min-width: min(100%, 220px); }
.list-more:has(> #loadMoreFamilies[hidden]) { display: none; }
.loading-state, .error-state { grid-column: 1 / -1; padding: 26px 18px; text-align: center; background: #fff; border: 1px solid var(--sje-line); border-radius: var(--sje-radius); color: var(--sje-muted); }
.loading-state::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #d9e7f5; border-top-color: var(--sje-primary); border-radius: 50%; animation: spin .8s linear infinite; }
.error-state { color: var(--sje-danger); background: var(--sje-danger-soft); border-color: #efaaaa; }
.error-state h2 { font-size: 18px; }
.error-state p { margin-top: 5px; }
.error-state .btn { margin-top: 14px; }
.empty-state { margin: 14px 0 40px; padding: 24px 16px; color: var(--sje-muted); text-align: center; background: #fff; border: 1px dashed #aebed1; border-radius: var(--sje-radius); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Practice overlay */
.overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 25, 50, .68);
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: min(94dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--sje-shadow-md);
}
.sheet::before { content: ""; display: block; width: 42px; height: 4px; margin: 0 auto 8px; background: #cbd7e5; border-radius: 999px; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 10px; }
.sheet-step { color: var(--sje-primary); font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.sheet-close, .audio-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  color: var(--sje-muted);
  background: #fff;
  border: 1px solid var(--sje-line);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.sheet-close:hover, .audio-button:hover { color: var(--sje-primary); background: var(--sje-primary-soft); border-color: #86acd6; }
.audio-button { width: 46px; height: 46px; flex-basis: 46px; margin-top: 5px; color: var(--sje-primary); font-size: 19px; }
.audio-button[aria-pressed="true"], .audio-button.playing { color: #fff; background: var(--sje-primary); border-color: var(--sje-primary); }
.flash-audio { min-height: 54px; align-items: center; margin: 2px 0; }
.flash-audio .audio-button { margin-top: 0; }
.flash { display: flex; min-height: 244px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 30px 20px; text-align: center; background: linear-gradient(155deg, #fff 20%, #edf5ff); border: 1px solid #c8daee; border-radius: 18px; cursor: pointer; }
.flash .fword { color: var(--sje-primary); font-size: clamp(27px, 8vw, 36px); font-weight: 900; line-height: 1.14; overflow-wrap: anywhere; }
.flash .fpos, .flash .fipa { color: var(--sje-muted); font-size: 14px; }
.flash .fmeaning { margin-top: 8px; font-size: 20px; font-weight: 800; }
.flash .fex { max-width: 390px; margin-top: 9px; color: var(--sje-ink-soft); font-size: 14px; font-style: italic; }
.flash .ftap { margin-top: 14px; color: var(--sje-muted); font-size: 12px; font-weight: 700; }
.quiz-q { margin: 14px 0; font-size: 17px; line-height: 1.52; }
.quiz-q b { color: var(--sje-primary); }
.quiz-opts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.quiz-opt { width: 100%; min-height: 50px; padding: 12px 14px; color: var(--sje-ink); text-align: left; background: #fff; border: 2px solid var(--sje-line); border-radius: 12px; font-size: 15px; cursor: pointer; }
.quiz-opt:hover { border-color: #7aa7d7; }
.quiz-opt.correct { color: #0d5f2e; background: var(--sje-ok-soft); border-color: var(--sje-ok); }
.quiz-opt.wrong { color: #8e1616; background: var(--sje-danger-soft); border-color: var(--sje-danger); }
.quiz-input { width: 100%; min-height: 50px; margin-bottom: 10px; padding: 12px 14px; color: var(--sje-ink); background: #fff; border: 2px solid var(--sje-line); border-radius: 12px; font-size: 16px; }
.quiz-input:focus { border-color: var(--sje-primary); outline: none; }
.quiz-fb { min-height: 24px; margin-bottom: 10px; font-size: 14px; }
.quiz-fb.ok { color: var(--sje-ok); font-weight: 800; }
.quiz-fb.bad { color: var(--sje-danger); font-weight: 800; }
.feedback-next { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; margin-top: 10px; }
.sheet-actions {
  position: sticky;
  bottom: calc(-16px - env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  gap: 10px;
  margin: 12px -16px -16px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(255, 255, 255, .9), #fff 25%);
  border-top: 1px solid var(--sje-line);
}
.sheet-actions .btn { flex: 1; }
.session-result { padding: 12px 0 4px; text-align: center; }
.session-result h2 { margin-top: 10px; font-size: 25px; line-height: 1.2; }
.session-result p { max-width: 390px; margin: 8px auto 0; color: var(--sje-muted); }
.family-result { padding-top: 24px; }
.family-result > p:last-of-type { margin-top: 14px; color: var(--sje-ink-soft); }
.result-score { display: inline-flex; width: 108px; height: 108px; align-items: center; justify-content: center; color: var(--sje-primary); background: var(--sje-primary-soft); border: 9px solid #c6dcf5; border-radius: 50%; font-size: 27px; font-weight: 900; }
.result-actions { justify-content: center; }
.topic-done-banner { margin: 20px 0 40px; padding: 22px; text-align: center; background: var(--sje-ok-soft); border: 1px solid #86c99e; border-radius: var(--sje-radius); }
.topic-done-banner h2, .topic-done-banner h3 { margin-bottom: 6px; color: var(--sje-ok); font-size: 19px; }
.topic-done-banner p { margin-bottom: 14px; color: var(--sje-muted); font-size: 14px; }

/* Keyboard accessibility */
:where(a, button, input, [tabindex]):focus-visible { outline: 2px solid transparent; box-shadow: var(--sje-focus); }
.level-card:focus-visible, .topic-card:focus-visible, .family-chip:focus-visible, .flash:focus-visible { z-index: 2; border-color: var(--sje-primary); }

/* Footer */
.site-footer { margin-top: 20px; padding: 26px 0 calc(26px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--sje-line); }
.site-footer .wrap { color: var(--sje-muted); font-size: 13px; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--sje-primary); text-underline-offset: 3px; }

@media (min-width: 370px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-card { min-height: 162px; padding: 16px; }
}
@media (min-width: 560px) {
  .wrap { padding-inline: 22px; }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .family-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 11px; }
  .filter-bar { margin-inline: 0; padding-inline: 0; }
  .session-card { padding: 24px; }
  .hero-actions .btn, .session-card .session-actions .btn, .result-actions .btn { flex: 0 0 auto; }
}
@media (min-width: 640px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { padding: 20px 22px 22px; border-radius: 22px; }
  .sheet::before { display: none; }
  .sheet-actions { position: static; margin: 12px 0 0; padding: 0; background: none; border-top: 0; }
}
@media (min-width: 820px) {
  .level-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
  .topic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .page-hero { padding-top: 22px; }
  .session-card {
    grid-template-columns: minmax(0, 1.35fr) minmax(270px, .8fr);
    grid-template-areas:
      "copy metrics"
      "actions metrics"
      "summary note";
    align-items: center;
  }
  .session-copy { grid-area: copy; }
  .session-actions { grid-area: actions; }
  .session-summary { grid-area: summary; }
  .session-metrics { grid-area: metrics; }
  .session-card .storage-note { grid-area: note; }
  .session-metrics { align-self: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Free Learning refresh: align vocabulary with the shared grammar experience. */
body {
  color: var(--sje-ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(3, 78, 162, .08), transparent 25rem),
    linear-gradient(180deg, #f8faff 0, var(--sje-bg) 31rem);
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1160px; padding-inline: 18px; }
.site-header .wrap {
  display: grid;
  min-height: 70px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand login" "nav nav";
  align-items: center;
  gap: 0 14px;
}
.wordmark { grid-area: brand; }
.learning-nav { grid-area: nav; }
.btn-login { grid-area: login; justify-self: end; }
.page-hero h1 { font-size: clamp(30px, 7vw, 48px); line-height: 1.08; letter-spacing: -.045em; }
.page-hero > p, .hero-copy { max-width: 760px; line-height: 1.65; }
.level-card { min-height: 205px; padding: 20px; border-radius: var(--sje-radius); }
.level-card h2 { font-size: 19px; }
.topic-card { min-height: 165px; padding: 18px; border-radius: var(--sje-radius); }
.session-card { border-radius: 22px; }
.session-card .session-eyebrow { color: #c7e5ff; }
.session-card .btn-primary { color: var(--sje-primary); background: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .16); }
.session-card .btn-primary:hover { background: var(--sje-primary-soft); }
.progress-panel { padding: 17px 18px; }
.family-chip { min-height: 94px; padding: 14px; border-radius: 14px; }
.family-chip .fw { font-size: 15px; }

.practice-overlay.overlay {
  display: none;
  align-items: stretch;
  padding: env(safe-area-inset-top) 0 0;
  background: rgba(7, 25, 50, .72);
  backdrop-filter: blur(6px);
}
.practice-overlay.overlay.open { display: flex; }
.practice-sheet.sheet {
  width: 100%;
  max-width: 720px;
  min-height: 100dvh;
  max-height: 100dvh;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  background: #f8faff;
  border-radius: 0;
}
.practice-sheet.sheet::before { display: none; }
.practice-topbar.sheet-top { margin-bottom: 0; }
.practice-step.sheet-step { max-width: calc(100% - 58px); line-height: 1.45; }
.vocab-practice-stage { min-height: 390px; }
.flash-stage { padding: 18px; }
.flash { min-height: 270px; border: 2px solid #c4d8ec; border-radius: 20px; }
.flash .fex { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.7; }
.flash-audio { display: flex; justify-content: center; }
.family-word-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; color: var(--sje-muted); font-size: 12px; }
.family-word-list > span:first-child { margin-right: 2px; }
.family-word-chip { display: inline-flex; padding: 3px 9px; color: var(--sje-primary); background: var(--sje-primary-soft); border-radius: 999px; font-weight: 750; }
.quiz-q.practice-question { margin: 0; color: var(--sje-ink); font-size: clamp(21px, 5vw, 29px); line-height: 1.38; }
.quiz-q.practice-question b { color: var(--sje-primary); }
.quiz-opts.practice-options { margin: 24px 0 0; }
.quiz-opt.practice-option { min-height: 58px; padding: 11px 14px; border-radius: 14px; }
.quiz-input { min-height: 56px; margin: 24px 0 0; padding: 13px 15px; border-radius: 14px; font-size: 17px; }
.quiz-fb.practice-feedback { min-height: 0; margin-bottom: 0; color: var(--sje-ink-soft); font-weight: 400; }
.quiz-fb.practice-feedback.ok { color: var(--sje-ink-soft); font-weight: 400; }
.quiz-fb.practice-feedback.bad { color: var(--sje-ink-soft); font-weight: 400; }
.quiz-fb.practice-feedback p { margin: 3px 0 0; }
.quiz-fb .feedback-answer { color: var(--sje-ink); font-weight: 800; }
.practice-feedback .feedback-next { display: inline-flex; width: 100%; margin-top: 3px; }
.vocab-practice-stage .sheet-actions { margin-top: 20px; }
.session-result.practice-stage { padding-top: clamp(28px, 6vw, 44px); }
.session-result.practice-stage .practice-instruction { margin-top: 18px; }
.session-result.practice-stage h2 { margin-top: 7px; font-size: clamp(25px, 6vw, 34px); }

@media (min-width: 620px) {
  .wrap { padding-inline: 24px; }
  .site-header .wrap { grid-template-columns: auto minmax(260px, 360px) 1fr; grid-template-areas: "brand nav login"; gap: 24px; }
  .learning-nav { margin: 0; }
  .practice-overlay.overlay { align-items: center; padding: 26px; }
  .practice-sheet.sheet { min-height: 0; max-height: min(92dvh, 820px); padding: 20px 24px 24px; border-radius: 26px; }
  .flash-stage { padding: 28px; }
}

.level-c2 { --level-accent: #755018; --level-soft: #faf3e6; }
.practice-context { margin: 12px 0; padding: 14px 18px; border-left: 3px solid #034ea2; background: #f3f7fc; line-height: 1.7; color: #26354b; }
