:root {
  color-scheme: light;
  --page: #f7f5ef;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --ink: #1f2933;
  --muted: #69737d;
  --muted-strong: #505b65;
  --line: #e5e1d8;
  --line-strong: #d5d0c6;
  --green: #17785a;
  --green-dark: #105c45;
  --green-soft: #e7f4ee;
  --coral: #ed6a5a;
  --coral-soft: #fff0ed;
  --violet: #6757c7;
  --violet-soft: #efedff;
  --gold: #9b6b09;
  --gold-soft: #fff4d7;
  --stage: #172421;
  --stage-soft: #21332e;
  --stage-text: #fbfffd;
  --shadow-sm: 0 1px 2px rgba(24, 33, 29, 0.06), 0 4px 12px rgba(24, 33, 29, 0.04);
  --shadow-md: 0 12px 34px rgba(32, 45, 39, 0.09);
  --shadow-stage: 0 24px 60px rgba(18, 31, 26, 0.18);
  --font-sans: "DM Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Manrope, "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --topbar-height: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body,
h1,
h2,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

button,
a,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

body.cinema-app-body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 80% 0%, rgba(231, 244, 238, 0.8), transparent 30rem),
    var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
}

::selection {
  background: #cde9dd;
  color: var(--green-dark);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbc7bf;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(103, 87, 199, 0.42);
  outline-offset: 3px;
}

.app-topbar {
  position: relative;
  z-index: 50;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 520px) minmax(240px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(213, 208, 198, 0.8);
  backdrop-filter: blur(18px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  color: inherit;
  text-decoration: none;
}

.app-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--green);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: -1px;
  box-shadow: 0 7px 18px rgba(23, 120, 90, 0.2);
}

.brand-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.app-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.app-tag {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.workspace-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: max-content;
  margin: 0 auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 2px rgba(31, 41, 51, 0.03);
}

.workspace-tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.workspace-tab:hover {
  color: var(--ink);
}

.workspace-tab.is-active {
  background: var(--surface);
  color: var(--green-dark);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted-strong);
  font-size: 9px;
}

.workspace-tab.is-active .tab-count {
  background: var(--green-soft);
  color: var(--green-dark);
}

.app-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.top-badge,
.icon-button,
.transcript-toggle {
  cursor: pointer;
}

.top-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.top-badge:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.top-badge[aria-pressed="true"] {
  border-color: #b9dfd1;
  background: var(--green-soft);
  color: var(--green-dark);
}

.top-badge-primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
  box-shadow: 0 8px 20px rgba(23, 120, 90, 0.18);
}

.top-badge-primary:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.button-count {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 10px;
}

.app-viewport {
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  display: flex;
  overflow: hidden;
}

.course-sidebar {
  width: 370px;
  flex: 0 0 370px;
  display: flex;
  flex-direction: column;
  background: rgba(251, 250, 247, 0.94);
  border-right: 1px solid var(--line);
  transition: margin-left 240ms ease, transform 240ms ease;
}

.course-sidebar.collapsed {
  margin-left: -370px;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 16px;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.sidebar-header h2 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.35px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}

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

.sidebar-close {
  display: none;
}

.course-progress-card {
  margin: 0 20px 14px;
  padding: 13px 14px;
  border: 1px solid #cfe6dc;
  border-radius: 14px;
  background: var(--green-soft);
}

.course-progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}

.course-progress-copy strong {
  font-size: 11px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 120, 90, 0.14);
}

.progress-track span {
  display: block;
  width: 2%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 300ms ease;
}

.sidebar-search {
  padding: 0 20px 14px;
}

.sidebar-search label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.search-field {
  position: relative;
}

.search-field > i {
  position: absolute;
  top: 50%;
  left: 13px;
  color: #8b949d;
  font-size: 12px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-field input:focus {
  border-color: #8bc9b2;
  box-shadow: 0 0 0 3px rgba(23, 120, 90, 0.1);
}

.search-shortcut {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  transform: translateY(-50%);
}

.lessons-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 28px;
}

.sidebar-lesson-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  min-height: 122px;
  margin-bottom: 8px;
  padding: 13px 13px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.58);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(24, 33, 29, 0.025);
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.sidebar-lesson-item:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}

