﻿:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-strong: #ffffff;
  --ink: #172033;
  --muted: #657084;
  --line: #EFEDF7;
  --line-strong: #E2E0EE;
  --accent: #4F2BFF;
  --accent-dark: #3D1CE0;
  --accent-soft: #EDE9FF;
  --gold: #4F2BFF;
  --gold-soft: #EDE9FF;
  --rose: #b94a48;
  --rose-soft: #ffe6e2;
  --blue: #4F2BFF;
  --blue-soft: #EDE9FF;
  --known: #08796D;
  --known-soft: #E8FAF6;
  --shadow: 0 18px 50px rgba(31, 36, 50, 0.12);
  --shadow-soft: 0 10px 28px rgba(31, 36, 50, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Poppins, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 220px),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

strong,
b {
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 20px;
}

.brand span {
  color: var(--accent);
}

.lesson-menu {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 30;
}

.lesson-menu summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.lesson-menu summary::-webkit-details-marker {
  display: none;
}

.lesson-menu summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 120ms ease;
}

.lesson-menu[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.lesson-menu summary span {
  color: var(--muted);
  font-weight: 600;
}

.lesson-menu summary strong {
  color: var(--accent-dark);
  font-weight: 600;
}

.lesson-menu summary:hover {
  border-color: #DFD8FF;
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.lesson-menu summary:active {
  transform: scale(0.96);
}

.lesson-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  width: min(320px, calc(100vw - 24px));
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: rgba(255, 253, 248, 0.98);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.lesson-menu-popover a {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.lesson-menu-popover a:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  transform: translateY(-1px);
}

.lesson-menu-popover a:active {
  transform: scale(0.96);
}

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

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

.lesson-menu-popover a span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.lesson-meta span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.lesson-layout {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  flex: 1;
}

.lesson-layout.single-column {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.rail {
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 92px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

.rail h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.phase-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}

.phase-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.phase-item:hover {
  color: var(--ink);
  background: #F6F5FA;
}

.phase-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.phase-item:active {
  transform: scale(0.96);
}

.phase-item.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.phase-item.done {
  color: var(--ink);
}

.phase-index {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

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

.phase-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.phase-mission {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  margin-top: 2px;
}

.stage {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
}

.progress-track {
  height: 7px;
  background: #EFEDF7;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 19;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.06);
  pointer-events: none;
}

#progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #4F2BFF 0%, #8B35FF 54%, #EF4F9B 100%);
  position: absolute;
  inset: 0 auto 0 0;
  transition: width 240ms ease;
}

#lesson-stage {
  padding: 26px;
}

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

.stage-header h2 {
  margin-bottom: 6px;
  font-size: 25px;
  line-height: 1.22;
}

.stage-header p {
  color: var(--muted);
  margin-bottom: 0;
  max-width: 720px;
}

.mission-hud {
  width: 230px;
  flex: 0 0 230px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.hud-topline,
.hud-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}

.hud-topline strong {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.hud-meter {
  height: 8px;
  margin: 9px 0;
  border-radius: 999px;
  overflow: hidden;
  background: #EFEDF7;
}

.hud-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 260ms ease;
}

.hud-stats span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--gold-soft);
}

.mission-hud p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.level-notice {
  margin: -8px 0 18px;
  padding: 11px 12px;
  border: 1px solid #DFD8FF;
  border-radius: var(--radius);
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 600;
  animation: reward-pop 260ms cubic-bezier(0.2, 0, 0, 1);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--blue);
  background: var(--blue-soft);
}

.stage-kicker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-sound-hint {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #DFD8FF;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(94, 47, 255, 0.16);
}

.sound-on-icon {
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
}

.video-frame {
  background: #111827;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #111827;
}

video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  background: #111827;
  outline: 1px solid oklch(0 0 0 / 0.1);
}

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

.watch-note {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.speed-button {
  min-width: 52px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-strong);
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.speed-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.speed-button.active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.watch-note p {
  color: var(--muted);
  margin-bottom: 0;
}

.watch-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.watch-focus strong {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--ink);
  background: var(--gold-soft);
  border: 1px solid #DFD8FF;
}

.unlock-wrap {
  margin-top: 18px;
}

.unlock-card {
  width: 100%;
  min-height: 130px;
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-strong);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.unlock-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms ease;
}

.unlock-card.ready {
  border-color: #DFD8FF;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
}

.unlock-card.ready::after {
  transform: scaleX(1);
}

.unlock-card:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(23, 32, 51, 0.12);
}

.unlock-card:active:not(:disabled) {
  transform: scale(0.98);
}

.unlock-card:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

.unlock-badge,
.unlock-start {
  width: max-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.unlock-badge {
  color: var(--accent-dark);
  background: #ffffff;
  border: 1px solid #DFD8FF;
}

.unlock-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.unlock-card p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
}

