@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap");

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #0b0a12;
  --muted: #6c6880;
  --line: #efedf7;
  --line-strong: #e2e0ee;
  --accent: #4f2bff;
  --accent-dark: #3d1ce0;
  --accent-soft: #ede9ff;
  --accent-soft-2: #f6f5fa;
  --accent-soft-3: #dfd8ff;
  --gold: #4f2bff;
  --gold-soft: #ede9ff;
  --rose: #f62d0d;
  --rose-soft: #fff0ee;
  --blue: #4f2bff;
  --blue-soft: #ede9ff;
  --success: #05a165;
  --success-soft: #e9fbf3;
  --shadow: 0 20px 56px rgba(79, 43, 255, 0.1);
  --shadow-soft: 0 10px 30px rgba(11, 10, 18, 0.06);
  --shadow-hover: 0 24px 64px rgba(79, 43, 255, 0.16);
  --radius: 16px;
  --radius-inner: 10px;
  --radius-control: 10px;
  --font-sans: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html,
body {
  background: #ffffff;
}

body {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-dark);
}

button,
input,
textarea,
select {
  font-family: var(--font-sans);
}

h1,
h2,
h3,
.brand,
.headword,
button,
input,
textarea {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0;
}

p,
li {
  color: inherit;
}

strong,
b {
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
  background: #ffffff;
}

.topbar {
  min-height: 74px;
  height: 74px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  margin-right: 10px;
  border-radius: 9px;
  background:
    linear-gradient(#ffffff, #ffffff) 8px 10px / 2px 10px no-repeat,
    linear-gradient(#ffffff, #ffffff) 13px 6px / 2px 18px no-repeat,
    linear-gradient(#ffffff, #ffffff) 18px 9px / 2px 12px no-repeat,
    linear-gradient(#ffffff, #ffffff) 23px 12px / 2px 6px no-repeat,
    var(--accent);
}

.brand span {
  color: var(--ink);
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
}

.lesson-menu summary {
  min-height: 42px;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
}

.lesson-menu summary span {
  color: var(--muted);
  font-weight: 600;
}

.lesson-menu summary strong {
  color: var(--accent);
  font-weight: 600;
}

.lesson-menu summary:hover {
  color: var(--accent-dark);
  background: var(--accent-soft-3);
  transform: translateY(-1px);
}

.lesson-menu summary:active {
  transform: scale(0.96);
}

.lesson-menu-popover {
  width: min(380px, calc(100vw - 24px));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(11, 10, 18, 0.12);
}

.lesson-menu:not([open]) .lesson-menu-popover {
  display: none;
}

.lesson-menu-popover a {
  min-height: 58px;
  border-radius: 12px;
  transition: background 180ms ease, border-color 180ms ease, transform 120ms ease;
}

.lesson-menu-popover a strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.lesson-menu-popover a span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.lesson-menu-popover a:hover {
  border-color: var(--line);
  background: var(--accent-soft-2);
  transform: translateY(-1px);
}

.lesson-menu-popover a.active {
  color: var(--accent);
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
}

.lesson-meta span {
  padding: 6px 11px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: var(--accent-soft-2);
  font-size: 13px;
  font-weight: 600;
}

.lesson-layout {
  max-width: 1180px;
  padding: 32px 40px 56px;
  gap: 28px;
  grid-template-columns: 288px minmax(0, 1fr);
}

.lesson-layout.single-column {
  max-width: 980px;
}

.rail,
.stage,
.panel,
.question-panel,
.audio-panel,
.vocab-card,
.exercise-panel,
.prompt-panel,
.chat-panel,
.review-section,
.unlock-card {
  border: 0;
  background: var(--accent-soft-2);
  box-shadow: none;
}

.rail {
  top: 106px;
  padding: 24px;
  border-radius: 20px;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.rail h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.16;
}

.eyebrow,
.mini-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.phase-list {
  gap: 8px;
}

.phase-item {
  min-height: 58px;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
}

.phase-item:hover {
  color: var(--ink);
  background: #ffffff;
}

.phase-item.current {
  color: var(--ink);
  border-color: var(--accent-soft-3);
  background: #ffffff;
}

.phase-item.done {
  color: var(--ink);
}

.phase-index {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--accent);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.phase-item.done .phase-index,
.speed-button.active,
.option-button.selected,
.vocab-dots button.active,
.vocab-swipe-actions .chosen {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.phase-name {
  font-size: 14px;
  font-weight: 600;
}

.phase-mission {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stage {
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 20px 56px rgba(79, 43, 255, 0.08);
}

.progress-track,
.deck-meter,
.meter,
.hud-meter {
  background: var(--line);
}

.progress-track {
  position: fixed;
  top: 74px;
  left: 0;
  right: 0;
  z-index: 21;
  height: 10px;
  border-radius: 0;
  overflow: hidden;
  background: #ebe7ff;
  box-shadow: 0 2px 10px rgba(79, 43, 255, 0.14);
  pointer-events: none;
}

#progress-bar,
.deck-meter span,
.meter > span {
  background: var(--accent);
}

#progress-bar {
  background: linear-gradient(90deg, var(--accent), #13b8a6);
  box-shadow: 0 0 14px rgba(79, 43, 255, 0.36);
}

#lesson-stage {
  padding: 32px;
}

.stage-header {
  gap: 24px;
  margin-bottom: 28px;
}

.compact-stage-header {
  max-width: 760px;
}

.stage-kicker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.stage-kicker-row .badge {
  margin: 0;
}

.phase-sound-hint {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  position: relative;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.18), 0 8px 20px rgba(79, 43, 255, 0.14);
}

.sound-on-icon {
  width: 28px;
  height: 28px;
  display: block;
  background: url("icons/sound-on.png") center / contain no-repeat;
}

.sound-on-speaker {
  fill: currentColor;
}

.sound-on-cutout {
  fill: rgba(255, 255, 255, 0.58);
}

.sound-on-wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 6.5;
  stroke-linecap: round;
}

.sound-on-wave.outer {
  opacity: 0.82;
}

.stage-header h2 {
  margin-bottom: 10px;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.08;
}

.stage-header p,
.watch-note p,
.dictionary-definition,
.deck-detail-grid p:last-child,
.phase-actions p,
.speech-coach-head p:last-child,
.lesson-menu-popover a span {
  color: var(--muted);
}

.mission-hud {
  display: none !important;
}

.hud-topline,
.hud-stats {
  font-size: 12px;
  font-weight: 600;
}

.hud-topline strong {
  color: var(--accent);
}

.hud-meter span {
  background: var(--accent);
}

.hud-stats span {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge,
.level-pill,
.topic-pill,
.reward-chip,
.review-badge,
.unlock-badge,
.unlock-start,
.vocab-score span,
.vocab-score strong {
  border-radius: 999px;
}

.badge,
.level-pill,
.topic-pill {
  color: var(--accent);
  border: 0;
  background: var(--accent-soft);
}

.level-notice,
.feedback.good,
.option-button.correct {
  border-color: rgba(5, 161, 101, 0.18);
  color: #047a4e;
  background: var(--success-soft);
}

.video-frame {
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: #0b0a12;
  box-shadow: 0 24px 70px rgba(23, 8, 90, 0.18);
  outline: 1px solid oklch(0 0 0 / 0.1);
}

.watch-video-frame {
  display: grid;
  background: #0b0a12;
}

.scene-video-shell {
  position: relative;
  display: grid;
  overflow: hidden;
  background: #020106;
  isolation: isolate;
}

.watch-video-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  background: linear-gradient(90deg, rgba(19, 14, 35, 0.96), rgba(79, 43, 255, 0.82));
}

.watch-video-cta div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.watch-video-cta strong {
  font-size: 16px;
  font-weight: 600;
}

.watch-video-cta span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.35;
}

.watch-video-cta .primary-button {
  min-height: 44px;
  flex: 0 0 auto;
  color: var(--accent);
  background: #ffffff;
  box-shadow: none;
}

video {
  outline: 0;
}

.speed-row {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.watch-note,
.hidden-transcript,
.speech-coach,
.summary-list li,
.scene-quote,
.word-details,
.memory-hook,
.micro-practice,
.text-input,
.text-area,
.speech-result > div,
.chat-log,
.message.ai,
.subtitle-line {
  border: 0;
  border-radius: 16px;
  background: var(--accent-soft-2);
}

.watch-note {
  display: block;
  padding: 18px 20px;
}

.watch-focus strong,
.hidden-transcript.revealed,
.memory-hook {
  color: var(--accent);
  background: var(--accent-soft);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.option-button,
.speed-button,
.ghost-mini,
.link-button {
  min-height: 44px;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 600;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 12px 34px rgba(79, 43, 255, 0.26);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button,
.ghost-mini,
.speed-button {
  color: var(--accent);
  border: 0;
  background: var(--accent-soft);
}

.secondary-button:hover,
.ghost-mini:hover,
.speed-button:hover {
  color: var(--accent-dark);
  background: var(--accent-soft-3);
}

.ghost-button {
  color: var(--muted);
  border: 1px solid var(--line);
  background: #ffffff;
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--accent-soft-2);
}

.danger-button {
  color: var(--rose);
  background: var(--rose-soft);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.speed-button:active,
.option-button:active,
.ghost-mini:active,
.lesson-menu-popover a:active {
  transform: scale(0.96);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled,
.ghost-mini:disabled {
  color: #9d99b1;
  background: #efedf7;
  box-shadow: none;
}

.unlock-card {
  min-height: 136px;
  border-radius: 22px;
  background: var(--accent-soft-2);
}

.unlock-card strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
}

.unlock-card::after {
  height: 6px;
  background: var(--accent);
}

.unlock-card.ready {
  background: var(--accent);
}

.unlock-card.ready,
.unlock-card.ready strong,
.unlock-card.ready p,
.unlock-card.ready .unlock-badge {
  color: #ffffff;
}

.unlock-card.ready .unlock-badge {
  background: rgba(255, 255, 255, 0.18);
}

.unlock-card.ready .unlock-start {
  color: var(--accent);
  background: #ffffff;
}

.unlock-card.ready::after {
  background: rgba(255, 255, 255, 0.3);
}

.question-panel,
.audio-panel,
.exercise-panel,
.prompt-panel,
.panel,
.chat-panel {
  padding: 22px;
  border-radius: 20px;
}

.question-panel h3,
.audio-panel h3,
.exercise-panel h3,
.prompt-panel h3,
.vocab-card h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.option-button {
  min-height: 52px;
  border: 1.5px solid #e9e7f4;
  background: #ffffff;
  color: var(--ink);
}

.option-button:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.option-button.selected {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-button.incorrect,
.feedback.warn {
  border-color: rgba(246, 45, 13, 0.18);
  color: #9d2a18;
  background: var(--rose-soft);
}

.feedback {
  border: 0;
  border-radius: 16px;
  background: var(--accent-soft-2);
}

.reward-feedback {
  position: relative;
  align-items: center;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 18px;
  overflow: hidden;
}

.reward-feedback::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.feedback-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.feedback.good.reward-feedback {
  color: #046645;
  background: linear-gradient(135deg, #e8fbf3 0%, #f4fff9 62%, #ffffff 100%);
  box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.2), 0 16px 34px rgba(5, 161, 101, 0.12);
  animation: answer-card-pop 260ms cubic-bezier(0.2, 0, 0, 1), feedback-glow 900ms ease-out;
}

.feedback.good .feedback-icon,
.feedback.good .reward-chip {
  background: linear-gradient(90deg, #05a165, #14b8a6);
}

.feedback.warn.reward-feedback {
  color: #8f2c1d;
  background: linear-gradient(135deg, #fff0ee 0%, #fff8f6 100%);
  box-shadow: inset 0 0 0 1px rgba(246, 45, 13, 0.18);
}

.feedback.warn .feedback-icon,
.feedback.warn .reward-chip {
  background: #f62d0d;
}

.question-panel.is-correct,
.exercise-panel.is-correct {
  background: linear-gradient(180deg, #ffffff 0%, #f2fff9 100%);
  box-shadow: inset 0 0 0 1.5px rgba(5, 161, 101, 0.24), 0 18px 42px rgba(5, 161, 101, 0.1);
  animation: answer-card-pop 260ms cubic-bezier(0.2, 0, 0, 1);
}

.question-panel.is-incorrect,
.exercise-panel.is-incorrect {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f5 100%);
  box-shadow: inset 0 0 0 1.5px rgba(246, 45, 13, 0.16);
}

.option-button.correct {
  color: #046645;
  border-color: rgba(5, 161, 101, 0.34);
  background: #e9fbf3;
  box-shadow: 0 10px 24px rgba(5, 161, 101, 0.12);
  animation: correct-option-pop 230ms cubic-bezier(0.2, 0, 0, 1);
}

.option-button.incorrect {
  animation: wrong-option-nudge 220ms ease-out;
}

.answer-toast {
  position: fixed;
  top: 86px;
  right: 22px;
  z-index: 160;
  width: min(336px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(79, 43, 255, 0.16);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 34px rgba(29, 20, 90, 0.12);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition-property: opacity, transform;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.answer-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.answer-toast.good {
  border-color: rgba(5, 161, 101, 0.3);
  box-shadow: 0 14px 34px rgba(5, 161, 101, 0.12);
}

.answer-toast.warn {
  border-color: rgba(246, 45, 13, 0.28);
  box-shadow: 0 14px 34px rgba(246, 45, 13, 0.1);
}

.answer-toast-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
}

.answer-toast.good .answer-toast-icon {
  background: #05a165;
  box-shadow: none;
}

.answer-toast.warn .answer-toast-icon {
  background: #f62d0d;
  box-shadow: none;
}

.answer-toast strong,
.answer-toast small {
  display: block;
}

.answer-toast strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.answer-toast small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.answer-toast.complete::before {
  content: none;
}

.reward-chip {
  color: #ffffff;
  background: var(--accent);
}

.sound-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #ded7ff;
  border-radius: 18px;
  color: var(--accent-dark);
  background: linear-gradient(135deg, #fff 0%, #f3efff 100%);
  box-shadow: 0 12px 30px rgba(79, 43, 255, 0.08);
}

.sound-cue-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 54%, #ff5c8a 100%);
}

.sound-cue-icon::before {
  content: "";
  width: 12px;
  height: 14px;
  border-radius: 4px 0 0 4px;
  background: currentColor;
  box-shadow: 8px 2px 0 -2px currentColor;
}

.sound-cue-icon span,
.sound-cue-icon::after {
  content: "";
  position: absolute;
  right: 9px;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.sound-cue-icon span {
  width: 12px;
  height: 18px;
}

.sound-cue-icon::after {
  width: 18px;
  height: 26px;
  opacity: 0.7;
}

.sound-cue strong {
  display: block;
  font-weight: 600;
}

.sound-cue p {
  margin: 1px 0 0;
  color: var(--muted);
}

.phase-actions {
  border-top: 1px solid var(--line);
}

audio {
  accent-color: var(--accent);
}

.vocab-deck {
  gap: 18px;
}

.vocab-card-shell {
  max-width: 430px;
}

.vocab-card-shell::before,
.vocab-card-shell::after {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(79, 43, 255, 0.08);
}

.vocab-card.deck-card {
  border: 0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(79, 43, 255, 0.18);
}

.vocab-card.deck-card.is-dragging {
  box-shadow: 0 30px 74px rgba(79, 43, 255, 0.24);
}

.deck-card .vocab-image,
.deck-card .vocab-image img {
  border-radius: 20px 20px 0 0;
}

.vocab-image {
  overflow: hidden;
  background: var(--accent-soft-2);
  border-bottom: 1px solid var(--line);
}

.vocab-image img,
.grammar-image img {
  width: 100%;
  display: block;
  background: var(--accent-soft-2);
  outline: 1px solid oklch(0 0 0 / 0.1);
}

.deck-card .vocab-image img,
.review-card .vocab-image img {
  object-fit: cover;
  object-position: center;
}

.deck-card .vocab-image img {
  aspect-ratio: 16 / 10;
  max-height: 210px;
}

.review-card .vocab-image img {
  aspect-ratio: 4 / 3;
  max-height: 230px;
}

.vocab-image img[src*="small-intestine"],
.vocab-image img[src*="hormone-molecule"],
.vocab-image img[src*="fixate-magnifying"] {
  object-fit: contain;
  padding: 10px;
  background: #ffffff;
}

.deck-card .headword,
.headword {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0;
}

.pos {
  color: var(--muted);
  font-weight: 600;
}

.ipa-row {
  color: var(--accent);
}

.dictionary-definition {
  border-left-color: var(--accent);
}

.scene-quote {
  color: var(--ink);
  background: var(--accent-soft);
}

.scene-quote span {
  color: var(--accent);
  text-transform: none;
}

.chip-row span,
.pattern-strip span,
.grammar-build span {
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.grammar-build span {
  color: #ffffff;
  background: var(--accent);
}

.reference-links,
.dictionary-links {
  border-top-color: var(--line);
  color: var(--muted);
}

.reference-links a,
.dictionary-links a,
.did-you-know-links a,
.transcript-link,
.data-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.vocab-score span,
.vocab-score strong {
  border: 0;
  background: #ffffff;
}

.vocab-score strong {
  color: var(--accent);
  background: var(--accent-soft);
}

.vocab-swipe-actions .chosen {
  color: #ffffff;
  background: var(--accent);
  outline: 3px solid rgba(79, 43, 255, 0.14);
}

.swipe-left.chosen,
.swipe-right.chosen {
  border-color: var(--accent);
  background: var(--accent);
}

.swipe-hint-left,
.swipe-hint-right {
  background: var(--accent);
}

.vocab-dots button {
  border-color: var(--line-strong);
  background: #ffffff;
}

.vocab-dots button.sorted {
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
}

.text-input,
.text-area {
  border: 1.5px solid #e9e7f4;
  background: #ffffff;
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--accent);
}

.speech-coach {
  background: var(--accent-soft-2);
}

.voice-answer-coach {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px;
  border-radius: calc(var(--radius) - 2px);
  color: #ffffff;
  background:
    radial-gradient(circle at 96% 14%, rgba(46, 197, 182, 0.38), transparent 30%),
    linear-gradient(135deg, #2f1bb4 0%, #5e2fff 58%, #df4f9b 100%);
  box-shadow: 0 14px 34px rgba(81, 43, 255, 0.18);
}

.voice-answer-coach .ai-coach-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.voice-answer-coach > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.voice-answer-coach strong {
  font-size: 16px;
  line-height: 1.25;
  text-wrap: balance;
}

.voice-answer-coach p {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.38;
}

.coach-processing {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f7f4ff);
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.12);
}

.coach-processing strong {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
}

.coach-processing span {
  color: var(--muted);
  line-height: 1.4;
}

.coach-processing-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece8ff;
}

.coach-processing-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.mimic-cue {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dfd8ff;
}

.mimic-cue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mimic-cue-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.35;
}

.mimic-cue-grid strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.waveform-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 74px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dfd8ff;
}

.waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  opacity: 0;
  transition: opacity 180ms ease;
}

.waveform-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(320px, 82%);
  height: 56px;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.compare-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.compare-strip.is-action-only {
  justify-content: flex-end;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
}

.compare-strip.is-action-only .compact-button {
  min-width: 188px;
}

.mimic-guide-points {
  display: grid;
  gap: 10px;
}

.mimic-guide-points span {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--ink);
  line-height: 1.45;
}

.speech-result > div {
  background: #ffffff;
}

.speech-result {
  grid-template-columns: 1fr;
  gap: 12px;
}

.speech-transcript-card {
  display: grid;
  gap: 8px;
}

.speech-transcript-card strong {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.speech-feedback.good {
  color: #047a4e;
  background: var(--success-soft);
}

.speech-feedback.warn {
  color: #9d2a18;
  background: var(--rose-soft);
}

.speech-feedback:has(.speech-feedback-grid) {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.speech-feedback:has(.speaking-feedback-stack) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.speaking-feedback-stack {
  display: grid;
  gap: 8px;
}

.speaking-feedback-summary {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #fbfaff);
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.12);
}

.speaking-feedback-summary.good {
  background: linear-gradient(180deg, #f6fff9, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.18);
}

.speaking-feedback-summary.warn {
  background: linear-gradient(180deg, #fffaf8, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(157, 42, 24, 0.16);
}

.feedback-status-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.speaking-feedback-summary.good .feedback-status-mark {
  background: #05a165;
}

.speaking-feedback-summary.warn .feedback-status-mark {
  background: #ff2d15;
}

.speaking-feedback-summary strong,
.coach-detail-card strong {
  display: block;
  line-height: 1.3;
}

.speaking-feedback-summary p,
.coach-detail-card p,
.coach-detail-card ul {
  margin: 0;
}

.speaking-feedback-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 2px 12px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.1);
}

.coach-detail-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid rgba(79, 43, 255, 0.1);
  background: transparent;
  box-shadow: none;
}

.coach-detail-card:first-child {
  border-top: 0;
}

.coach-detail-card.good {
  background: transparent;
  box-shadow: none;
}

.coach-detail-card.good strong {
  color: #067a53;
}

.coach-detail-card.warn {
  background: transparent;
  box-shadow: none;
}

.coach-detail-card.warn strong {
  color: #8c2a1e;
}

.coach-detail-card ul {
  display: grid;
  gap: 5px;
  padding-left: 18px;
}

.coach-detail-card:only-child,
.coach-detail-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.speech-feedback-grid {
  display: grid;
  gap: 10px;
}

.coach-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.1);
}

.coach-section strong {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.coach-section p,
.coach-section ul {
  margin: 0;
}

.coach-section ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.coach-section.good {
  background: var(--success-soft);
  box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.14);
}

.coach-section.good strong {
  color: #047a4e;
}

.coach-section.warn {
  background: var(--rose-soft);
  box-shadow: inset 0 0 0 1px rgba(157, 42, 24, 0.14);
}

.coach-section.warn strong {
  color: #9d2a18;
}

.coach-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.coach-chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 600;
}