.sidebar-lesson-item.active-lesson {
  border-color: #9fd1be;
  background: linear-gradient(135deg, #edf8f3, #e4f3ed);
  box-shadow: 0 8px 22px rgba(23, 120, 90, 0.09);
}

.item-rail {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.item-num {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted-strong);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
}

.active-lesson .item-num {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.item-rail-line {
  width: 1px;
  flex: 1;
  min-height: 28px;
  margin-top: 8px;
  background: linear-gradient(var(--line), transparent);
}

.active-lesson .item-rail-line {
  background: linear-gradient(#9fd1be, transparent);
}

.item-copy {
  min-width: 0;
}

.item-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.item-progress-state {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0efeb;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.item-progress-state.is-current {
  background: var(--green);
  color: white;
}

.item-progress-state.is-viewed {
  background: var(--green-soft);
  color: var(--green-dark);
}

.item-duration {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.item-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item-rule {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  margin-top: 5px;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-desc {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.active-lesson .item-state {
  color: var(--green);
}

.empty-lessons {
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.cinema-stage-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 30px clamp(20px, 4vw, 56px) 56px;
  scroll-behavior: smooth;
}

.cinema-stage-wrap > * {
  width: min(100%, 1080px);
  margin-inline: auto;
}

.lesson-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.lesson-intro h1 {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.lesson-intro p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.lesson-position {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

#lesson-position-current {
  color: var(--green);
  font-size: 28px;
  font-weight: 800;
}

.lesson-position-divider {
  color: var(--line-strong);
}

.pattern-card-banner {
  position: relative;
  margin-bottom: 14px;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid #ddd8ff;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, #f7f6ff, #efedff);
  box-shadow: var(--shadow-sm);
}

.pattern-card-banner::after {
  content: "";
  position: absolute;
  top: -32px;
  right: -22px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(103, 87, 199, 0.08);
}

.pattern-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(280px, 1.25fr);
  align-items: center;
  gap: 20px;
}

.pattern-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--violet);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pattern-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.pattern-title {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.pattern-description {
  color: #515266;
  font-size: 12px;
  line-height: 1.5;
}

.example-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: -6px;
}

.example-chip {
  padding: 6px 9px;
  border: 1px solid rgba(103, 87, 199, 0.15);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted-strong);
  font-size: 11px;
}

.example-chip strong {
  color: var(--violet);
}

.cinema-video-stage {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.035), transparent 45%),
    var(--stage);
  box-shadow: var(--shadow-stage);
  isolation: isolate;
}

#lt-cinema-canvas,
.stage-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#lt-cinema-canvas {
  z-index: -2;
  opacity: 0.44;
}

.stage-glow {
  z-index: -1;
  filter: blur(10px);
}

.stage-glow-one {
  top: -45%;
  left: -28%;
  width: 65%;
  height: 90%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(71, 175, 134, 0.18), transparent 68%);
}

.stage-glow-two {
  top: auto;
  right: -25%;
  bottom: -50%;
  left: auto;
  width: 70%;
  height: 95%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 87, 199, 0.15), transparent 68%);
}

.cinema-stage-overlay {
  width: min(100%, 920px);
  padding: 42px clamp(24px, 6vw, 70px);
  color: var(--stage-text);
  text-align: center;
}

.live-captions-box {
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.captions-top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.caption-speaker-tag {
  color: #a9d5c4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.caption-time {
  color: #82958e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.caption-time::before {
  content: "•";
  margin-right: 8px;
  color: #51645d;
}

.live-words-stream {
  display: block;
  min-height: 3em;
  color: #aebcb7;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.5vw, 38px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.45;
  text-wrap: balance;
}

.caption-word {
  display: inline;
  padding: 0.04em 0.1em;
  border-radius: 0.22em;
  transition: color 100ms linear, background 100ms linear;
}

.caption-word.past {
  color: #f3faf7;
}

.caption-word.active-word {
  background: #dff5ec;
  color: #143a2e;
  box-shadow: 0 0 0 3px rgba(114, 202, 168, 0.08);
}

.cinema-player-bar {
  position: relative;
  z-index: 3;
  margin-top: -1px;
  padding: 17px 20px 14px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.scrubber-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.time-label {
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
}

.time-label:last-child {
  text-align: right;
}

.app-scrubber-slider {
  --progress: 0%;
  width: 100%;
  height: 18px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.app-scrubber-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--green) 0 var(--progress), #e3e1dc var(--progress) 100%);
}

.app-scrubber-slider::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -5px;
  appearance: none;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 1px 5px rgba(16, 92, 69, 0.35);
}