.unlock-start {
  color: #ffffff;
  background: var(--accent);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(79, 43, 255, 0.24);
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.speed-button:active,
.option-button:active {
  transform: scale(0.96);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-button:disabled:hover {
  background: var(--accent);
  transform: none;
}

.secondary-button:disabled:hover {
  background: var(--surface-strong);
  transform: none;
}

.ghost-button:disabled:hover {
  background: transparent;
  transform: none;
}

.danger-button:disabled:hover {
  background: var(--rose-soft);
  transform: none;
}

.secondary-button {
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
}

.secondary-button:hover {
  background: #F6F5FA;
  transform: translateY(-1px);
}

.ghost-button {
  width: 100%;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.comprehension-layout {
  grid-template-columns: minmax(0, 1fr) 220px;
}

.comprehension-progress {
  display: grid;
  gap: 5px;
  align-self: start;
  padding: 10px 12px;
}

.comprehension-progress h3,
.comprehension-progress p {
  margin-bottom: 0;
}

.progress-mini-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.progress-mini-row strong {
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress-mini-row span,
.comprehension-progress p {
  color: var(--muted);
  font-size: 12px;
}

.comprehension-progress .meter {
  height: 8px;
  margin-top: 3px;
}

.panel,
.question-panel,
.audio-panel,
.vocab-card,
.exercise-panel,
.prompt-panel,
.chat-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 18px;
}

.question-panel,
.audio-panel,
.exercise-panel,
.prompt-panel {
  margin-bottom: 14px;
}

.question-panel h3,
.audio-panel h3,
.exercise-panel h3,
.prompt-panel h3,
.vocab-card h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.question-panel h3:focus,
.audio-panel h3:focus,
.exercise-panel h3:focus,
.prompt-panel h3:focus,
.vocab-card h3:focus {
  outline: none;
}

.option-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.option-button {
  width: 100%;
  min-height: 46px;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .option-button:not(.selected):not(.correct):not(.incorrect):hover {
    border-color: #d8d1ff;
    background: #fbfaff;
  }
}

@media (max-width: 720px) {
  .option-button:not(.selected):not(.correct):not(.incorrect):hover {
    border-color: var(--line);
    background: #ffffff;
  }
}

.option-button:active,
.primary-button:active,
.secondary-button:active,
.compact-button:active,
.mic-button:active,
.stop-button:active {
  transform: scale(0.96);
}

.option-button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-button.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-button.incorrect {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.feedback {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--muted);
  background: #F6F5FA;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.feedback.good {
  border-color: #DFD8FF;
  color: var(--accent-dark);
  background: var(--accent-soft);
  animation: reward-pop 220ms cubic-bezier(0.2, 0, 0, 1);
}

.feedback.warn {
  border-color: #efb8ae;
  color: #7f2d2a;
  background: var(--rose-soft);
  animation: soft-nudge 240ms ease;
}

.reward-chip {
  flex: 0 0 auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.answer-toast {
  position: fixed;
  z-index: 90;
  top: 82px;
  right: 24px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(336px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(79, 43, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 34px rgba(29, 20, 90, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(12px);
}

.answer-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.answer-toast.good {
  border-color: rgba(5, 161, 101, 0.3);
}

.answer-toast.warn {
  border-color: rgba(246, 45, 13, 0.28);
}

.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;
}

.answer-toast.warn .answer-toast-icon {
  background: #ff3d23;
}

.answer-toast span:last-child {
  display: grid;
  gap: 2px;
}

.answer-toast strong,
.answer-toast small {
  line-height: 1.25;
}

.answer-toast strong {
  font-size: 14px;
  font-weight: 600;
}

.answer-toast small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.focused-task-progress {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 18px;
  background: #F6F3FF;
}

.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-variant-numeric: tabular-nums;
  line-height: 1;
}

.focused-task-progress-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.focused-task-dots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 7px;
}

.focused-task-dot {
  height: 8px;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: #E7E2F7;
  cursor: pointer;
}

.focused-task-dot.done {
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.focused-task-dot.current {
  outline: 3px solid rgba(94, 47, 255, 0.16);
}

.focused-flow-actions {
  position: static;
  z-index: 35;
  display: grid;
  grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 18px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(23, 32, 51, 0.12);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.focused-flow-actions .compact-button {
  width: 100%;
  min-height: 48px;
}

.focused-flow-hint {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  font-weight: 600;
}

.order-builder {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.order-slot-row,
.word-bank-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 58px;
  align-items: center;
  padding: 12px;
  border: 1px solid #DFD8FF;
  border-radius: 16px;
  background: #ffffff;
}

.order-slot {
  min-height: 36px;
  min-width: 76px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.order-token,
.word-chip {
  min-height: 38px;
  border: 1px solid #DFD8FF;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.order-token.selected {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.word-bank-grid {
  background: #F9F7FF;
}

.phase-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.phase-actions p {
  margin-bottom: 0;
  color: var(--muted);
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: #EFEDF7;
  overflow: hidden;
  margin-top: 8px;
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--gold);
}

audio {
  width: 100%;
  min-height: 38px;
  margin: 8px 0 12px;
}

.hidden-transcript {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: #F6F5FA;
}

.hidden-transcript.revealed {
  color: var(--ink);
  background: var(--gold-soft);
  border-style: solid;
}

.notes-list {
  padding-left: 18px;
  color: var(--muted);
}

.notes-list li {
  margin-bottom: 6px;
}

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

  .vocab-deck {
    display: grid;
    gap: 14px;
    padding-bottom: 0;
  }

.vocab-deck-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

.vocab-score {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.vocab-score span,
.vocab-score strong {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
}

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

.deck-meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #EFEDF7;
}

.deck-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 220ms ease;
}

.vocab-sort-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(116px, 0.34fr) minmax(320px, 460px) minmax(116px, 0.34fr);
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.vocab-sort-button {
  min-width: 0;
  min-height: 118px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) + 6px);
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

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

.vocab-sort-button small {
  color: currentColor;
  opacity: 0.72;
  font-size: 12px;
  font-weight: 600;
}

.vocab-sort-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(31, 36, 50, 0.12);
}

.vocab-sort-button:active {
  transform: scale(0.96);
}

.sort-known {
  grid-column: 1;
  grid-row: 1;
  color: var(--known);
  border-color: rgba(8, 121, 109, 0.22);
  background: var(--known-soft);
}

.sort-new {
  grid-column: 3;
  grid-row: 1;
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.sort-known.chosen {
  border-color: var(--known);
  background: #D9F5EF;
}

.sort-new.chosen {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.vocab-card-shell {
  width: 100%;
  max-width: 460px;
  margin: 0;
  position: relative;
  perspective: 1000px;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}

.vocab-card-shell::before,
.vocab-card-shell::after {
  content: "";
  position: absolute;
  inset: 12px 18px auto;
  height: 92%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}

.vocab-card-shell::before {
  z-index: -2;
  transform: rotate(-4deg) translateX(-18px);
}

.vocab-card-shell::after {
  z-index: -1;
  transform: rotate(4deg) translateX(18px);
}

.vocab-card-shell .lesson-pop {
  opacity: 1;
  transform: none;
  animation: none;
}

.vocab-card-shell.slide-left .vocab-card {
  animation: card-enter-left 260ms cubic-bezier(0.2, 0, 0, 1);
}

.vocab-card-shell.slide-right .vocab-card,
.vocab-card-shell.slide-ready .vocab-card {
  animation: card-enter-right 260ms cubic-bezier(0.2, 0, 0, 1);
}

.vocab-card.deck-card {
  position: relative;
  z-index: 1;
  padding: 0;
  gap: 0;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  cursor: default;
  touch-action: pan-y;
  user-select: text;
  box-shadow: 0 18px 42px rgba(23, 32, 51, 0.16);
  transform: translate3d(var(--drag-x, 0), var(--drag-y, 0), 0) rotate(var(--drag-rotate, 0deg));
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms ease, border-color 180ms ease;
  will-change: transform;
}

.vocab-image[data-swipe-handle] {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.vocab-image[data-swipe-handle]:active {
  cursor: grabbing;
}

.vocab-card.deck-card.is-dragging {
  cursor: grabbing;
  animation: none !important;
  transition: none;
  box-shadow: 0 24px 58px rgba(23, 32, 51, 0.2);
}

.vocab-card.deck-card.throw-left {
  animation: none !important;
  transform: translate3d(-125%, -20px, 0) rotate(-15deg);
  opacity: 0;
  transition: transform 170ms ease, opacity 170ms ease;
}

.vocab-card.deck-card.throw-right {
  animation: none !important;
  transform: translate3d(125%, -20px, 0) rotate(15deg);
  opacity: 0;
  transition: transform 170ms ease, opacity 170ms ease;
}

.vocab-card-shell.intent-left .deck-card {
  border-color: var(--known);
}

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

.swipe-hint {
  position: absolute;
  top: 42%;
  z-index: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.94);
  transition: opacity 120ms ease, transform 120ms ease;
}

.swipe-hint-left {
  left: -78px;
  background: var(--known);
}

.swipe-hint-right {
  right: -62px;
  background: var(--accent);
}

.vocab-card-shell.intent-left .swipe-hint-left,
.vocab-card-shell.intent-right .swipe-hint-right {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.deck-card-body {
  display: grid;
  gap: 9px;
  padding: 14px 16px 16px;
}

.deck-card .vocab-image {
  margin: 0;
  border-radius: 14px 14px 0 0;
  height: min(230px, 42vh);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.deck-card .vocab-image img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  -webkit-user-drag: none;
}

.deck-card .headword {
  font-size: 24px;
}

.deck-card .dictionary-definition {
  font-size: 15px;
  line-height: 1.45;
}

.deck-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.deck-detail-grid p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.word-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
}

.word-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}

.word-details[open] {
  display: grid;
  gap: 12px;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.06);
}

.word-section-grid {
  display: grid;
  gap: 10px;
}

.word-section-grid.expanded {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.word-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.word-section p:last-child,
.word-section ul:last-child {
  margin-bottom: 0;
}

.word-section .mini-label {
  margin-bottom: 6px;
}

.examples-section,
.mistake-section,
.memory-section,
.micro-section {
  grid-column: 1 / -1;
}

.mistake-section {
  border-color: #efb8ae;
  color: #7f2d2a;
  background: #ffe6e2;
}

.mistake-section .mini-label {
  color: #9b332f;
}

.memory-section {
  border-color: #DFD8FF;
  background: var(--accent-soft);
}

.micro-section {
  border-color: #DFD8FF;
  color: var(--accent-dark);
  background: #F7F5FF;
  font-weight: 600;
}

.vocab-review-backdrop {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  padding: 14px 20px;
  max-width: 100vw;
  overflow-x: hidden;
  background: rgba(23, 32, 51, 0.34);
  backdrop-filter: blur(8px);
}

.vocab-review-popup {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 1px solid #DFD8FF;
  border-radius: calc(var(--radius) + 6px);
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(23, 32, 51, 0.28);
  user-select: text;
}

.vocab-review-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(79, 43, 255, 0.38) transparent;
  scrollbar-width: thin;
  padding: 16px 20px 12px;
}

.vocab-review-scroll::-webkit-scrollbar {
  width: 10px;
}

.vocab-review-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(79, 43, 255, 0.38);
  background-clip: content-box;
}

.vocab-review-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.vocab-review-scroll > .mini-label {
  margin-bottom: 10px;
}

.vocab-card.review-card {
  padding: 0;
  gap: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  background: #ffffff;
}

.review-card-side {
  flex: 0 0 320px;
  max-width: 34%;
  display: grid;
  align-content: start;
  border-right: 1px solid var(--line);
  background: #F6F5FA;
}

.review-card .vocab-image {
  margin: 0;
  align-self: start;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: #F6F5FA;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.review-card .vocab-image img {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 220px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.review-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.review-word-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.review-word-panel .headword {
  font-size: 24px;
}

.review-word-panel .ipa-row {
  display: grid;
  gap: 4px;
}

.review-card .dictionary-definition {
  font-size: 15px;
  line-height: 1.4;
  padding-left: 10px;
}

.definition-hero {
  padding: 16px 18px;
  border: 1px solid #DFD8FF;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 43, 255, 0.04);
}

.definition-pattern {
  margin: 2px 0 8px;
  color: var(--accent-dark);
  font-size: 19px;
  line-height: 1.35;
  font-weight: 600;
}

.definition-copy {
  margin-bottom: 0;
  padding-left: 13px;
  border-left: 4px solid var(--accent);
  color: var(--ink);
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  text-wrap: pretty;
}

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

.sound-button {
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #DFD8FF;
  border-radius: var(--radius-control);
  color: var(--accent-dark);
  background: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.sound-button:hover,
.sound-button.playing {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sound-button:active {
  transform: scale(0.96);
}

.sound-wave {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.sound-wave::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 2px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 4px -2px 0 currentColor, 8px 1px 0 currentColor;
}

.word-details-expanded {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-color: #DFD8FF;
  background: #FAF9FF;
}

.word-details-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.word-details-heading h4 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.review-card .word-section-grid {
  gap: 8px;
}

.review-card .word-section {
  padding: 9px 10px;
}

.review-card .word-section .mini-label {
  margin-bottom: 4px;
}

.review-card .example-list {
  padding-left: 16px;
}

.review-card .example-list li {
  margin-bottom: 3px;
}

.review-card .chip-row {
  gap: 5px;
}

.review-card .chip-row span {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 12px;
}

.review-card .scene-quote {
  padding: 9px 10px;
}

.review-card .examples-section,
.review-card .mistake-section,
.review-card .memory-section,
.review-card .micro-section {
  grid-column: auto;
}

.vocab-review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 10px 20px 12px;
  border-top: 1px solid #ECE7FF;
  background: #ffffff;
  box-shadow: 0 -10px 24px rgba(78, 47, 255, 0.08);
}

.vocab-review-actions .reference-links {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 0;
  border-top: 0;
}

.vocab-review-actions .primary-button {
  flex: 0 0 auto;
  min-width: 132px;
}

.vocab-nav-row {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.ghost-mini {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.ghost-mini:hover {
  color: var(--ink);
  background: var(--surface-strong);
  transform: translateY(-1px);
}

.ghost-mini:active {
  transform: scale(0.96);
}

.ghost-mini:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.vocab-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.vocab-dots button {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.vocab-dots button.sorted {
  border-color: #DFD8FF;
  background: var(--accent-soft);
}

.vocab-dots button.active {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.18);
}

.vocab-card {
  display: grid;
  gap: 11px;
  align-content: start;
  overflow: hidden;
}

.lesson-pop {
  opacity: 0;
  transform: translateY(10px);
  animation: pop-in 360ms cubic-bezier(0.2, 0, 0, 1) forwards;
  animation-delay: var(--delay, 0ms);
}

.vocab-image {
  position: relative;
  margin: -18px -18px 2px;
  background: #F6F5FA;
  border-bottom: 1px solid var(--line);
}

.vocab-image img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #FFFFFF;
}

.vocab-card h3,
.headword-row {
  margin-bottom: 0;
}

.headword-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.headword {
  font-size: 25px;
  line-height: 1.1;
}

.pos {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
  font-weight: 600;
}

.ipa-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.level-pill,
.topic-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.level-pill {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #DFD8FF;
}

.topic-pill {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #b6c9e6;
}

.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.reference-links > span:first-child {
  color: var(--ink);
  font-weight: 600;
}

.reference-links p {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 0;
}

.reference-links a,
.transcript-link {
  color: var(--accent-dark);
  display: inline;
  font-weight: 600;
  white-space: normal;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.grammar-label {
  color: var(--muted);
  margin-bottom: 0;
}

.dictionary-definition {
  font-size: 16px;
  line-height: 1.55;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.vocab-meta {
  color: var(--muted);
  font-size: 13px;
}

.example-list {
  padding-left: 18px;
  margin: 0;
}

.example-list li {
  margin-bottom: 6px;
}

.scene-quote {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--blue-soft);
}

.scene-quote span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.word-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.chip-row span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--ink);
  background: #F6F5FA;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}

.mini-label {
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.text-input,
.text-area {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
}

.text-input {
  min-height: 44px;
}

.text-area {
  min-height: 108px;
  resize: vertical;
}

.recorder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.mic-button,
.stop-button {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.mic-button {
  background: linear-gradient(135deg, var(--accent), #ef4f9b);
  box-shadow: 0 18px 34px rgba(94, 47, 255, 0.28);
}

.mic-button span {
  width: 18px;
  height: 24px;
  position: relative;
  display: block;
  border: 3px solid currentColor;
  border-radius: 999px;
  background: transparent;
}

.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 {
  background: #F3EEFF;
}

.stop-button span {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 5px;
  background: #9C83FF;
}

.mic-button:disabled,
.stop-button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
  box-shadow: none;
}

.speech-coach {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #F6F5FA;
}

.speech-coach.compact {
  margin-top: 12px;
}

.speech-coach-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.speech-coach-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.waveform-shell {
  position: relative;
  width: 100%;
  height: 74px;
  overflow: hidden;
  border: 1px solid #DFD8FF;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 14% 50%, rgba(94, 47, 255, 0.12), transparent 20%),
    linear-gradient(180deg, #ffffff, #F7F5FF);
}

.waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background:
    linear-gradient(180deg, transparent 49%, rgba(94, 47, 255, 0.18) 50%, transparent 51%),
    transparent;
}

.recording .waveform-canvas {
  background:
    linear-gradient(180deg, transparent 49%, rgba(46, 197, 182, 0.28) 50%, transparent 51%),
    #ffffff;
}

.speech-result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.speech-review-sheet {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #ded8f5;
  border-radius: 16px;
  background: #ffffff;
}

.speech-review-sheet.good {
  border-color: #bde5d3;
}

.speech-review-sheet.warn {
  border-color: #ebd1cb;
}

.speech-review-sheet > * + * {
  border-top: 1px solid #eeeaf7;
}

.speech-review-sheet .coach-processing {
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: #faf9ff;
  box-shadow: none;
}

.speech-review-sheet .coach-processing-meter {
  height: 4px;
}

.speech-review-transcript {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 12px 14px;
  background: #ffffff;
}

.speech-review-transcript span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.speech-review-transcript p {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.speech-review-sheet .speech-feedback,
.speech-review-sheet .speech-feedback.good,
.speech-review-sheet .speech-feedback.warn {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.speech-review-content {
  display: grid;
}

.speech-review-basic {
  padding: 14px;
}

.speech-review-basic .mini-label {
  margin: 0 0 6px;
}

.speech-review-basic > p:last-child {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.speech-review-basic ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.speech-review-basic li {
  line-height: 1.45;
}

.speech-review-verdict,
.speech-review-focus {
  min-width: 0;
  padding: 14px;
}

.speech-review-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.speech-review-label-row .mini-label,
.speech-review-focus .mini-label {
  margin: 0;
}

.speech-review-state {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  color: #6d231b;
  background: #fff0ec;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.speech-review-state.good {
  color: #056b49;
  background: #e8f8f1;
}

.speech-review-verdict > strong,
.speech-review-focus > strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
  text-wrap: pretty;
}

.speech-review-verdict > p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.speech-review-focus {
  border-top: 1px solid #eeeaf7;
  background: #faf9ff;
}

.speech-review-focus.good {
  background: #f6fcf9;
}

.speech-review-focus.warn {
  background: #fffaf8;
}

.speech-review-focus > strong {
  margin-top: 5px;
}

.speech-review-focus .coach-chip-row {
  margin-top: 10px;
}

.speech-review-focus ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.speech-review-focus li {
  line-height: 1.45;
}

.speech-review-encouragement {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid #e4f3ec;
  color: #056b49;
  background: #f6fcf9;
  line-height: 1.45;
}

.speech-coach.compact .waveform-shell {
  height: 48px;
}

.speech-coach.compact .speech-coach-head {
  align-items: center;
}

.speech-coach.compact .recorder {
  margin-top: 4px;
}

.speak-stack {
  display: grid;
  gap: 14px;
}

.speak-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-color: #DFD8FF;
  background:
    radial-gradient(circle at top right, rgba(94, 47, 255, 0.08), transparent 34%),
    #ffffff;
}

.speak-card-top,
.speaking-hero-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.mimic-panel .speak-card-top {
  display: block;
}

.mimic-card-copy {
  min-width: 0;
}

.mimic-card-copy h3,
.mimic-card-copy p {
  overflow-wrap: normal;
  word-break: normal;
}

.speak-step-badge,
.mic-orb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 12px 26px rgba(94, 47, 255, 0.22);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mic-orb::before {
  content: "";
  width: 15px;
  height: 20px;
  display: block;
  border: 3px solid currentColor;
  border-radius: 999px;
  background: transparent;
}

.mic-orb::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 24px;
  height: 13px;
  transform: translateX(-50%);
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 14px 14px;
}

.speak-step-badge.speech-icon::before {
  content: "";
  width: 16px;
  height: 22px;
  border-radius: 999px 999px 10px 10px;
  border: 3px solid currentColor;
  border-top-width: 6px;
}

.speak-instruction {
  max-width: none;
  color: var(--muted);
  text-wrap: pretty;
}

.listen-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: calc(var(--radius) + 4px);
  background: #F6F5FA;
  border: 1px solid #DFD8FF;
}


.listen-player audio {
  margin: 0;
}

.memory-cues,
.target-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-cues span,
.target-chip-row span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #F6F5FA;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.memory-cues span:first-child {
  color: #7f2d2a;
  background: var(--rose-soft);
  border-color: #efb8ae;
}

.memory-cues span.done,
.target-chip-row span {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #DFD8FF;
}

.speaking-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-color: #DFD8FF;
  background:
    linear-gradient(135deg, rgba(94, 47, 255, 0.08), transparent 46%),
    var(--surface-strong);
}

.speaking-panel h3 {
  max-width: none;
  text-wrap: balance;
  margin-bottom: 6px;
}

.speaking-question {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.16;
  text-wrap: balance;
}

.speaking-scenario {
  max-width: 66ch;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  text-wrap: pretty;
}

.word-bank-label {
  margin-bottom: -6px;
}

.speaking-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, 0.75fr);
  gap: 12px;
}

.speaking-focus-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid #DFD8FF;
  border-radius: calc(var(--radius) + 2px);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(81, 43, 255, 0.08);
}

