:root {
  --paper: #F3F5F4;
  --ink: #151817;
  --charcoal: #252927;
  --coral: #D95F4B;
  --paper-muted: #C7CECA;
  --ink-muted: #69716D;
  --ink-dim: #919A95;
  --rule: rgba(21, 24, 23, .17);
  --dark-rule: rgba(243, 245, 244, .2);
  --dark-dim: rgba(243, 245, 244, .63);
  --sans: "Manrope", Arial, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --radius: 6px;
  --ease: cubic-bezier(.22, .8, .2, 1);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body,
button { -webkit-tap-highlight-color: transparent; }

button,
a { font: inherit; }

button {
  border: 0;
  cursor: pointer;
}

button:disabled { cursor: not-allowed; opacity: .45; }

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

a { color: inherit; text-decoration: none; }

[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }

.main-content { min-height: 100vh; }

.site-masthead {
  width: 100%;
  min-height: 64px;
  padding: 0 34px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--coral);
  color: var(--paper);
  font: 700 11px var(--mono);
  letter-spacing: 0;
}

.brand-name { min-width: 0; display: grid; gap: 1px; }
.brand strong { font-size: 14px; line-height: 1; letter-spacing: 0; }
.brand small { color: var(--ink-muted); font: 500 9px var(--mono); letter-spacing: 0; text-transform: uppercase; }

.primary-nav { display: flex; align-items: center; gap: 4px; }

.primary-nav button {
  min-height: 35px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.primary-nav button:hover,
.primary-nav button:focus-visible { border-color: var(--rule); color: var(--ink); }
.primary-nav button:active { transform: scale(.97); }
.primary-nav button.active { border-color: var(--coral); color: var(--ink); }
.primary-nav svg { width: 15px; height: 15px; stroke-width: 1.8; }
.primary-nav em { min-width: 17px; height: 17px; padding: 0 4px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--charcoal); color: var(--paper); font: 600 9px var(--mono); font-style: normal; }
.primary-nav button.active em { background: var(--coral); }

.masthead-meta { justify-self: end; display: flex; align-items: center; gap: 14px; color: var(--ink-muted); font: 600 10px var(--mono); text-transform: uppercase; }
.masthead-meta #sidebar-phase-label { display: none; }

.mobile-nav { display: none; }

.app-view { width: 100%; min-height: calc(100vh - 64px); padding: 24px 34px 44px; display: none; flex-direction: column; gap: 22px; }
.app-view.active { display: flex; }

.eyebrow,
.lesson-index,
.lesson-meta,
.pulse-item > span,
.stage-topline,
.lesson-command > span,
.stage-label,
.teach-step > span,
.phrase-theater-kicker,
.phrase-teach-panel > span,
.review-label,
.review-rule,
.mission-index,
.mission-state,
.lesson-pattern-kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow { margin: 0; color: var(--coral); }