.app-scrubber-slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #e3e1dc;
}

.app-scrubber-slider::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--green);
}

.app-scrubber-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 1px 5px rgba(16, 92, 69, 0.35);
}

.player-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
}

.player-controls-group,
.speed-controls-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn-ctrl {
  min-width: 43px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.btn-ctrl:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: #f4f2ed;
  transform: translateY(-1px);
}

.btn-ctrl:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-icon {
  padding: 0;
}

.btn-play-main {
  min-width: 132px;
  padding: 0 17px;
  border-color: var(--green);
  background: var(--green);
  color: white;
  box-shadow: 0 8px 18px rgba(23, 120, 90, 0.17);
}

.btn-play-main:hover:not(:disabled) {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.btn-play-main.is-playing {
  border-color: #d9a83f;
  background: var(--gold-soft);
  color: #6e4b05;
  box-shadow: none;
}

.speed-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.speed-chip {
  min-width: 40px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.speed-chip:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.speed-chip.active {
  border-color: #cfe6dc;
  background: var(--green-soft);
  color: var(--green-dark);
}

.shortcut-hint {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  color: #909891;
  font-size: 9px;
}

/* Quiz workspace */
.quiz-view {
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  overflow-y: auto;
  background:
    radial-gradient(circle at 88% 2%, rgba(103, 87, 199, 0.1), transparent 28rem),
    radial-gradient(circle at 10% 18%, rgba(23, 120, 90, 0.09), transparent 25rem),
    var(--page);
}

.quiz-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.quiz-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, 0.75fr);
  align-items: end;
  gap: 36px;
  padding: 34px;
  border: 1px solid #d9e9e2;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
}

.quiz-hero h1,
.quiz-runner-heading h1,
.quiz-result h1 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.quiz-hero h1 {
  max-width: 660px;
  margin-top: 9px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  text-wrap: balance;
}

.quiz-hero-copy > p {
  max-width: 690px;
  margin-top: 13px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.65;
}

.quiz-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.quiz-overview > div,
.quiz-result-stats > div {
  min-width: 0;
  padding: 17px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
}

.quiz-overview strong,
.quiz-result-stats strong {
  display: block;
  color: var(--green-dark);
  font-family: var(--font-display);
  font-size: 24px;
}

.quiz-overview span,
.quiz-result-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quiz-library-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 34px 2px 18px;
}

.quiz-library-toolbar h2 {
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: -0.035em;
}