.grammar-spotlight {
  border: 0;
  border-radius: 22px;
  background: var(--accent-soft-2);
}

.grammar-image,
.grammar-copy {
  border: 0;
  background: var(--accent-soft-2);
}

.grammar-copy h3 {
  font-weight: 600;
}

.chat-log {
  background: var(--accent-soft-2);
}

.message.user {
  color: #ffffff;
  background: var(--accent);
}

.completion-review-panel {
  margin: 16px 0;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid #E1DBFF;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 249, 255, 0.98)),
    #ffffff;
  box-shadow: 0 18px 42px rgba(58, 36, 160, 0.08);
}

.completion-review-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(79, 43, 255, 0.12);
}

.completion-review-head h3 {
  margin: 4px 0 6px;
  font-size: 24px;
  line-height: 1.15;
  text-wrap: balance;
}

.completion-review-head p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
}

.completion-ring {
  min-width: 118px;
  padding: 13px 14px;
  border-radius: 16px;
  color: #ffffff;
  background: #0b0a12;
  text-align: center;
  box-shadow: 0 16px 32px rgba(11, 10, 18, 0.14);
}

.completion-ring strong {
  display: block;
  font-size: 25px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.completion-ring span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.completion-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.completion-check-card {
  min-width: 0;
  min-height: 96px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.completion-check-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.completion-check-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.completion-check-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.completion-check-card.is-done {
  border-color: rgba(5, 161, 101, 0.18);
  background: linear-gradient(180deg, #f7fffb, #ffffff);
}

.completion-check-card.needs-review {
  border-color: rgba(239, 79, 147, 0.18);
  background: linear-gradient(180deg, #fffafd, #ffffff);
}

.completion-check-card.is-done span,
.completion-check-card.is-done p {
  color: #067a53;
}

.completion-check-card.needs-review span,
.completion-check-card.needs-review p {
  color: #8a3158;
}

.completion-review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(79, 43, 255, 0.1);
}

.completion-review-actions .link-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #DFD8FF;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #ffffff;
  text-decoration: none;
}

.completion-review-actions .link-button:hover {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.review-section {
  border-radius: 24px;
  background: var(--accent-soft-2);
}

.review-heading h3 {
  font-size: 26px;
  font-weight: 600;
}

.review-badge {
  color: var(--accent);
  background: var(--accent-soft);
}

.subtitle-line {
  background: #ffffff;
}

.subtitle-line:hover {
  background: var(--accent-soft);
}

.timecode {
  color: var(--accent);
}

.review-video {
  top: 104px;
}

@media (max-width: 940px) {
  .lesson-layout {
    padding: 20px;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
  }

  .stage {
    order: 1;
  }

  .rail {
    order: 2;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 64px;
    padding: 10px 14px;
    gap: 10px;
  }

  .progress-track {
    top: 114px;
  }

  .lesson-menu-popover {
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(70vh, 460px);
    overflow-y: auto;
    transform: none;
  }

  .brand {
    font-size: 19px;
  }

  .lesson-layout {
    padding: 12px;
    gap: 12px;
  }

  .stage {
    border-radius: 18px;
  }

  .rail {
    padding: 14px;
    border-radius: 18px;
  }

  #lesson-stage {
    padding: 28px 16px 16px;
  }

  .stage-header {
    margin-bottom: 18px;
  }

  .stage-kicker-row {
    margin-bottom: 7px;
  }

  .stage-header h2 {
    font-size: 26px;
    line-height: 1.04;
  }

  .stage-header p {
    display: none;
  }

  .mission-hud {
    width: 100%;
    flex-basis: auto;
    box-shadow: none;
  }

  .video-frame,
  video {
    border-radius: 16px;
  }

  .question-panel,
  .audio-panel,
  .exercise-panel,
  .prompt-panel,
  .panel,
  .chat-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .unlock-card {
    min-height: 120px;
    border-radius: 18px;
  }

  .unlock-card strong {
    font-size: 22px;
  }

  .vocab-card-shell {
    max-width: min(100%, 360px);
  }

  .vocab-card.deck-card,
  .vocab-card-shell::before,
  .vocab-card-shell::after {
    border-radius: 18px;
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img {
    border-radius: 18px 18px 0 0;
  }

  .deck-card .vocab-image img {
    max-height: 148px;
  }

  .vocab-swipe-actions {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: 100%;
    max-width: min(100%, 360px);
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button,
  .option-button,
  .speed-button,
  .ghost-mini {
    min-height: 44px;
  }
}

@media (min-width: 941px) and (max-height: 820px) {
  .lesson-layout {
    padding-bottom: 0 !important;
  }
}

/* Responsive lesson deck pass: fit the active task first, then let detail pages scroll. */
@media (min-width: 941px) {
  .lesson-layout {
    max-width: min(1120px, calc(100vw - 64px));
    grid-template-columns: minmax(248px, 268px) minmax(0, 1fr);
    gap: clamp(18px, 1.8vw, 26px);
    padding: clamp(18px, 2.2vh, 28px) clamp(24px, 3vw, 40px) 36px;
  }

  .rail {
    top: 98px;
    max-height: calc(100dvh - 116px);
    overflow-y: auto;
    padding: 20px;
  }

  .rail-heading {
    margin-bottom: 16px;
  }

  .phase-list {
    gap: 6px;
    margin-bottom: 14px;
  }

  .phase-item {
    min-height: 50px;
    padding: 8px 10px;
  }

  #lesson-stage {
    padding: clamp(22px, 2.7vh, 30px);
  }

  .stage-header {
    gap: 18px;
    margin-bottom: clamp(14px, 2vh, 22px);
  }

  .stage-kicker-row {
    margin-bottom: 8px;
  }

  .stage-header h2 {
    margin-bottom: 6px;
    font-size: clamp(30px, 2.5vw, 38px);
  }

  .stage-header p {
    max-width: 68ch;
    font-size: 16px;
    line-height: 1.45;
  }

  .watch-video-frame video {
    width: 100%;
    max-height: min(52dvh, 500px);
    object-fit: contain;
  }

  .watch-video-cta {
    padding: 10px 12px;
  }

  .watch-video-cta .primary-button {
    min-height: 42px;
  }

  .video-toolbar {
    margin-top: 10px;
  }
}

@media (min-width: 941px) and (max-height: 820px) {
  .lesson-layout {
    max-width: min(1060px, calc(100vw - 48px));
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 20px;
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .rail {
    top: 94px;
    padding: 18px;
  }

  .rail h1 {
    font-size: 21px;
  }

  .phase-item {
    min-height: 46px;
    grid-template-columns: 28px 1fr;
  }

  .phase-index {
    width: 28px;
    height: 28px;
  }

  #lesson-stage {
    padding: 20px 24px 22px;
  }

  .stage-header {
    margin-bottom: 14px;
  }

  .stage-header h2 {
    font-size: 34px;
  }

  .stage-header p {
    font-size: 15px;
  }

  .watch-video-frame video {
    max-height: calc(100dvh - 370px);
    min-height: 240px;
  }
}

@media (max-width: 640px) {
  .lesson-layout {
    padding: 8px 10px max(18px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .stage {
    border-radius: 20px;
  }

  #lesson-stage {
    padding: 12px;
  }

  .stage-header {
    gap: 8px;
    margin-bottom: 10px;
  }

  .stage-kicker-row {
    margin-bottom: 4px;
  }

  .stage-header h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 7vw, 31px);
    line-height: 1.02;
  }

  .phase-sound-hint {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .sound-on-icon {
    width: 24px;
    height: 24px;
  }

  .level-notice,
  .guidance-notice {
    margin: 0 0 10px;
    padding: 9px 10px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.35;
  }

  .watch-video-frame video {
    max-height: min(42dvh, 330px);
    object-fit: contain;
  }

  .watch-video-cta {
    gap: 8px;
    padding: 9px;
  }

  .watch-video-cta strong {
    font-size: 14px;
  }

  .watch-video-cta .primary-button {
    min-width: 108px;
    min-height: 42px;
    padding-inline: 10px;
  }

  .video-toolbar {
    margin-top: 8px;
  }

  .speed-select {
    min-height: 40px;
  }

  .focused-task-progress {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px 9px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .focused-task-progress-copy {
    display: contents;
  }

  .focused-task-progress-copy strong {
    font-size: 18px;
  }

  .focused-task-progress-copy span {
    max-width: none;
    color: var(--muted);
    font-size: 11px;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
  }

  .focused-task-dots {
    grid-column: 1 / -1;
    gap: 5px;
  }

  .focused-task-dot {
    height: 7px;
  }

  .question-list {
    gap: 10px;
  }

  .focused-question-list {
    padding-bottom: 0;
  }

  .question-panel,
  .exercise-panel {
    margin-bottom: 0;
    padding: 12px;
    border-radius: 16px;
  }

  .question-panel h3,
  .exercise-panel h3 {
    margin-bottom: 8px;
    font-size: clamp(18px, 5.3vw, 22px);
    line-height: 1.18;
  }

  .question-aid,
  .practice-aid {
    display: none;
  }

  .blank-line {
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.35;
  }

  .option-list,
  .match-choice-list {
    gap: 7px;
    margin-top: 9px;
  }

  .option-button {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 14px;
    line-height: 1.28;
  }

  .reward-feedback {
    display: grid;
    grid-template-columns: 26px auto minmax(0, 1fr);
    align-items: center;
    min-height: 0;
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    gap: 6px 8px;
    font-size: 14px;
    line-height: 1.35;
  }

  .reward-feedback > span:last-child {
    grid-column: 1 / -1;
  }

  .feedback-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    font-size: 13px;
  }

  .reward-chip {
    min-height: 24px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    position: static;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .focused-flow-actions.is-ready {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 28;
    margin: 0 auto;
    padding: 6px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 42px rgba(23, 8, 90, 0.14);
    backdrop-filter: blur(14px);
  }

  .focused-question-list:has(+ .focused-flow-actions.is-ready) {
    padding-bottom: 66px;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 44px;
    border-radius: 14px;
  }

  .answer-toast {
    display: none !important;
  }

  .rail {
    padding: 12px;
    border-radius: 18px;
  }

  .phase-list {
    gap: 7px;
  }

  .phase-item {
    min-width: 142px;
    min-height: 56px;
  }
}

@media (max-width: 390px), (max-height: 740px) and (max-width: 640px) {
  #lesson-stage {
    padding: 10px;
  }

  .focused-task-progress {
    gap: 5px 8px;
    margin-bottom: 8px;
    padding: 6px 9px;
  }

  .focused-task-dot {
    height: 6px;
  }

  .stage-header h2 {
    font-size: 24px;
  }

  .watch-video-frame video {
    max-height: 37dvh;
  }

  .question-panel,
  .exercise-panel {
    padding: 10px;
  }

  .question-panel h3,
  .exercise-panel h3 {
    font-size: 18px;
  }

  .option-button {
    min-height: 42px;
    padding: 8px 9px;
    font-size: 13.5px;
  }

  .reward-feedback {
    padding: 9px;
    font-size: 13px;
    line-height: 1.3;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    margin-top: 6px;
  }

  .reward-feedback {
    grid-template-columns: 24px auto minmax(0, 1fr);
    padding: 8px;
  }

  /* The last span carries the explanation for a right answer and the coaching
     for a wrong one. Hiding it on the smallest phones removed the only
     teaching content in the feedback, leaving just an icon and a chip.
     Keep it, compactly, on its own row. */
  .reward-feedback > span:last-child {
    grid-column: 1 / -1;
    font-size: 12.5px;
    line-height: 1.35;
    margin-top: 2px;
  }

  .focused-flow-actions.is-ready {
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    padding: 4px !important;
  }
}

@media (max-width: 640px) {
  .reward-feedback {
    display: grid;
    grid-template-columns: 26px auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 8px;
  }

  .reward-feedback > span:last-child {
    grid-column: 1 / -1;
  }

  .focused-flow-actions.is-ready {
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    z-index: 28;
    margin: 0 auto !important;
    padding: 6px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 16px 42px rgba(23, 8, 90, 0.14) !important;
    backdrop-filter: blur(14px);
  }

  .focused-question-list:has(+ .focused-flow-actions.is-ready) {
    padding-bottom: 66px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* Release polish: onboarding, progress, vocabulary popups, and mobile rhythm. */
:root {
  --progress-gradient: linear-gradient(90deg, #4f2bff 0%, #7c3cff 48%, #a855f7 100%);
}

.lesson-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.quick-guide-button {
  position: relative;
  min-height: 42px;
  padding: 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(79, 43, 255, 0.08);
  transition: transform 140ms ease, background 160ms ease, color 160ms ease, box-shadow 180ms ease;
  isolation: isolate;
}

.quick-guide-button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.82) 45%, transparent 56%);
  transform: translateX(-140%);
  animation: guide-button-sheen 4200ms cubic-bezier(0.2, 0, 0, 1) infinite;
}

.quick-guide-button:hover {
  color: var(--accent-dark);
  background: var(--accent-soft-3);
  box-shadow: 0 14px 36px rgba(79, 43, 255, 0.15);
  transform: translateY(-1px);
}

.quick-guide-button:active {
  transform: scale(0.96);
}

.progress-track {
  position: fixed;
  top: 74px;
  left: 0;
  right: 0;
  z-index: 39;
  height: 9px;
  border-radius: 0;
  background: #ebe7ff;
  box-shadow: 0 2px 14px rgba(79, 43, 255, 0.18);
  pointer-events: none;
}

#progress-bar,
.hud-meter span,
.deck-meter span,
.meter > span {
  background: var(--progress-gradient);
}

#progress-bar {
  box-shadow: 0 0 16px rgba(124, 60, 255, 0.48);
}

.tracking-pulse {
  animation: tracking-pulse 1100ms ease-in-out 3;
}

.tracking-toast {
  position: fixed;
  top: 90px;
  left: 50%;
  z-index: 60;
  max-width: min(340px, calc(100vw - 32px));
  translate: -50% 0;
  padding: 12px 14px;
  border: 1px solid #dfd8ff;
  border-radius: 14px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(79, 43, 255, 0.18);
  pointer-events: none;
  font-weight: 600;
  animation: toast-in 260ms ease-out;
}

.guide-open {
  overflow: hidden;
}

.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 10, 18, 0.44);
  backdrop-filter: blur(10px);
}

.guide-card {
  width: min(560px, 100%);
  position: relative;
  display: grid;
  gap: 16px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid #dfd8ff;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 34px 100px rgba(11, 10, 18, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.62) inset;
  animation: guide-in 360ms cubic-bezier(0.2, 0, 0, 1);
  isolation: isolate;
}

.guide-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 128px;
  z-index: -1;
  background:
    linear-gradient(135deg, #efeaff 0%, #ffffff 58%, #eef9ff 100%);
}

.guide-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 30px;
  right: 30px;
  height: 5px;
  border-radius: 0 0 999px 999px;
  background: var(--progress-gradient);
}

.guide-card > * {
  position: relative;
  z-index: 1;
}

.guide-card h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
  text-wrap: balance;
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 120ms both;
}

.guide-card > p:not(.mini-label) {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
  text-wrap: pretty;
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 190ms both;
}

.guide-card > .mini-label {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(124, 60, 255, 0.1);
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 80ms both;
}

.guide-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: transparent;
  background: var(--accent-soft-2);
  cursor: pointer;
  font-size: 0;
  font-weight: 600;
}

.guide-close::before,
.guide-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #4f2bff;
}

.guide-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.guide-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.guide-close:hover {
  background: #f0ebff;
}

.guide-visual {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28px;
  background: var(--accent-soft);
  box-shadow: 0 18px 46px rgba(79, 43, 255, 0.16), inset 0 0 0 1px rgba(124, 60, 255, 0.08);
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 30ms both;
}