.speaking-focus-card .mini-label {
  margin: 0;
}

.grammar-focus-card {
  color: #ffffff;
  background:
    radial-gradient(circle at 95% 0%, rgba(46, 197, 182, 0.35), transparent 38%),
    linear-gradient(135deg, #512bff, #875cff);
  border-color: transparent;
}

.grammar-focus-card .mini-label,
.grammar-focus-card span {
  color: rgba(255, 255, 255, 0.78);
}

.grammar-focus-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.22;
  text-wrap: balance;
}

.grammar-focus-card span {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.ai-coach-banner {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-radius: calc(var(--radius) + 4px);
  color: #ffffff;
  background:
    radial-gradient(circle at 96% 12%, rgba(46, 197, 182, 0.42), transparent 28%),
    linear-gradient(135deg, #2f1bb4 0%, #5e2fff 54%, #ef4f9b 100%);
  box-shadow: 0 18px 46px rgba(81, 43, 255, 0.22);
}

.ai-coach-icon,
.ai-coach-banner > span[aria-hidden="true"] {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #512bff;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 600;
}

.ai-coach-icon::before,
.ai-coach-banner > span[aria-hidden="true"]::before {
  content: "AI";
}

.ai-coach-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.ai-coach-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.ai-coach-banner strong {
  font-size: 18px;
  line-height: 1.25;
  text-wrap: balance;
}

.ai-coach-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.42;
}

.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;
}