.quiz-library-toolbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.quiz-search {
  width: min(320px, 100%);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.quiz-search:focus-within {
  border-color: #a8d3c3;
  box-shadow: 0 0 0 3px rgba(23, 120, 90, 0.09);
}

.quiz-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.quiz-lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.quiz-lesson-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.quiz-lesson-card:hover {
  transform: translateY(-2px);
  border-color: #c4ddd3;
  box-shadow: var(--shadow-md);
}

.quiz-card-topline,
.quiz-card-stats,
.quiz-runner-topline,
.quiz-question-meta,
.quiz-feedback-actions,
.quiz-result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-card-number,
.quiz-card-status {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.quiz-card-number { color: var(--green); }

.quiz-card-status {
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
}

.quiz-card-status.is-mastered {
  background: var(--green-soft);
  color: var(--green-dark);
}

.quiz-lesson-card h3 {
  margin-top: 11px;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.quiz-card-details {
  margin: 6px 0 15px;
  color: var(--muted);
  font-size: 10px;
}

.quiz-card-stats {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.quiz-card-score strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
}

.quiz-card-score span {
  color: var(--muted);
  font-size: 9px;
}

.quiz-start-button,
.quiz-primary-button,
.quiet-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.quiz-start-button,
.quiz-primary-button {
  border: 1px solid var(--green);
  background: var(--green);
  color: white;
  box-shadow: 0 7px 18px rgba(23, 120, 90, 0.16);
}

.quiz-start-button:hover,
.quiz-primary-button:hover {
  transform: translateY(-1px);
  border-color: var(--green-dark);
  background: var(--green-dark);
}

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

.quiet-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.quiz-runner {
  width: min(900px, 100%);
  margin: 0 auto;
}

.quiz-runner-topline > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.quiz-runner-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 22px;
}

.quiz-runner-heading h1 {
  margin-top: 6px;
  font-size: clamp(25px, 4vw, 38px);
}

.quiz-live-score {
  min-width: 84px;
  padding: 11px 13px;
  border: 1px solid #d9e9e2;
  border-radius: 13px;
  background: var(--green-soft);
  text-align: right;
}

.quiz-live-score strong {
  display: block;
  color: var(--green-dark);
  font-family: var(--font-display);
  font-size: 20px;
}

.quiz-live-score span {
  color: var(--green-dark);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.quiz-question-progress {
  margin-bottom: 14px;
}

.quiz-question-meta {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.quiz-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e4dc;
}

.quiz-progress-track span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 200ms ease;
}

.quiz-question-card {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
}

.quiz-question-kicker {
  color: var(--violet);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quiz-question-card h2 {
  max-width: 780px;
  margin: 10px 0 25px;
  font-family: var(--font-display);
  font-size: clamp(21px, 3vw, 29px);
  line-height: 1.34;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-option {
  min-height: 70px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.quiz-option:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #a8d3c3;
  background: white;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 800;
}

.quiz-option-copy {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.quiz-option.is-correct {
  border-color: #8ac5ae;
  background: var(--green-soft);
}

.quiz-option.is-correct .quiz-option-marker {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.quiz-option.is-wrong {
  border-color: #efaea6;
  background: var(--coral-soft);
}

.quiz-option.is-wrong .quiz-option-marker {
  border-color: var(--coral);
  background: var(--coral);
  color: white;
}

.quiz-option.is-muted {
  opacity: 0.58;
}

.quiz-feedback {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  animation: quizReveal 180ms ease-out both;
}

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

.quiz-feedback-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.quiz-feedback-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--green);
  color: white;
}

.quiz-feedback.is-wrong .quiz-feedback-icon {
  background: var(--coral);
}

.quiz-feedback-heading strong {
  font-family: var(--font-display);
  font-size: 16px;
}

.quiz-feedback-heading p {
  margin-top: 3px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.5;
}

.quiz-feedback-note {
  margin: 14px 0;
  padding: 13px 14px;
  border-left: 3px solid var(--violet);
  border-radius: 0 10px 10px 0;
  background: var(--violet-soft);
}

.quiz-feedback-note span {
  color: var(--violet);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.quiz-feedback-note p {
  margin-top: 4px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
}

.quiz-result {
  width: min(650px, 100%);
  margin: 36px auto 0;
  padding: clamp(28px, 6vw, 52px);
  border: 1px solid #d9e9e2;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.quiz-result-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 19px;
  background: var(--green);
  color: white;
  font-size: 22px;
  box-shadow: 0 12px 28px rgba(23, 120, 90, 0.2);
}

.quiz-result h1 {
  margin-top: 7px;
  font-size: 34px;
}

.quiz-result > p {
  max-width: 490px;
  margin: 8px auto 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.quiz-result-score {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 0 auto 18px;
  border: 10px solid var(--green-soft);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #b9dfd1;
}

.quiz-result-score strong {
  color: var(--green-dark);
  font-family: var(--font-display);
  font-size: 35px;
}

.quiz-result-score span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.quiz-result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 390px;
  margin: 0 auto 20px;
}

.quiz-result-actions {
  justify-content: center;
}

kbd {
  display: inline-grid;
  min-width: 18px;
  min-height: 17px;
  place-items: center;
  margin-right: 3px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-family: inherit;
  font-size: 8px;
  font-weight: 800;
}

.transcript-card-container {
  margin-top: 18px;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
}

.transcript-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.transcript-card-header h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.3px;
}

.transcript-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.transcript-toggle i {
  transition: transform 180ms ease;
}

.transcript-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.transcript-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.transcript-stream-list {
  max-height: 430px;
  overflow-y: auto;
  margin-top: 16px;
  padding: 4px 5px 4px 0;
}

.t-line-item {
  width: 100%;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 5px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.t-line-item:hover {
  border-color: var(--line);
  background: var(--surface);
}

.t-line-item.active-t-line {
  border-color: #b9dfd1;
  background: var(--green-soft);
}

.t-speaker {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.t-speaker.is-prompt {
  color: var(--gold);
}

.t-copy {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.t-target {
  display: block;
  margin-top: 4px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
}

.t-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #21332e;
  color: white;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1050px) {
  .app-topbar {
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  }

  .quiz-hero {
    grid-template-columns: 1fr;
  }

  .quiz-overview {
    max-width: 540px;
  }

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

  .course-sidebar {
    width: 330px;
    flex-basis: 330px;
  }

  .course-sidebar.collapsed {
    margin-left: -330px;
  }

  .pattern-content {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .example-chips {
    grid-column: auto;
    margin-top: 2px;
  }

  .player-top-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 64px;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 14px;
  }

  .app-logo {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .brand-info,
  #btn-toggle-captions span,
  #btn-toggle-sidebar > span:not(.button-count) {
    display: none;
  }

  .workspace-tabs {
    justify-self: center;
  }

  .workspace-tab {
    min-height: 34px;
    padding: 0 10px;
  }

  .workspace-tab i {
    display: none;
  }

  .top-badge {
    width: 40px;
    padding: 0;
  }

  .top-badge-primary {
    width: auto;
    padding: 0 9px;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 70;
    inset: var(--topbar-height) 0 0;
    display: block;
    background: rgba(20, 28, 25, 0.38);
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .course-sidebar {
    position: fixed;
    z-index: 80;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: min(88vw, 350px);
    transform: translateX(0);
    box-shadow: 20px 0 40px rgba(22, 32, 28, 0.16);
  }

  .course-sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-105%);
  }

  .sidebar-close {
    display: grid;
  }

  .cinema-stage-wrap {
    padding: 22px 14px 40px;
  }

  .lesson-intro {
    align-items: flex-start;
  }

  .lesson-position {
    display: none;
  }

  .lesson-intro h1 {
    font-size: 28px;
  }

  .pattern-card-banner {
    padding: 14px;
  }

  .example-chips {
    display: none;
  }

  .cinema-video-stage {
    min-height: 280px;
    border-radius: 20px;
  }

  .cinema-stage-overlay {
    padding: 34px 18px;
  }

  .live-words-stream {
    font-size: 23px;
  }

  .cinema-player-bar {
    padding: 15px 12px 12px;
  }

  .player-top-row {
    align-items: stretch;
  }

  .player-controls-group {
    justify-content: space-between;
  }

  .btn-ctrl {
    min-width: 40px;
    padding-inline: 8px;
  }

  .btn-play-main {
    min-width: 112px;
  }

  .btn-play-main span {
    font-size: 10px;
  }

  .speed-controls-group {
    justify-content: center;
    padding-top: 2px;
  }

  .shortcut-hint {
    display: none;
  }

  .quiz-shell {
    width: min(100% - 28px, 1180px);
    padding: 24px 0 42px;
  }

  .quiz-hero {
    gap: 22px;
    padding: 24px 20px;
    border-radius: 20px;
  }

  .quiz-overview {
    max-width: none;
  }

  .quiz-library-toolbar {
    align-items: stretch;
    flex-direction: column;
    margin-top: 25px;
  }

  .quiz-search {
    width: 100%;
  }

  .quiz-lesson-grid {
    grid-template-columns: 1fr;
  }

  .quiz-runner-heading {
    align-items: flex-start;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .quiz-feedback-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .quiz-feedback-actions button {
    width: 100%;
  }

  .transcript-card-container {
    padding: 16px;
  }

  .transcript-toggle-label {
    display: none;
  }

  .transcript-toggle {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .t-line-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .t-speaker {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .app-name {
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-tabs {
    gap: 2px;
    padding: 3px;
  }

  .workspace-tab {
    padding: 0 7px;
    font-size: 10px;
  }

  .tab-count {
    display: none;
  }

  .quiz-overview {
    grid-template-columns: 1fr;
  }

  .quiz-overview > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
  }

  .quiz-overview span {
    margin: 0;
    text-align: right;
  }

  .quiz-runner-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-live-score {
    text-align: left;
  }

  .quiz-question-card {
    border-radius: 18px;
  }

  .quiz-result-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .lesson-intro p {
    font-size: 12px;
  }

  .pattern-description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .btn-ctrl:first-child,
  .btn-ctrl:last-child {
    display: none;
  }

  .player-controls-group {
    justify-content: center;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #lt-cinema-canvas {
    display: none;
  }
}

@media (forced-colors: active) {
  .status-dot {
    border: 1px solid currentColor;
  }

  .app-scrubber-slider {
    forced-color-adjust: none;
  }
}