.view-heading {
  width: min(1180px, 100%);
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.view-heading h1 { margin: 5px 0 0; color: var(--ink); font-size: clamp(24px, 3vw, 42px); line-height: 1; letter-spacing: 0; }
.view-heading-tools { display: flex; align-items: center; gap: 18px; }
.view-counter { color: var(--ink-muted); font: 600 11px var(--mono); white-space: nowrap; }
.view-counter strong { color: var(--ink); font-size: 18px; }
.view-intro { max-width: 510px; margin: 12px 0 0; color: var(--ink-muted); font-size: 13px; }

.text-control,
.all-lines-button,
.icon-button {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.text-control:hover,
.text-control:focus-visible,
.all-lines-button:hover,
.all-lines-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible { border-color: var(--coral); color: var(--ink); }
.text-control:active,
.all-lines-button:active,
.icon-button:active { transform: scale(.97); }
.text-control svg,
.all-lines-button svg,
.icon-button svg { width: 15px; height: 15px; stroke-width: 1.8; }
.icon-button { width: 36px; padding: 0; }

/* The home view is one photographic sheet with a small live ticker above it. */
.home-view { padding-top: 17px; }
.daily-sheet { width: min(1440px, 100%); margin: 0 auto; }

.rio-pulse { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.rio-ticker { min-height: 56px; display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2.6fr) auto; align-items: center; gap: 18px; }
.rio-ticker .eyebrow { color: var(--ink); font-weight: 700; }
.pulse-grid { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pulse-item { min-width: 0; padding: 0 17px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: baseline; }
.pulse-item + .pulse-item { border-left: 1px solid var(--rule); }
.pulse-item > span { grid-column: 1; color: var(--ink-muted); font-size: 9px; }
.pulse-item strong { grid-column: 2; color: var(--ink); font-size: 14px; line-height: 1; white-space: nowrap; }
.pulse-item small { grid-column: 2; min-width: 0; overflow: hidden; color: var(--ink-muted); font-size: 10px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.ticker-refresh { white-space: nowrap; }

.today-hero {
  --home-image: url("assets/week-01/day-01-restaurant.jpg");
  min-height: calc(100vh - 164px);
  margin-top: 18px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius);
  background-color: var(--charcoal);
  background-image: var(--home-image);
  background-position: center 38%;
  background-size: cover;
  background-blend-mode: multiply;
}

.today-hero::before { position: absolute; inset: 0; z-index: -1; background: rgba(21, 24, 23, .46); content: ""; }
.today-hero::after { position: absolute; inset: 0; z-index: -1; border: 1px solid rgba(243, 245, 244, .24); border-radius: var(--radius); content: ""; pointer-events: none; }

.hero-webgl { width: 35%; height: 55%; position: absolute; z-index: 0; top: 10%; right: 3%; opacity: .7; pointer-events: none; }
.hero-webgl.no-webgl { display: none; }

.today-hero-copy { width: min(720px, 62%); padding: clamp(36px, 7vw, 92px) clamp(28px, 5vw, 74px) 42px; position: relative; z-index: 1; }
.today-date { color: var(--paper); }
.hero-greeting { margin: 7px 0 0; color: var(--paper-muted); font-size: 12px; }
.today-hero-copy .lesson-index { margin: 28px 0 0; color: var(--paper-muted); }
.today-hero-copy h1 { max-width: 760px; margin: 10px 0 0; color: var(--paper); font-size: clamp(45px, 6.4vw, 92px); font-weight: 800; line-height: .94; letter-spacing: 0; }
.hero-outcome { max-width: 600px; margin: 24px 0 0; color: var(--paper); font-size: clamp(17px, 1.8vw, 25px); font-weight: 600; line-height: 1.18; }
.hero-support { max-width: 460px; margin: 13px 0 0; color: var(--dark-dim); font-size: 13px; }
.lesson-meta { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 0; color: var(--paper-muted); }
.lesson-meta span { padding-right: 15px; }
.lesson-meta span + span { padding-left: 15px; border-left: 1px solid var(--dark-rule); }
.lesson-meta [data-state="error"] { color: var(--coral); }
.session-actions { margin-top: 26px; display: flex; gap: 8px; }
.start-lesson-button,
.session-action,
.stage-controls button,
.phrase-theater-actions button,
.review-main-actions button,
.review-modal-actions button,
.mission-play { min-height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(243, 245, 244, .42); border-radius: var(--radius); background: rgba(21, 24, 23, .58); color: var(--paper); font-size: 11px; font-weight: 800; transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease; }
.start-lesson-button:hover,
.session-action:hover,
.stage-controls button:hover,
.phrase-theater-actions button:hover,
.review-main-actions button:hover,
.review-modal-actions button:hover,
.mission-play:hover { border-color: var(--coral); color: var(--paper); }
.start-lesson-button:active,
.session-action:active,
.stage-controls button:active,
.phrase-theater-actions button:active,
.review-main-actions button:active,
.review-modal-actions button:active,
.mission-play:active { transform: scale(.97); }
.start-lesson-button { border-color: var(--coral); background: var(--coral); color: var(--paper); }
.start-lesson-button:hover { background: #C85140; }
.start-lesson-button svg,
.session-action svg,
.stage-controls svg,
.phrase-theater-actions svg,
.review-main-actions svg,
.review-modal-actions svg,
.mission-play svg { width: 16px; height: 16px; stroke-width: 1.8; }

.home-lower-edge { margin-top: auto; padding: 0 clamp(28px, 5vw, 74px) 142px; position: relative; z-index: 1; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.home-anchor { max-width: 600px; padding-left: 15px; border-left: 3px solid var(--coral); }
.home-anchor span { display: block; color: var(--paper-muted); font: 600 9px var(--mono); text-transform: uppercase; }
.home-anchor strong { display: block; margin-top: 6px; color: var(--paper); font-size: clamp(16px, 1.7vw, 23px); line-height: 1.15; }
.home-commands { display: flex; gap: 7px; }
.home-commands .session-action { min-height: 32px; padding: 0 9px; border-color: transparent; background: transparent; color: var(--paper-muted); }
.home-commands .session-action:hover { border-color: rgba(243, 245, 244, .35); }

.lesson-queue { position: absolute; right: 0; bottom: 0; left: 0; z-index: 2; padding: 14px clamp(18px, 3vw, 42px) 16px; background: rgba(21, 24, 23, .87); color: var(--paper); }
.queue-header { display: flex; align-items: baseline; gap: 13px; }
.queue-header .eyebrow { color: var(--coral); font-size: 9px; }
.queue-header h2 { margin: 0; color: var(--paper); font-size: 13px; line-height: 1; }
.queue-list { min-width: 0; margin-top: 12px; display: grid; grid-template-columns: repeat(10, minmax(92px, 1fr)); gap: 0; overflow-x: auto; scrollbar-width: thin; }
.lesson-queue-row { min-width: 0; padding: 7px 12px 4px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; border-top: 1px solid rgba(243, 245, 244, .17); border-bottom: 0; background: transparent; color: var(--paper-muted); text-align: left; transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease; }
.lesson-queue-row + .lesson-queue-row { border-left: 1px solid rgba(243, 245, 244, .17); }
.lesson-queue-row:hover,
.lesson-queue-row:focus-visible { background: rgba(243, 245, 244, .08); color: var(--paper); }
.lesson-queue-row:active { transform: scale(.98); }
.lesson-queue-row.active { border-top-color: var(--coral); background: rgba(217, 95, 75, .12); color: var(--paper); }
.queue-day { color: inherit; font: 600 9px var(--mono); }
.queue-copy { min-width: 0; display: grid; gap: 2px; }
.queue-copy strong { overflow: hidden; color: inherit; font-size: 11px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.queue-copy small { overflow: hidden; color: var(--dark-dim); font-size: 9px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.queue-status { color: var(--dark-dim); font: 600 8px var(--mono); text-transform: uppercase; }
.lesson-queue-row.active .queue-status { color: var(--coral); }

/* The lesson is a single listening stage. The line drawer is the only place the full list lives. */
.learn-workspace { width: min(1120px, 100%); margin: 0 auto; }
.teaching-stage { min-height: 660px; padding: 22px 0 20px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stage-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--ink-muted); }
.stage-topline span:last-child { color: var(--coral); }
.lesson-command { max-width: 620px; margin-top: 36px; }
.lesson-command > span { color: var(--coral); }
.lesson-command strong { display: block; margin-top: 8px; color: var(--ink); font-size: clamp(20px, 2.7vw, 32px); line-height: 1.05; }
.lesson-command p { max-width: 520px; margin: 9px 0 0; color: var(--ink-muted); font-size: 12px; }
.stage-phrase-heading { margin-top: 54px; }
.stage-label { display: block; margin-bottom: 12px; color: var(--coral); }
.kinetic-phrase { min-height: 104px; max-width: 960px; display: flex; flex-wrap: wrap; align-content: center; gap: 6px 12px; }
.kinetic-phrase span { color: var(--ink); font-size: clamp(40px, 5.1vw, 75px); font-weight: 800; line-height: .98; animation: wordLift 420ms var(--ease) both; }
.kinetic-phrase span.spoken { color: var(--ink-muted); }
.kinetic-phrase span.speaking { color: var(--coral); transform: translateY(-4px); animation: wordPulse 480ms var(--ease) both; }
.stage-english { max-width: 760px; margin: 18px 0 0; color: var(--ink-muted); font-size: 15px; }
.pronunciation-line { max-width: 820px; margin-top: 17px; padding-top: 13px; display: flex; align-items: baseline; gap: 18px; border-top: 1px solid var(--rule); }
.pronunciation-line span { color: var(--ink-muted); font: 600 10px var(--mono); text-transform: uppercase; }
.pronunciation-line strong { color: var(--ink); font: 600 15px var(--mono); line-height: 1.35; }
.stage-syllable-strip,
.phrase-theater-syllables { min-height: 31px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stage-syllable-strip { margin-top: 13px; }
.stage-syllable-strip span,
.phrase-theater-syllables span { padding: 5px 7px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink-muted); font: 600 11px var(--mono); transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease; }
.stage-syllable-strip span.spoken,
.phrase-theater-syllables span.spoken { border-color: transparent; color: var(--ink); }
.stage-syllable-strip span.speaking,
.phrase-theater-syllables span.speaking { border-color: var(--coral); background: rgba(217, 95, 75, .1); color: var(--coral); transform: translateY(-2px); }
.stage-teaching-note { max-width: 820px; margin-top: 27px; padding: 13px 0 13px 15px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 18px; border-left: 3px solid var(--coral); }
.stage-teaching-note > span { grid-column: 1 / -1; color: var(--coral); }
.stage-teaching-note p { margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 1.45; }
.stage-teaching-note button,
.memory-cue-play { min-height: 30px; padding: 0 8px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; color: var(--ink-muted); font-size: 10px; font-weight: 700; transition: color 160ms ease, border-color 160ms ease, transform 120ms ease; }
.stage-teaching-note button:hover,
.memory-cue-play:hover { border-color: var(--coral); color: var(--ink); }
.stage-teaching-note button:active,
.memory-cue-play:active { transform: scale(.97); }
.stage-teaching-note svg,
.memory-cue-play svg { width: 14px; height: 14px; }
.stage-details { max-width: 820px; margin-top: 24px; border-top: 1px solid var(--rule); }
.stage-details summary,
.phrase-film-details summary { min-height: 39px; padding: 11px 0; display: flex; align-items: center; justify-content: space-between; color: var(--ink-muted); cursor: pointer; font-size: 11px; font-weight: 800; list-style: none; }
.stage-details summary::-webkit-details-marker,
.phrase-film-details summary::-webkit-details-marker { display: none; }
.stage-details summary svg,
.phrase-film-details summary svg { width: 15px; height: 15px; transition: transform 160ms ease; }
.stage-details[open] summary svg,
.phrase-film-details[open] summary svg { transform: rotate(180deg); }
.teaching-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 0 0 12px; }
.teach-step { min-width: 0; padding-top: 10px; border-top: 1px solid var(--rule); }
.teach-step > span { display: block; margin-bottom: 6px; color: var(--ink-muted); font-size: 9px; }
.teach-step p,
.teach-step small { margin: 0; color: var(--ink-muted); font-size: 11px; line-height: 1.42; }
.teach-step.primary { border-top-color: var(--coral); }
.teach-step.primary > span { color: var(--coral); }
.teach-step.primary strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 15px; line-height: 1.2; }
.stage-progress { height: 3px; max-width: 820px; margin-top: 19px; overflow: hidden; background: var(--rule); }
.stage-progress i { width: 0; height: 100%; display: block; background: var(--coral); transition: width 120ms linear; }
.stage-controls { max-width: 820px; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stage-controls .stage-play { border-color: var(--coral); background: var(--coral); color: var(--paper); }
.stage-controls .stage-play:hover { background: #C85140; }
.stage-step { background: transparent !important; border-color: var(--rule) !important; color: var(--ink-muted) !important; }
.stage-step:hover { border-color: var(--coral) !important; color: var(--ink) !important; }

.lesson-lines-drawer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.lesson-lines-drawer.active { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(21, 24, 23, .48); opacity: 0; transition: opacity 180ms ease; }
.drawer-panel { width: min(580px, 100%); height: 100%; padding: 27px 30px 30px; position: absolute; top: 0; right: 0; overflow-y: auto; background: var(--paper); transform: translateX(100%); transition: transform 200ms var(--ease); }
.lesson-lines-drawer.active .drawer-backdrop { opacity: 1; }
.lesson-lines-drawer.active .drawer-panel { transform: translateX(0); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.drawer-header h2 { margin: 6px 0 0; font-size: 30px; line-height: 1; }
.drawer-toolbar { padding: 17px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); }
.drawer-toolbar p { max-width: 250px; margin: 0; color: var(--ink-muted); font-size: 12px; }
.conversation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.conversation-actions .text-control { white-space: nowrap; }
.lesson-pattern-banner { margin: 19px 0 5px; padding: 13px 0 15px 14px; border-left: 3px solid var(--coral); }
.lesson-pattern-kicker { color: var(--coral); }
.lesson-pattern-banner strong { display: block; margin-top: 5px; color: var(--ink); font-size: 15px; line-height: 1.25; }
.lesson-pattern-banner p { margin: 6px 0 0; color: var(--ink-muted); font-size: 11px; line-height: 1.4; }
.lesson-pattern-example { display: block; margin-top: 8px; color: var(--ink); font: 600 11px var(--mono); }
.lesson-pattern-example b { color: var(--coral); }
#dialogue { border-top: 1px solid var(--rule); }
.dialogue-row { min-width: 0; padding: 15px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 11px; align-items: center; border-bottom: 1px solid var(--rule); cursor: pointer; transition: color 160ms ease, background-color 160ms ease, padding-left 160ms ease; }
.dialogue-row:hover { padding-left: 5px; background: rgba(21, 24, 23, .035); }
.dialogue-row.selected { padding-left: 9px; border-left: 3px solid var(--coral); background: rgba(217, 95, 75, .08); }
.dialogue-row .speaker,
.dialogue-row .status { color: var(--ink-muted); font: 600 9px var(--mono); text-transform: uppercase; }
.dialogue-row .speaker { color: var(--coral); }
.dialogue-copy { min-width: 0; }
.dialogue-row strong { display: block; color: var(--ink); font-size: 13px; line-height: 1.25; }
.dialogue-row small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 11px; line-height: 1.35; }
.hide-english .dialogue-row small { display: none; }
.status-wrap { display: grid; justify-items: end; gap: 7px; }
.line-audio { min-height: 28px; padding: 0 7px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; color: var(--ink-muted); font-size: 10px; font-weight: 700; transition: color 160ms ease, border-color 160ms ease, transform 120ms ease; }
.line-audio:hover { border-color: var(--coral); color: var(--ink); }
.line-audio:active { transform: scale(.97); }
.line-audio svg { width: 13px; height: 13px; }

/* Phrase Theater is a phrase film, not a dialog box inside the lesson. */
.phrase-theater { position: fixed; inset: 0; z-index: 40; overflow: hidden; }
.phrase-theater-backdrop { position: absolute; inset: 0; background: rgba(21, 24, 23, .84); opacity: 0; transition: opacity 180ms ease; }
.phrase-film { width: 100%; min-height: 100%; padding: 30px 5vw 34px; position: relative; overflow-y: auto; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; background-color: var(--charcoal); background-image: var(--lesson-image); background-position: center; background-size: cover; background-blend-mode: multiply; opacity: 0; transform: translateY(12px); transition: opacity 180ms ease, transform 200ms var(--ease); }
.phrase-film::before { position: absolute; inset: 0; z-index: -1; background: rgba(21, 24, 23, .56); content: ""; }
.phrase-theater.active .phrase-theater-backdrop { opacity: 1; }
.phrase-theater.active .phrase-film { opacity: 1; transform: translateY(0); }
.phrase-film-head,
.phrase-film-main,
.phrase-film-footer,
.phrase-film-details { position: relative; z-index: 1; width: min(1180px, 100%); margin-right: auto; margin-left: auto; }
.phrase-film-head { padding-right: 44px; }
.phrase-theater-close { position: absolute; z-index: 2; top: 26px; right: 5vw; border-color: rgba(243, 245, 244, .42); color: var(--paper); }
.phrase-theater-close:hover { border-color: var(--coral); color: var(--paper); }
.phrase-theater-kicker { display: flex; justify-content: space-between; gap: 16px; color: var(--paper-muted); }
.phrase-theater-kicker span:last-child { color: var(--coral); }
.phrase-film-cue { max-width: 750px; margin-top: clamp(48px, 10vh, 112px); }
.phrase-film-cue span { color: var(--paper-muted); font: 600 10px var(--mono); text-transform: uppercase; }
.phrase-film-cue strong { display: block; margin-top: 8px; color: var(--paper); font-size: clamp(19px, 2.7vw, 35px); line-height: 1.08; }
.phrase-film-main { min-height: 320px; margin-top: 28px; display: flex; flex-direction: column; justify-content: center; }
.phrase-film-main .stage-label { color: var(--paper-muted); }
.phrase-theater-words { max-width: 1080px; display: flex; flex-wrap: wrap; gap: 8px 15px; }
.phrase-theater-words span { color: var(--paper); font-size: clamp(42px, 7vw, 104px); font-weight: 800; line-height: .95; animation: wordLift 480ms var(--ease) both; }
.phrase-theater-words span.is-accent { color: var(--coral); }
.phrase-theater-syllables { margin-top: 28px; }
.phrase-theater-syllables span { border-color: rgba(243, 245, 244, .35); color: var(--paper-muted); }
.phrase-theater-syllables span.spoken { color: var(--paper); }
.phrase-theater-syllables span.speaking { border-color: var(--coral); background: rgba(217, 95, 75, .14); color: var(--paper); }
.phrase-film-footer { padding-top: 18px; border-top: 1px solid rgba(243, 245, 244, .26); }
.phrase-lesson-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid rgba(243, 245, 244, .2); }
.phrase-lesson-track span { min-height: 32px; padding: 0 5px; display: grid; place-items: center; border-right: 1px solid rgba(243, 245, 244, .2); color: var(--dark-dim); font: 600 9px var(--mono); text-align: center; text-transform: uppercase; }
.phrase-lesson-track span:last-child { border-right: 0; }
.phrase-lesson-track span.active { background: rgba(217, 95, 75, .18); color: var(--paper); }
.phrase-theater-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.phrase-theater-actions .phrase-theater-play { border-color: var(--coral); background: var(--coral); color: var(--paper); }
.phrase-theater-actions .phrase-theater-good { margin-left: auto; }
.phrase-film-details { margin-top: 18px; border-top: 1px solid rgba(243, 245, 244, .2); }
.phrase-film-details summary { color: var(--paper-muted); }
.phrase-theater-teach-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; padding-bottom: 8px; }
.phrase-teach-panel { min-width: 0; padding-top: 10px; border-top: 1px solid rgba(243, 245, 244, .2); }
.phrase-teach-panel > span { color: var(--paper-muted); }
.phrase-teach-panel p { margin: 7px 0 0; color: var(--dark-dim); font-size: 11px; line-height: 1.45; }
.phrase-theater-pronunciation { color: var(--paper) !important; font-family: var(--mono) !important; }
.phrase-breakdown-list { margin-top: 7px; display: grid; gap: 4px; }
.phrase-breakdown-row { display: grid; grid-template-columns: minmax(84px, .8fr) minmax(0, 1fr); gap: 8px; align-items: baseline; }
.phrase-breakdown-row strong { color: var(--paper); font-size: 10px; }
.phrase-breakdown-row span { color: var(--dark-dim); font-size: 10px; }
.phrase-film-details .memory-cue-play { margin-top: 8px; border-color: rgba(243, 245, 244, .35); color: var(--paper-muted); }
.phrase-film-details .memory-cue-play:hover { border-color: var(--coral); color: var(--paper); }

/* Review reveals in place and keeps the practice plane centered. */
.review-stage { width: min(760px, 100%); min-height: 600px; margin: 16px auto 0; padding: 32px 0 30px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.review-stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.review-label { color: var(--coral); }
.review-rule { color: var(--ink-muted); }
.review-display { min-height: 190px; padding: 62px 0 48px; display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.review-stage h2 { margin: 0; color: var(--ink); font-size: clamp(34px, 6.2vw, 72px); line-height: .98; letter-spacing: 0; }
.review-phrase-burst { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.review-phrase-burst span { color: var(--ink); font-size: clamp(32px, 5.3vw, 63px); font-weight: 800; line-height: .98; animation: wordLift 420ms var(--ease) both; }
.review-subtitle { max-width: 540px; margin: 20px 0 0; color: var(--ink-muted); font-size: 13px; }
.review-main-actions { margin-top: 28px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-step,
.review-replay,
.reveal-button { background: transparent; color: var(--ink-muted); }
.reveal-button { border-color: var(--coral) !important; background: var(--coral) !important; color: var(--paper) !important; }
.reveal-button:hover { background: #C85140 !important; }
.review-overlay { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--rule); }
.review-answer-label { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.review-answer-label > span { color: var(--coral); font: 600 10px var(--mono); text-transform: uppercase; }
.review-close { padding: 0; background: transparent; color: var(--ink-muted); font-size: 10px; font-weight: 700; }
.review-close:hover { color: var(--ink); }
.review-modal-english { display: none; }
.review-modal-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.review-rating { margin-top: 16px; display: flex; gap: 7px; }
.review-rating button,
.mission-rating button { min-height: 32px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; color: var(--ink-muted); font-size: 10px; font-weight: 800; transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease; }
.review-rating button:hover,
.mission-rating button:hover,
.review-rating button.selected,
.mission-rating button.selected { border-color: var(--coral); color: var(--ink); }
.review-rating button.selected,
.mission-rating button.selected { background: rgba(217, 95, 75, .12); }
.review-rating button:active,
.mission-rating button:active { transform: scale(.97); }

/* Reps are one set of divided rows. Only the active row exposes its detail. */
.mission-list { width: min(980px, 100%); margin: 10px auto 0; border-top: 1px solid var(--rule); }
.mission-item { border-bottom: 1px solid var(--rule); }
.mission-toggle { width: 100%; min-height: 76px; padding: 15px 0; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 18px; align-items: center; gap: 15px; background: transparent; color: var(--ink); text-align: left; transition: color 160ms ease, background-color 160ms ease, padding-left 160ms ease; }
.mission-toggle:hover { padding-left: 7px; background: rgba(21, 24, 23, .035); }
.mission-toggle:active { transform: scale(.995); }
.mission-item.expanded .mission-toggle { padding-left: 10px; border-left: 3px solid var(--coral); }
.mission-index { color: var(--coral); }
.mission-copy { min-width: 0; display: grid; gap: 4px; }
.mission-copy strong { overflow: hidden; color: var(--ink); font-size: 16px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.mission-copy small { overflow: hidden; color: var(--ink-muted); font-size: 11px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.mission-state { color: var(--ink-muted); font-size: 9px; }
.mission-toggle svg { width: 16px; height: 16px; color: var(--ink-muted); transition: color 160ms ease, transform 160ms ease; }
.mission-item.expanded .mission-toggle svg { color: var(--coral); transform: rotate(180deg); }
.mission-detail { padding: 0 0 19px 55px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.mission-copy-detail { min-width: 0; display: grid; gap: 5px; }
.mission-ritual,
.mission-preview { color: var(--ink-muted); font-size: 11px; line-height: 1.35; }
.mission-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mission-rating { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

@keyframes wordPulse {
  0% { transform: translateY(2px); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

@keyframes wordLift {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .site-masthead { padding-inline: 20px; grid-template-columns: 1fr auto; }
  .desktop-nav { display: none; }
  .masthead-meta { justify-self: end; }
  .masthead-meta #sidebar-day-label,
  .masthead-meta #sidebar-phase-label { display: none; }
  .app-view { padding-right: 20px; padding-left: 20px; }
  .rio-ticker { grid-template-columns: 1fr; gap: 10px; padding: 13px 0; }
  .pulse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticker-refresh { position: absolute; right: 20px; margin-top: -37px; }
  .today-hero-copy { width: 72%; }
  .teaching-flow,
  .phrase-theater-teach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-panel { width: min(560px, 100%); }
}

@media (max-width: 640px) {
  body { padding-bottom: 72px; }
  .site-masthead { min-height: 58px; padding-inline: 16px; }
  .brand-mark { width: 28px; height: 28px; font-size: 10px; }
  .brand small { display: none; }
  .masthead-meta { font-size: 9px; }
  .mobile-nav { width: 100%; min-height: 68px; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); position: fixed; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; border-top: 1px solid var(--rule); background: rgba(243, 245, 244, .97); }
  .mobile-nav button { min-height: 52px; padding: 5px 2px; display: grid; grid-template-columns: 1fr; justify-items: center; gap: 2px; font-size: 9px; }
  .mobile-nav button svg { width: 17px; height: 17px; }
  .mobile-nav em { position: absolute; margin: -4px 0 0 24px; }
  .app-view { min-height: calc(100vh - 58px); padding: 18px 16px 28px; gap: 18px; }
  .view-heading { align-items: flex-start; gap: 13px; }
  .view-heading h1 { font-size: clamp(24px, 8vw, 34px); }
  .view-heading-tools { gap: 8px; }
  .view-counter { font-size: 10px; }
  .view-counter strong { font-size: 16px; }
  .all-lines-button { min-height: 32px; padding: 0 8px; }
  .home-view { padding-top: 13px; }
  .rio-ticker { min-height: 0; padding: 11px 0 12px; }
  .rio-ticker .eyebrow { font-size: 9px; }
  .pulse-grid { gap: 0; }
  .pulse-item { padding: 0 7px; display: block; }
  .pulse-item:first-child { padding-left: 0; }
  .pulse-item strong { display: block; margin-top: 3px; font-size: 12px; }
  .pulse-item small { display: block; margin-top: 3px; font-size: 9px; }
  .ticker-refresh { right: 16px; margin-top: -52px; min-height: 29px; padding-inline: 7px; }
  .ticker-refresh span { display: none; }
  .today-hero { min-height: calc(100vh - 184px); margin-top: 13px; background-position: 60% center; }
  .hero-webgl { width: 70%; height: 42%; top: 2%; right: -11%; opacity: .54; }
  .today-hero-copy { width: 100%; padding: 27px 18px 30px; }
  .today-hero-copy .lesson-index { margin-top: 22px; }
  .today-hero-copy h1 { max-width: 340px; font-size: clamp(42px, 13vw, 62px); }
  .hero-outcome { max-width: 340px; margin-top: 17px; font-size: 17px; }
  .hero-support { max-width: 310px; font-size: 12px; }
  .lesson-meta { margin-top: 18px; font-size: 9px; }
  .lesson-meta span { padding-right: 9px; }
  .lesson-meta span + span { padding-left: 9px; }
  .session-actions { margin-top: 19px; }
  .start-lesson-button { min-height: 44px; }
  .home-lower-edge { padding: 0 18px 124px; display: block; }
  .home-anchor { max-width: 310px; }
  .home-anchor strong { font-size: 15px; }
  .home-commands { margin-top: 13px; gap: 4px; }
  .home-commands .session-action { padding-left: 0; }
  .lesson-queue { padding: 11px 14px 13px; }
  .queue-header { gap: 8px; }
  .queue-header h2 { font-size: 11px; }
  .queue-list { margin-top: 9px; grid-template-columns: repeat(10, 112px); }
  .lesson-queue-row { padding: 6px 8px 4px; }

  .teaching-stage { min-height: 0; padding: 13px 0 17px; }
  .stage-topline { font-size: 9px; }
  .lesson-command { margin-top: 21px; }
  .lesson-command strong { font-size: 23px; }
  .lesson-command p { font-size: 11px; }
  .stage-phrase-heading { margin-top: 27px; }
  .kinetic-phrase { min-height: 91px; gap: 5px 9px; }
  .kinetic-phrase span { font-size: clamp(35px, 10vw, 52px); }
  .stage-english { margin-top: 13px; font-size: 13px; }
  .pronunciation-line { margin-top: 13px; display: block; }
  .pronunciation-line strong { display: block; margin-top: 7px; font-size: 13px; }
  .stage-syllable-strip { margin-top: 10px; gap: 4px; }
  .stage-syllable-strip span { padding: 4px 5px; font-size: 10px; }
  .stage-teaching-note { margin-top: 17px; grid-template-columns: 1fr; gap: 7px; }
  .stage-teaching-note button { width: fit-content; }
  .stage-details { margin-top: 15px; }
  .teaching-flow { grid-template-columns: 1fr 1fr; gap: 10px; }
  .teach-step p,
  .teach-step small { font-size: 10px; }
  .stage-progress { margin-top: 13px; }
  .stage-controls { margin-top: 12px; }
  .stage-controls button { min-height: 38px; padding: 0 9px; }
  .stage-controls .stage-play { min-width: 116px; }
  .drawer-panel { width: 100%; height: min(83dvh, 720px); top: auto; bottom: 0; padding: 19px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: var(--radius) var(--radius) 0 0; transform: translateY(100%); }
  .lesson-lines-drawer.active .drawer-panel { transform: translateY(0); }
  .drawer-header { padding-bottom: 13px; }
  .drawer-header h2 { font-size: 26px; }
  .drawer-toolbar { display: block; padding: 13px 0; }
  .drawer-toolbar p { max-width: none; font-size: 11px; }
  .conversation-actions { margin-top: 11px; justify-content: flex-start; }
  .dialogue-row { grid-template-columns: 27px minmax(0, 1fr) auto; gap: 8px; padding: 12px 0; }
  .dialogue-row strong { font-size: 12px; }
  .dialogue-row small { font-size: 10px; }
  .status-wrap .status { display: none; }
  .line-audio { min-height: 27px; padding-inline: 6px; }
  .line-audio span { display: none; }

  .phrase-film { padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); }
  .phrase-theater-close { top: 17px; right: 16px; }
  .phrase-film-head { padding-right: 44px; }
  .phrase-film-cue { margin-top: 52px; }
  .phrase-film-cue strong { font-size: 20px; }
  .phrase-film-main { min-height: 246px; margin-top: 18px; }
  .phrase-theater-words { gap: 6px 10px; }
  .phrase-theater-words span { font-size: clamp(35px, 10.5vw, 58px); }
  .phrase-theater-syllables { margin-top: 20px; gap: 4px; }
  .phrase-theater-syllables span { padding: 4px 5px; font-size: 10px; }
  .phrase-film-footer { padding-top: 13px; }
  .phrase-theater-actions { gap: 5px; }
  .phrase-theater-actions button { min-height: 38px; padding-inline: 9px; }
  .phrase-theater-actions .phrase-theater-good { margin-left: 0; }
  .phrase-theater-actions button span { font-size: 10px; }
  .phrase-theater-teach-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .review-stage { min-height: calc(100dvh - 184px); margin-top: 6px; padding: 22px 0 20px; }
  .review-stage-head { display: block; }
  .review-rule { display: block; margin-top: 6px; font-size: 10px; }
  .review-display { min-height: 176px; padding: 45px 0 30px; }
  .review-stage h2 { font-size: clamp(35px, 12vw, 58px); }
  .review-phrase-burst { gap: 6px 9px; }
  .review-phrase-burst span { font-size: clamp(31px, 10vw, 52px); }
  .review-subtitle { font-size: 12px; }
  .review-main-actions { margin-top: 22px; }
  .review-main-actions button { min-height: 38px; padding-inline: 9px; }
  .review-main-actions .review-step span { display: none; }
  .review-main-actions .review-step { width: 39px; padding: 0; }
  .review-overlay { margin-top: 22px; }
  .review-modal-actions { gap: 5px; }
  .review-modal-actions button { min-height: 36px; padding-inline: 8px; }
  .review-modal-actions .review-step span { display: none; }
  .review-modal-actions .review-step { width: 38px; padding: 0; }

  .mission-list { margin-top: 0; }
  .mission-toggle { grid-template-columns: 30px minmax(0, 1fr) 15px; gap: 10px; min-height: 70px; }
  .mission-state { display: none; }
  .mission-detail { padding-left: 40px; display: block; }
  .mission-copy-detail { margin-top: 10px; }
  .mission-rating { margin-top: 13px; justify-content: flex-start; }
}

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