.speech-coach.free-speech {
  margin-top: 0;
  border-color: #d8cffd;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(81, 43, 255, 0.1);
}

.voice-summary-panel {
  border-color: #DFD8FF;
  background: #ffffff;
}

.speech-coach.blind {
  border-color: #DFD8FF;
  background: linear-gradient(180deg, #F6F5FA, #ffffff);
}

.voice-recorder {
  align-items: stretch;
}

.voice-recorder .primary-button,
.voice-recorder .secondary-button {
  min-height: 44px;
}

.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);
}

.compare-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #DFD8FF;
  border-radius: 16px;
  background: #F7F4FF;
}

.compare-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.compare-strip .compact-button {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--rose);
  display: none;
}

.recording .recording-dot {
  display: inline-block;
}

.grammar-pattern-sheet {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.grammar-pattern-main {
  display: grid;
  gap: 10px;
  max-width: 74ch;
}

.grammar-pattern-main h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(25px, 2.5vw, 36px);
  line-height: 1.1;
  font-weight: 600;
  text-wrap: balance;
}

.grammar-build {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.grammar-build span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  animation: pop-in 340ms cubic-bezier(0.2, 0, 0, 1) forwards;
  animation-delay: var(--delay, 0ms);
}

.grammar-fact-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) minmax(0, 0.9fr);
  gap: 12px 16px;
  margin: 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.grammar-core-facts {
  grid-template-columns: minmax(0, 1fr);
  max-width: 62ch;
}