.guide-visual::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px solid rgba(79, 43, 255, 0.2);
  border-radius: 22px;
  animation: guide-visual-ring 2600ms ease-in-out infinite;
}

.guide-visual::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  height: 5px;
  border-radius: 999px;
  background: var(--progress-gradient);
  transform-origin: left center;
  animation: guide-visual-meter 2400ms ease-in-out infinite;
}

.guide-visual span {
  width: 40px;
  height: 40px;
  display: block;
  position: relative;
  z-index: 1;
  border-radius: 12px;
  color: var(--accent);
  background:
    linear-gradient(currentColor, currentColor) 10px 12px / 4px 18px no-repeat,
    linear-gradient(currentColor, currentColor) 18px 7px / 4px 28px no-repeat,
    linear-gradient(currentColor, currentColor) 26px 14px / 4px 14px no-repeat;
  animation: guide-icon-breathe 3000ms ease-in-out infinite;
}

.guide-visual.play span {
  clip-path: polygon(28% 14%, 28% 86%, 84% 50%);
  background: var(--accent);
}

.guide-visual.quiz span {
  border: 4px solid var(--accent);
  border-radius: 12px;
  background:
    linear-gradient(var(--accent), var(--accent)) 8px 10px / 22px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 8px 20px / 16px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 8px 30px / 22px 4px no-repeat;
}

.guide-visual.mic span {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 0;
  background: url("icons/microphone.png") center / contain no-repeat;
  box-shadow: none;
}

.guide-visual.cards span {
  border: 4px solid var(--accent);
  transform: rotate(-6deg);
  background: #ffffff;
  box-shadow: 13px 9px 0 -3px #dfd8ff;
}

.guide-visual.trophy span {
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(180deg, #ffd166, #a855f7);
  box-shadow: 0 26px 0 -17px var(--accent);
}

.guide-dots {
  display: flex;
  gap: 7px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 8px;
  border-radius: 999px;
  background: var(--accent-soft-2);
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 260ms both;
}

.guide-dots button {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: width 220ms cubic-bezier(0.2, 0, 0, 1), background 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.guide-dots button:hover {
  transform: scale(1.12);
}

.guide-dots button.active {
  width: 36px;
  background: var(--progress-gradient);
  box-shadow: 0 8px 18px rgba(79, 43, 255, 0.24);
  animation: guide-dot-breathe 1700ms ease-in-out infinite;
}

.guide-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 330ms both;
}

.guide-actions .primary-button,
.guide-actions .secondary-button {
  min-width: 128px;
}

.guide-flow-control {
  display: grid;
  grid-template-columns: 48px minmax(92px, auto) minmax(180px, max-content);
  gap: 12px;
  align-items: center;
  grid-column: 1 / -1;
  justify-self: center;
  width: min(960px, 100%);
  margin-top: 8px;
  animation: guide-item-in 420ms cubic-bezier(0.2, 0, 0, 1) 330ms both;
}

.guide-icon-button,
.guide-main-button,
.guide-pips button {
  border: 0;
  cursor: pointer;
  transition-property: transform, opacity, background, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.guide-icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--accent);
  background: #fff;
  box-shadow: inset 0 0 0 1px #dfd8ff, 0 10px 26px rgba(79, 43, 255, 0.1);
}

.guide-icon-button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px var(--line);
}

.guide-icon-button:active:not(:disabled),
.guide-main-button:active,
.guide-pips button:active {
  transform: scale(0.96);
}

.guide-arrow {
  width: 12px;
  height: 12px;
  display: block;
  border: solid currentColor;
  border-width: 0 0 3px 3px;
}

.guide-arrow-left {
  transform: translateX(2px) rotate(45deg);
}

.guide-pips {
  display: flex;
  align-items: center;
  gap: 0;
}

.guide-pips button {
  width: 34px;
  height: 44px;
  min-height: 44px;
  position: relative;
  border-radius: 999px;
  background: transparent;
}

.guide-pips button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #dfd8ff;
  transform: translate(-50%, -50%);
  transition-property: width, background, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.guide-pips button.done::after,
.guide-pips button.active::after {
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 54%, #ff5c8a 100%);
}

.guide-pips button.active {
  width: 56px;
}

.guide-pips button.active::after {
  width: 38px;
  box-shadow: 0 10px 22px rgba(79, 43, 255, 0.22);
}

.guide-main-button {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 54%, #ff5c8a 100%);
  box-shadow: 0 18px 40px rgba(79, 43, 255, 0.24);
  font-weight: 600;
}

.grammar-audio-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 16px;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.grammar-audio-panel .sound-cue {
  margin: 0;
}

.comprehension-progress.compact-stat {
  align-self: start;
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 18px;
}

.comprehension-progress.compact-stat > strong {
  font-size: 28px;
  line-height: 1;
}

.comprehension-progress.compact-stat > span {
  color: var(--muted);
  font-weight: 600;
}

.sort-known {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #ffffff;
}

.sort-known.chosen {
  color: var(--accent-dark);
  border-color: #dfd8ff;
  background: var(--accent-soft);
}

.sort-new,
.sort-new.chosen {
  color: #ffffff;
  background: var(--progress-gradient);
}

.vocab-complete-card {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 18px;
  border-radius: 18px;
  background: var(--accent-soft);
}

.vocab-complete-card strong {
  color: var(--ink);
  font-size: 20px;
}

.vocab-complete-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.vocab-deck-complete {
  min-height: 260px;
  align-content: start;
}

.vocab-deck-complete .vocab-complete-card {
  width: min(100%, 620px);
}

.vocab-review-backdrop {
  z-index: 80;
  overflow: hidden;
}

.vocab-review-popup {
  max-height: min(900px, calc(100dvh - 28px));
}

.vocab-review-scroll {
  max-height: calc(100dvh - 118px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.review-card-side {
  flex-basis: 340px;
}

.review-word-panel .headword-row {
  align-items: baseline;
}

.definition-hero {
  border: 2px solid #dfd8ff;
  background: #ffffff;
}

.definition-pattern {
  color: var(--ink);
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.28;
}

.definition-copy {
  border-left-width: 5px;
  font-size: clamp(20px, 2.5vw, 30px);
  line-height: 1.36;
  font-weight: 600;
}

.word-section-grid.expanded {
  gap: 12px;
}

.word-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.mistake-section {
  border-color: #f1b6ad;
  background: #fff0ee;
}

.memory-section,
.micro-section {
  border-color: #dfd8ff;
}

.waveform-placeholder span {
  width: 7px;
  min-height: 18px;
  max-height: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4f2bff, #a855f7);
  animation: waveform-vibrate 1800ms ease-in-out infinite;
  animation-delay: calc(var(--i) * -90ms);
  transform-origin: center;
}

.recording .waveform-shell {
  border-color: #a855f7;
  box-shadow: 0 0 0 4px rgba(124, 60, 255, 0.12), 0 16px 34px rgba(79, 43, 255, 0.16);
}

.recording .waveform-placeholder {
  opacity: 0;
}

.recording .waveform-placeholder span {
  animation-duration: 1800ms;
}

.recording .waveform-canvas {
  background:
    linear-gradient(180deg, transparent 49%, rgba(124, 60, 255, 0.22) 50%, transparent 51%),
    #ffffff;
  opacity: 1;
}

.watch-out-panel {
  border: 1px solid #f1b6ad;
  background: #fff0ee;
}

.optional-speak-link {
  margin-top: 12px;
  text-align: center;
}

.link-button {
  min-height: 42px;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.next-lesson-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 22px;
  border-radius: 20px;
  background: var(--accent-soft);
}

.next-lesson-panel h3 {
  margin: 0 0 4px;
  font-size: 24px;
}

.next-lesson-panel p {
  margin: 0;
  color: var(--muted);
}

.primary-button.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  overflow: hidden;
}

.confetti-layer span {
  position: absolute;
  top: -24px;
  left: var(--x);
  width: 10px;
  height: 16px;
  border-radius: 3px;
  background: var(--color);
  animation: confetti-drop 1700ms cubic-bezier(0.18, 0.78, 0.26, 1) forwards;
  animation-delay: var(--delay);
}

.confetti-layer.vocab span {
  width: 8px;
  height: 12px;
}

.transcript-link {
  display: inline;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

@keyframes tracking-pulse {
  0%,
  100% {
    box-shadow: 0 2px 14px rgba(79, 43, 255, 0.18);
  }
  50% {
    box-shadow: 0 3px 24px rgba(124, 60, 255, 0.48);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guide-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes guide-item-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guide-line-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guide-icon-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-2px) scale(1.04);
  }
}

@keyframes guide-visual-ring {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(0.92);
  }
}

@keyframes guide-visual-meter {
  0%,
  100% {
    transform: scaleX(0.36);
  }
  50% {
    transform: scaleX(1);
  }
}

@keyframes guide-dot-breathe {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.18);
  }
}

@keyframes guide-button-sheen {
  0%,
  62% {
    transform: translateX(-140%);
  }
  82%,
  100% {
    transform: translateX(140%);
  }
}

@keyframes confetti-drop {
  0% {
    opacity: 0;
    transform: translate3d(0, -24px, 0) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx), 112vh, 0) rotate(var(--rot));
  }
}

@keyframes waveform-vibrate {
  0% {
    transform: scaleY(0.45);
    opacity: 0.62;
  }
  45% {
    transform: scaleY(1.18);
    opacity: 0.95;
  }
  100% {
    transform: scaleY(0.62);
    opacity: 0.76;
  }
}

