:root {
    --bg: #f4efe7;
    --surface: #fbf8f3;
    --surface-soft: #f2ebe2;
    --text: #2c241d;
    --muted: #7b6f63;
    --line: #dfd4c7;
    --accent: #8a6b52;
    --accent-dark: #6f543f;
    --accent-soft: #eadfd2;
    --gold: #a9855f;
    --gold-soft: #f1e6d9;
    --focus-bg: #ece3d8;
    --shadow: 0 22px 60px rgba(50, 36, 25, 0.12);
    --radius-xl: 24px; --radius-lg: 16px; --radius-md: 12px;
    --ease-smooth: cubic-bezier(.22, 1, .36, 1);
    --ease-soft: cubic-bezier(.33, 1, .68, 1);
    --motion-long: 900ms;
    --motion-medium: 620ms;
    --motion-short: 320ms;
  }
  * { box-sizing: border-box; }
  body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: var(--text);
    background: radial-gradient(circle at 12% -4%, rgba(138,107,82,0.10), transparent 30rem), radial-gradient(circle at 92% 4%, rgba(169,133,95,0.08), transparent 26rem), var(--bg); -webkit-font-smoothing: antialiased; }
  button, input { font: inherit; }
  button { cursor: pointer; }

  .page { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 0 4px; }
  .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
  .brand-wordmark { display: block; width: auto; height: 48px; flex: none; object-fit: contain; }
  .lesson-meta { text-align: right; }
  .lesson-meta strong { display: block; font-size: 15.4px; font-weight: 600; }
  .lesson-meta span { display: block; margin-top: 2px; font-size: 13.2px; color: var(--muted); }
  .lesson-meta .instructor-credit {
    display: block;
    margin: 0;
    font-size: 12.65px;
    font-weight: 500;
    color: #77695d;
  }

  .instructor-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
  }

  .instructor-avatar {
    display: block;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    max-width: 32px;
    min-height: 32px;
    max-height: 32px;
    flex: 0 0 32px;
    border: 1px solid rgba(111, 84, 63, 0.16);
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: #efe6db;
    box-shadow: 0 6px 14px rgba(80, 57, 40, 0.13);
  }

  .shell { overflow: hidden; background: var(--surface); border: 1px solid rgba(221,228,223,0.95); border-radius: var(--radius-xl); box-shadow: var(--shadow); }

  .video-wrap {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #201914;
    user-select: none;
    margin: 0;
    border-radius: 0;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: margin, border-radius, box-shadow, transform;
    transition:
      margin var(--motion-long) var(--ease-smooth),
      border-radius 720ms var(--ease-smooth),
      box-shadow 720ms var(--ease-smooth),
      transform var(--motion-long) var(--ease-smooth);
  }

  .shell {
    position: relative;
    isolation: isolate;
    transition:
      background 760ms var(--ease-soft),
      box-shadow 760ms var(--ease-soft);
  }

  .shell.paused {
    background: linear-gradient(180deg, #f6f0e9 0%, var(--focus-bg) 100%);
  }

  .shell.paused .video-wrap {
    margin: 18px;
    border-radius: var(--radius-lg);
    transform: translate3d(0, 0, 0) scale(.997);
    box-shadow:
      0 18px 42px rgba(50, 36, 25, 0.11),
      0 0 0 1px rgba(120, 98, 78, 0.07);
  }

  .shell.resuming .video-wrap {
    transition-duration: 820ms, 680ms, 680ms, 820ms;
  }


  .lecture-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #090909;
  }
  .caption-overlay {
    position: absolute;
    left: 50%;
    bottom: clamp(74px, 8.5%, 94px);
    z-index: 5;
    width: max-content;
    max-width: min(82%, 920px);
    margin: 0;
    padding: 11px 18px 12px;
    border: 1px solid rgba(255, 247, 235, 0.20);
    border-radius: 14px;
    color: #fffaf2;
    background:
      linear-gradient(180deg, rgba(43, 31, 23, 0.88), rgba(27, 19, 14, 0.91));
    box-shadow:
      0 14px 34px rgba(8, 5, 3, 0.30),
      0 2px 8px rgba(8, 5, 3, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(14px) saturate(1.12);
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
    font-family: "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(11.2px, 1.12vw, 16.8px);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.34;
    text-align: center;
    text-wrap: balance;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.52);
    transform: translateX(-50%);
    transform-origin: 50% 100%;
    pointer-events: none;
  }
  .caption-overlay::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 231, 202, 0.52), transparent);
  }
  .caption-overlay.is-changing {
    animation: caption-arrive 220ms cubic-bezier(.22, 1, .36, 1);
  }
  @keyframes caption-arrive {
    from { opacity: 0.30; transform: translateX(-50%) translateY(5px) scale(.985); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  }
  .caption-overlay[hidden] { display: none; }
  .cc-button {
    width: 40px;
    border-radius: 10px;
    border-color: rgba(255,255,255,0.17);
    font-family: "Avenir Next", Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.065em;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  }
  .cc-button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 247, 235, 0.34);
  }
  .cc-button.active {
    color: #2c1f16;
    border-color: rgba(255, 247, 235, 0.82);
    background: #fff7eb;
    box-shadow: 0 5px 16px rgba(20, 13, 9, 0.20);
  }
  .video-wrap:fullscreen .caption-overlay,
  .video-wrap:-webkit-full-screen .caption-overlay {
    bottom: clamp(92px, 9%, 126px);
    max-width: min(78%, 1160px);
    padding: 14px 24px 15px;
    border-radius: 17px;
    font-size: clamp(15.2px, 1.4vw, 24px);
  }
  @media (max-width: 680px) {
    .caption-overlay {
      bottom: 64px;
      max-width: 90%;
      padding: 8px 12px 9px;
      border-radius: 11px;
      font-size: clamp(9.6px, 2.4vw, 12px);
      line-height: 1.3;
    }
    .caption-overlay::before { left: 12px; right: 12px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .caption-overlay.is-changing { animation: none; }
  }
  .cc-button[hidden] { display: none; }

  .lecture-video[hidden],
  .lesson-scene[hidden] {
    display: none !important;
  }

  .lesson-scene { position: absolute; inset: 0; display: grid; grid-template-columns: 35% 65%; background: #261f19; }
  .instructor-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background:
      linear-gradient(to bottom, rgba(138,107,82,0.10), rgba(29,23,19,0.24)),
      radial-gradient(circle at 50% 22%, #6d5a4b 0, #342a23 46%, #1d1713 100%);
  }
  .instructor-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 38%;
    transform: none;
    filter: saturate(0.92) contrast(1.02) brightness(0.98);
  }
  .instructor-photo-overlay {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(to right, rgba(29,23,19,0.18), rgba(29,23,19,0.02) 28%, rgba(29,23,19,0.10) 100%),
      linear-gradient(to bottom, rgba(255,255,255,0.04), rgba(0,0,0,0.08));
    pointer-events: none;
  }
  .instructor-label { position: absolute; left: 20px; bottom: 54px; color: rgba(255,248,243,0.84); font-size: 12px; letter-spacing: 0.04em; }

  .slide-panel { position: relative; padding: 7% 7% 12%; color: var(--text); background: linear-gradient(140deg, #fcf8f2, #eee4d8); }
    .slide-brand {
    position: absolute;
    top: 18px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 7px;
    border: 1px solid rgba(64, 88, 107, 0.10);
    border-radius: 999px;
    background: rgba(251, 248, 243, 0.78);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 22px rgba(50, 36, 25, 0.05);
    opacity: 0.92;
  }
  .slide-brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    overflow: hidden;
    flex: none;
    background: #fbf8f3;
    box-shadow: 0 4px 10px rgba(111, 84, 63, 0.16);
  }
  .slide-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
  }
  .slide-brand-word {
    color: #6f6256;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
  }
.slide-kicker { margin-bottom: 12px; color: var(--accent); font-size: clamp(10px, 1.1vw, 12px); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
  .slide-title { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: clamp(26px, 4vw, 58px); font-weight: 500; letter-spacing: -0.04em; line-height: 0.98; }
  .equation { margin-top: clamp(18px, 3.4vw, 40px); padding: clamp(14px, 2vw, 22px) clamp(16px, 2.2vw, 26px); border: 1px solid rgba(138,107,82,0.18); border-left: 4px solid var(--accent); border-radius: 14px; background: rgba(255,255,255,0.82); box-shadow: 0 12px 30px rgba(32,50,42,0.07); font-family: Georgia, serif; font-size: clamp(18px, 2.4vw, 32px); display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  .equation .why { font-family: Inter, sans-serif; font-size: clamp(11px, 1.1vw, 13px); color: var(--accent); font-weight: 600; }
  .slide-copy { margin-top: 16px; max-width: 660px; color: #57635d; font-size: clamp(11px, 1.3vw, 15px); line-height: 1.55; }
  .slide-source {
    margin-top: 14px;
    color: #73807a;
    font-size: clamp(10px, 1.05vw, 12px);
    line-height: 1.45;
  }
  sub { font-size: 0.62em; }

  .media-setup {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 9;
    transform: translate(-50%, -50%);
    display: grid;
    justify-items: center;
    gap: 10px;
  }

  .media-start {
    position: static;
    transform: none;
    z-index: 9;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 19px;
    border: 1px solid rgba(255,255,255,0.24);
    border-radius: 999px;
    color: #fbf8f3;
    background: rgba(33, 26, 21, 0.78);
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 38px rgba(0,0,0,0.24);
    font-weight: 600;
    transition: opacity 320ms ease, background 180ms ease;
  }
  .media-start:hover {
    transform: none;
    background: rgba(33, 26, 21, 0.92);
  }
  .media-setup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -46%);
  }
  .media-setup {
    transition: opacity 320ms ease, transform 320ms ease;
  }
  .media-note {
    max-width: 280px;
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.35);
  }
  .media-start-icon {
    font-size: 13px;
  }

  .state-badge { position: absolute; top: 16px; right: 16px; left: auto; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid rgba(255,255,255,0.16); border-radius: 999px; color: #fbf8f3; background: rgba(18,30,25,0.6); backdrop-filter: blur(10px); font-size: 12px; font-weight: 600; }
  .state-dot { width: 8px; height: 8px; border-radius: 50%; background: #c9b19a; box-shadow: 0 0 0 4px rgba(201,177,154,0.16); }
  .state-badge.paused .state-dot { background: #c59a6b; box-shadow: 0 0 0 4px rgba(197,154,107,0.16); }
  .state-badge.resuming .state-dot {
    background: #bea48c;
    box-shadow: 0 0 0 4px rgba(190,164,140,0.16);
    animation: resume-pulse 0.7s ease-in-out infinite alternate;
  }
  @keyframes resume-pulse {
    from { opacity: 0.55; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.08); }
  }

  .pause-screen {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    background: rgba(22, 17, 14, 0.18);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 520ms ease,
      background 520ms ease;
  }
  .pause-screen.visible { opacity: 1; }
  .pause-icon {
    width: 70px;
    height: 70px;
    border: 1px solid rgba(255,255,255,0.24);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fbf8f3;
    background: rgba(33, 26, 21, 0.60);
    backdrop-filter: blur(10px);
    font-size: 24px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.18);
    opacity: 0;
    transform: scale(.88) translateY(4px);
    transition:
      opacity 420ms ease 80ms,
      transform 620ms var(--ease-smooth) 40ms;
  }
  .pause-screen.visible .pause-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  .shell.resuming .pause-icon {
    opacity: 0;
    transform: scale(.94) translateY(-3px);
    transition-delay: 0ms;
  }

  .controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 30px 18px 14px; color: #fbf8f3; background: linear-gradient(to top, rgba(8,15,12,0.9), transparent); }
  .progress { position: relative; height: 5px; margin-bottom: 12px; border-radius: 999px; background: rgba(255,255,255,0.24); overflow: hidden; cursor: pointer; }
  .progress-fill { width: 34%; height: 100%; border-radius: inherit; background: #eadfd2; transition: width 200ms linear; }
  .control-row { display: flex; align-items: center; gap: 12px; }
  .icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: #fbf8f3; background: rgba(255,255,255,0.13); display: grid; place-items: center; font-size: 13px; transition: background 150ms ease, transform 150ms ease; }
  .icon-button:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

  .fullscreen-button .fullscreen-glyph {
    width: 20px;
    height: 20px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
  }

  .volume-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
  }

  .volume-button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .volume-button svg {
    display: block;
    width: 15px;
    height: 15px;
    overflow: visible;
  }

  .volume-button .speaker-body {
    fill: currentColor;
    stroke: none;
  }

  .volume-button .speaker-wave,
  .volume-button .speaker-mute {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .volume-slider {
    width: 82px;
    height: 18px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
  }

  .volume-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #eadfd2 var(--volume-level, 100%), rgba(255,255,255,0.25) var(--volume-level, 100%));
  }

  .volume-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: 1px solid rgba(69, 50, 36, 0.24);
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    background: #f6efe7;
    box-shadow: 0 3px 10px rgba(0,0,0,0.28);
  }

  .volume-slider::-moz-range-track {
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
  }

  .volume-slider::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: #eadfd2;
  }

  .volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 1px solid rgba(69, 50, 36, 0.24);
    border-radius: 50%;
    background: #f6efe7;
    box-shadow: 0 3px 10px rgba(0,0,0,0.28);
  }

  .volume-slider:focus-visible {
    outline: 2px solid rgba(246,239,231,0.86);
    outline-offset: 4px;
    border-radius: 999px;
  }

  @media (max-width: 760px) {
    .volume-control { min-width: 100px; gap: 6px; }
    .volume-slider { width: 58px; }
  }

  .time { font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.82); }
  .spacer { flex: 1; }
  .shortcut { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,0.76); font-size: 11px; }
  kbd { min-width: 46px; padding: 4px 8px; border: 1px solid rgba(255,255,255,0.26); border-bottom-color: rgba(255,255,255,0.4); border-radius: 7px; color: #fbf8f3; background: rgba(255,255,255,0.1); text-align: center; font: inherit; font-size: 11px; font-weight: 600; }

  .below-video {
    padding: 18px;
    background: transparent;
    transition:
      padding var(--motion-medium) var(--ease-smooth),
      background-color 760ms var(--ease-soft);
  }

  .watching-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    max-height: 72px;
    color: var(--muted);
    font-size: 14px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition:
      max-height 520ms var(--ease-smooth),
      min-height 520ms var(--ease-smooth),
      opacity 260ms ease,
      transform 420ms var(--ease-smooth);
  }
  .watching-hint.hidden {
    min-height: 0;
    max-height: 0;
    opacity: 0;
    transform: translateY(-7px);
  }
  .watching-hint kbd {
    color: var(--text);
    border-color: #d6cabd;
    background: #f4ede5;
  }

  .qa-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 16px, 0) scale(.994);
    filter: blur(1.4px);
    will-change: grid-template-rows, opacity, transform, filter;
    transition:
      grid-template-rows 860ms var(--ease-smooth),
      opacity 430ms ease 80ms,
      transform 720ms var(--ease-smooth) 60ms,
      filter 440ms ease 60ms,
      visibility 0s linear 860ms;
  }

  .qa-panel.open {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
    transition:
      grid-template-rows 920ms var(--ease-smooth) 60ms,
      opacity 480ms ease 190ms,
      transform 760ms var(--ease-smooth) 110ms,
      filter 470ms ease 130ms,
      visibility 0s linear 0s;
  }

  .qa-inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 12px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0);
    box-shadow: 0 0 0 rgba(50,36,25,0);
    backdrop-filter: blur(0);
    transition:
      padding 820ms var(--ease-smooth) 40ms,
      background 580ms ease 160ms,
      box-shadow 620ms ease 150ms,
      backdrop-filter 580ms ease 150ms;
  }

  .qa-panel.open .qa-inner {
    padding: 10px 12px 12px;
    background: rgba(255,255,255,0.91);
    box-shadow: 0 18px 42px rgba(50,36,25,0.09);
    backdrop-filter: blur(14px);
  }

  .shell.resuming .qa-panel {
    opacity: 0;
    transform: translate3d(0, 9px, 0) scale(.996);
    filter: blur(1px);
    transition:
      grid-template-rows 680ms var(--ease-smooth) 120ms,
      opacity 260ms ease,
      transform 360ms var(--ease-soft),
      filter 260ms ease,
      visibility 0s linear 680ms;
  }

  .prev { margin-bottom: 16px; }
  .prev[hidden] { display: none; }
  .prev-toggle { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent-dark); padding: 11px 13px; }
  .prev-toggle:hover { background: #e9efeb; }
  .prev-toggle .chev { width: 13px; height: 13px; fill: currentColor; flex: none; transition: transform .2s; }
  .prev-toggle.open .chev { transform: rotate(90deg); }
  .prev-list { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
  .prev-list[hidden] { display: none; }
  .prev-q { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 14px; color: var(--text); transition: border-color .15s; }
  .prev-q:hover { border-color: var(--accent); }
  .prev-q .chev { width: 12px; height: 12px; fill: var(--muted); flex: none; transition: transform .2s; }
  .prev-q.open .chev { transform: rotate(90deg); }
  .prev-q-num {
    flex: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
  }
  .prev-q-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .prev-q-ts { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
  .prev-a { padding-top: 8px; }
  .prev-a[hidden] { display: none; }
  .prev-a .answer-question { display: none; }

  .qa-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
  .qa-heading h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.025em;
    transition: opacity 220ms ease, transform 300ms var(--ease-smooth);
  }
  .qa-heading h2.prompt-changing {
    opacity: 0;
    transform: translateY(4px);
  }
  .qa-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
  .timestamp-pill { flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; color: var(--accent-dark); background: var(--accent-soft); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

  .ask-form { display: flex; gap: 10px; align-items: stretch; }
  .question-input { flex: 1; min-height: 50px; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-md); outline: none; color: var(--text); background: #fbfcfb; transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease; }
  .question-input::placeholder { color: #9aa29e; }
  .question-input:focus { border-color: rgba(47,111,94,0.7); background: white; box-shadow: 0 0 0 4px rgba(47,111,94,0.1); }
  .ask-button { min-width: 92px; padding: 0 20px; border: 0; border-radius: var(--radius-md); font-weight: 600; color: #fbf8f3; background: var(--accent); transition: transform 150ms ease, background 150ms ease, opacity 150ms ease; }
  .ask-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
  .ask-button:disabled { cursor: wait; opacity: 0.62; transform: none; }
  .ask-button,
  .resume-button {
    transition:
      background 220ms ease,
      opacity 220ms ease,
      transform 320ms var(--ease-smooth),
      box-shadow 320ms ease;
  }
  .ask-button:not(:disabled):active,
  .resume-button:not(:disabled):active {
    transform: translateY(1px) scale(.985);
  }

  .current { display: flex; flex-direction: column; }
  .answer-card {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: rgba(242,235,226,0);
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(.994);
    overflow: hidden;
    transition:
      grid-template-rows 620ms var(--ease-smooth),
      margin-top 520ms var(--ease-smooth),
      border-color 440ms ease,
      background 480ms ease,
      opacity 360ms ease 70ms,
      transform 560ms var(--ease-smooth) 40ms;
  }

  .answer-card-inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 18px;
    transition: padding 600ms var(--ease-smooth);
  }

  .answer-card.visible {
    grid-template-rows: 1fr;
    margin-top: 16px;
    border-color: var(--line);
    background: var(--surface-soft);
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .answer-card.visible .answer-card-inner {
    padding: 18px;
  }

  .current.answering .answer-card {
    box-shadow: 0 12px 28px rgba(50,36,25,0.055);
  }
  .question-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    margin-bottom: 13px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .qa-index {
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
    white-space: nowrap;
  }
  .question-time {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.65;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .answer-label {
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
  }
  .verified { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; color: #fbf8f3; background: var(--accent-dark); font-size: 11.5px; font-weight: 600; }
  .verified svg { width: 13px; height: 13px; fill: white; }
  .answer-question { margin: 0; font-size: 13.5px; line-height: 1.5; font-weight: 600; color: var(--text); }
  .answer-copy { margin: 0; color: #34403a; font-size: 15.5px; line-height: 1.62; min-height: 1.62em; }
  .answer-copy.streaming::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 4px;
    vertical-align: -0.12em;
    border-radius: 2px;
    background: var(--accent);
    animation: stream-cursor 0.8s steps(1) infinite;
  }
  @keyframes stream-cursor {
    0%, 46% { opacity: 1; }
    47%, 100% { opacity: 0; }
  }
  .grounding { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
  .ground-label { font-size: 12.5px; color: var(--muted); }
  .source { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 8px; background: var(--gold-soft); color: #7a5b22; font-size: 12.5px; }
  .source.green { background: var(--accent-soft); color: var(--accent-dark); }
  .source svg { width: 12px; height: 12px; fill: currentColor; }

  .panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 18px; }
  .foot-hint { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px; }
  .foot-hint kbd { color: var(--text); border-color: #d6cabd; background: #f4ede5; }
  .resume-button { padding: 11px 17px; border: 0; border-radius: var(--radius-md); font-weight: 600; color: #fbf8f3; background: var(--accent); transition: transform 150ms ease, background 150ms ease; }
  .resume-button:hover { background: var(--accent-dark); transform: translateY(-1px); }

  .footer-note { margin: 16px 4px 0; color: #8a938f; font-size: 12px; text-align: center; }

  /* Fullscreen the complete lesson shell so the Q&A remains available. */
  .shell:fullscreen {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #171310;
    transition: background-color 820ms ease;
  }

  .shell:fullscreen .video-wrap {
    flex: 0 0 auto;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    aspect-ratio: auto;
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
  }

  .shell:fullscreen .below-video {
    display: block;
    flex: 0 0 auto;
    width: min(90%, 1160px);
    max-height: 0;
    margin: 0 auto;
    padding: 0 18px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translate3d(0, 24px, 0);
    transition:
      max-height 880ms var(--ease-smooth),
      padding 760ms var(--ease-smooth),
      margin 760ms var(--ease-smooth),
      opacity 380ms ease 130ms,
      transform 680ms var(--ease-smooth) 80ms;
  }

  /* Pausing in fullscreen opens a clarification workspace. */
  .shell:fullscreen.paused {
    overflow-y: auto;
    background: linear-gradient(180deg, #f3ece4 0%, var(--focus-bg) 100%);
  }

  .shell:fullscreen.paused .video-wrap {
    width: calc(100% - 36px);
    max-width: 1160px;
    height: 62dvh;
    min-height: 360px;
    margin: 18px auto;
    border-radius: var(--radius-lg);
    box-shadow:
      0 16px 38px rgba(50, 36, 25, 0.12),
      0 0 0 1px rgba(120, 98, 78, 0.08);
  }

  .shell:fullscreen.paused .below-video {
    width: calc(100% - 36px);
    max-width: 1160px;
    max-height: 1200px;
    margin: 0 auto 18px;
    padding: 10px 18px 18px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .shell:fullscreen.paused .watching-hint {
    display: none;
  }

  .shell:fullscreen .fullscreen-button {
    background: rgba(255,255,255,0.20);
  }

  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      transition-delay: 0ms !important;
      scroll-behavior: auto !important;
    }
  }
  @media (max-width: 760px) {
    .lesson-scene { grid-template-columns: 32% 68%; }
    .slide-copy { display: none; }
    .ask-form { flex-direction: column; }
    .ask-button { height: 48px; }
    .shell.paused .video-wrap { margin: 12px 3% 4px; }
  }
  @media (max-width: 520px) {
    .brand { gap: 8px; }
    .brand-wordmark { height: 40px; object-fit: contain; }
    .slide-brand {
      top: 12px;
      right: 12px;
      padding: 6px 9px 6px 6px;
      gap: 6px;
    }
    .slide-brand-mark {
      width: 21px;
      height: 21px;
    }
    .brand-logo {
      width: 138px;
      max-width: 48vw;
    }
    .slide-brand-word {
      font-size: 11px;
    }

    .lesson-meta { display: none; }
    .video-wrap { aspect-ratio: 4/3; }
    .instructor-label { display: none; }

    .shell.paused .video-wrap {
      margin: 14px;
    }

    .shell:fullscreen.paused .video-wrap {
      width: calc(100% - 24px);
      height: 48dvh;
      min-height: 260px;
      margin: 12px auto;
      border-radius: 14px;
      box-shadow:
        0 12px 24px rgba(50, 36, 25, 0.10),
        0 0 0 1px rgba(120, 98, 78, 0.08);
    }

    .shell:fullscreen .below-video,
    .shell:fullscreen.paused .below-video {
      width: calc(100% - 24px);
      border-radius: 14px;
    }

    .shell:fullscreen.paused .below-video {
      margin: 0 auto 12px;
      padding: 10px 12px 16px;
    }
  }


  /* =========================================================
     shared side-by-side lesson + interaction workspace
     Inspired by the persistent vertical research-assistant layout,
     while retaining the shared visual language and pause-to-ask flow.
     ========================================================= */
  .page {
    width: min(1400px, calc(100% - 32px));
  }

  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: auto;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }

  .video-wrap,
  .shell.paused .video-wrap,
  .shell.resuming .video-wrap {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: auto;
    min-width: 0;
    margin: 0;
    border-radius: 0;
    transform: none;
    box-shadow: none;
  }

  .below-video {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: rgba(251, 248, 243, 0.98);
  }

  .qa-panel,
  .qa-panel.open,
  .shell.resuming .qa-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    filter: none;
    transition: background 320ms ease, opacity 320ms ease;
  }

  .qa-panel:not(.open) {
    background: rgba(248, 244, 238, 0.62);
  }

  .qa-inner,
  .qa-panel.open .qa-inner {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .qa-heading {
    flex: 0 0 auto;
    align-items: flex-start;
    margin: 0;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(251, 248, 243, 0.96);
  }

  .qa-heading h2 {
    font-size: 18px;
    line-height: 1.2;
  }

  .qa-heading p {
    max-width: 210px;
    line-height: 1.45;
  }

  .timestamp-pill {
    padding: 6px 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  .conversation-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 16px 10px;
    scrollbar-width: thin;
    scrollbar-color: #cdbfae transparent;
  }

  .conversation-scroll::-webkit-scrollbar { width: 7px; }
  .conversation-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cdbfae;
  }

  .watching-hint {
    min-height: 0;
    max-height: none;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 14px;
    border: 1px dashed #d6cabd;
    border-radius: 12px;
    background: rgba(242, 235, 226, 0.62);
    color: #75695e;
    line-height: 1.45;
    text-align: left;
    opacity: 1;
    transform: none;
  }

  .watching-hint.hidden {
    display: none;
  }

  .prev {
    margin-bottom: 12px;
  }

  .prev-toggle,
  .prev-q {
    padding: 10px 11px;
    font-size: 12.5px;
  }

  .prev-q-ts {
    display: none;
  }

  .current {
    min-height: 0;
  }

  .answer-card.visible {
    margin-top: 0;
    margin-bottom: 12px;
  }

  .answer-card.visible .answer-card-inner {
    padding: 15px;
  }

  .answer-copy {
    font-size: 14px;
    line-height: 1.58;
  }

  .answer-question {
    font-size: 13px;
    line-height: 1.45;
  }

  .question-line {
    gap: 7px;
    margin-bottom: 11px;
    padding-bottom: 10px;
  }

  .grounding {
    align-items: flex-start;
    gap: 7px;
  }

  .source {
    max-width: 100%;
    line-height: 1.35;
  }

  .ask-form {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    padding: 13px 16px 10px;
    border-top: 1px solid var(--line);
    background: rgba(251, 248, 243, 0.98);
  }

  .question-input {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    font-size: 13px;
  }

  .question-input:disabled {
    cursor: not-allowed;
    color: #978b80;
    background: #f1ebe4;
  }

  .ask-button {
    min-width: 70px;
    padding: 0 14px;
    font-size: 13px;
  }

  .ask-button:disabled {
    cursor: not-allowed;
  }

  .panel-foot {
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 0 16px 14px;
    background: rgba(251, 248, 243, 0.98);
  }

  .foot-hint {
    font-size: 11px;
  }

  .resume-button {
    min-height: 40px;
    padding: 9px 13px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .resume-button[hidden] {
    display: none;
  }

  .shell.paused {
    background: var(--surface);
  }

  /* Fullscreen preserves the same two-column relationship. */
  .shell:fullscreen,
  .shell:fullscreen.paused {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(380px, 31vw);
    grid-template-rows: 100dvh;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background: #171310;
  }

  .shell:fullscreen .video-wrap,
  .shell:fullscreen.paused .video-wrap {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    aspect-ratio: auto;
  }

  .shell:fullscreen .below-video,
  .shell:fullscreen.paused .below-video {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    max-width: none;
    max-height: none;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 1;
    overflow: hidden;
    pointer-events: auto;
    transform: none;
    border-radius: 0;
  }

  .shell:fullscreen.paused .watching-hint {
    display: none;
  }

  @media (max-width: 1040px) {
    .page {
      width: min(980px, calc(100% - 24px));
    }

    .shell {
      grid-template-columns: 1fr;
      grid-template-rows: auto minmax(420px, 56vh);
    }

    .video-wrap,
    .shell.paused .video-wrap,
    .shell.resuming .video-wrap {
      grid-column: 1;
      grid-row: 1;
    }

    .below-video {
      grid-column: 1;
      grid-row: 2;
      height: auto;
      border-left: 0;
      border-top: 1px solid var(--line);
    }
  }

  @media (max-width: 760px) {
    .shell {
      grid-template-rows: auto minmax(440px, 62vh);
    }

    .ask-form {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .ask-button {
      height: auto;
    }
  }

  @media (max-width: 520px) {
    .page {
      width: min(100% - 16px, 720px);
      padding-top: 16px;
    }

    .shell {
      grid-template-rows: auto 500px;
      border-radius: 18px;
    }

    .shell.paused .video-wrap {
      margin: 0;
    }

    .qa-heading {
      padding: 16px 14px 13px;
    }

    .qa-heading p {
      max-width: 190px;
    }

    .conversation-scroll {
      padding: 13px 13px 8px;
    }

    .ask-form {
      padding: 11px 13px 9px;
    }

    .panel-foot {
      padding: 0 13px 12px;
    }

    .foot-hint {
      display: none;
    }

    .resume-button {
      width: 100%;
    }
  }



  /* =========================================================
     Two-mode shared workspace
     Normal mode: 70/30 lesson + interaction split.
     Fullscreen mode: video only.
     ========================================================= */
  .shell {
    grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  }

  .qa-panel,
  .qa-panel.open,
  .qa-panel:not(.open) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: rgba(251, 248, 243, 0.98);
  }

  .question-input:disabled {
    cursor: text;
    color: var(--text);
    background: #fbfcfb;
  }

  .panel-foot {
    justify-content: flex-start;
  }

  .resume-button {
    display: none !important;
  }

  /* Fullscreen mode: the requested fullscreen element contains only the video surface.
     The interaction panel, page header, lesson metadata, and footer remain outside it. */
  .shell:fullscreen,
  .shell:fullscreen.paused,
  .shell:-webkit-full-screen,
  .shell:-webkit-full-screen.paused {
    display: block;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background: #171310;
  }

  .shell:fullscreen .video-wrap,
  .shell:fullscreen.paused .video-wrap,
  .shell:-webkit-full-screen .video-wrap,
  .shell:-webkit-full-screen.paused .video-wrap {
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    aspect-ratio: auto;
  }

  .shell:fullscreen .below-video,
  .shell:fullscreen.paused .below-video,
  .shell:-webkit-full-screen .below-video,
  .shell:-webkit-full-screen.paused .below-video {
    display: none !important;
  }

  @media (max-width: 1040px) {
    .shell {
      grid-template-columns: 1fr;
    }
  }



  /* =========================================================
     Fixed desktop workspace
     - Uses nearly the full browser viewport
     - Maintains a true 70/30 split
     - Keeps the workspace height fixed
     - Scrolls only the conversation, never the whole layout
     ========================================================= */
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 100dvh;
  }

  .page {
    width: calc(100vw - 24px);
    max-width: none;
    height: 100dvh;
    margin: 0 auto;
    padding: 12px 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    row-gap: 10px;
    overflow: hidden;
  }

  .topbar {
    min-height: 54px;
    margin: 0;
    padding: 0 8px;
  }

  .shell,
  .shell.paused,
  .shell.resuming {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  .video-wrap,
  .shell.paused .video-wrap,
  .shell.resuming .video-wrap {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    aspect-ratio: auto;
    transform: none;
    box-shadow: none;
    overflow: hidden;
  }

  .below-video {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border-left: 1px solid var(--line);
  }

  .qa-panel,
  .qa-panel.open,
  .qa-panel:not(.open),
  .shell.resuming .qa-panel,
  .qa-inner,
  .qa-panel.open .qa-inner {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .qa-inner,
  .qa-panel.open .qa-inner {
    display: flex;
    flex-direction: column;
  }

  .conversation-scroll {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .qa-heading,
  .ask-form,
  .panel-foot {
    flex: 0 0 auto;
  }

  .current,
  .prev,
  .prev-list {
    min-height: 0;
  }

  .footer-note {
    display: none;
  }

  /* Preserve video-only fullscreen. */
  .shell:fullscreen,
  .shell:fullscreen.paused,
  .shell:-webkit-full-screen,
  .shell:-webkit-full-screen.paused {
    display: block;
    width: 100vw;
    height: 100dvh;
  }

  .shell:fullscreen .video-wrap,
  .shell:fullscreen.paused .video-wrap,
  .shell:-webkit-full-screen .video-wrap,
  .shell:-webkit-full-screen.paused .video-wrap {
    width: 100vw;
    height: 100dvh;
  }

  /* Keep side-by-side mode on ordinary laptop widths. */
  @media (max-width: 1040px) and (min-width: 841px) {
    .page {
      width: calc(100vw - 16px);
      padding: 8px 0;
    }

    .shell,
    .shell.paused,
    .shell.resuming {
      grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
      grid-template-rows: minmax(0, 1fr);
    }

    .video-wrap,
    .shell.paused .video-wrap,
    .shell.resuming .video-wrap {
      grid-column: 1;
      grid-row: 1;
      height: 100%;
      aspect-ratio: auto;
    }

    .below-video {
      grid-column: 2;
      grid-row: 1;
      height: 100%;
      border-top: 0;
      border-left: 1px solid var(--line);
    }
  }

  /* Compact screens stack, with a fixed-height interaction area. */
  @media (max-width: 840px) {
    html,
    body {
      height: auto;
      min-height: 100%;
      overflow: auto;
    }

    .page {
      width: min(100% - 16px, 760px);
      height: auto;
      min-height: 100dvh;
      padding: 12px 0 20px;
      display: block;
      overflow: visible;
    }

    .topbar {
      margin-bottom: 10px;
    }

    .shell,
    .shell.paused,
    .shell.resuming {
      height: auto;
      display: grid;
      grid-template-columns: 1fr;
      grid-template-rows: auto 520px;
      overflow: hidden;
    }

    .video-wrap,
    .shell.paused .video-wrap,
    .shell.resuming .video-wrap {
      grid-column: 1;
      grid-row: 1;
      width: 100%;
      height: auto;
      aspect-ratio: 16 / 9;
    }

    .below-video {
      grid-column: 1;
      grid-row: 2;
      height: 520px;
      border-left: 0;
      border-top: 1px solid var(--line);
    }
  }



  /* =========================================================
     Authoritative video-only fullscreen fix
     The fullscreen element is now #videoWrap itself—not .shell.
     This prevents pause/resume from revealing the interaction panel
     or creating any intermediate empty/black workspace.
     ========================================================= */
  #videoWrap:fullscreen,
  #videoWrap:-webkit-full-screen {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    background: #171310 !important;
  }

  #videoWrap:fullscreen .lesson-scene,
  #videoWrap:-webkit-full-screen .lesson-scene {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Pausing in fullscreen changes only playback state and overlays.
     It must never resize the video or expose sibling UI. */
  .shell.paused #videoWrap:fullscreen,
  .shell.resuming #videoWrap:fullscreen,
  .shell.paused #videoWrap:-webkit-full-screen,
  .shell.resuming #videoWrap:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
  }



  /* =========================================================
     Modern, softly grouped shared conversations
     Each question-answer exchange lives in one very light card.
     ========================================================= */
  .unit {
    margin: 0 0 14px;
  }

  .answer-card,
  .answer-card.visible {
    border-radius: 16px;
  }

  .answer-card.visible {
    margin: 0;
    border-color: rgba(111, 84, 63, 0.13);
    background: rgba(255, 253, 249, 0.82);
    box-shadow: 0 8px 24px rgba(50, 36, 25, 0.035);
  }

  .answer-card.visible .answer-card-inner {
    padding: 0;
  }

  .question-block {
    padding: 13px 15px 12px;
    border-bottom: 1px solid rgba(111, 84, 63, 0.09);
    background: rgba(244, 239, 232, 0.52);
  }

  .message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
  }

  .message-role {
    color: var(--accent-dark);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .question-time {
    color: #9a8d81;
    font-size: 10.75px;
    line-height: 1.3;
  }

  .answer-question {
    margin: 0;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.48;
  }

  .answer-block {
    padding: 14px 15px 15px;
  }

  .answer-head {
    margin-bottom: 9px;
    gap: 8px;
  }

  .message-marker {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    padding: 0;
    border: 1px solid #c9ad92;
    border-radius: 4px;
    background: #f1e6d8;
    color: #6b4d35;
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
  }

  .answer-label {
    color: var(--accent-dark);
    font-size: 12.5px;
    font-weight: 700;
  }

  .verified {
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid rgba(111, 84, 63, 0.13);
    color: #756354;
    background: rgba(242, 235, 226, 0.58);
    font-size: 10.5px;
    font-weight: 600;
  }

  .verified svg {
    width: 11px;
    height: 11px;
    fill: var(--accent-dark);
  }

  .answer-copy {
    color: #3f3933;
    font-size: 14px;
    line-height: 1.6;
  }

  .grounding {
    margin-top: 12px;
    padding-top: 10px;
    border-top-color: rgba(111, 84, 63, 0.09);
  }

  .ground-label {
    color: #918276;
    font-size: 10.5px;
  }

  .source {
    border-color: rgba(111, 84, 63, 0.10);
    color: #7f7063;
    background: rgba(248, 244, 238, 0.74);
    font-size: 10.5px;
  }

  .source.green {
    color: #6f6256;
    background: rgba(242, 235, 226, 0.62);
  }

  .prev-a .answer-question {
    display: block;
  }

  .prev-q-num {
    min-width: 25px;
    color: var(--accent-dark);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: none;
  }



  /* =========================================================
     Questions and answers / Take Notes workspace
     ========================================================= */
  .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .panel-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(251, 248, 243, 0.98);
  }

  .panel-tabs {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(111, 84, 63, 0.12);
    border-radius: 13px;
    background: rgba(242, 235, 226, 0.68);
  }

  .panel-tab {
    min-height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 11px;
    border: 0;
    border-radius: 9px;
    color: #796b60;
    background: transparent;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 160ms ease, background 180ms ease, box-shadow 180ms ease, transform 160ms ease;
  }

  .panel-tab:hover {
    color: var(--accent-dark);
  }

  .panel-tab:active {
    transform: scale(.98);
  }

  .panel-tab.active {
    color: var(--accent-dark);
    background: rgba(255, 253, 249, 0.98);
    box-shadow: 0 2px 9px rgba(50, 36, 25, 0.08);
  }



  .panel-toolbar .timestamp-pill {
    margin-left: auto;
  }

  .panel-view {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .panel-view[hidden] {
    display: none !important;
  }

  .notes-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: #cdbfae transparent;
  }

  .notes-scroll::-webkit-scrollbar { width: 7px; }
  .notes-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cdbfae;
  }

  .notes-empty {
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 24px 18px;
    border: 1px dashed rgba(111, 84, 63, 0.18);
    border-radius: 14px;
    color: #8a7b70;
    background: rgba(255, 253, 249, 0.5);
    font-size: 12.5px;
    line-height: 1.55;
    text-align: center;
  }

  .notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .note-card {
    position: relative;
    padding: 12px 38px 13px 13px;
    border: 1px solid rgba(111, 84, 63, 0.12);
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.82);
    box-shadow: 0 7px 20px rgba(50, 36, 25, 0.025);
  }

  .note-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 7px;
    padding: 4px 7px;
    border: 1px solid rgba(111, 84, 63, 0.12);
    border-radius: 999px;
    color: var(--accent-dark);
    background: rgba(242, 235, 226, 0.62);
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
  }

  .note-time:hover {
    background: rgba(233, 222, 210, 0.86);
  }

  .note-text {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
  }

  .note-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #a09287;
    background: transparent;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
  }

  .note-delete:hover {
    color: #755d4d;
    background: rgba(242, 235, 226, 0.72);
  }

  .note-form {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    padding: 13px 16px 10px;
    border-top: 1px solid var(--line);
    background: rgba(251, 248, 243, 0.98);
  }

  .note-input {
    width: 100%;
    min-height: 78px;
    max-height: 135px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    outline: none;
    color: var(--text);
    background: #fbfcfb;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  }

  .note-input::placeholder { color: #9aa29e; }

  .note-input:focus {
    border-color: rgba(47,111,94,0.7);
    background: white;
    box-shadow: 0 0 0 4px rgba(47,111,94,0.1);
  }

  .add-note-button {
    min-width: 76px;
    padding: 0 13px;
    border: 0;
    border-radius: var(--radius-md);
    color: #fbf8f3;
    background: var(--accent);
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
    transition: background 180ms ease, transform 160ms ease;
  }

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

  .notes-foot {
    flex: 0 0 auto;
    padding: 0 16px 14px;
    color: #93867b;
    background: rgba(251, 248, 243, 0.98);
    font-size: 10.75px;
  }

  .save-note-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
  }

  .save-note-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid rgba(111, 84, 63, 0.14);
    border-radius: 9px;
    color: #756354;
    background: rgba(242, 235, 226, 0.5);
    font-size: 10.75px;
    font-weight: 650;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  }

  .save-note-button:hover {
    color: var(--accent-dark);
    background: rgba(233, 222, 210, 0.78);
  }

  .save-note-button:active {
    transform: scale(.98);
  }

  .save-note-button.saved {
    color: var(--accent-dark);
    background: rgba(222, 235, 228, 0.86);
  }


  /* Compact answer footer: evidence on demand, note action always visible. */
  .answer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid rgba(111, 84, 63, 0.10);
  }

  .sources-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 0;
    border: 0;
    color: #7b6d62;
    background: transparent;
    font-size: 10.75px;
    font-weight: 650;
    cursor: pointer;
    transition: color 160ms ease;
  }

  .sources-toggle:hover {
    color: var(--accent-dark);
  }

  .sources-toggle svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform 180ms ease;
  }

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

  .source-details {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
    padding: 10px;
    border: 1px solid rgba(111, 84, 63, 0.10);
    border-radius: 10px;
    background: rgba(242, 235, 226, 0.34);
  }

  .source-details[hidden] {
    display: none !important;
  }

  .source-details .source {
    padding: 4px 8px;
    font-size: 10.75px;
  }

  .answer-actions .save-note-button {
    margin-left: auto;
  }

  .save-note-row {
    display: none;
  }

  @media (max-width: 760px) {
    .panel-toolbar {
      padding: 10px 11px;
      gap: 7px;
    }
    .panel-tab {
      padding: 7px 9px;
      font-size: 12px;
    }
    .panel-toolbar .timestamp-pill { display: none; }
    .note-form { grid-template-columns: 1fr; }
    .add-note-button { min-height: 42px; }
  }



  /* =========================================================
     Course navigation workspace
     ========================================================= */
  .workspace {
    --course-nav-width: 264px;
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--course-nav-width) 8px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    transition: grid-template-columns 380ms var(--ease-smooth);
  }

  .course-sidebar {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(111, 84, 63, 0.13);
    border-radius: 18px;
    background: rgba(251, 248, 243, 0.94);
    box-shadow: 0 14px 34px rgba(50, 36, 25, 0.07);
    transition: opacity 240ms ease, transform 380ms var(--ease-smooth), border-color 240ms ease;
  }

  .workspace > .shell {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 68px;
    padding: 12px;
    border-bottom: 1px solid rgba(111, 84, 63, 0.09);
  }

  .student-profile {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }

  .student-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid rgba(111, 84, 63, 0.16);
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: #efe6db;
    box-shadow: 0 8px 18px rgba(80, 57, 40, 0.14);
  }

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

  .sidebar-copy strong,
  .sidebar-copy span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-copy strong {
    margin-top: 2px;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
  }

  .student-kicker {
    color: #998a7d;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .sidebar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
  }

  .sidebar-icon-button {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #7c6c5f;
    background: transparent;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
  }

  .sidebar-icon-button:hover {
    color: var(--accent-dark);
    background: rgba(138, 107, 82, 0.09);
  }

  .sidebar-icon-button:active {
    transform: scale(.96);
  }

  .sidebar-icon-button svg,
  .module-chevron,
  .sidebar-restore svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .course-summary {
    margin: 12px 12px 8px;
    padding: 13px;
    border: 1px solid rgba(111, 84, 63, 0.10);
    border-radius: 14px;
    background: rgba(242, 235, 226, 0.54);
  }

  .course-summary strong,
  .course-summary span {
    display: block;
  }

  .course-eyebrow {
    color: #998a7d;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .course-summary strong {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.35;
  }

  .course-summary > span:last-of-type {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.4;
  }

  .course-progress {
    height: 4px;
    margin-top: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(111, 84, 63, 0.12);
  }

  .course-progress span {
    width: 28%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
  }

  .course-tree {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 8px 12px;
    overscroll-behavior: contain;
  }

  .course-module + .course-module {
    margin-top: 4px;
  }

  .module-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 8px;
    border: 0;
    border-radius: 9px;
    color: #77685b;
    background: transparent;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
  }

  .module-toggle:hover {
    background: rgba(138, 107, 82, 0.055);
  }

  .module-chevron {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    transition: transform 190ms ease;
  }

  .course-module.open .module-chevron {
    transform: rotate(90deg);
  }

  .module-lessons {
    display: none;
    gap: 3px;
    margin-top: 1px;
  }

  .course-module.open > .module-lessons {
    display: grid;
  }

  .lecture-item {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--text);
    background: transparent;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  }

  .lecture-item:hover {
    background: rgba(138, 107, 82, 0.055);
  }

  .lecture-item.pending {
    color: rgba(73, 57, 44, 0.72);
  }

  .lecture-item.pending .lecture-index {
    border-style: dashed;
    background: rgba(255, 253, 249, 0.42);
  }

  .lecture-item.pending .lecture-copy small {
    color: #a19488;
  }

  .lecture-item:active {
    transform: scale(.99);
  }

  .lecture-item.active {
    border-color: rgba(111, 84, 63, 0.13);
    background: rgba(234, 223, 210, 0.68);
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .lecture-index {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(111, 84, 63, 0.13);
    border-radius: 8px;
    color: #806c5a;
    background: rgba(255, 253, 249, 0.72);
    font-size: 10px;
    font-weight: 700;
  }

  .lecture-item.active .lecture-index {
    color: #fbf8f3;
    border-color: var(--accent);
    background: var(--accent);
  }

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

  .lecture-copy strong,
  .lecture-copy small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .lecture-copy strong {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
  }

  .lecture-copy small {
    margin-top: 2px;
    color: #9a8d81;
    font-size: 9.5px;
    line-height: 1.3;
  }

  .lecture-status {
    color: #8b9a83;
    font-size: 10px;
  }

  .lecture-status.playing {
    color: var(--accent);
    font-size: 9px;
  }

  .sidebar-foot {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 11px 13px 13px;
    border-top: 1px solid rgba(111, 84, 63, 0.09);
    color: #8d7e71;
    font-size: 9.5px;
    line-height: 1.4;
  }

  .autosave-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    margin-top: 3px;
    border-radius: 999px;
    background: #78936f;
    box-shadow: 0 0 0 3px rgba(120, 147, 111, 0.10);
  }

  .sidebar-resizer {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    cursor: col-resize;
    touch-action: none;
  }

  .sidebar-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 42px;
    border-radius: 999px;
    background: rgba(111, 84, 63, 0.14);
    transform: translate(-50%, -50%);
    transition: height 160ms ease, background 160ms ease;
  }

  .sidebar-resizer:hover::after,
  .sidebar-resizer.dragging::after {
    height: 68px;
    background: rgba(111, 84, 63, 0.38);
  }

  .sidebar-restore {
    position: absolute;
    z-index: 15;
    top: 12px;
    left: 8px;
    display: none;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 11px;
    color: #fbf8f3;
    background: rgba(38, 31, 25, 0.74);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.17);
    font-size: 10px;
    font-weight: 650;
  }

  .sidebar-restore:hover {
    background: rgba(38, 31, 25, 0.90);
  }

  .sidebar-restore svg {
    width: 17px;
    height: 17px;
  }

  /* One familiar sidebar control: fully open or fully hidden. */
  .sidebar-toggle svg,
  .sidebar-restore svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sidebar-restore {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    justify-content: center;
    color: #6f5948;
    background: rgba(251, 248, 243, 0.95);
    border-color: rgba(111, 84, 63, 0.16);
    box-shadow: 0 10px 24px rgba(36, 27, 21, 0.14);
  }

  .sidebar-restore:hover {
    color: var(--accent-dark);
    background: #fffdfa;
  }

  .sidebar-backdrop {
    display: none;
  }

  .workspace.sidebar-collapsed {
    grid-template-columns: 62px 0 minmax(0, 1fr);
  }

  .workspace.sidebar-collapsed .course-sidebar {
    border-radius: 16px;
  }

  .workspace.sidebar-collapsed .sidebar-top {
    min-height: 58px;
    padding: 10px 8px;
    justify-content: center;
  }

  .workspace.sidebar-collapsed .student-profile {
    justify-content: center;
  }

  .workspace.sidebar-collapsed .sidebar-copy,
  .workspace.sidebar-collapsed .course-summary,
  .workspace.sidebar-collapsed .module-toggle,
  .workspace.sidebar-collapsed .lecture-copy,
  .workspace.sidebar-collapsed .lecture-status,
  .workspace.sidebar-collapsed .sidebar-foot,
  .workspace.sidebar-collapsed .hide-sidebar,
  .workspace.sidebar-collapsed .sidebar-resizer {
    display: none;
  }

  .workspace.sidebar-collapsed .sidebar-actions {
    position: absolute;
    top: 48px;
  }

  .workspace.sidebar-collapsed .collapse-sidebar svg {
    transform: rotate(180deg);
  }

  .workspace.sidebar-collapsed .course-tree {
    padding: 36px 8px 10px;
  }

  .workspace.sidebar-collapsed .course-module + .course-module {
    margin-top: 3px;
  }

  .workspace.sidebar-collapsed .course-module.open > .module-lessons {
    display: grid;
  }

  .workspace.sidebar-collapsed .lecture-item {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 42px;
    padding: 6px;
  }

  .workspace.sidebar-hidden {
    grid-template-columns: 0 0 minmax(0, 1fr);
  }

  .workspace.sidebar-hidden .course-sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-24px);
    border-color: transparent;
  }

  .workspace.sidebar-hidden .sidebar-resizer {
    display: none;
  }

  .workspace.sidebar-hidden .sidebar-restore {
    display: inline-flex;
  }

  .lecture-switch-toast {
    position: absolute;
    z-index: 20;
    left: 50%;
    top: 18px;
    max-width: min(520px, calc(100% - 120px));
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: 12px;
    color: #fffaf6;
    background: rgba(38, 31, 25, 0.82);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.18);
    transform: translate(-50%, -12px);
    opacity: 0;
    pointer-events: none;
    font-size: 11px;
    font-weight: 550;
    text-align: center;
    transition: opacity 220ms ease, transform 300ms var(--ease-smooth);
  }

  .lecture-switch-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  @media (max-width: 1180px) and (min-width: 841px) {
    .workspace {
      --course-nav-width: 232px;
    }
  }

  @media (max-width: 840px) {
    .workspace,
    .workspace.sidebar-collapsed,
    .workspace.sidebar-hidden {
      position: relative;
      display: block;
      width: 100%;
      height: auto;
      overflow: visible;
    }

    .workspace > .shell {
      width: 100%;
    }

    .course-sidebar {
      position: fixed;
      z-index: 120;
      top: 8px;
      bottom: 8px;
      left: 8px;
      width: min(86vw, 320px);
      height: auto;
      border-radius: 18px;
      opacity: 0;
      pointer-events: none;
      transform: translateX(calc(-100% - 18px));
      box-shadow: 0 24px 70px rgba(30, 22, 17, 0.28);
    }

    .workspace.mobile-sidebar-open .course-sidebar {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(0);
    }

    .workspace.sidebar-collapsed .sidebar-copy,
    .workspace.sidebar-collapsed .course-summary,
    .workspace.sidebar-collapsed .module-toggle,
    .workspace.sidebar-collapsed .lecture-copy,
    .workspace.sidebar-collapsed .lecture-status,
    .workspace.sidebar-collapsed .sidebar-foot,
    .workspace.sidebar-collapsed .hide-sidebar {
      display: initial;
    }

    .workspace.sidebar-collapsed .course-sidebar {
      width: min(86vw, 320px);
    }

    .workspace.sidebar-collapsed .sidebar-top {
      min-height: 68px;
      padding: 12px;
      justify-content: space-between;
    }

    .workspace.sidebar-collapsed .student-profile {
      justify-content: flex-start;
    }

    .workspace.sidebar-collapsed .sidebar-actions {
      position: static;
    }

    .workspace.sidebar-collapsed .collapse-sidebar {
      display: none;
    }

    .workspace.sidebar-collapsed .course-tree {
      padding: 4px 8px 12px;
    }

    .workspace.sidebar-collapsed .module-lessons {
      display: none;
    }

    .workspace.sidebar-collapsed .course-module.open > .module-lessons {
      display: grid;
    }

    .workspace.sidebar-collapsed .lecture-item {
      grid-template-columns: 26px minmax(0, 1fr) auto;
      justify-items: stretch;
      min-height: 48px;
      padding: 7px 8px;
    }

    .collapse-sidebar,
    .sidebar-resizer {
      display: none !important;
    }

    .sidebar-backdrop {
      position: fixed;
      z-index: 110;
      inset: 0;
      display: block;
      background: rgba(28, 21, 17, 0.30);
      opacity: 0;
      pointer-events: none;
      transition: opacity 220ms ease;
    }

    .workspace.mobile-sidebar-open .sidebar-backdrop {
      opacity: 1;
      pointer-events: auto;
    }

    .sidebar-restore,
    .workspace.sidebar-hidden .sidebar-restore {
      display: inline-flex;
      position: absolute;
      top: 10px;
      left: 8px;
    }
  }