.grammar-fact-list div {
  min-width: 0;
}

.grammar-fact-list dt {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  text-transform: uppercase;
}

.grammar-fact-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.34;
}

.grammar-task-section {
  margin: 20px 0 24px;
  padding-top: 18px;
  border-top: 2px solid #e9e5f6;
}

.grammar-task-heading {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.grammar-task-number {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.grammar-task-heading h3 {
  margin: 2px 0 3px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 600;
  text-wrap: balance;
}

.grammar-task-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-wrap: pretty;
}

.grammar-task-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: #5f5578;
  background: #f0edf8;
  font-size: 12px;
  font-weight: 600;
}

.grammar-speech-task.is-locked .grammar-task-number {
  color: #6f6981;
  background: #ebe8f2;
}

.grammar-task-locked-copy {
  margin: 0;
  padding: 13px 15px;
  border-left: 3px solid #cfc8e4;
  border-radius: 0 10px 10px 0;
  color: #625d72;
  background: #f8f7fb;
  font-size: 14px;
  line-height: 1.4;
}

.grammar-speaking-brief {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: #f7f5ff;
}

.grammar-speaking-brief h4 {
  max-width: 58ch;
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  text-wrap: balance;
}

.grammar-speaking-cues {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px 22px;
  padding-top: 10px;
  border-top: 1px solid #ddd7f4;
}

.grammar-speaking-cues p {
  display: grid;
  gap: 3px;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.grammar-speaking-cues span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.grammar-speaking-cues strong {
  font-size: 17px;
  font-weight: 600;
}

.grammar-speech-task .speech-coach.free-speech {
  margin-top: 12px;
}

.grammar-usage-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  align-items: start;
  margin: 0 0 14px;
  padding: 0 2px;
}

.grammar-usage-notes > div {
  min-width: 0;
}

.grammar-usage-notes p {
  margin: 0;
}

.grammar-caution-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grammar-caution-list li {
  position: relative;
  padding-left: 16px;
  color: var(--ink);
  line-height: 1.34;
}

.grammar-caution-list li::before {
  content: "";
  position: absolute;
  top: 0.63em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--rose);
}

body.grammar-bonus-open {
  overflow: hidden;
}

.grammar-bonus-trigger {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid #DDD5FF;
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(31, 24, 70, 0.08);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition-property: transform, border-color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: ease-out;
}

.grammar-bonus-trigger:hover {
  border-color: #BEB0FF;
  box-shadow: 0 14px 30px rgba(31, 24, 70, 0.12);
}

.grammar-bonus-trigger:active {
  transform: scale(0.96);
}

.grammar-bonus-trigger:focus-visible {
  outline: 3px solid rgba(81, 43, 255, 0.24);
  outline-offset: 3px;
}

.grammar-bonus-trigger-icon,
.grammar-bonus-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5A3A00;
  background: #FFE39A;
  box-shadow: inset 0 0 0 1px rgba(90, 58, 0, 0.14);
}

.grammar-bonus-trigger-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.grammar-bonus-gift {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grammar-bonus-trigger-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.grammar-bonus-trigger-copy small {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.grammar-bonus-trigger-copy strong {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

.grammar-bonus-trigger-action {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 600;
}

.grammar-bonus-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 10, 28, 0.56);
  backdrop-filter: blur(6px);
  animation: grammar-bonus-backdrop-in 180ms ease-out both;
}

.grammar-bonus-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: calc(var(--radius) + 2px);
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 32px 80px rgba(9, 7, 24, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.72);
  animation: grammar-bonus-dialog-in 260ms cubic-bezier(0.2, 0, 0, 1) both;
}

.grammar-bonus-dialog::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  height: 5px;
  background: linear-gradient(90deg, #FFCB52 0 30%, var(--accent) 30% 100%);
}