@media (max-width: 940px) {
  .next-lesson-panel,
  .guide-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .comprehension-progress.compact-stat {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .comprehension-progress.compact-stat .meter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .quick-guide-button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .progress-track {
    top: 116px;
    height: 8px;
  }

  .tracking-toast {
    display: none;
  }

  .guide-backdrop {
    align-items: end;
    padding: 10px;
  }

  .guide-card {
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    gap: 13px;
    padding: 22px;
    border-radius: 22px;
  }

  .guide-card::before {
    height: 102px;
  }

  .guide-card::after {
    left: 22px;
    right: 22px;
  }

  .guide-card h2 {
    font-size: 30px;
  }

  .guide-card > p:not(.mini-label) {
    font-size: 16px;
    line-height: 1.55;
  }

  .guide-visual {
    width: 76px;
    height: 76px;
    border-radius: 22px;
  }

  .guide-visual::before {
    inset: 8px;
    border-radius: 18px;
  }

  .guide-visual::after {
    left: 15px;
    right: 15px;
    bottom: 13px;
  }

  .guide-dots {
    width: fit-content;
    justify-content: flex-start;
  }

  .guide-actions .primary-button,
  .guide-actions .secondary-button {
    width: 100%;
  }

  .mimic-cue-grid {
    grid-template-columns: 1fr;
  }

  .waveform-shell {
    min-height: 68px;
  }

  .waveform-placeholder {
    width: min(260px, 84%);
    gap: 6px;
  }

  .vocab-review-backdrop {
    align-items: stretch;
    padding: 8px;
  }

  .vocab-review-popup {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .vocab-review-scroll {
    max-height: calc(100dvh - 116px);
    padding: 12px;
  }

  .definition-copy {
    font-size: 21px;
  }

  .review-word-panel {
    padding: 14px;
  }

  .sound-row {
    grid-template-columns: 1fr;
  }

  .speech-result {
    grid-template-columns: 1fr;
  }

  .next-lesson-panel {
    padding: 18px;
  }

}

/* Full-page onboarding and simplified lesson flow refresh. */
.tracking-toast {
  display: none !important;
}

.quick-guide-button::after {
  animation: none;
  content: none;
}

.progress-track {
  background: #ede9ff;
  box-shadow: 0 12px 36px rgba(79, 43, 255, 0.1);
}

.progress-track #progress-bar,
#progress-bar,
.hud-meter span,
.deck-meter span,
.meter span {
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 54%, #ff5c8a 100%);
}

.full-guide {
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 44px);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 92, 138, 0.13), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(79, 43, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #f7f4ff 52%, #ffffff 100%);
  backdrop-filter: blur(12px);
}

.full-guide .guide-page {
  width: min(1088px, calc(100vw - 56px));
  max-height: calc(100dvh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(286px, 340px);
  grid-template-rows: auto auto;
  align-items: stretch;
  justify-content: center;
  gap: clamp(22px, 3vw, 38px);
  padding: clamp(30px, 3.2vw, 44px);
  border: 1px solid rgba(124, 60, 255, 0.14);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(79, 43, 255, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.84) inset;
  background:
    linear-gradient(90deg, rgba(255, 92, 138, 0.06), rgba(255, 255, 255, 0) 34%),
    #ffffff;
  overflow: hidden;
}

.full-guide .guide-page-intro {
  width: min(1088px, calc(100vw - 56px));
}

.full-guide .guide-page::before,
.full-guide .guide-page::after {
  content: none;
}

.guide-hero {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 14px;
  max-width: 650px;
  overflow: visible;
  padding-right: 0;
}

.full-guide .guide-page:not(.guide-page-intro) .guide-hero {
  justify-self: end;
  max-width: 600px;
}

.guide-kicker,
.guide-map-kicker {
  margin: 0;
  width: fit-content;
  color: #4f2bff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.guide-kicker {
  padding: 8px 11px;
  border-radius: 999px;
  background: #efeaff;
}

.guide-hero h2 {
  margin: 0;
  color: #0b0a12;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 0.96;
  font-weight: 600;
  text-wrap: balance;
}

.guide-page-intro .guide-hero h2 {
  font-size: clamp(64px, 7vw, 96px);
  line-height: 0.92;
}

.full-guide .guide-page:not(.guide-page-intro) .guide-hero h2 {
  font-size: clamp(44px, 4.4vw, 60px);
  line-height: 0.98;
}

.guide-lede {
  max-width: 38ch;
  margin: 0;
  color: #0b0a12;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  line-height: 1.12;
  text-wrap: balance;
}

.guide-copy {
  display: grid;
  gap: 10px;
  max-width: 58ch;
  margin-top: 6px;
}

.guide-copy-line {
  opacity: 0;
  transform: translateY(8px);
  animation: guide-line-in 280ms cubic-bezier(0.2, 0, 0, 1) calc(60ms + var(--line-index, 0) * 45ms) both;
}

.guide-hero p {
  margin: 0;
  color: #6a667f;
  font-size: clamp(15px, 1vw, 16.5px);
  line-height: 1.5;
  text-wrap: pretty;
}

.full-guide .guide-close {
  width: 44px;
  height: 44px;
  top: 22px;
  right: 22px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dfd8ff, 0 10px 24px rgba(79, 43, 255, 0.12);
}

.guide-method {
  min-height: 0;
  width: 100%;
  align-self: center;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e5ddff;
  border-radius: 24px;
  background: #f7f4ff;
  box-shadow: none;
  overflow: visible;
}

.guide-intro-map {
  align-content: center;
  background:
    radial-gradient(circle at 90% 8%, rgba(255, 92, 138, 0.16), transparent 28%),
    #f7f4ff;
}

.guide-method .guide-visual {
  display: none;
}

.guide-step-list {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.guide-step-list button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 7px 8px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.guide-step-list li.active button {
  color: var(--ink);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #ded6ff, 0 10px 24px rgba(79, 43, 255, 0.08);
}

.guide-step-list li.done button {
  color: var(--accent);
}

.guide-step-list span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #6a667f;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e5ddff;
  font-size: 13px;
  font-weight: 600;
}

.guide-step-list li.active span {
  color: #fff;
  background: #4f2bff;
  box-shadow: none;
}

.guide-step-list li.done span {
  color: #4f2bff;
  background: #f0ebff;
  box-shadow: inset 0 0 0 1px #ded6ff;
}

.guide-step-list strong {
  min-width: 0;
  font-size: clamp(13px, 0.95vw, 14.5px);
  font-weight: 600;
  line-height: 1.18;
}

.guide-intro-steps {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.guide-intro-steps li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-areas:
    "num title"
    "num copy";
  gap: 4px 12px;
  align-items: center;
  min-height: 78px;
  padding: 13px 14px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #efeaff, 0 14px 30px rgba(79, 43, 255, 0.06);
}

.guide-intro-steps span {
  grid-area: num;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #4f2bff;
  font-size: 14px;
  font-weight: 600;
  background: #f0ebff;
  box-shadow: inset 0 0 0 1px #ded6ff;
}

.guide-intro-steps strong {
  grid-area: title;
  color: #0b0a12;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.05;
}

.guide-intro-steps em {
  grid-area: copy;
  color: #6a667f;
  font-size: 13.5px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}

.full-guide .guide-flow-control {
  align-self: end;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #eee8ff;
  animation: none;
}

.guide-visual::before,
.guide-visual::after,
.guide-visual span {
  animation: none !important;
}

.full-guide .guide-visual {
  display: none !important;
}

.full-guide .guide-visual::before {
  animation: none !important;
}

.full-guide .guide-visual::after {
  animation: none !important;
}

.full-guide .guide-visual span {
  animation: none !important;
}

.guide-closing .guide-page {
  animation: guide-zoom-out 260ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

.guide-backdrop.guide-closing {
  pointer-events: none;
}

.lesson-entering .stage {
  animation: lesson-enter-in 540ms cubic-bezier(0.2, 0, 0, 1) both;
}

.video-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.speed-select {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.speed-select select {
  min-height: 34px;
  padding: 0 30px 0 10px;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.speed-row {
  display: none !important;
}

.check-summary {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--accent-soft-2);
}

.check-summary-label {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.check-summary .meter {
  width: 100%;
  min-width: 120px;
  margin: 0;
}

.mini-task-progress {
  display: grid;
  grid-template-columns: auto minmax(92px, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--accent-soft-2);
}

.mini-task-progress span {
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mini-task-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.mini-task-progress .meter {
  grid-column: 1 / -1;
  margin: 0;
}

.task-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.task-title-row .mini-label {
  margin: 0;
}

.task-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.task-status.done {
  color: #047a4e;
  background: var(--success-soft);
}

.task-status.pending {
  color: var(--accent);
  background: var(--accent-soft);
}

.question-panel.is-complete,
.audio-panel.is-complete,
.exercise-panel.is-complete,
.speaking-panel.is-complete {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.18);
}

.question-panel.is-pending,
.audio-panel.is-pending,
.exercise-panel.is-pending,
.speaking-panel.is-pending {
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.1);
}

.needs-attention {
  animation: missing-task-pulse 1200ms cubic-bezier(0.2, 0, 0, 1) 2;
  outline: 3px solid rgba(79, 43, 255, 0.34);
  outline-offset: 4px;
}

.phase-item.locked {
  opacity: 0.72;
}

.phase-item.locked .phase-index {
  background: #efedf7;
}

.phase-next-wrap {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.primary-button.is-locked {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(79, 43, 255, 0.72), rgba(168, 85, 247, 0.72));
  box-shadow: none;
  cursor: pointer;
}

.primary-button.is-locked:hover {
  background: linear-gradient(90deg, rgba(79, 43, 255, 0.86), rgba(168, 85, 247, 0.86));
}

.phase-actions-hint {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.guidance-notice {
  border-color: #dfd8ff;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.question-list {
  display: grid;
  gap: 14px;
}

.focused-question-list {
  min-height: 0;
}

.focused-task-progress {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--accent-soft-2);
}

.focused-task-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.focused-task-progress-copy strong {
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.focused-task-progress-copy span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.focused-task-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.focused-task-dot {
  width: 100%;
  min-width: 32px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #e5e0f7;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease;
}

.focused-task-dot.done {
  background: linear-gradient(90deg, #4f2bff 0%, #ff5c8a 100%);
}

.focused-task-dot.current {
  box-shadow: 0 0 0 3px rgba(79, 43, 255, 0.16);
  transform: scaleY(1.35);
}

.focused-task-dot:active {
  transform: scale(0.96);
}

.focused-flow-actions {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(23, 8, 90, 0.14);
  backdrop-filter: blur(14px);
}

.focused-flow-actions .primary-button,
.focused-flow-actions .secondary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
}

.focused-flow-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.speech-target-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dfd8ff;
}

.speech-target-line {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.35;
  text-wrap: pretty;
}

.varied-question,
.varied-exercise {
  position: relative;
  overflow: hidden;
}

.question-aid,
.practice-aid {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

.blank-line {
  margin: 10px 0 14px;
  padding: 13px 15px;
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
  line-height: 1.45;
  text-wrap: pretty;
}

.option-list.blank-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-list.blank-choice-list .option-button {
  width: auto;
  min-width: 104px;
  border-radius: 999px;
  justify-content: center;
}

.reply-choice-list .option-button,
.sentence-choice-list .option-button {
  border-left: 4px solid #ded7ff;
  text-align: left;
  line-height: 1.45;
}

.match-choice-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.match-choice-list .option-button {
  min-height: 64px;
  align-items: center;
}

.meaning-choice-list .option-button {
  line-height: 1.45;
  text-wrap: pretty;
}

.did-you-know-section {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #ffffff 0%, #f4f0ff 100%);
  box-shadow: inset 0 0 0 1px #ded7ff;
}

.did-you-know-head,
.did-you-know-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.did-you-know-head span,
.did-you-know-links span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.did-you-know-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.did-you-know-item {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.did-you-know-item strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.did-you-know-item p {
  margin: 4px 0;
  color: var(--ink);
  line-height: 1.45;
  text-wrap: pretty;
}

.did-you-know-item em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.45;
}

.did-you-know-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.did-you-know-links p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.stage-complete-card {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-top: 16px;
  padding: 20px;
  border-radius: 22px;
  background: var(--accent-soft);
  box-shadow: 0 18px 48px rgba(79, 43, 255, 0.12);
  animation: reward-pop 260ms cubic-bezier(0.2, 0, 0, 1);
}

.stage-complete-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.stage-complete-card p {
  margin: 0;
  color: var(--muted);
}

.mimic-principle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.mimic-principle strong {
  color: var(--accent);
}

.mimic-principle span {
  color: var(--muted);
}

.mimic-panel .speak-card-top {
  grid-template-columns: minmax(0, 1fr);
}

.mimic-card-copy {
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
}

.mimic-card-copy .speak-instruction {
  max-width: 100%;
  margin: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.mimic-panel .speak-step-badge {
  width: 44px;
  height: 44px;
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 54%, #ff5c8a 100%);
}

.mimic-panel .speak-step-badge::before {
  content: none;
}

.mimic-panel h3 {
  margin-bottom: 4px;
}

.speech-coach.blind {
  padding: 0;
  border: 0;
  background: transparent;
}

.mic-recorder {
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.mic-button,
.stop-button {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 160ms ease, background 160ms ease;
}

.mic-button {
  color: var(--accent);
  border: 3px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    var(--progress-gradient) border-box;
  box-shadow: 0 16px 36px rgba(79, 43, 255, 0.18);
}

.stop-button {
  color: var(--accent);
  background: #f4f0ff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.1);
}

.mic-button:active,
.stop-button:active {
  transform: scale(0.96);
}

.mic-button:disabled,
.stop-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.mic-button span {
  width: 18px;
  height: 24px;
  position: relative;
  border: 3px solid currentColor;
  border-radius: 999px;
  background: transparent;
  filter: none;
}

.mic-button span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 16px;
  width: 26px;
  height: 16px;
  transform: translateX(-50%);
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 16px 16px;
}

.mic-button span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 34px;
  width: 16px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -8px 0 -1px currentColor;
}

.stop-button span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: currentColor;
}

.mic-recorder audio {
  flex: 1 1 260px;
  min-width: 220px;
}

.mimic-result {
  grid-template-columns: 1fr;
}

.simple-word-card {
  justify-items: center;
  gap: 12px;
  padding: 18px 18px 20px;
  text-align: center;
}

.simple-word-card .headword-row {
  justify-content: center;
}

.word-card-nudge {
  max-width: 32ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.deck-card .sound-row {
  width: 100%;
  max-width: 260px;
}

.vocab-review-backdrop {
  animation: study-backdrop-in 180ms ease-out;
}

.vocab-review-popup {
  animation: study-card-rise 260ms cubic-bezier(0.2, 0, 0, 1);
}

@keyframes guide-zoom-out {
  to {
    opacity: 0;
    transform: scale(0.94);
    filter: blur(3px);
  }
}

@keyframes lesson-enter-in {
  from {
    opacity: 0.4;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes study-card-rise {
  from {
    opacity: 0;
    transform: translateY(48px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes study-backdrop-in {
  from {
    background: rgba(23, 32, 51, 0);
  }
}

@keyframes missing-task-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.1), 0 0 0 rgba(79, 43, 255, 0);
  }
  45% {
    box-shadow: inset 0 0 0 2px rgba(79, 43, 255, 0.42), 0 18px 44px rgba(79, 43, 255, 0.2);
  }
}

@keyframes answer-card-pop {
  0% {
    transform: scale(0.992);
  }
  65% {
    transform: scale(1.006);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes correct-option-pop {
  0% {
    transform: scale(0.98);
  }
  70% {
    transform: scale(1.012);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrong-option-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(3px);
  }
}

@keyframes feedback-glow {
  0% {
    box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.2), 0 0 0 rgba(5, 161, 101, 0);
  }
  45% {
    box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.28), 0 0 0 8px rgba(5, 161, 101, 0.08);
  }
  100% {
    box-shadow: inset 0 0 0 1px rgba(5, 161, 101, 0.2), 0 16px 34px rgba(5, 161, 101, 0.12);
  }
}

@media (max-width: 940px) {
  .full-guide {
    padding: 14px;
  }

  .full-guide .guide-page {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-items: stretch;
    gap: 16px;
    align-content: start;
    width: min(720px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    padding: 66px 24px 24px;
  }

  .guide-hero {
    width: 100%;
    align-content: start;
  }

  .guide-method {
    width: 100%;
    align-self: start;
  }

  .guide-page-intro .guide-hero h2 {
    font-size: clamp(58px, 12vw, 84px);
  }

  .guide-lede {
    max-width: 24ch;
    font-size: clamp(24px, 5vw, 34px);
  }
}

@media (max-width: 640px) {
  .full-guide {
    padding: 0;
  }

  .full-guide .guide-page {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    padding: 66px 16px calc(112px + env(safe-area-inset-bottom));
  }

  .guide-hero h2 {
    font-size: 36px;
    line-height: 0.98;
  }

  .guide-page-intro .guide-hero h2 {
    font-size: clamp(54px, 18vw, 72px);
  }

  .guide-lede {
    max-width: 18ch;
    font-size: clamp(23px, 7vw, 30px);
    line-height: 1.06;
  }

  .guide-hero p {
    font-size: 14px;
    line-height: 1.42;
  }

  .full-guide .guide-flow-control {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    width: min(356px, calc(100vw - 24px));
    grid-template-columns: 44px minmax(0, 1fr);
    margin-top: 0;
    padding: 10px;
    border: 0;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 46px rgba(79, 43, 255, 0.16);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
  }

  .guide-pips {
    justify-content: flex-end;
  }

  .guide-pips button {
    width: 24px;
    height: 36px;
    min-height: 36px;
  }

  .guide-pips button.active {
    width: 38px;
  }

  .guide-pips button::after {
    width: 8px;
    height: 8px;
  }

  .guide-pips button.active::after {
    width: 28px;
  }

  .guide-main-button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
  }

  .guide-method {
    max-height: none;
    overflow: visible;
    padding: 14px;
    border-radius: 20px;
  }

  .guide-page:not(.guide-page-intro) .guide-method {
    display: none;
  }

  .guide-intro-steps {
    gap: 8px;
  }

  .guide-intro-steps li {
    min-height: 68px;
    padding: 11px;
  }

  .guide-intro-steps strong {
    font-size: 16px;
  }

  .guide-intro-steps em {
    font-size: 12.5px;
  }

  .guide-step-list button {
    min-height: 52px;
    border-radius: 14px;
  }

  .video-toolbar {
    justify-content: stretch;
  }

  .watch-video-cta {
    align-items: stretch;
    padding: 10px;
  }

  .watch-video-cta div {
    justify-content: center;
  }

  .watch-video-cta span {
    display: none;
  }

  .watch-video-cta .primary-button {
    min-width: 132px;
  }

  .speed-select {
    width: 100%;
    justify-content: space-between;
    border-radius: 16px;
  }

  .check-summary {
    grid-template-columns: auto minmax(72px, 1fr);
  }

  .check-summary .meter {
    width: 100%;
    min-width: 0;
  }

  .match-choice-list {
    grid-template-columns: 1fr;
  }

  .focused-task-progress {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .focused-task-progress-copy strong {
    font-size: 18px;
  }

  .focused-task-progress-copy span {
    max-width: 62%;
    font-size: 12px;
  }

  .focused-task-dots {
    gap: 6px;
  }

  .focused-task-dot {
    min-width: 0;
    height: 7px;
  }

  .focused-question-list {
    padding-bottom: 76px;
  }

  .focused-flow-actions {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    margin: 14px -4px 0;
    padding: 8px;
    border-radius: 18px;
  }

  .focused-flow-actions.is-awaiting-answer {
    position: static;
    margin: 12px 0 0;
    box-shadow: none;
    background: var(--accent-soft-2);
    backdrop-filter: none;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 46px;
    padding-inline: 10px;
    font-size: 14px;
  }

  .question-panel h3,
  .exercise-panel h3 {
    font-size: 17px;
    line-height: 1.22;
  }

  .option-button {
    padding: 10px 12px;
    line-height: 1.35;
  }

  .reply-choice-list .option-button,
  .sentence-choice-list .option-button,
  .meaning-choice-list .option-button {
    font-size: 14px;
  }

  .option-list.blank-choice-list .option-button {
    flex: 1 1 128px;
    min-width: 0;
  }

  .did-you-know-head,
  .did-you-know-links {
    align-items: flex-start;
    flex-direction: column;
  }

  .sound-cue {
    align-items: flex-start;
    padding: 12px;
  }

  .sound-cue-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 13px;
  }

  .mic-recorder {
    justify-content: center;
    width: 100%;
  }

  .mic-recorder audio {
    flex-basis: 100%;
    min-width: 0;
  }

  .speak-panel,
  .mimic-panel,
  .mimic-panel .speak-card-top,
  .mimic-card-copy,
  .speech-coach {
    min-width: 0;
    width: 100%;
  }

  .mimic-card-copy .speak-instruction,
  .speech-coach-head p:last-child {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .speech-target-card {
    padding: 12px;
    border-radius: 16px;
  }

  .speech-target-line {
    font-size: 17px;
  }

  .task-title-row {
    align-items: flex-start;
    gap: 8px;
  }

  .task-status {
    min-height: 26px;
    padding: 0 9px;
    font-size: 11px;
  }

  .mini-task-progress {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px 12px;
  }

  .mini-task-progress span {
    font-size: 20px;
  }

  .phase-next-wrap,
  .phase-actions-hint {
    width: 100%;
    justify-items: stretch;
    text-align: center;
  }

  .answer-toast {
    top: 104px;
    right: 14px;
    left: 14px;
    width: auto;
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 10px 12px;
    border-radius: 16px;
  }

  .answer-toast-icon {
    width: 30px;
    height: 30px;
  }

  .answer-toast strong {
    font-size: 14px;
  }

  .answer-toast small {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .question-panel.is-correct,
  .exercise-panel.is-correct,
  .feedback.good.reward-feedback,
  .option-button.correct,
  .option-button.incorrect,
  .needs-attention {
    animation: none;
  }

  .answer-toast {
    transition-duration: 1ms;
  }
}

/* Final mobile fit overrides: keep each task screen deck-like after all legacy blocks. */
@media (max-width: 640px) {
  .lesson-layout {
    padding: 8px 10px max(18px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  #lesson-stage {
    padding: 12px;
  }

  .stage-header {
    gap: 8px;
    margin-bottom: 10px;
  }

  .stage-kicker-row {
    margin-bottom: 4px;
  }

  .stage-header h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 7vw, 31px);
    line-height: 1.02;
  }

  .stage-header p,
  .question-aid,
  .practice-aid {
    display: none;
  }

  .watch-video-frame video {
    max-height: min(42dvh, 330px);
    object-fit: contain;
  }

  .watch-video-cta {
    gap: 8px;
    padding: 9px;
  }

  .watch-video-cta .primary-button {
    min-width: 108px;
    min-height: 42px;
    padding-inline: 10px;
  }

  .focused-task-progress {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px 9px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .focused-task-progress-copy {
    display: contents;
  }

  .focused-task-progress-copy strong {
    font-size: 18px;
  }

  .focused-task-progress-copy span {
    max-width: none;
    font-size: 11px;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
  }

  .focused-task-dots {
    grid-column: 1 / -1;
    gap: 5px;
  }

  .focused-task-dot {
    height: 7px;
    min-width: 0;
  }

  .focused-question-list {
    padding-bottom: 0;
  }

  .question-panel,
  .exercise-panel {
    margin-bottom: 0;
    padding: 12px;
    border-radius: 16px;
  }

  .question-panel h3,
  .exercise-panel h3 {
    margin-bottom: 8px;
    font-size: clamp(18px, 5.3vw, 22px);
    line-height: 1.18;
  }

  .option-list,
  .match-choice-list {
    gap: 7px;
    margin-top: 9px;
  }

  .option-button {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 14px;
    line-height: 1.28;
  }

  .reward-feedback {
    min-height: 0;
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    gap: 8px;
    font-size: 14px;
    line-height: 1.35;
  }

  .feedback-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    font-size: 13px;
  }

  .reward-chip {
    min-height: 24px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    position: static;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 44px;
    border-radius: 14px;
  }

  .answer-toast {
    display: none !important;
  }
}

@media (max-width: 390px), (max-height: 740px) and (max-width: 640px) {
  #lesson-stage {
    padding: 10px;
  }

  .focused-task-progress {
    gap: 5px 8px;
    margin-bottom: 8px;
    padding: 6px 9px;
  }

  .focused-task-dot {
    height: 6px;
  }

  .question-panel,
  .exercise-panel {
    padding: 10px;
  }

  .question-panel h3,
  .exercise-panel h3 {
    font-size: 18px;
  }

  .option-button {
    min-height: 42px;
    padding: 8px 9px;
    font-size: 13.5px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    margin-top: 6px;
  }
}

/* 2026-08 mobile lesson QA pass: one task at a time, stable thumb controls, safer vocab visuals. */
html,
body {
  overflow-x: hidden;
}

.lesson-layout,
.stage,
#lesson-stage,
.question-panel,
.exercise-panel,
.prompt-panel,
.audio-panel,
.vocab-card {
  min-width: 0;
}

.lesson-layout {
  align-items: start;
}

.stage {
  overflow: visible;
}

.primary-button,
.secondary-button,
.ghost-button,
.ghost-mini,
.option-button,
.sound-button,
.quick-guide-button {
  transition-property: transform, background, color, box-shadow, border-color, opacity;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.sound-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sound-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.16), 0 8px 22px rgba(79, 43, 255, 0.08);
  font-weight: 600;
  cursor: pointer;
}

.sound-button:active {
  transform: scale(0.96);
}

.sound-button .sound-wave {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 20px;
  background: url("icons/sound-on.png") center / contain no-repeat;
}

.vocab-concept {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 0;
  position: relative;
  color: var(--accent);
  background:
    linear-gradient(180deg, #ffffff 0 70%, #f0ecff 70% 100%),
    var(--accent-soft-2);
}

.vocab-concept .concept-stage {
  width: min(78%, 300px);
  height: 135px;
  position: relative;
  display: block;
}

.vocab-concept > strong {
  align-self: stretch;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--accent-dark);
  background: rgba(237, 233, 255, 0.88);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.concept-table {
  position: absolute;
  left: 21%;
  right: 8%;
  bottom: 6px;
  height: 44px;
  border-radius: 999px 999px 24px 24px;
  background: #dff8f0;
  box-shadow: inset 0 -5px 0 rgba(5, 161, 101, 0.2);
}

.concept-person {
  position: absolute;
  bottom: 38px;
  width: 72px;
  height: 92px;
}

.concept-person::before,
.concept-person::after {
  content: "";
  position: absolute;
  left: 50%;
  translate: -50% 0;
}

.concept-person::before {
  top: 0;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #ffd9a3;
  box-shadow: inset 0 14px 0 #151a2f;
}

.concept-person::after {
  bottom: 0;
  width: 72px;
  height: 56px;
  border-radius: 28px 28px 8px 8px;
  background: #4f2bff;
}

.concept-person.left {
  left: 36%;
}

.concept-person.right {
  right: 4%;
}

.concept-person.right::before {
  box-shadow: inset 0 12px 0 #bc7a16;
}

.concept-person.right::after {
  background: #08796d;
}

.concept-question {
  position: absolute;
  top: 10px;
  right: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 4px solid #bc7a16;
  border-radius: 999px;
  color: #bc7a16;
  background: #fff3c4;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.concept-road {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 32px;
  height: 18px;
  border-radius: 999px;
  background: #2f65ad;
  transform: rotate(-5deg);
}

.concept-hump {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 40px;
  height: 82px;
  border: 12px solid #bc7a16;
  border-bottom: 0;
  border-radius: 130px 130px 0 0;
}

.concept-label {
  position: absolute;
  left: 50%;
  bottom: 78px;
  translate: -50% 0;
  padding: 8px 10px;
  border-radius: 999px;
  color: #0b0a12;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(11, 10, 18, 0.08);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.vocab-concept-sex-context {
  background:
    linear-gradient(180deg, #ffffff 0 70%, #fff2f5 70% 100%),
    #ffffff;
}

.concept-card {
  position: absolute;
  min-width: 112px;
  display: grid;
  place-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  color: #5f2242;
  background: #fff2f5;
  box-shadow: inset 0 0 0 1px #ffd0dc, 0 14px 34px rgba(255, 92, 138, 0.12);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.concept-card.large {
  top: 8px;
  left: 50%;
  min-width: 138px;
  min-height: 78px;
  translate: -50% 0;
  color: #ffffff;
  background: linear-gradient(90deg, #4f2bff, #ff5c8a);
}

.concept-card:not(.large):nth-child(2) {
  left: 5%;
  bottom: 20px;
}

.concept-card:not(.large):nth-child(3) {
  right: 5%;
  bottom: 20px;
}

.vocab-image img {
  object-position: center;
}

.review-video {
  max-width: 100%;
  margin-bottom: 14px;
}

.review-video video {
  width: 100%;
}

.review-grid {
  grid-template-columns: 1fr;
}

.subtitle-panel {
  max-height: none;
  overflow: visible;
}

.focused-question-list {
  min-height: 0;
}

.answer-toast {
  pointer-events: none;
}

@media (min-width: 941px) {
  .lesson-layout {
    max-width: min(1080px, calc(100vw - 88px));
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 20px;
    padding-top: 20px;
  }

  .rail {
    top: 102px;
    max-height: calc(100dvh - 118px);
    padding: 18px;
  }

  .phase-item {
    min-height: 46px;
    padding: 7px 9px;
  }

  .phase-index {
    width: 28px;
    height: 28px;
  }

  .rail h1 {
    font-size: 21px;
  }

  #lesson-stage {
    padding: 24px 30px 28px;
  }

  .stage-header {
    margin-bottom: 14px;
  }

  .stage-header h2 {
    font-size: clamp(30px, 2.25vw, 38px);
  }

  .watch-video-frame video {
    max-height: min(46dvh, 430px);
    object-fit: contain;
  }

  .vocab-card-shell {
    max-width: 390px;
  }
}

@media (min-width: 941px) and (max-height: 820px) {
  .watch-video-frame video {
    max-height: calc(100dvh - 350px);
    min-height: 220px;
  }

  #lesson-stage {
    padding: 20px 26px 22px;
  }

  .focused-task-progress {
    margin-bottom: 10px;
    padding: 12px 14px;
  }

  .question-panel,
  .exercise-panel {
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
  }

  .choice-list,
  .multiple-choice-list,
  .fill-blank-choice-list,
  .true-false-list {
    gap: 8px;
  }

  .option-button {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
  }

  .feedback.reward-feedback {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .focused-flow-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
    margin-top: 8px;
    padding: 8px;
    border-radius: 18px;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 42px;
    border-radius: 14px;
  }
}

@media (max-width: 640px) {
  body {
    background: #ffffff;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .topbar {
    min-height: 0;
    padding: 8px 12px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand guide"
      "menu menu";
    gap: 7px 10px;
    align-items: center;
  }

  .brand {
    grid-area: brand;
    font-size: 17px;
  }

  .brand::before {
    width: 27px;
    height: 27px;
    margin-right: 8px;
    border-radius: 8px;
    background:
      linear-gradient(#ffffff, #ffffff) 7px 9px / 2px 9px no-repeat,
      linear-gradient(#ffffff, #ffffff) 12px 5px / 2px 17px no-repeat,
      linear-gradient(#ffffff, #ffffff) 17px 8px / 2px 11px no-repeat,
      linear-gradient(#ffffff, #ffffff) 22px 11px / 2px 6px no-repeat,
      var(--accent);
  }

  .lesson-meta {
    grid-area: guide;
  }

  .quick-guide-button {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 12px;
  }

  .lesson-menu {
    grid-area: menu;
    width: 100%;
  }

  .lesson-menu summary {
    width: 100%;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: none;
  }

  .lesson-menu-popover {
    top: calc(100% + 6px);
  }

  .progress-track {
    top: 100px;
    height: 6px;
  }

  .lesson-layout {
    width: 100%;
    max-width: 390px;
    padding: 8px 8px calc(82px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .stage {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 14px 34px rgba(79, 43, 255, 0.08);
  }

  #lesson-stage {
    min-height: calc(100dvh - 126px);
    padding: 12px;
  }

  .stage-header {
    margin-bottom: 9px;
  }

  .stage-kicker-row {
    gap: 7px;
  }

  .badge {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .phase-sound-hint {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.2), 0 8px 18px rgba(79, 43, 255, 0.12);
  }

  .sound-on-icon {
    width: 28px;
    height: 28px;
  }

  .sound-on-wave {
    stroke-width: 7.4;
  }

  .stage-header h2 {
    font-size: clamp(25px, 8vw, 33px);
    line-height: 1.02;
  }

  .stage-header p {
    display: none;
  }

  .level-notice,
  .guidance-notice {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.35;
  }

  .watch-video-frame {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
  }

  .watch-video-frame video {
    max-height: calc(100dvh - 260px);
    min-height: 164px;
    object-fit: contain;
  }

  .watch-video-cta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px;
    border-radius: 0;
    background: rgba(24, 12, 72, 0.94);
    color: #ffffff;
  }

  .watch-video-cta strong,
  .watch-video-cta span {
    color: #ffffff;
  }

  .watch-video-cta .primary-button {
    min-height: 42px;
    border-radius: 14px;
    background: #ffffff;
    color: var(--accent);
    box-shadow: none;
  }

  .video-toolbar {
    margin-top: 8px;
  }

  .speed-select {
    min-height: 42px;
  }

  .mimic-principle {
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 14px;
    gap: 4px 8px;
  }

  .mimic-principle span {
    font-size: 12.5px;
    line-height: 1.35;
  }

  .focused-task-progress {
    grid-template-columns: auto minmax(0, 1fr);
    margin: 0 0 8px;
    padding: 9px 10px;
  }

  .focused-task-progress-copy strong {
    font-size: 20px;
    line-height: 1;
  }

  .focused-task-progress-copy span {
    font-size: 12px;
    line-height: 1.05;
  }

  .focused-question-list {
    padding-bottom: 78px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    position: fixed !important;
    left: 50%;
    right: auto;
    bottom: max(9px, env(safe-area-inset-bottom));
    z-index: 55;
    width: min(374px, calc(100vw - 20px));
    display: grid;
    grid-template-columns: minmax(78px, 0.7fr) minmax(0, 1.3fr);
    gap: 8px;
    margin: 0;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 46px rgba(23, 8, 90, 0.18);
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 44px;
    border-radius: 14px;
    padding: 0 10px;
    font-size: 14px;
  }

  .focused-flow-hint {
    display: none;
  }

  .question-panel,
  .exercise-panel {
    min-height: min(490px, calc(100dvh - 220px));
    display: flex;
    flex-direction: column;
    padding: 12px;
  }

  .option-list {
    gap: 7px;
  }

  .option-button {
    min-height: 43px;
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 13.5px;
  }

  .feedback.reward-feedback {
    margin-top: auto;
    padding: 10px;
    font-size: 13.5px;
    line-height: 1.35;
  }

  .answer-toast {
    top: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    right: auto !important;
    width: min(344px, calc(100vw - 28px)) !important;
    display: grid !important;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    padding: 10px 12px;
    border-radius: 16px;
    transform: translate(-50%, 10px) scale(0.98);
  }

  .answer-toast.show {
    transform: translate(-50%, 0) scale(1);
  }

  .answer-toast-icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .answer-toast strong {
    font-size: 14px;
  }

  .answer-toast small {
    font-size: 11.5px;
  }

  .speak-panel,
  .mimic-panel {
    padding: 12px;
    border-radius: 18px;
  }

  .mimic-card-copy .speak-instruction {
    font-size: 13px;
    line-height: 1.35;
  }

  .listen-player audio {
    width: 100%;
    min-width: 0;
  }

  .mic-button,
  .stop-button {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .compare-strip.is-action-only {
    justify-content: stretch;
  }

  .compare-strip.is-action-only .compact-button {
    width: 100%;
    min-width: 0;
  }

  .speech-result,
  .speech-feedback-grid {
    gap: 8px;
  }

  .speaking-feedback-summary,
  .speaking-feedback-details {
    grid-template-columns: 1fr;
  }

  .speaking-feedback-summary {
    gap: 10px;
    padding: 12px;
  }

  .coach-section {
    padding: 11px;
    border-radius: 14px;
  }

  .vocab-deck {
    gap: 8px;
  }

  .vocab-deck-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
  }

  .vocab-deck-top .mini-label {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .vocab-deck-top h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.1;
  }

  .vocab-score {
    justify-content: end;
    gap: 4px;
  }

  .vocab-score span {
    display: none;
  }

  .vocab-score strong {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  .deck-meter {
    height: 6px;
    margin: 2px 0 1px;
  }

  .vocab-sort-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    align-items: stretch;
  }

  .vocab-card-shell {
    grid-column: 1 / -1;
    grid-row: 1;
    width: calc(100% - 20px);
    max-width: 100%;
  }

  .vocab-sort-button {
    position: relative;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .vocab-sort-button span {
    font-size: 14px;
    line-height: 1;
  }

  .vocab-sort-button small {
    display: none;
  }

  .sort-known {
    grid-column: 1;
    grid-row: 2;
  }

  .sort-new {
    grid-column: 2;
    grid-row: 2;
  }

  .vocab-card.deck-card {
    border-radius: 18px;
    box-shadow: 0 14px 38px rgba(79, 43, 255, 0.14);
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: clamp(138px, 24dvh, 178px);
    min-height: 0;
    border-radius: 18px 18px 0 0;
  }

  .deck-card .vocab-image img {
    aspect-ratio: auto;
    max-height: none;
    object-fit: cover;
  }

  .deck-card .vocab-concept .concept-stage {
    height: 96px;
  }

  .deck-card .vocab-concept > strong {
    padding: 8px;
    font-size: 17px;
  }

  .deck-card-body,
  .simple-word-card {
    gap: 7px;
    padding: 10px 12px 12px;
  }

  .simple-word-card .mini-label {
    font-size: 11px;
  }

  .deck-card .headword {
    font-size: clamp(20px, 6vw, 25px);
    line-height: 1.08;
  }

  .pos {
    font-size: 12px;
  }

  .sound-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .sound-button {
    min-height: 44px;
    border-radius: 12px;
  }

  .word-card-nudge {
    display: none;
  }

  .vocab-nav-row {
    gap: 6px;
    margin-top: 1px;
  }

  .vocab-dots {
    gap: 5px;
  }

  .vocab-dots button {
    width: 8px;
    height: 8px;
  }

  .vocab-dots button.active {
    width: 22px;
  }

  .ghost-mini {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 13px;
  }

  .vocab-review-backdrop {
    align-items: stretch;
    padding: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vocab-review-popup {
    align-self: center;
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .vocab-review-scroll {
    max-height: calc(100dvh - 92px);
    padding: 12px;
  }

  .review-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-card-side {
    flex-basis: auto;
  }

  .review-card .vocab-image,
  .review-card .vocab-image img,
  .review-card .vocab-concept {
    max-height: 210px;
  }

  .definition-hero {
    padding: 12px;
    border-radius: 16px;
  }

  .definition-pattern {
    font-size: 17px;
  }

  .definition-copy {
    font-size: clamp(20px, 6.4vw, 28px);
    line-height: 1.28;
  }

  .word-section-grid.expanded {
    grid-template-columns: 1fr;
  }

  .vocab-review-actions {
    gap: 8px;
    padding: 10px 12px;
  }

  .vocab-review-actions .primary-button {
    min-height: 46px;
    border-radius: 14px;
  }

  .grammar-spotlight,
  .grammar-use-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .grammar-image img {
    max-height: 132px;
    object-fit: contain;
  }

  .grammar-copy h3 {
    font-size: 21px;
  }

  .pattern-strip {
    gap: 6px;
  }

  .pattern-strip span {
    font-size: 12px;
  }

  .writing-coach-card .text-area {
    min-height: 94px;
  }

  .prompt-panel.speaking-panel {
    min-height: auto;
  }

  .speaking-hero-row {
    gap: 10px;
  }

  .speaking-hero-row h3 {
    font-size: 20px;
    line-height: 1.2;
  }

  .ai-coach-banner {
    padding: 12px;
    border-radius: 16px;
  }

  .voice-answer-coach {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .voice-answer-coach .ai-coach-icon {
    width: 40px;
    height: 40px;
  }

  .voice-answer-coach strong {
    font-size: 15px;
  }

  .ai-coach-banner p {
    font-size: 13px;
    line-height: 1.38;
  }

  .review-section {
    margin-top: 4px;
    padding: 12px;
    border-radius: 18px;
  }

  .review-video {
    margin-bottom: 10px;
  }

  .review-heading {
    margin-bottom: 10px;
  }

  .review-heading h3 {
    font-size: 20px;
  }

  .subtitle-line {
    grid-template-columns: 46px 1fr;
    gap: 8px;
    min-height: 44px;
    padding: 9px;
    border-radius: 14px;
    font-size: 14px;
  }

  .next-lesson-panel {
    margin-top: 12px;
    padding: 16px;
    border-radius: 18px;
  }

  .rail {
    position: relative;
    top: auto;
    max-height: none;
    padding: 16px;
  }

  .rail-heading {
    margin-bottom: 12px;
  }

  .phase-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .phase-item {
    min-height: 54px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .phase-name {
    font-size: 13px;
    line-height: 1.1;
  }

  .phase-mission {
    font-size: 11px;
    line-height: 1.2;
  }
}

@media (max-width: 390px) {
  .lesson-layout {
    max-width: 370px;
    padding-inline: 6px;
  }

  #lesson-stage {
    padding: 10px;
  }

  .watch-video-frame video {
    max-height: calc(100dvh - 246px);
    min-height: 150px;
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: clamp(126px, 21dvh, 158px);
  }

  .deck-card .vocab-concept .concept-stage {
    height: 82px;
  }

  .question-panel,
  .exercise-panel {
    padding: 10px;
  }

  .option-button {
    min-height: 40px;
    font-size: 13px;
  }
}

/* 2026-08-28 production mobile-flow polish: focused screens, stable thumbs, semantic media. */
:root {
  --mobile-topbar-height: 106px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 58;
}

.progress-track {
  background: #eeeaff;
}

#progress-bar {
  background: linear-gradient(90deg, #4f2bff 0%, #7c3cff 52%, #ff5c8a 100%);
}

.option-button.correct,
.question-panel.is-correct,
.exercise-panel.is-correct {
  animation: correct-pop 220ms cubic-bezier(0.2, 0, 0, 1);
}

.option-button.incorrect,
.question-panel.is-incorrect,
.exercise-panel.is-incorrect {
  animation: wrong-option-nudge 180ms cubic-bezier(0.2, 0, 0, 1);
}

@media (min-width: 941px) {
  .lesson-layout {
    max-width: min(1040px, calc(100vw - 96px));
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    padding-top: 18px;
  }

  .rail {
    padding: 18px;
  }

  .phase-list {
    gap: 5px;
  }

  .phase-item {
    min-height: 44px;
    padding: 6px 8px;
  }

  .stage {
    max-width: 780px;
  }

  #lesson-stage {
    padding: 24px 30px;
  }

  .stage-header {
    margin-bottom: 12px;
  }

  .stage-header h2 {
    font-size: clamp(28px, 2.1vw, 36px);
    line-height: 1;
  }

  .stage-header p {
    font-size: 15px;
    line-height: 1.45;
  }

  .watch-video-frame video {
    max-height: min(43dvh, 390px);
  }

  .video-toolbar {
    margin-top: 10px;
  }
}

@media (min-width: 941px) and (max-height: 760px) {
  .topbar {
    min-height: 62px;
    height: 62px;
  }

  .progress-track {
    top: 62px;
    height: 7px;
  }

  .lesson-layout {
    padding-top: 12px;
  }

  .rail {
    top: 82px;
    max-height: calc(100dvh - 94px);
  }

  .watch-video-frame video {
    max-height: calc(100dvh - 300px);
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    min-height: var(--mobile-topbar-height);
    height: auto;
    padding: 9px 12px 10px;
    box-shadow: 0 10px 28px rgba(79, 43, 255, 0.06);
  }

  .lesson-menu summary {
    min-height: 36px;
    border-radius: 13px;
  }

  .progress-track {
    position: fixed;
    top: var(--mobile-topbar-height);
    z-index: 57;
    height: 5px;
    box-shadow: none;
  }

  .lesson-layout {
    max-width: 390px;
    min-height: calc(100dvh - var(--mobile-topbar-height));
    padding: 8px 10px calc(78px + env(safe-area-inset-bottom));
  }

  .rail {
    display: block;
    order: 2;
    width: 100%;
    margin-top: 14px;
    padding: 16px;
    border-radius: 22px;
    background: var(--accent-soft-2);
  }

  .rail-heading {
    margin-bottom: 12px;
  }

  .rail-heading .eyebrow {
    font-size: 12px;
  }

  .rail-heading h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .phase-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .phase-item {
    min-height: 50px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
  }

  .phase-item.current {
    background: #ffffff;
  }

  .phase-name {
    font-size: 14px;
  }

  .phase-mission {
    font-size: 12px;
  }

  #reset-progress {
    width: 100%;
    min-height: 46px;
    border-radius: 16px;
    background: #ffffff;
  }

  .stage {
    border-radius: 0;
    box-shadow: none;
  }

  #lesson-stage {
    min-height: auto;
    padding: 10px 2px calc(84px + env(safe-area-inset-bottom));
  }

  .stage-header {
    margin-bottom: 8px;
  }

  .badge {
    min-height: 28px;
    padding: 0 10px;
  }

  .phase-sound-hint {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .sound-on-icon {
    width: 29px;
    height: 29px;
    transform: translateX(1px);
  }

  .stage-header h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 7.2vw, 30px);
  }

  .level-notice,
  .guidance-notice {
    margin-bottom: 8px;
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.3;
  }

  .watch-video-frame {
    border-radius: 18px;
  }

  .watch-video-frame video {
    width: 100%;
    max-height: calc(100dvh - 238px);
    min-height: 168px;
  }

  .watch-video-cta {
    min-height: 62px;
  }

  .watch-video-cta div {
    gap: 0;
  }

  .watch-video-cta strong {
    font-size: 14px;
  }

  .watch-video-cta span {
    font-size: 11.5px;
    line-height: 1.25;
  }

  .watch-video-cta .primary-button {
    min-width: 104px;
  }

  .video-toolbar {
    margin-top: 8px;
  }

  .speed-select {
    min-height: 38px;
    justify-content: space-between;
  }

  .mimic-principle {
    display: block;
    margin-bottom: 8px;
    padding: 9px 10px;
  }

  .mimic-principle strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
  }

  .mimic-principle span {
    display: block;
    font-size: 11.8px;
    line-height: 1.28;
  }

  .focused-task-progress {
    min-height: 44px;
    margin-bottom: 8px;
    padding: 7px 9px;
    border-radius: 15px;
  }

  .focused-task-progress-copy strong {
    font-size: 20px;
  }

  .focused-task-progress-copy span {
    font-size: 11.5px;
  }

  .focused-task-dots {
    gap: 5px;
  }

  .focused-task-dot {
    height: 6px;
  }

  .question-list,
  .speak-stack {
    gap: 8px;
  }

  .focused-question-list {
    padding-bottom: 74px;
  }

  .question-panel,
  .exercise-panel,
  .audio-panel,
  .prompt-panel {
    padding: 11px;
    border-radius: 18px;
  }

  .question-panel,
  .exercise-panel {
    min-height: min(430px, calc(100dvh - 250px));
    max-height: calc(100dvh - 188px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .question-panel h3,
  .exercise-panel h3,
  .audio-panel h3,
  .prompt-panel h3 {
    font-size: 17px;
    line-height: 1.18;
  }

  .question-aid,
  .blank-line,
  .practice-aid {
    margin: 4px 0 8px;
    font-size: 12.2px;
    line-height: 1.3;
  }

  .option-list,
  .choice-grid,
  .chunk-grid {
    gap: 7px;
  }

  .option-button {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.22;
  }

  .feedback.reward-feedback {
    margin-top: 8px;
    padding: 10px;
    font-size: 12.5px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(372px, calc(100vw - 18px));
    padding: 7px;
    border-radius: 18px;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    min-height: 44px;
    border-radius: 14px;
    font-size: 13px;
  }

  .phase-actions {
    position: static;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(82px, 0.7fr) minmax(0, 1.3fr);
    gap: 8px;
    margin: 16px 0 0;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(25, 16, 68, 0.08);
    transform: none;
    backdrop-filter: none;
  }

  .phase-actions > .secondary-button,
  .phase-actions .primary-button {
    min-height: 44px;
    border-radius: 14px;
    font-size: 13px;
  }

  .phase-actions .phase-next-wrap {
    display: grid;
  }

  .phase-actions-hint {
    display: none;
  }

  .vocab-complete-card {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 55;
    width: min(372px, calc(100vw - 18px));
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    margin: 0;
    padding: 9px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 46px rgba(23, 8, 90, 0.18);
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
  }

  .vocab-complete-card .reward-chip {
    display: none;
  }

  .vocab-complete-card strong {
    font-size: 13px;
    line-height: 1.2;
  }

  .vocab-complete-card p {
    display: none;
  }

  .vocab-complete-card .primary-button {
    min-height: 44px;
    border-radius: 14px;
    white-space: nowrap;
  }

  .answer-toast {
    display: grid !important;
    top: auto !important;
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    max-height: 64px;
    overflow: hidden;
  }

  .answer-toast small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mimic-panel {
    max-height: calc(100dvh - 256px);
    overflow-y: auto;
  }

  .mimic-panel .speak-card-top {
    margin-bottom: 8px;
  }

  .mimic-panel h3 {
    font-size: 17px;
  }

  .mimic-card-copy .speak-instruction {
    font-size: 12px;
  }

  .listen-player {
    padding: 8px;
    border-radius: 16px;
  }

  .recorder.voice-recorder {
    gap: 10px;
    margin-top: 8px;
  }

  .mic-button,
  .stop-button {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .speech-target-card {
    padding: 10px;
    gap: 8px;
  }

  .speech-target-line {
    font-size: 14px;
    line-height: 1.25;
  }

  .waveform-shell {
    min-height: 58px;
    margin-top: 8px;
  }

  .compare-strip {
    padding: 0;
  }

  .vocab-deck {
    gap: 6px;
  }

  .vocab-deck-top h3 {
    font-size: 19px;
  }

  .vocab-score strong {
    min-height: 22px;
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: clamp(118px, 21dvh, 154px);
  }

  .deck-card-body,
  .simple-word-card {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .deck-card .headword {
    font-size: clamp(19px, 5.7vw, 23px);
  }

  .headword-row {
    gap: 7px;
  }

  .sound-button {
    min-height: 44px;
  }

  .vocab-sort-layout {
    gap: 6px;
  }

  .vocab-sort-button {
    min-height: 42px;
  }

  .vocab-nav-row {
    margin-top: 0;
  }

  .ghost-mini {
    min-height: 34px;
  }

  .vocab-review-popup {
    width: min(520px, calc(100vw - 18px));
    max-height: calc(100dvh - 18px);
  }

  .vocab-review-scroll {
    max-height: calc(100dvh - 86px);
    padding: 10px;
  }

  .review-card .vocab-image,
  .review-card .vocab-image img,
  .review-card .vocab-concept {
    max-height: 154px;
  }

  .review-word-panel {
    padding: 12px;
  }

  .definition-hero {
    padding: 11px;
  }

  .definition-copy {
    font-size: clamp(18px, 5.8vw, 24px);
    line-height: 1.25;
  }

  .word-section-grid.expanded {
    gap: 8px;
  }

  .word-section {
    padding: 10px;
  }

  .grammar-spotlight {
    padding: 10px;
    gap: 8px;
  }

  .grammar-image {
    display: none;
  }

  .grammar-copy h3 {
    font-size: 18px;
  }

  .grammar-use-grid,
  .pattern-strip {
    display: none;
  }

  .writing-coach-card .text-area,
  .text-area {
    min-height: 84px;
  }

  .prompt-panel.speaking-panel {
    max-height: calc(100dvh - 178px);
    overflow-y: auto;
  }

  .speaking-hero-row h3 {
    font-size: 18px;
  }

  .ai-coach-banner {
    padding: 10px;
    border-radius: 15px;
  }

  .voice-answer-coach {
    padding: 10px;
    border-radius: 15px;
  }

  .review-section {
    padding: 10px;
  }

  .review-video video {
    max-height: 220px;
    object-fit: contain;
  }

  .review-note {
    font-size: 12px;
  }

  .subtitle-line {
    grid-template-columns: 40px 1fr;
    min-height: 40px;
    padding: 8px;
    font-size: 13px;
    line-height: 1.32;
  }

  .next-lesson-panel {
    padding: 14px;
  }

  .full-guide .guide-page {
    overflow-y: auto;
    padding: 66px 16px calc(112px + env(safe-area-inset-bottom));
    align-items: start;
    justify-content: flex-start;
  }

  .full-guide .guide-page-intro {
    justify-content: flex-start;
  }

  .guide-hero {
    width: 100%;
    max-height: none;
    overflow: visible;
    align-content: start;
    gap: 10px;
    padding-right: 0;
  }

  .guide-hero h2 {
    font-size: clamp(32px, 9vw, 40px);
    line-height: 0.98;
  }

  .guide-page-intro .guide-hero h2 {
    font-size: clamp(54px, 18vw, 72px);
  }

  .guide-lede {
    max-width: 18ch;
    font-size: clamp(23px, 7vw, 30px);
    line-height: 1.06;
  }

  .guide-copy {
    gap: 6px;
  }

  .guide-hero p {
    font-size: 14px;
    line-height: 1.42;
  }

  .guide-copy-line {
    animation-duration: 260ms;
  }

  .guide-method {
    max-height: none;
    overflow: visible;
  }

  .guide-page:not(.guide-page-intro) .guide-method {
    display: none;
  }

  .full-guide .guide-flow-control {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    width: min(356px, calc(100vw - 24px));
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 46px rgba(79, 43, 255, 0.16);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
  }

  .guide-main-button {
    grid-column: 1 / -1;
    min-height: 48px;
    border-radius: 16px;
  }

  .guide-pips {
    min-width: 0;
    justify-content: end;
  }
}

@media (max-width: 390px), (max-height: 760px) and (max-width: 640px) {
  :root {
    --mobile-topbar-height: 100px;
  }

  .topbar {
    padding-top: 7px;
    padding-bottom: 8px;
  }

  #lesson-stage {
    padding-top: 8px;
  }

  .stage-header h2 {
    font-size: clamp(23px, 7vw, 28px);
  }

  .watch-video-frame video {
    max-height: calc(100dvh - 226px);
    min-height: 150px;
  }

  .question-panel,
  .exercise-panel {
    max-height: calc(100dvh - 176px);
  }

  .mimic-panel {
    max-height: calc(100dvh - 238px);
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: clamp(104px, 18dvh, 132px);
  }

  .review-card .vocab-image,
  .review-card .vocab-image img,
  .review-card .vocab-concept {
    max-height: 134px;
  }

  .definition-copy {
    font-size: clamp(17px, 5.4vw, 22px);
  }
}

@media (max-width: 640px) {
  .focused-question-list {
    padding-bottom: 112px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    position: fixed !important;
    inset-inline: auto !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 70;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(76px, 0.72fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    padding: 8px;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 34px rgba(23, 8, 90, 0.16);
    transform: translateX(-50%) !important;
    backdrop-filter: blur(12px);
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    padding-inline: 10px;
    border-radius: 15px;
    white-space: nowrap;
  }

  .focused-flow-hint {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    grid-template-columns: minmax(70px, 0.66fr) minmax(0, 1.34fr);
    gap: 7px;
    padding: 7px;
  }

  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button {
    font-size: 13px;
    padding-inline: 8px;
  }
}

/* Quiz interaction variety: real match and order tasks, not just skinned MCQ. */
.pair-match-board {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) 32px minmax(0, 1.2fr);
  align-items: stretch;
  gap: 12px;
  margin-top: 14px;
}

.pair-match-left,
.pair-match-options .match-option,
.statement-card,
.order-builder {
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(79, 46, 255, 0.12);
}

.pair-match-left {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  color: var(--accent);
  background: linear-gradient(135deg, #f0ecff, #ffffff);
}

.pair-match-left span,
.pair-match-options .match-option span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
}

.pair-match-left strong {
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
  text-wrap: balance;
}

.pair-match-connector {
  position: relative;
  min-height: 132px;
}

.pair-match-connector::before,
.pair-match-connector::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.pair-match-connector::before {
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-pink));
}

.pair-match-connector::after {
  right: -1px;
  width: 13px;
  height: 13px;
  border-top: 3px solid var(--accent-pink);
  border-right: 3px solid var(--accent-pink);
  transform: translateY(-50%) rotate(45deg);
}

.pair-match-options {
  display: grid;
  gap: 10px;
}

.pair-match-options .match-option {
  justify-content: start;
  min-height: 58px;
  text-align: left;
  line-height: 1.35;
}

.order-builder {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff, #f8f6ff);
}

.order-slot-row,
.word-bank-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-slot {
  min-height: 46px;
  min-width: min(160px, 100%);
  flex: 1 1 90px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border: 1.5px dashed rgba(79, 46, 255, 0.22);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 600;
  text-align: center;
}

.order-token,
.word-chip {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  color: #ffffff;
  background: linear-gradient(90deg, var(--accent), var(--accent-pink));
  box-shadow: 0 10px 24px rgba(79, 46, 255, 0.18);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition-property: transform, box-shadow, opacity;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.word-chip {
  color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 0 0 1.5px rgba(79, 46, 255, 0.16);
}

.order-token:active,
.word-chip:active,
.pair-match-options .match-option:active {
  transform: scale(0.96);
}

.statement-card {
  padding: 14px 16px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 600;
}

.true-false-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .pair-match-board {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .pair-match-left {
    min-height: 82px;
    padding: 14px;
  }

  .pair-match-left strong {
    font-size: clamp(22px, 7vw, 30px);
  }

  .pair-match-connector {
    min-height: 18px;
  }

  .pair-match-connector::before {
    left: 18px;
    right: 18px;
  }

  .pair-match-connector::after {
    right: 18px;
  }

  .pair-match-options .match-option {
    min-height: 52px;
  }

  .order-builder {
    padding: 10px;
    gap: 10px;
  }

  .sequence-question .order-slot-row {
    min-height: 0;
    gap: 6px;
  }

  .order-slot {
    min-height: 40px;
    flex-basis: 68px;
    font-size: 12px;
  }

  .sequence-question .order-slot {
    min-width: 0;
    min-height: 22px;
    flex: 1 1 48px;
    padding: 4px 6px;
  }

  .sequence-question .order-slot:first-child:not(:empty) {
    flex-basis: 100%;
    min-height: 32px;
  }

  .order-token,
  .word-chip {
    min-height: 44px;
    padding: 9px 12px;
    font-size: 13px;
  }

  .sequence-question .word-chip {
    white-space: normal;
    line-height: 1.25;
    text-align: center;
  }
}

/* QA hard stop: on phones, answers already give inline feedback, so no floating toast should cover choices. */
@media (max-width: 640px) {
  .answer-toast,
  .answer-toast.show {
    display: none !important;
  }
}

/* QA hard stop: vocabulary images must teach the cue without being cropped. */
.deck-card .vocab-image,
.review-card .vocab-image {
  display: grid;
  place-items: center;
  background: #ffffff;
}

.deck-card .vocab-image img,
.review-card .vocab-image img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center center !important;
  background: #ffffff;
}

.deck-card .vocab-image img {
  padding: 8px;
}

.review-card .vocab-image img {
  padding: 10px;
}

@media (max-width: 640px) {
  .deck-card .vocab-image img,
  .review-card .vocab-image img {
    padding: 6px;
  }
}

/* QA hard stop: order-builder answer chips must remain readable after selection/checking. */
.order-builder .order-token.selected,
.question-panel .order-builder .order-token.selected,
.exercise-panel .order-builder .order-token.selected,
.varied-exercise .order-builder .order-token.selected {
  color: #ffffff !important;
  background-color: #4f2eff !important;
  background-image: linear-gradient(90deg, #4f2eff, #ef4f93) !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  border: 0 !important;
  box-shadow: 0 10px 24px rgba(79, 46, 255, 0.22) !important;
  opacity: 1 !important;
}

.order-builder .word-chip {
  color: #4f2eff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

.order-builder .order-slot {
  color: #5f5a77;
  background: rgba(255, 255, 255, 0.82);
}

/* QA hard stop: true/false context is the question, so mobile compression must not hide it. */
.practice-aid.statement-card {
  display: block !important;
}

@media (max-width: 640px) {
  .practice-aid.statement-card {
    display: block !important;
    margin: 8px 0 10px;
    padding: 11px 12px;
    font-size: 13px;
    line-height: 1.34;
  }

  .vocab-deck-complete .vocab-complete-card {
    width: min(372px, calc(100vw - 18px));
  }
}

/* 2026-09-01 landing-aligned lesson skin. Keep this late so the shared
   Murmury lesson routes inherit one visual language without changing lesson logic. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #0b0a12;
  --muted: #6c6880;
  --line: #efedf7;
  --line-strong: #dedbed;
  --accent: #4f2bff;
  --accent-dark: #3d1ce0;
  --accent-soft: #ede9ff;
  --accent-soft-2: #f6f5fa;
  --accent-soft-3: #dfd8ff;
  --accent-pink: #4f2bff;
  --gold: #4f2bff;
  --gold-soft: #ede9ff;
  --known: #0b0a12;
  --known-soft: #ffffff;
  --success: #05a165;
  --success-soft: #e9fbf3;
  --shadow: 0 18px 44px rgba(25, 16, 68, 0.08);
  --shadow-soft: 0 8px 22px rgba(25, 16, 68, 0.05);
  --shadow-hover: 0 20px 42px rgba(25, 16, 68, 0.1);
  --radius: 12px;
  --radius-inner: 8px;
  --radius-control: 8px;
  --font-sans: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mobile-topbar-height: 96px;
}

* {
  letter-spacing: 0 !important;
}

html,
body {
  background: #ffffff !important;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-sans) !important;
}

body {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.app-shell {
  background: #ffffff;
}

.topbar {
  height: 70px;
  min-height: 70px;
  padding-inline: 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: none;
}

@media (min-width: 1240px) {
  .topbar {
    padding-inline: calc((100% - 1180px) / 2);
  }
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.brand::before {
  width: 30px;
  height: 30px;
  margin-right: 10px;
  border-radius: 8px;
  background:
    linear-gradient(#ffffff, #ffffff) 8px 10px / 2px 10px no-repeat,
    linear-gradient(#ffffff, #ffffff) 13px 6px / 2px 18px no-repeat,
    linear-gradient(#ffffff, #ffffff) 18px 9px / 2px 12px no-repeat,
    linear-gradient(#ffffff, #ffffff) 23px 12px / 2px 6px no-repeat,
    var(--accent);
}

.lesson-menu summary,
.quick-guide-button,
.lesson-meta span {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.lesson-menu summary strong,
.quick-guide-button,
.lesson-menu-popover a.active strong {
  color: var(--accent);
}

.lesson-menu summary:hover,
.quick-guide-button:hover,
.lesson-menu-popover a:hover {
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
  box-shadow: none;
}

.lesson-menu-popover {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.lesson-menu-popover a {
  border-radius: 8px;
  font-weight: 500;
}

.lesson-menu-popover a.active {
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
}

.progress-track {
  position: relative;
  top: auto;
  z-index: 10;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

#progress-bar,
.meter span,
.deck-meter span,
.focused-task-dot.done,
.focused-task-dot.current,
.vocab-dots button.active,
.vocab-dots button.sorted {
  background: var(--accent) !important;
  background-image: none !important;
}

.progress-track > #progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  height: 100%;
  border-radius: inherit;
  box-shadow: none;
  transition: width 240ms ease;
}

.lesson-layout {
  width: 100%;
  max-width: 1180px;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 36px;
  padding: 28px 32px 72px;
  align-items: start;
}

.lesson-layout.single-column {
  max-width: 900px;
  grid-template-columns: minmax(0, 1fr);
}

.rail {
  top: 96px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--accent-soft-2);
  box-shadow: none;
}

.rail-heading {
  margin-bottom: 18px;
}

.rail-heading .eyebrow,
.mini-label,
.badge,
.task-status,
.level-pill,
.topic-pill,
.reward-chip,
.vocab-score span,
.vocab-score strong {
  font-weight: 600;
}

.rail-heading .eyebrow,
.mini-label {
  color: var(--accent);
  font-size: 12px;
  text-transform: none;
}

.rail h1 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.18;
  font-weight: 600;
}

.phase-list {
  gap: 6px;
}

.phase-item {
  min-height: 50px;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.phase-item.current {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #ffffff;
  box-shadow: none;
}

.phase-item.done {
  background: transparent;
}

.phase-index {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.phase-item.done .phase-index,
.phase-item.current .phase-index {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.phase-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.phase-mission {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

#reset-progress {
  width: 100%;
  min-height: 42px;
}

.stage {
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#lesson-stage {
  padding: 22px 0 48px;
}

.stage-header {
  max-width: 720px;
  margin: 0 0 22px;
}

.stage-kicker-row {
  gap: 10px;
  margin-bottom: 14px;
}

.badge {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
}

.phase-sound-hint {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border: 1px solid var(--accent-soft-3);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: none;
}

.sound-on-icon {
  width: 28px;
  height: 28px;
}

.stage-header h2 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 40px;
  line-height: 1.04;
  font-weight: 600;
}

.stage-header p {
  max-width: 680px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
}

.primary-button,
.watch-video-cta .primary-button,
.focused-flow-actions .primary-button,
.phase-actions .primary-button,
.vocab-review-actions .primary-button,
.vocab-complete-card .primary-button {
  min-height: 48px;
  border-radius: 4px;
  color: #ffffff;
  background: var(--ink);
  background-image: none;
  box-shadow: none;
  font-weight: 600;
}

.primary-button:hover,
.watch-video-cta .primary-button:hover,
.focused-flow-actions .primary-button:hover,
.phase-actions .primary-button:hover {
  color: #ffffff;
  background: var(--accent-dark);
  box-shadow: none;
  transform: translateY(-1px);
}

.primary-button:disabled,
.primary-button.is-locked {
  color: #9c98af;
  background: var(--accent-soft-2);
  box-shadow: none;
}

.secondary-button,
.ghost-button,
.ghost-mini {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: none;
  font-weight: 600;
}

.secondary-button:hover,
.ghost-button:hover,
.ghost-mini:hover {
  border-color: var(--accent-soft-3);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.watch-video-frame,
.question-panel,
.exercise-panel,
.audio-panel,
.prompt-panel,
.review-section,
.next-lesson-panel,
.word-section,
.grammar-spotlight,
.vocab-card,
.vocab-review-popup,
.focused-task-progress {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.watch-video-frame video {
  background: #000000;
}

.watch-video-cta,
.phase-actions,
.focused-flow-actions,
.vocab-complete-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.vocab-deck {
  width: 100%;
  max-width: 860px;
  display: grid;
  gap: 14px;
}

.vocab-deck-top {
  align-items: end;
}

.vocab-deck-top h3 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.12;
  font-weight: 600;
}

.vocab-score {
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.vocab-score span,
.vocab-score strong {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft-2);
}

.vocab-score strong {
  color: var(--accent);
  background: var(--accent-soft);
}

.deck-meter {
  height: 8px;
  background: var(--line);
}

.vocab-sort-layout {
  display: grid;
  grid-template-columns: minmax(0, 620px) 168px;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
}

.vocab-card-shell {
  width: 100%;
  max-width: 620px;
  grid-column: 1;
  grid-row: auto;
  justify-self: stretch;
  perspective: none;
}

.vocab-card-shell::before,
.vocab-card-shell::after {
  display: none;
}

.vocab-card-shell .lesson-pop,
.vocab-card.deck-card {
  animation: none;
}

.vocab-card.deck-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.vocab-card.deck-card.is-dragging {
  box-shadow: var(--shadow-hover);
}

.vocab-card-shell.intent-left .deck-card,
.vocab-card-shell.intent-right .deck-card {
  border-color: var(--accent-soft-3);
}

.vocab-sort-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: stretch;
  gap: 12px;
}

.vocab-sort-button,
.sort-known,
.sort-new {
  grid-column: auto;
  grid-row: auto;
}

.vocab-sort-button {
  min-height: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  text-align: left;
  align-content: center;
  justify-items: start;
  background: #ffffff;
}

.vocab-sort-button span {
  color: inherit;
  font-size: 15px;
  font-weight: 600;
}

.vocab-sort-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  opacity: 1;
}

.sort-known {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
}

.sort-new {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.sort-new small {
  color: rgba(255, 255, 255, 0.78);
}

.sort-known:hover,
.sort-known.chosen {
  color: var(--accent);
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
  box-shadow: none;
}

.sort-new:hover,
.sort-new.chosen {
  color: #ffffff;
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  box-shadow: none;
}

.deck-card .vocab-image,
.review-card .vocab-image,
.vocab-concept {
  background: var(--accent-soft-2);
}

.deck-card .vocab-image,
.deck-card .vocab-image img,
.deck-card .vocab-concept {
  height: 206px;
}

.deck-card-body,
.simple-word-card {
  padding: 20px 28px 22px;
  gap: 10px;
}

.deck-card .headword {
  color: var(--ink);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 600;
}

.pos,
.level-pill,
.topic-pill,
.task-status,
.reward-chip {
  border-radius: 999px;
}

.pos {
  color: var(--muted);
  background: transparent;
}

.word-card-nudge {
  color: var(--muted);
  font-size: 14px;
}

.sound-row {
  gap: 10px;
}

.sound-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: none;
  font-weight: 600;
}

.sound-button:hover {
  border-color: var(--accent-soft-3);
  background: var(--accent-soft);
  box-shadow: none;
}

.vocab-nav-row {
  margin-top: 2px;
  gap: 12px;
}

.vocab-dots {
  gap: 8px;
}

.vocab-dots button {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--line);
}

.vocab-dots button.active {
  width: 36px;
}

.vocab-sort-feedback {
  display: none;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--accent-soft-2);
  box-shadow: none;
  font-size: 13px;
}

.question-panel h3,
.exercise-panel h3,
.audio-panel h3,
.prompt-panel h3 {
  color: var(--ink);
  font-weight: 600;
}

.option-button,
.word-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  background-image: none;
  box-shadow: none;
  font-weight: 500;
}

.option-button:hover,
.word-chip:hover {
  border-color: var(--accent-soft-3);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.option-button.selected,
.option-button.correct,
.word-chip.selected,
.order-builder .order-token.selected,
.question-panel .order-builder .order-token.selected,
.exercise-panel .order-builder .order-token.selected,
.varied-exercise .order-builder .order-token.selected {
  color: #ffffff !important;
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  background-image: none !important;
  box-shadow: none !important;
}

.option-button.incorrect {
  color: #9f2415;
  border-color: #ffd2ca;
  background: #fff0ee;
}

.full-guide {
  background: linear-gradient(180deg, #ffffff 0%, #fbfafe 100%) !important;
}

.full-guide .guide-page {
  border-color: var(--line);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(246, 245, 250, 0.64), rgba(255, 255, 255, 0) 28%),
    #ffffff;
  box-shadow: 0 24px 70px rgba(25, 16, 68, 0.1);
}

.full-guide .guide-hero h2 {
  font-weight: 600;
}

.guide-kicker {
  color: var(--muted);
  background: var(--accent-soft-2);
}

.guide-intro-map,
.guide-method {
  border-color: var(--line);
  border-radius: 16px;
  background: var(--accent-soft-2) !important;
  box-shadow: none;
}

.guide-intro-steps li,
.guide-step-list li.active button {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: none;
}

.guide-intro-steps span,
.guide-step-list span {
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-soft-3);
  font-variant-numeric: tabular-nums;
}

.guide-step-list li.active span {
  color: #ffffff;
  background: var(--accent);
  box-shadow: none;
}

.guide-step-list li.done span {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-soft-3);
}

.guide-icon-button {
  border-radius: 4px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.guide-icon-button:hover {
  background: var(--accent-soft-2);
  box-shadow: inset 0 0 0 1px var(--accent-soft-3);
}

.guide-pips button::after {
  width: 7px;
  height: 7px;
  background: var(--line);
  background-image: none;
}

.guide-pips button.done::after,
.guide-pips button.active::after {
  background: var(--accent);
  background-image: none;
}

.guide-pips button.active {
  width: 42px;
}

.guide-pips button.active::after {
  width: 28px;
  box-shadow: none;
}

.full-guide .guide-main-button {
  min-height: 52px;
  border-radius: 4px;
  color: #ffffff;
  background: var(--ink);
  background-image: none;
  box-shadow: none;
  font-weight: 600;
}

.full-guide .guide-main-button:hover {
  background: #24212d;
  box-shadow: none;
}

@media (max-width: 940px) {
  .topbar {
    height: auto;
    min-height: var(--mobile-topbar-height);
    padding: 10px 16px 12px;
    gap: 8px 12px;
  }

  .progress-track {
    position: fixed;
    top: var(--mobile-topbar-height);
  }

  .lesson-layout {
    max-width: 430px;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 16px 14px calc(86px + env(safe-area-inset-bottom));
  }

  .rail {
    order: 2;
    position: static;
    width: 100%;
    max-height: none;
    padding: 16px;
    border-radius: 12px;
    background: var(--accent-soft-2);
  }

  .stage {
    order: 1;
  }

  #lesson-stage {
    min-height: auto;
    padding: 16px 0 calc(86px + env(safe-area-inset-bottom));
  }

  .stage-header {
    margin-bottom: 16px;
  }

  .stage-header h2 {
    font-size: 34px;
    line-height: 1.08;
  }

  .stage-header p {
    font-size: 15px;
    line-height: 1.5;
  }

  .vocab-deck {
    max-width: 100%;
    gap: 12px;
  }

  .vocab-deck-top {
    display: grid;
    gap: 10px;
  }

  .vocab-score {
    justify-content: flex-start;
  }

  .vocab-sort-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: 174px;
  }

  .deck-card-body,
  .simple-word-card {
    padding: 14px;
    gap: 8px;
  }

  .deck-card .headword,
  .vocab-deck-top h3 {
    font-size: 24px;
  }

  .vocab-sort-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 8px;
  }

  .vocab-sort-button {
    min-height: 56px;
    padding: 10px 12px;
  }

  .phase-actions,
  .focused-flow-actions,
  .vocab-complete-card {
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(25, 16, 68, 0.1);
  }
}

@media (max-width: 390px) {
  :root {
    --mobile-topbar-height: 100px;
  }

  .lesson-layout {
    padding-inline: 10px;
  }

  .stage-header h2 {
    font-size: 30px;
  }
}

/* 2026-09-01 compact lesson menu: navigation, not a lesson-sized panel. */
.lesson-menu-popover {
  width: min(520px, calc(100vw - 24px));
  max-height: min(64dvh, 520px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(11, 10, 18, 0.12);
  z-index: 80;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft-3) transparent;
}

.lesson-menu-popover a {
  min-width: 0;
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 8px;
}

.lesson-menu-popover a strong {
  font-size: 13px;
  line-height: 1.18;
  text-wrap: balance;
}

.lesson-menu-popover a span {
  font-size: 11px;
  line-height: 1.22;
  text-wrap: pretty;
}

@media (max-width: 940px) {
  .lesson-menu-popover {
    max-height: min(58dvh, calc(100dvh - 124px));
  }
}

@media (max-width: 640px) {
  .lesson-menu summary {
    max-width: 100%;
  }

  .lesson-menu-popover {
    left: 0;
    right: auto;
    width: 100%;
    max-height: min(54dvh, calc(100dvh - var(--mobile-topbar-height) - 20px));
    grid-template-columns: minmax(0, 1fr);
    transform: none;
  }
}

@media (max-width: 390px) {
  .lesson-menu-popover {
    max-height: min(52dvh, calc(100dvh - var(--mobile-topbar-height) - 18px));
  }
}

/* 2026-09-02 Quick Guide polish: compact, landing-aligned, and readable. */
.full-guide {
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.5vw, 28px);
  background: #f7f6fb;
  backdrop-filter: blur(10px);
}

.full-guide .guide-page,
.full-guide .guide-page-intro,
.full-guide .guide-page:not(.guide-page-intro) {
  width: min(960px, calc(100vw - 32px));
  min-height: 0;
  height: auto;
  max-height: calc(100dvh - 32px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(18px, 2.4vw, 28px);
  align-items: stretch;
  padding: clamp(22px, 2.4vw, 30px);
  border: 1px solid #e8e4f1;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(25, 16, 68, 0.1), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
  overflow: hidden;
}

.full-guide .guide-page-intro {
  grid-template-columns: minmax(0, 0.95fr) minmax(310px, 360px);
}

.full-guide .guide-page::before,
.full-guide .guide-page::after {
  content: none;
}

.guide-hero,
.full-guide .guide-page:not(.guide-page-intro) .guide-hero {
  min-height: 0;
  max-width: 610px;
  justify-self: start;
  align-content: center;
  gap: 12px;
  padding: 0;
  overflow: visible;
}

.guide-kicker,
.guide-map-kicker {
  width: fit-content;
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  color: #4f2bff;
  background: #f0edff;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
}

.guide-hero h2,
.guide-page-intro .guide-hero h2,
.full-guide .guide-page:not(.guide-page-intro) .guide-hero h2 {
  margin: 0;
  color: #0b0a12;
  font-size: clamp(42px, 5.1vw, 68px);
  line-height: 0.98;
  font-weight: 600;
  text-wrap: balance;
}

.guide-page-intro .guide-hero h2 {
  font-size: clamp(54px, 6.2vw, 76px);
}

.guide-lede {
  max-width: 34ch;
  margin: 0;
  color: #0b0a12;
  font-size: clamp(17px, 1.45vw, 21px);
  font-weight: 600;
  line-height: 1.24;
  text-wrap: balance;
}

.guide-copy {
  display: grid;
  gap: 6px;
  max-width: 46ch;
  margin: 4px 0 0;
}

.guide-copy-line {
  opacity: 0;
  transform: translateY(6px);
  animation: guide-line-in 240ms cubic-bezier(0.2, 0, 0, 1) calc(50ms + var(--line-index, 0) * 40ms) both;
}

.guide-hero p {
  margin: 0;
  color: #686279;
  font-size: 14px;
  line-height: 1.42;
  text-wrap: pretty;
}

.full-guide .guide-close {
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  color: #4f2bff;
  background: #ffffff;
  box-shadow: 0 0 0 1px #e2dcf7, 0 10px 24px rgba(25, 16, 68, 0.08);
}

.guide-loop-map,
.guide-cycle-panel {
  position: relative;
  min-height: 300px;
  align-self: center;
  align-content: start;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #ece8f6;
  border-radius: 18px;
  background: #f6f5fa !important;
  box-shadow: none;
  overflow: hidden;
}

.guide-loop-wrap,
.guide-cycle-wheel {
  position: relative;
  min-height: 246px;
  display: grid;
  place-items: center;
}

.guide-loop-path,
.guide-cycle-wheel::before {
  position: absolute;
  inset: 42px 26px 36px;
  border: 2px solid #ded8f4;
  border-radius: 999px;
  pointer-events: none;
}

.guide-loop-path {
  display: block;
}

.guide-cycle-wheel::before {
  content: "";
}

.guide-loop-path::before,
.guide-cycle-wheel::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border-top: 2px solid #4f2bff;
  border-right: 2px solid #4f2bff;
  background: #f6f5fa;
  transform: rotate(45deg);
}

.guide-loop-path::before {
  top: 45%;
  right: -6px;
}

.guide-cycle-wheel::after {
  display: none;
}

.guide-loop-orbit,
.guide-cycle-steps,
.guide-step-beats {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-loop-orbit,
.guide-cycle-steps {
  position: absolute;
  inset: 0;
}

.guide-loop-node {
  position: absolute;
  width: 130px;
  min-height: 64px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas:
    "num title"
    "num copy";
  gap: 3px 8px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(11, 10, 18, 0.06), 0 10px 24px rgba(25, 16, 68, 0.08);
}

.guide-loop-node-1 {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.guide-loop-node-2 {
  right: 0;
  bottom: 8px;
}

.guide-loop-node-3 {
  left: 0;
  bottom: 8px;
}

.guide-loop-node span,
.guide-cycle-steps span,
.guide-step-beats span {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #4f2bff;
  background: #efebff;
  box-shadow: inset 0 0 0 1px #ded8ff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.guide-loop-node span {
  grid-area: num;
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.guide-loop-node strong {
  grid-area: title;
  color: #0b0a12;
  font-size: 15px;
  line-height: 1.06;
  font-weight: 600;
}

.guide-loop-node em {
  grid-area: copy;
  color: #686279;
  font-size: 11px;
  line-height: 1.18;
  font-style: normal;
  font-weight: 600;
  text-wrap: pretty;
}

.guide-loop-core,
.guide-cycle-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(11, 10, 18, 0.06), 0 14px 28px rgba(25, 16, 68, 0.08);
}

.guide-loop-core {
  width: 112px;
  height: 112px;
  gap: 4px;
  padding: 16px;
  border-radius: 999px;
}

.guide-loop-core strong,
.guide-cycle-center strong {
  color: #0b0a12;
  font-weight: 600;
  line-height: 1.04;
  text-wrap: balance;
}

.guide-loop-core strong {
  font-size: 17px;
}

.guide-loop-core span,
.guide-cycle-center em {
  color: #686279;
  font-style: normal;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: pretty;
}

.guide-loop-core span {
  font-size: 10.5px;
}

.guide-step-beats {
  max-width: 620px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.guide-step-beats li {
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: #f6f5fa;
  box-shadow: inset 0 0 0 1px #ebe7f4;
}

.guide-step-beats span {
  width: 24px;
  height: 24px;
  color: #ffffff;
  background: #4f2bff;
  box-shadow: none;
  font-size: 11px;
}

.guide-step-beats strong {
  min-width: 0;
  color: #0b0a12;
  font-size: 12px;
  line-height: 1.12;
  font-weight: 600;
  text-wrap: balance;
}

.guide-cycle-center {
  width: 132px;
  height: 132px;
  gap: 5px;
  padding: 16px;
  border-radius: 999px;
}

.guide-cycle-center small {
  color: #4f2bff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.guide-cycle-center strong {
  font-size: 17px;
}

.guide-cycle-center em {
  font-size: 10.5px;
}

.guide-cycle-steps li {
  position: absolute;
}

.guide-cycle-steps li:nth-child(1) {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.guide-cycle-steps li:nth-child(2) {
  top: 30px;
  right: 42px;
}

.guide-cycle-steps li:nth-child(3) {
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}

.guide-cycle-steps li:nth-child(4) {
  right: 42px;
  bottom: 30px;
}

.guide-cycle-steps li:nth-child(5) {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

.guide-cycle-steps li:nth-child(6) {
  left: 42px;
  bottom: 30px;
}

.guide-cycle-steps li:nth-child(7) {
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
}

.guide-cycle-steps li:nth-child(8) {
  top: 30px;
  left: 42px;
}

.guide-cycle-steps button {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: #4f2bff;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(79, 43, 255, 0.14), 0 8px 18px rgba(25, 16, 68, 0.08);
  cursor: pointer;
  transition-property: color, background, box-shadow, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.guide-cycle-steps button:hover {
  background: #f0edff;
}

.guide-cycle-steps button:active {
  transform: scale(0.96);
}

.guide-cycle-steps span {
  width: 22px;
  height: 22px;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
}

.guide-cycle-steps strong {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  width: max-content;
  max-width: 104px;
  color: #686279;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition-property: opacity;
  transition-duration: 150ms;
}

.guide-cycle-steps li.active button {
  color: #ffffff;
  background: #4f2bff;
  box-shadow: 0 0 0 4px rgba(79, 43, 255, 0.1), 0 12px 24px rgba(79, 43, 255, 0.16);
}

.guide-cycle-steps li.active span {
  color: #ffffff;
}

.guide-cycle-steps li.done button {
  color: #4f2bff;
  background: #efebff;
}

.guide-cycle-steps li.active strong,
.guide-cycle-steps button:hover strong {
  opacity: 1;
}

.full-guide .guide-flow-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(132px, 180px);
  gap: 12px;
  align-items: center;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid #efedf7;
  animation: none;
}

.guide-icon-button,
.guide-main-button,
.guide-pips button {
  transition-property: color, background, box-shadow, transform, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.guide-icon-button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: #4f2bff;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e6e1f3;
}

.guide-icon-button:disabled {
  color: #c5bddf;
  opacity: 1;
}

.guide-pips {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
}

.guide-pips button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.guide-pips button::after {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e5e1f0;
  box-shadow: none;
  transform: none;
}

.guide-pips button.done::after,
.guide-pips button.active::after {
  background: #4f2bff;
}

.guide-pips button.active {
  width: 28px;
}

.guide-pips button.active::after {
  width: 28px;
}

.guide-main-button {
  min-height: 44px;
  border-radius: 10px;
  color: #ffffff;
  background-color: #0b0a12;
  background-image: none;
  box-shadow: none;
}

.guide-main-button:hover {
  background-color: #24212d;
}

.guide-icon-button:active:not(:disabled),
.guide-main-button:active,
.guide-pips button:active {
  transform: scale(0.96);
}

.guide-visual::before,
.guide-visual::after,
.guide-visual span,
.guide-pips button.active::after {
  animation: none !important;
}

@media (max-width: 940px) {
  .full-guide {
    padding: 8px;
  }

  .full-guide .guide-page,
  .full-guide .guide-page-intro,
  .full-guide .guide-page:not(.guide-page-intro) {
    width: min(430px, calc(100vw - 16px));
    min-height: 0;
    height: auto;
    max-height: calc(100dvh - 16px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 10px;
    padding: 18px 14px;
    border-radius: 18px;
  }

  .guide-hero,
  .full-guide .guide-page:not(.guide-page-intro) .guide-hero {
    justify-self: stretch;
    max-width: none;
    gap: 8px;
  }

  .guide-hero h2,
  .guide-page-intro .guide-hero h2,
  .full-guide .guide-page:not(.guide-page-intro) .guide-hero h2 {
    font-size: clamp(34px, 12vw, 46px);
    line-height: 0.98;
  }

  .guide-page-intro .guide-hero h2 {
    font-size: clamp(42px, 15vw, 54px);
  }

  .guide-kicker,
  .guide-map-kicker {
    padding: 6px 9px;
    font-size: 11px;
  }

  .guide-lede {
    max-width: 100%;
    font-size: 14.5px;
    line-height: 1.28;
  }

  .guide-copy {
    gap: 4px;
    margin-top: 0;
  }

  .guide-hero p {
    font-size: 12.5px;
    line-height: 1.33;
  }

  .guide-loop-map,
  .guide-cycle-panel {
    display: grid;
    min-height: auto;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
  }

  .guide-loop-wrap {
    min-height: 186px;
  }

  .guide-loop-path {
    inset: 28px 22px 26px;
  }

  .guide-loop-node {
    width: 108px;
    min-height: 50px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 2px 7px;
    padding: 8px;
    border-radius: 10px;
  }

  .guide-loop-node span {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .guide-loop-node strong {
    font-size: 13px;
  }

  .guide-loop-node em {
    font-size: 9.5px;
  }

  .guide-loop-node-2,
  .guide-loop-node-3 {
    bottom: 0;
  }

  .guide-loop-core {
    width: 82px;
    height: 82px;
    padding: 10px;
  }

  .guide-loop-core strong {
    font-size: 13px;
  }

  .guide-loop-core span {
    display: none;
  }

  .guide-step-beats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 4px;
  }

  .guide-step-beats li {
    min-height: 38px;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    align-items: start;
    padding: 8px;
  }

  .guide-step-beats span {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .guide-step-beats strong {
    font-size: 10.5px;
    line-height: 1.12;
  }

  .guide-cycle-wheel {
    min-height: 190px;
  }

  .guide-cycle-wheel::before {
    inset: 28px 24px;
  }

  .guide-cycle-center {
    width: 94px;
    height: 94px;
    gap: 3px;
    padding: 9px;
  }

  .guide-cycle-center strong {
    font-size: 12px;
  }

  .guide-cycle-center small,
  .guide-cycle-center em {
    font-size: 9.5px;
  }

  .guide-cycle-steps li:nth-child(2),
  .guide-cycle-steps li:nth-child(4) {
    right: 32px;
  }

  .guide-cycle-steps li:nth-child(6),
  .guide-cycle-steps li:nth-child(8) {
    left: 32px;
  }

  .guide-cycle-steps li:nth-child(3) {
    right: 0;
  }

  .guide-cycle-steps li:nth-child(7) {
    left: 0;
  }

  .guide-cycle-steps button {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .guide-cycle-steps span {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .guide-cycle-steps strong {
    display: none;
  }

  .full-guide .guide-close {
    top: 12px;
    right: 12px;
  }

  .full-guide .guide-flow-control {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    padding-top: 10px;
    border: 0;
    border-top: 1px solid #efedf7;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .guide-pips {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: center;
    gap: 8px;
  }

  .guide-icon-button {
    grid-column: 1;
    grid-row: 2;
  }

  .guide-main-button {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 360px), (max-height: 700px) and (max-width: 640px) {
  .full-guide .guide-page,
  .full-guide .guide-page-intro,
  .full-guide .guide-page:not(.guide-page-intro) {
    gap: 6px;
    padding: 12px 8px;
  }

  .guide-hero,
  .full-guide .guide-page:not(.guide-page-intro) .guide-hero {
    gap: 6px;
  }

  .guide-hero p {
    font-size: 12px;
    line-height: 1.26;
  }

  .guide-hero h2,
  .guide-page-intro .guide-hero h2,
  .full-guide .guide-page:not(.guide-page-intro) .guide-hero h2 {
    font-size: clamp(32px, 12vw, 40px);
  }

  .guide-copy-line:nth-child(n+2) {
    display: none;
  }

  .guide-loop-wrap {
    min-height: 172px;
  }

  .guide-loop-node {
    width: 98px;
  }

  .guide-loop-node em {
    display: none;
  }

  .guide-cycle-wheel {
    min-height: 180px;
  }

  .guide-loop-map,
  .guide-cycle-panel {
    gap: 6px;
    padding: 10px;
  }

  .guide-step-beats li {
    min-height: 32px;
    padding: 6px;
  }

  .full-guide .guide-flow-control {
    padding-top: 8px;
  }
}

/* 2026-09-02 mobile lesson menu: phone sheet, not a squeezed desktop dropdown. */
@media (min-width: 641px) and (max-width: 940px) {
  .lesson-menu[open] {
    z-index: 90;
  }

  .lesson-menu-popover {
    left: 50%;
    right: auto;
    width: min(520px, calc(100vw - 32px));
    max-height: min(58dvh, calc(100dvh - 112px));
    transform: translateX(-50%);
  }
}

@media (max-width: 640px) {
  .topbar {
    backdrop-filter: none;
  }

  .lesson-menu {
    position: relative;
    z-index: 70;
  }

  .lesson-menu[open] {
    z-index: 140;
  }

  .lesson-menu[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(11, 10, 18, 0.18);
    backdrop-filter: blur(3px);
    pointer-events: none;
  }

  .lesson-menu summary {
    position: relative;
    z-index: 142;
    justify-content: center;
    overflow: hidden;
  }

  .full-guide .guide-page:not(.guide-page-intro) .guide-method {
    display: grid;
  }

  .lesson-menu-popover {
    position: fixed;
    top: auto;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    max-height: min(70dvh, calc(100dvh - var(--mobile-topbar-height) - 22px));
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 9px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 22px 70px rgba(11, 10, 18, 0.24);
    transform: none;
    z-index: 141;
  }

  .lesson-menu-popover::before {
    content: "";
    order: -2;
    display: block;
    justify-self: center;
    width: 42px;
    height: 4px;
    margin: 2px 0 6px;
    border-radius: 999px;
    background: var(--accent-soft-3);
  }

  .lesson-menu-popover a {
    min-height: 45px;
    padding: 7px 10px;
    border-radius: 10px;
  }

  .lesson-menu-popover a.active {
    order: -1;
    border-color: var(--accent-soft-3);
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .lesson-menu-popover a strong {
    font-size: 12px;
    line-height: 1.15;
  }

  .lesson-menu-popover a span {
    font-size: 10.5px;
    line-height: 1.18;
  }
}

@media (max-width: 360px) {
  .lesson-menu-popover {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: min(68dvh, calc(100dvh - var(--mobile-topbar-height) - 16px));
    padding: 7px;
    border-radius: 16px;
  }

  .lesson-menu-popover a {
    min-height: 42px;
    padding: 6px 9px;
  }
}

@media (max-height: 620px) and (max-width: 640px) {
  .lesson-menu-popover {
    max-height: min(62dvh, calc(100dvh - var(--mobile-topbar-height) - 28px));
  }

  .lesson-menu-popover a {
    min-height: 40px;
  }
}

/* 2026-09-02 density calibration: make 100% browser zoom feel like the approved 67% view. */
:root {
  --lesson-density-width: clamp(1000px, 61.5vw, 1180px);
  --lesson-density-rail: clamp(212px, 15.5vw, 244px);
  --lesson-density-gap: clamp(26px, 2.2vw, 36px);
  --lesson-density-topbar: 62px;
  --lesson-density-mobile-topbar: 96px;
}

@media (min-width: 941px) {
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  .topbar {
    height: var(--lesson-density-topbar);
    min-height: var(--lesson-density-topbar);
    padding-inline: max(28px, calc((100% - var(--lesson-density-width)) / 2));
  }

  .brand {
    font-size: 17px;
  }

  .brand::before {
    width: 28px;
    height: 28px;
    margin-right: 9px;
    border-radius: 8px;
  }

  .lesson-menu summary,
  .quick-guide-button,
  .lesson-meta span {
    min-height: 38px;
    padding-inline: 15px;
    font-size: 12.5px;
  }

  .progress-track {
    top: var(--lesson-density-topbar);
    height: 5px;
  }

  .lesson-layout {
    max-width: var(--lesson-density-width);
    grid-template-columns: var(--lesson-density-rail) minmax(0, 1fr);
    gap: var(--lesson-density-gap);
    padding: 26px 32px 84px;
  }

  .rail {
    top: calc(var(--lesson-density-topbar) + 28px);
    padding: 16px;
  }

  .rail-heading {
    margin-bottom: 16px;
  }

  .rail h1 {
    font-size: 20px;
    line-height: 1.16;
  }

  .phase-list {
    gap: 4px;
  }

  .phase-item {
    min-height: 42px;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 8px;
    border-radius: 9px;
  }

  .phase-index {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .phase-name {
    font-size: 13px;
  }

  .phase-mission {
    font-size: 11px;
  }

  .stage {
    max-width: none;
  }

  #lesson-stage {
    padding: 18px 0 36px;
  }

  .stage-header {
    max-width: min(100%, 640px);
    margin-bottom: 16px;
  }

  .stage-kicker-row {
    gap: 8px;
    margin-bottom: 10px;
  }

  .badge {
    min-height: 30px;
    padding-inline: 12px;
    font-size: 12px;
  }

  .phase-sound-hint {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .sound-on-icon {
    width: 24px;
    height: 24px;
  }

  .stage-header h2 {
    margin-bottom: 8px;
    font-size: clamp(28px, 2.05vw, 34px);
    line-height: 1.05;
  }

  .stage-header p {
    max-width: 600px;
    font-size: 14.5px;
    line-height: 1.5;
  }

  .focused-task-progress {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .focused-task-progress-copy strong,
  .progress-mini-row strong {
    font-size: 19px;
  }

  .focused-task-progress-copy span,
  .progress-mini-row span,
  .comprehension-progress p {
    font-size: 11.5px;
  }

  .focused-task-dot {
    height: 7px;
  }

  .question-panel,
  .exercise-panel,
  .audio-panel,
  .prompt-panel,
  .word-section,
  .grammar-spotlight,
  .vocab-card {
    padding: 14px;
    border-radius: 12px;
  }

  .question-panel h3,
  .exercise-panel h3,
  .audio-panel h3,
  .prompt-panel h3,
  .vocab-card h3 {
    font-size: 16px;
    line-height: 1.24;
  }

  .option-list,
  .choice-list,
  .multiple-choice-list,
  .fill-blank-choice-list,
  .true-false-list {
    gap: 8px;
  }

  .option-button {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 8px;
  }

  .feedback,
  .feedback.reward-feedback {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .ghost-mini,
  .compact-button,
  .focused-flow-actions .primary-button,
  .focused-flow-actions .secondary-button,
  .phase-actions .primary-button,
  .phase-actions > .secondary-button {
    min-height: 42px;
  }

  .focused-flow-actions,
  .phase-actions {
    max-width: min(680px, 100%);
    margin-top: 14px;
    padding: 8px;
    border-radius: 12px;
  }

  .watch-video-frame video {
    max-height: min(40dvh, 360px);
  }

  .vocab-deck {
    max-width: 680px;
  }

  .vocab-deck-top h3 {
    font-size: 24px;
  }

  .vocab-sort-layout {
    grid-template-columns: minmax(0, 460px) 138px;
    gap: 14px;
  }

  .vocab-card-shell {
    max-width: 460px;
  }

  .deck-card .vocab-image,
  .deck-card .vocab-image img,
  .deck-card .vocab-concept {
    height: 172px;
  }
}

@media (max-width: 640px) {
  :root {
    --mobile-topbar-height: var(--lesson-density-mobile-topbar);
  }

  .topbar {
    min-height: var(--lesson-density-mobile-topbar);
    padding: 8px 12px;
    gap: 6px 8px;
    grid-template-rows: auto auto;
  }

  .brand {
    width: auto;
    justify-self: start;
    font-size: 16px;
  }

  .brand::before {
    width: 26px;
    height: 26px;
    margin-right: 8px;
  }

  .quick-guide-button {
    min-height: 34px;
    padding-inline: 11px;
    font-size: 11.5px;
  }

  .lesson-menu {
    padding-bottom: 0;
  }

  .lesson-menu summary {
    min-height: 34px;
    font-size: 12px;
  }

  .progress-track {
    top: var(--lesson-density-mobile-topbar);
  }

  .lesson-layout {
    padding-top: 10px;
  }

  #lesson-stage {
    min-height: auto;
    padding-top: 10px;
  }

  .stage-header h2 {
    font-size: clamp(24px, 6.8vw, 28px);
  }

  .rail {
    padding: 14px;
  }

  .phase-item {
    min-height: 44px;
    border-radius: 12px;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    width: min(370px, calc(100vw - 20px));
  }
}

@media (max-width: 360px), (max-height: 620px) and (max-width: 640px) {
  :root {
    --lesson-density-mobile-topbar: 88px;
    --mobile-topbar-height: 88px;
  }

  .topbar {
    min-height: var(--lesson-density-mobile-topbar);
    padding: 7px 10px;
    gap: 5px 8px;
  }

  .brand {
    font-size: 15.5px;
  }

  .brand::before {
    width: 24px;
    height: 24px;
    margin-right: 7px;
  }

  .quick-guide-button,
  .lesson-menu summary {
    min-height: 32px;
    font-size: 11.5px;
  }

  .progress-track {
    top: var(--lesson-density-mobile-topbar);
  }

  .lesson-layout {
    padding-top: 8px;
  }

  #lesson-stage {
    padding-top: 8px;
  }

  .stage-header {
    margin-bottom: 6px;
  }

  .stage-kicker-row {
    margin-bottom: 6px;
  }

  .stage-header h2 {
    font-size: clamp(23px, 7vw, 25px);
  }

  .focused-task-progress {
    margin-bottom: 6px;
    padding: 7px 8px;
  }

  .focused-task-progress-copy strong {
    font-size: 18px;
  }

  .question-panel,
  .exercise-panel,
  .audio-panel,
  .prompt-panel {
    padding: 10px;
  }

  .question-panel h3,
  .exercise-panel h3,
  .audio-panel h3,
  .prompt-panel h3 {
    font-size: 16px;
    line-height: 1.18;
  }

  .question-panel p,
  .exercise-panel p,
  .audio-panel p,
  .prompt-panel p {
    font-size: 13px;
    line-height: 1.35;
  }

  .option-list,
  .choice-list,
  .multiple-choice-list,
  .fill-blank-choice-list,
  .true-false-list {
    gap: 6px;
  }

  .option-button {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.25;
  }

  .focused-question-list {
    padding-bottom: 0;
  }

  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 12px 0 0;
    transform: none !important;
  }
}

@media (max-width: 700px) {
  .completion-review-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .completion-review-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .completion-review-head h3 {
    font-size: 20px;
  }

  .completion-ring {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    text-align: left;
  }

  .completion-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .completion-check-card {
    min-height: 86px;
    padding: 11px;
    border-radius: 14px;
  }

  .completion-check-card strong {
    font-size: 21px;
  }

  .completion-review-actions {
    justify-content: stretch;
  }

  .completion-review-actions .link-button {
    flex: 1 1 130px;
  }
}

@media (max-width: 360px) {
  .completion-checklist {
    grid-template-columns: 1fr;
  }
}

.progress-track {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: 1;
  width: 100%;
  pointer-events: none;
}

.progress-track > #progress-bar {
  position: absolute !important;
  inset: 0 auto 0 0 !important;
  height: 100% !important;
  border-radius: inherit;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  .progress-track {
    position: static !important;
  }

  .progress-track > #progress-bar {
    position: static !important;
    display: block;
    inset: auto !important;
  }
}

/* Focused task navigation belongs in the lesson flow; fixed footers can cover
   the active question on short mobile viewports. */
.focused-flow-actions,
.focused-flow-actions.is-ready,
.focused-flow-actions.is-awaiting-answer {
  position: static !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 760px !important;
  margin: 18px auto 0 !important;
  transform: none !important;
}

.focused-question-list:has(+ .focused-flow-actions),
.focused-question-list:has(+ .focused-flow-actions.is-ready),
.focused-question-list:has(+ .focused-flow-actions.is-awaiting-answer) {
  padding-bottom: 0 !important;
}

@media (max-width: 640px) {
  .focused-flow-actions,
  .focused-flow-actions.is-ready,
  .focused-flow-actions.is-awaiting-answer {
    max-width: 100% !important;
    margin-top: 12px !important;
  }
}