.grammar-bonus-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: #3E3B50;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(31, 24, 70, 0.12), 0 8px 20px rgba(31, 24, 70, 0.10);
  cursor: pointer;
  transition-property: transform, color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: ease-out;
}

.grammar-bonus-close span,
.grammar-bonus-close span::after {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.grammar-bonus-close span::after {
  content: "";
  transform: rotate(90deg);
}

.grammar-bonus-close:hover {
  color: var(--accent-dark);
  box-shadow: 0 0 0 1px rgba(81, 43, 255, 0.24), 0 10px 22px rgba(31, 24, 70, 0.14);
}

.grammar-bonus-close:active,
.grammar-bonus-done:active {
  transform: scale(0.96);
}

.grammar-bonus-close:focus-visible,
.grammar-bonus-done:focus-visible {
  outline: 3px solid rgba(81, 43, 255, 0.25);
  outline-offset: 3px;
}

.grammar-bonus-header {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 28px 76px 22px 28px;
  background: #FFFCF3;
  border-bottom: 1px solid #EEE8D8;
}

.grammar-bonus-lockup {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.grammar-bonus-lockup .grammar-bonus-gift {
  width: 32px;
  height: 32px;
}

.grammar-bonus-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1px 0 7px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.grammar-bonus-kicker span {
  color: #5A3A00;
}

.grammar-bonus-header h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
}

.grammar-bonus-header > div > p:last-child {
  max-width: 52ch;
  margin: 9px 0 0;
  color: #545166;
  font-size: 15px;
  line-height: 1.48;
  text-wrap: pretty;
}

.grammar-bonus-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 28px;
}

.grammar-bonus-note {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid #EEEAF8;
  opacity: 0;
  transform: translateY(8px);
  animation: grammar-bonus-note-in 240ms ease-out forwards;
  animation-delay: calc(100ms + (var(--bonus-index) * 70ms));
}

.grammar-bonus-note:last-child {
  border-bottom: 0;
}

.grammar-bonus-note-number {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.grammar-bonus-note > div {
  min-width: 0;
}

.grammar-bonus-note h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.24;
  font-weight: 600;
  text-wrap: balance;
}

.grammar-bonus-note p {
  margin: 6px 0 0;
  color: #454256;
  font-size: 15px;
  line-height: 1.48;
  text-wrap: pretty;
}

.grammar-bonus-note blockquote {
  margin: 11px 0 0;
  padding: 9px 12px;
  border-left: 3px solid var(--accent);
  color: var(--accent-dark);
  background: #F5F2FF;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

.grammar-bonus-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}

.grammar-bonus-links a {
  color: var(--accent-dark);
}

.grammar-bonus-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px 16px 28px;
  border-top: 1px solid #EEEAF8;
  background: #ffffff;
}

.grammar-bonus-footer p {
  margin: 0;
  color: #666277;
  font-size: 13px;
  line-height: 1.4;
}

.grammar-bonus-done {
  min-width: 124px;
  min-height: 46px;
  transition-property: transform, background-color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: ease-out;
}

@keyframes grammar-bonus-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes grammar-bonus-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes grammar-bonus-note-in {
  to { opacity: 1; transform: translateY(0); }
}

.chat-log {
  height: 300px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #F6F5FA;
}

.message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: var(--radius);
}

.message.ai {
  justify-self: start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message.user {
  justify-self: end;
  color: #ffffff;
  background: var(--accent);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.summary-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.summary-list li {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.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);
}

.data-link {
  color: var(--accent-dark);
  font-weight: 600;
}

.review-section {
  margin: 16px 0;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.review-heading h3 {
  margin: 3px 0 0;
  font-size: 22px;
}

.review-note {
  max-width: 58ch;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.review-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.review-video {
  position: static;
  max-width: 840px;
  width: 100%;
}

.subtitle-panel {
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 8px;
  padding-right: 0;
}

.subtitle-line {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  color: var(--ink);
  background: #ffffff;
}

.subtitle-line span:last-child {
  display: block;
  min-width: 0;
  line-height: 1.5;
  text-wrap: pretty;
}

.subtitle-line span:last-child > strong {
  display: block;
  margin-bottom: 4px;
}

.timecode {
  color: var(--blue);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scene-notes-section {
  margin: 18px 0 4px;
  display: grid;
  gap: 12px;
}

.scene-notes-heading {
  display: grid;
  gap: 4px;
}

.scene-notes-heading h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
  text-wrap: balance;
}

.scene-notes-heading p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-wrap: pretty;
}

.scene-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.scene-note-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.scene-note-card img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  outline: 1px solid oklch(0 0 0 / 0.1);
}

.scene-note-card h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 15px;
  line-height: 1.25;
  text-wrap: balance;
}

.scene-note-card p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  text-wrap: pretty;
}

.scene-note-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.scene-note-links .data-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  text-decoration: none;
}

@keyframes pop-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reward-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes soft-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-3px);
  }
  70% {
    transform: translateX(3px);
  }
}

@keyframes card-enter-left {
  0% {
    opacity: 0;
    transform: translate3d(-42px, 6px, 0) rotate(-4deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0);
  }
}

@keyframes card-enter-right {
  0% {
    opacity: 0;
    transform: translate3d(42px, 6px, 0) rotate(4deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0);
  }
}

@media (max-width: 940px) {
  .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 16px;
  }

  .stage {
    order: 1;
  }

  .rail {
    order: 2;
    position: static;
  }

  .phase-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid,
  .vocab-grid,
  .deck-detail-grid,
  .speech-result,
  .grammar-fact-list,
  .grammar-usage-notes,
  .review-grid,
  .scene-note-grid {
    grid-template-columns: 1fr;
  }

  .review-video {
    position: static;
  }

  .mission-hud {
    width: 100%;
    flex-basis: auto;
  }

  .word-section-grid.expanded {
    grid-template-columns: 1fr;
  }

  .vocab-card.review-card {
    display: block;
    overflow: visible;
  }

  .review-card-side {
    max-width: none;
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-card .vocab-image {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-card .vocab-image img {
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 0 12px;
    gap: 8px;
  }

  .brand {
    font-size: 18px;
  }

  .lesson-meta {
    display: flex;
    gap: 6px;
    font-size: 12px;
  }

  .lesson-menu {
    order: 3;
    flex-basis: 100%;
    justify-content: stretch;
    padding-bottom: 8px;
  }

  .lesson-menu summary {
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }

  .lesson-menu-popover {
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
  }

  .lesson-meta span:first-child {
    display: none;
  }

  .lesson-meta span {
    padding: 4px 8px;
  }

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

  .progress-track {
    top: 104px;
  }

  .stage,
  .rail {
    min-width: 0;
    max-width: 100%;
    border-radius: 10px;
  }

  .rail {
    padding: 12px;
  }

  .vocab-review-backdrop {
    align-items: end;
    padding: 10px;
  }

  .vocab-review-popup {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 128px);
    border-radius: 14px;
  }

  .vocab-review-scroll {
    padding: 14px;
  }

  .vocab-review-actions {
    display: grid;
    justify-items: stretch;
    padding: 12px 14px 14px;
  }

  .vocab-review-actions .reference-links {
    justify-content: center;
    text-align: center;
  }

  .vocab-review-actions .reference-links p {
    justify-content: center;
  }

  .vocab-review-actions .primary-button {
    width: 100%;
  }

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

  .rail h1 {
    font-size: 18px;
  }

  .phase-list {
    display: flex;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .phase-item {
    min-width: 150px;
    grid-template-columns: 26px 1fr;
    padding: 8px;
    scroll-snap-align: start;
  }

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

  .ghost-button {
    min-height: 44px;
  }

  #lesson-stage {
    padding: 14px;
  }

  .stage-header,
  .watch-note,
  .phase-actions,
  .chat-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

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

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

  .stage-header p {
    font-size: 14px;
  }

  .mission-hud {
    padding: 10px;
    box-shadow: none;
  }

  .level-notice {
    margin: -4px 0 14px;
    font-size: 13px;
  }

  .video-frame,
  video {
    border-radius: 8px;
  }

  .speed-row {
    gap: 6px;
  }

  .speed-button {
    flex: 1;
    min-width: 0;
  }

  .watch-focus {
    display: grid;
    grid-template-columns: 1fr;
  }

  .watch-focus strong {
    justify-content: center;
  }

  .unlock-card {
    min-height: 116px;
    padding: 15px;
  }

  .unlock-card strong {
    font-size: 20px;
  }

  .panel,
  .question-panel,
  .audio-panel,
  .vocab-card,
  .exercise-panel,
  .prompt-panel,
  .chat-panel {
    padding: 14px;
  }

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

  .option-button {
    min-height: 52px;
    padding: 12px;
  }

  .feedback {
    display: grid;
    gap: 7px;
  }

  .reward-chip {
    width: max-content;
  }

  .button-row,
  .recorder {
    align-items: stretch;
  }

  .button-row button,
  .recorder button {
    width: 100%;
  }

  .speak-panel,
  .speaking-panel {
    padding: 14px;
  }

  .speak-card-top,
  .speaking-hero-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .speak-step-badge,
  .mic-orb {
    width: 42px;
    height: 42px;
  }

  .listen-player {
    grid-template-columns: 1fr;
  }

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

  .speech-review-transcript {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .speech-review-verdict,
  .speech-review-focus {
    padding: 12px;
  }

  .word-detail-grid {
    grid-template-columns: 1fr;
  }

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

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

  .vocab-sort-layout {
    max-width: min(100%, 430px);
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .vocab-card-shell,
  .vocab-nav-row {
    max-width: min(100%, 390px);
  }

  .vocab-card-shell {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    overflow: hidden;
  }

  .vocab-sort-button {
    min-height: 54px;
    padding: 9px 10px;
    border-radius: var(--radius);
  }

  .sort-known {
    grid-column: 1;
    grid-row: 2;
  }

  .sort-new {
    grid-column: 2;
    grid-row: 2;
  }

  .swipe-hint {
    top: 34%;
    font-size: 11px;
    min-height: 34px;
    padding: 6px 8px;
  }

  .swipe-hint-left {
    left: 8px;
  }

  .swipe-hint-right {
    right: 8px;
  }

  .deck-card .vocab-image img {
    max-height: none;
  }

  .deck-card .vocab-image {
    height: clamp(118px, 31vh, 160px);
  }

  .deck-card-body {
    gap: 7px;
    padding: 10px 12px 12px;
  }

  .deck-card .headword {
    font-size: 20px;
  }

  .deck-card .dictionary-definition {
    font-size: 14px;
    line-height: 1.35;
  }

  .deck-card .scene-quote {
    gap: 4px;
    padding: 9px;
  }

  .deck-card .word-details summary {
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .vocab-image {
    margin: -14px -14px 0;
  }

  .vocab-image img {
    aspect-ratio: 4 / 3;
  }

  .deck-card .vocab-image {
    margin: 0;
  }

  .deck-card .vocab-image img {
    aspect-ratio: 16 / 10;
  }

  .headword {
    font-size: 22px;
  }

  .dictionary-definition {
    font-size: 15px;
  }

  .grammar-pattern-sheet {
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
  }

  .grammar-pattern-main h3 {
    font-size: 22px;
    line-height: 1.12;
  }

  .grammar-task-section {
    margin: 16px 0 20px;
    padding-top: 14px;
  }

  .grammar-task-heading {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 9px;
    margin-bottom: 11px;
  }

  .grammar-task-number {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .grammar-task-heading h3 {
    font-size: 18px;
  }

  .grammar-task-heading p:last-child {
    font-size: 13px;
  }

  .grammar-task-badge {
    min-height: 28px;
    padding: 4px 8px;
  }

  .grammar-speaking-brief {
    gap: 8px;
    padding: 13px 12px;
  }

  .grammar-speaking-brief h4 {
    font-size: 17px;
    line-height: 1.28;
  }

  .grammar-speaking-cues {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 8px;
  }

  .grammar-speaking-cues strong {
    font-size: 15px;
  }

  .grammar-build span {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 13px;
  }

  .grammar-fact-list div {
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid #E6E0FF;
  }

  .grammar-fact-list div:last-child {
    border-bottom: 0;
  }

  .grammar-core-facts div {
    padding: 6px 0;
  }

  .grammar-fact-list dd,
  .grammar-usage-notes p,
  .grammar-caution-list li {
    font-size: 14px;
    line-height: 1.34;
  }

  .text-area {
    min-height: 96px;
  }

  .chat-log {
    height: 260px;
  }

  .message {
    max-width: 94%;
  }

  .review-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .subtitle-line {
    grid-template-columns: 48px 1fr;
    min-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 640px) {
  .stage-header {
    margin-bottom: 12px;
  }

  .compact-stage-header h2 {
    font-size: clamp(26px, 9vw, 36px);
    line-height: 1.02;
  }

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

  .stage-kicker-row {
    gap: 6px;
  }

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

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

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

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

  .focused-flow-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    grid-template-columns: minmax(84px, 0.4fr) minmax(0, 1fr);
    width: min(100%, 100vw);
    max-width: 100%;
    margin-top: 12px;
    padding: 8px;
    border-radius: 16px;
  }

  .focused-flow-actions .compact-button {
    min-height: 46px;
    padding: 0 10px;
  }

  .grammar-bonus-trigger {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 14px;
    padding: 9px 10px;
  }

  .grammar-bonus-trigger-icon {
    width: 40px;
    height: 40px;
  }

  .grammar-bonus-trigger-copy strong {
    font-size: 14px;
  }

  .grammar-bonus-trigger-action {
    font-size: 13px;
  }

  .grammar-bonus-backdrop {
    padding: 8px;
  }

  .grammar-bonus-dialog {
    max-height: calc(100dvh - 16px);
    border-radius: var(--radius);
  }

  .grammar-bonus-close {
    top: 10px;
    right: 10px;
  }

  .grammar-bonus-header {
    display: block;
    padding: 20px 58px 16px 16px;
  }

  .grammar-bonus-lockup {
    float: left;
    width: 40px;
    height: 40px;
    margin: 0 10px 6px 0;
    border-radius: 10px;
  }

  .grammar-bonus-lockup .grammar-bonus-gift {
    width: 23px;
    height: 23px;
  }

  .grammar-bonus-kicker {
    min-height: 40px;
    align-content: center;
    gap: 5px;
    margin-bottom: 5px;
    font-size: 10px;
  }

  .grammar-bonus-header h2 {
    clear: both;
    font-size: 23px;
  }

  .grammar-bonus-header > div > p:last-child {
    font-size: 14px;
  }

  .grammar-bonus-list {
    padding: 0 16px;
  }

  .grammar-bonus-note {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 0;
  }

  .grammar-bonus-note h3 {
    font-size: 16px;
  }

  .grammar-bonus-note p {
    font-size: 14px;
  }

  .grammar-bonus-note blockquote {
    padding: 8px 10px;
    font-size: 13px;
  }

  .grammar-bonus-footer {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px;
  }

  .grammar-bonus-done {
    width: 100%;
  }

  .answer-toast {
    top: 118px;
    right: 10px;
    left: 10px;
    bottom: auto;
    max-width: none;
    padding: 9px 10px;
  }

  .answer-toast small {
    display: none;
  }

  .order-slot-row,
  .word-bank-grid {
    min-height: 50px;
    padding: 9px;
  }

  .order-token,
  .word-chip {
    min-height: 36px;
    padding: 7px 10px;
  }

  .mic-button,
  .stop-button {
    width: 58px;
    height: 58px;
  }

  .mic-button span {
    width: 18px;
    height: 24px;
  }

  .speech-coach.blind {
    padding: 10px;
  }

  .mimic-principle {
    padding: 11px;
  }

  .compare-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .compare-strip .compact-button {
    width: 100%;
  }

  .speaking-question {
    font-size: 22px;
    line-height: 1.18;
  }

  .speaking-focus-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .speaking-focus-card {
    padding: 12px;
    border-radius: 16px;
  }

  .grammar-focus-card strong {
    font-size: 16px;
  }

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

  .ai-coach-icon,
  .ai-coach-banner > span[aria-hidden="true"] {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .ai-coach-banner strong {
    font-size: 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;
  }

}

@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;
  }

  .grammar-bonus-header {
    padding-top: 16px;
    padding-bottom: 13px;
  }

  .grammar-bonus-header h2 {
    font-size: 22px;
  }

  .grammar-bonus-header > div > p:last-child {
    margin-top: 7px;
    line-height: 1.4;
  }

  .grammar-bonus-footer p {
    display: none;
  }

  .grammar-task-heading {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .grammar-task-badge {
    grid-column: 2;
    justify-self: start;
  }
}

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


/* ===== Role Play mimic (Mini Lessons 11-15) ===== */
.roleplay-cast {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}
.roleplay-cast > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(81, 43, 255, 0.14);
}
.roleplay-cast-you { background: #f6f5fa; }
.roleplay-cast strong {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.25;
}
.roleplay-chip {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
}
.roleplay-chip.you { background: #512bff; color: #fff; }
.roleplay-chip.them { background: #e9e4ff; color: #3a2a7a; }

.roleplay-stack {
  gap: 10px;
}

.roleplay-cue {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(81, 43, 255, 0.16);
  box-shadow: 0 10px 26px rgba(25, 16, 68, 0.06);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.roleplay-cue.is-playing,
.roleplay-your-line.is-playing {
  border-color: rgba(81, 43, 255, 0.55);
  box-shadow: 0 8px 24px rgba(81, 43, 255, 0.14);
}
.roleplay-cue-empty {
  background: #f6f5fa;
}
.roleplay-cue-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.roleplay-cue-kicker {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  color: #512bff;
  background: #ede9ff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.roleplay-cue-head strong {
  min-width: 0;
  color: #0b0a12;
  font-size: 14px;
  line-height: 1.2;
}
.roleplay-cue-head small {
  margin-left: auto;
  color: #6c6880;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.roleplay-cue p {
  margin: 0;
  color: #5c6480;
  font-size: 12px;
  line-height: 1.35;
}
.roleplay-cue audio { width: 100%; }
.roleplay-cue:not(.roleplay-closing) .roleplay-sequence-audio,
.roleplay-panel > .roleplay-sequence-audio { display: none; }

.roleplay-panel {
  padding: 16px;
  border-color: rgba(81, 43, 255, 0.2);
}
.roleplay-panel .speak-card-top {
  padding-bottom: 6px;
}
.roleplay-panel .roleplay-actions { margin: 8px 0 12px; }
.roleplay-your-label { margin: 0 0 6px; }
.roleplay-your-line {
  border-radius: 12px;
  border: 1px solid rgba(81, 43, 255, 0.14);
  background: #f6f5fa;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.roleplay-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.roleplay-targets span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #512bff;
  background: #ede9ff;
  font-size: 11px;
  font-weight: 600;
}
.roleplay-why {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #5c6480;
}

@media (min-width: 860px) {
  .roleplay-stack {
    grid-template-columns: minmax(230px, 0.72fr) minmax(420px, 1.28fr);
    align-items: start;
  }
  .roleplay-stack > .roleplay-cue {
    margin-bottom: 0;
  }
  .roleplay-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: end;
  }
  .roleplay-panel .speak-card-top {
    grid-column: 1 / -1;
  }
  .roleplay-panel .roleplay-actions {
    grid-column: 1;
    margin: 4px 0 0;
  }
  .roleplay-panel > .speech-coach.blind {
    grid-column: 2;
    align-self: end;
  }
  .roleplay-panel .mic-recorder {
    flex-wrap: nowrap;
    gap: 7px;
    margin: 0;
  }
  .roleplay-stack > .roleplay-closing {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .roleplay-cast { gap: 6px; }
  .roleplay-cast > div { gap: 6px; padding: 8px; border-radius: 12px; }
  .roleplay-cast strong { font-size: 12.5px; }
  .roleplay-chip { padding: 4px 7px; font-size: 10px; }
  .roleplay-cue { padding: 12px; }
  .roleplay-cue-head { align-items: flex-start; flex-wrap: wrap; }
  .roleplay-cue-head small { margin-left: 0; }
  .roleplay-panel { padding: 14px; }
  .roleplay-panel .roleplay-actions button { width: 100%; }
}

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