body:has(.lecture-view) {
  min-height: 100vh;
  background: #f3f5f8;
  color: var(--nada-navy);
  font-family: var(--nada-font);
}
body:has(.lecture-view) main { padding-block: clamp(1rem, 2.6vw, 2.3rem) 2.5rem; }
body:has(.lecture-view) .account button,
.lecture-mode {
  color: var(--nada-midnight);
  border: 1px solid #b3c0d3;
  background: #fff;
}
body:has(.lecture-view) .account button:hover,
.lecture-mode:hover { border-color: var(--nada-blue); background: #edf3ff; }
.lecture-view { margin: 0 auto; max-width: 70rem; }
.lecture-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2.1vw, 1.5rem) clamp(1rem, 2.8vw, 2rem);
  color: #fff;
  background: linear-gradient(108deg, var(--nada-navy), var(--nada-midnight) 75%, #133465);
  border-radius: .65rem .65rem 0 0;
}
.lecture-header > div { min-width: 0; }
.lecture-header .subject-label { display: flex; align-items: center; gap: .55rem; color: var(--nada-yellow); font-size: .89rem; font-weight: 750; }
.lecture-header .subject-label::before { content: ''; flex: 0 0 1.35rem; height: 2px; background: currentColor; }
.lecture-header h1 { margin: .13rem 0 0; font-size: clamp(1.45rem, 3vw, 2.45rem); line-height: 1.2; font-weight: 800; letter-spacing: -.05em; }
.lecture-header h1:focus { outline: none; }
.lecture-pages { margin-top: .3rem; color: #dbe6f7; font-size: .94rem; }
.lecture-back {
  flex: 0 0 auto;
  min-height: 42px;
  padding: .5rem .85rem;
  color: #fff;
  border: 1px solid #8199b8;
  background: transparent;
  font-size: .92rem;
}
.lecture-back::before { content: ''; display: inline-block; width: .45rem; height: .45rem; margin-right: .4rem; border-left: 2px solid; border-bottom: 2px solid; transform: translateY(-.06rem) rotate(45deg); }
.lecture-back:hover { background: #183965; border-color: #b6c9e0; }
.lecture-frame { color: #fff; background: var(--nada-navy); overflow: hidden; border-radius: 0 0 .65rem .65rem; }
.lecture-screen { position: relative; display: grid; place-items: center; min-width: 0; background: #050912; }
.lecture-video { display: block; width: 100%; height: auto; min-height: 0; max-height: 66vh; aspect-ratio: 16 / 9; object-fit: contain; background: #050912; }
.lecture-frame [hidden], .lecture-mode[hidden] { display: none; }
.lecture-frame button, .lecture-speed select {
  color: #f6f9ff;
  border: 1px solid #687f9e;
  background-color: var(--nada-midnight);
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.25;
  min-height: 2.65rem;
  white-space: nowrap;
}
.lecture-frame button { padding: .5rem .8rem; }
.lecture-frame button:hover, .lecture-speed select:hover { background-color: #193d6e; border-color: #a6bddc; }
.lecture-frame .lecture-caption-toggle[aria-pressed=true] {
  border-color: var(--nada-yellow);
  color: var(--nada-yellow);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.lecture-view :focus-visible { outline: 3px solid var(--nada-blue); outline-offset: 2px; }
.lecture-header :focus-visible, .lecture-frame :focus-visible { outline-color: var(--nada-yellow); }
.lecture-frame .lecture-video:focus-visible { outline-offset: -3px; }
.lecture-frame .lecture-overlay {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 44px;
  padding: .7rem 1.25rem;
  color: #fff;
  background: #06142fee;
  border: 1px solid #d1dcee;
  border-radius: 2rem;
  font-size: 1.02rem;
}
.lecture-frame .lecture-overlay:hover { background: var(--nada-midnight); }
.lecture-frame .lecture-overlay[hidden] { display: none; }
.lecture-overlay::before { content: ''; border-left: .66rem solid var(--nada-yellow); border-block: .42rem solid transparent; }
.lecture-controls { padding: .55rem clamp(.8rem, 2.3vw, 1.6rem) 1rem; background: var(--nada-navy); }
.lecture-timebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .38rem; }
.lecture-frame input[type=range] {
  display: block;
  appearance: auto;
  color-scheme: dark;
  accent-color: var(--nada-yellow);
  background: transparent;
  border: 0;
  padding: 0;
  height: 2rem;
  min-height: 2rem;
  cursor: pointer;
}
.lecture-timeline { flex: 1 1 0; min-width: 0; }
.lecture-times { flex: 0 0 auto; color: #c4d3e8; font-size: .91rem; font-variant-numeric: tabular-nums; }
.lecture-times span:first-child { color: #fff; font-weight: 750; }
.lecture-actions,.lecture-settings,.lecture-transport,.lecture-speed,.lecture-sound { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.lecture-actions { justify-content: space-between; gap: .6rem 1rem; }
.lecture-transport .lecture-play {
  min-width: 4.5rem;
  color: var(--nada-navy);
  background: var(--nada-yellow);
  border-color: var(--nada-yellow);
  font-weight: 750;
}
.lecture-transport .lecture-play:hover { background: #ffe575; border-color: #ffe575; }
.lecture-speed { color: #dce6f5; font-size: .91rem; }
.lecture-speed select {
  width: auto;
  padding: .4rem 1.8rem .4rem .65rem;
  background-image: linear-gradient(45deg, transparent 50%, #e1e9f5 50%), linear-gradient(135deg, #e1e9f5 50%, transparent 50%);
  background-position: calc(100% - 13px) center, calc(100% - 8px) center;
}
.lecture-speed option { background: #fff; color: var(--nada-navy); }
.lecture-frame input.lecture-volume { width: 4.5rem; accent-color: #75aaff; }
.lecture-status { padding: .4rem 1rem .85rem; color: #fff0a8; font-size: .93rem; }
.lecture-status:empty { display: none; }
.lecture-mode { display: block; min-height: 40px; margin: .8rem 0 0 auto; padding: .4rem .75rem; font-size: .88rem; }
.lecture-frame.is-player-fullscreen { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; border-radius: 0; background: #050912; }
.lecture-frame.is-player-fullscreen .lecture-screen { flex: 1; min-height: 0; }
.lecture-frame.is-player-fullscreen .lecture-video { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.lecture-with-chapters .lecture-video::-webkit-media-controls-fullscreen-button { display: none; }
.lecture-frame > .lecture-fullscreen { display: block; align-self: flex-end; margin: .3rem .65rem .3rem auto; }
.lecture-with-chapters { max-width: 90rem; }
.lecture-heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.chapter-toggle { min-height: 42px; padding: .5rem .85rem; color: #fff; background: #183965; border: 1px solid #8199b8; font-size: .92rem; }
.chapter-toggle:hover { color: #fff; background: #224976; border-color: #b6c9e0; }
.lecture-frame .chapter-edge-toggle {
  position: absolute;
  z-index: 1;
  inset: 50% 0 auto auto;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 14px;
  height: 78px;
  padding: 0;
  color: #465e7c;
  background: rgb(247 250 253 / 90%);
  border: 1px solid rgb(72 98 128 / 24%);
  border-right: 0;
  border-radius: 6px 0 0 6px;
}
.lecture-frame .chapter-edge-toggle::before {
  content: '';
  box-sizing: border-box;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translateX(-1px) rotate(45deg);
}
.lecture-frame .chapter-edge-toggle[aria-expanded=false]::before { transform: translateX(1px) rotate(225deg); }
/* Extend the hit area into the video without widening the visible tab. */
.lecture-frame .chapter-edge-toggle::after {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 26px;
}
@media (any-pointer: coarse) {
  .lecture-frame .chapter-edge-toggle::after { width: 44px; }
}
.lecture-frame .chapter-edge-toggle:hover { color: #123d77; background: #eff5ff; border-color: #a7beda; }
.lecture-frame .chapter-edge-toggle:focus-visible { outline: 2px solid #325a93; outline-offset: -2px; }
.lecture-screen.is-playing:not(.at-chapter-edge):not(.touch-edge-shown) .chapter-edge-toggle:not(:focus-visible) {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .lecture-frame .chapter-edge-toggle { transition: opacity .12s ease-out; }
}
.lecture-workspace { display: grid; grid-template-columns: minmax(0,1fr) clamp(15rem,26%,21rem); align-items: stretch; }
.lecture-workspace:has(.lecture-chapters[hidden]) { grid-template-columns: minmax(0,1fr); }
.lecture-chapters { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fff; color: var(--nada-navy); border: 1px solid #d3deed; border-radius: 0 0 .65rem 0; }
.lecture-chapters[hidden] { display: none; }
.lecture-chapters h2 { margin: 0; padding: 1rem; border-bottom: 1px solid #d3deed; font-size: 1.06rem; font-weight: 750; }
.chapter-list { list-style: none; margin: 0; padding: .35rem 0; overflow-y: auto; }
.chapter-jump { display: grid; width: 100%; grid-template-columns: max-content 1fr; gap: .7rem; align-items: baseline; min-height: 44px; padding: .7rem .9rem; text-align: start; line-height: 1.42; color: #24364c; background: transparent; border: 0; border-inline-start: 4px solid transparent; border-radius: 0; }
.chapter-jump:hover { color: #124a9d; background: #f2f6fd; }
.chapter-jump[aria-current] { border-inline-start-color: var(--nada-yellow); background: #eaf1fc; color: #0d3875; font-weight: 750; }
.chapter-jump:focus-visible { outline-offset: -3px; }
.chapter-time { color: #285690; font-size: .86rem; font-variant-numeric: tabular-nums; }
.chapter-name { overflow-wrap: anywhere; }
.lecture-with-chapters.is-player-fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; max-width: none; overflow: auto; margin: 0; background: var(--nada-navy); }
.lecture-with-chapters.is-player-fullscreen .lecture-header { flex: none; border-radius: 0; }
.lecture-with-chapters.is-player-fullscreen .lecture-workspace { flex: 1; min-height: 0; }
.lecture-with-chapters.is-player-fullscreen .lecture-frame { min-height: 0; display: flex; flex-direction: column; border-radius: 0; }
.lecture-with-chapters.is-player-fullscreen .lecture-screen { flex: 1; min-height: 0; }
.lecture-with-chapters.is-player-fullscreen .lecture-video { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.lecture-with-chapters.is-player-fullscreen .lecture-mode { display: none; }
.lecture-with-chapters.is-viewport-fullscreen { position: fixed; inset: 0; z-index: 100; height: 100%; height: 100dvh; }
html:has(.is-viewport-fullscreen), body:has(.is-viewport-fullscreen) { overflow: hidden; }
@media (min-width: 761px) {
  body:has(.lecture-with-chapters) main.wrap { width: min(90rem,calc(100% - 3rem)); }
  .lecture-workspace:has(.lecture-chapters:not([hidden])) .lecture-frame { border-bottom-right-radius: 0; }
  .lecture-chapters { contain: size; }
}
@media (max-width: 760px) {
  .lecture-frame .chapter-edge-toggle { height: 68px; }
  .lecture-workspace { display: flex; flex-direction: column; }
  .lecture-chapters { border-radius: .55rem; margin-top: .65rem; }
  .chapter-list { max-height: 17rem; }
  .lecture-with-chapters.is-player-fullscreen .lecture-frame { flex: 1; }
  .lecture-with-chapters.is-player-fullscreen .lecture-chapters { margin: 0; border-radius: 0; }
  .lecture-with-chapters.is-player-fullscreen .chapter-list { max-height: 20vh; }
}
@media (orientation: landscape) and (any-pointer: coarse) {
  .lecture-with-chapters.is-player-fullscreen .lecture-header { display: none; }
  .lecture-with-chapters.is-player-fullscreen .lecture-workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .lecture-with-chapters.is-player-fullscreen .lecture-workspace:has(.lecture-chapters:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) min(34%, 19rem);
  }
  .lecture-with-chapters.is-player-fullscreen .lecture-chapters { contain: size; overflow: hidden; margin: 0; border-radius: 0; }
  .lecture-with-chapters.is-player-fullscreen .chapter-list { max-height: none; overscroll-behavior: contain; }
}
@media (max-width: 600px) {
  body:has(.lecture-view) .topbar { align-items: center; }
  .lecture-header { align-items: start; flex-direction: column-reverse; gap: .75rem; }
  .lecture-back { min-height: 40px; padding: .36rem .65rem; font-size: .86rem; }
  .lecture-controls { padding: .4rem .7rem .8rem; }
  .lecture-timebar { gap: .55rem; }
  .lecture-settings,.lecture-transport { gap: .38rem; }
  .lecture-frame button,.lecture-speed select { min-height: 2.75rem; }
  .lecture-frame input.lecture-volume { width: 3.4rem; }
  .lecture-actions { align-items: start; }
}

.lecture-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .9rem; }
.lecture-title-row h1 { min-width: 0; }
.lecture-note-open { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; margin-top: .18rem; padding: .4rem .85rem; border: 1px solid #9fb6d5; color: #fff; background: #183965; font-size: .9rem; white-space: nowrap; }
.lecture-note-open::before { content: ''; display: inline-block; width: .67rem; height: .86rem; border: 1.5px solid currentColor; border-radius: 2px; box-shadow: inset 2px 0 currentColor; }
.lecture-note-open:hover, .lecture-note-open[aria-expanded=true] { color: var(--nada-navy); border-color: var(--nada-yellow); background: var(--nada-yellow); }
.lecture-side-tabs { display: grid; grid-template-columns: 1fr 1fr; flex: none; border-bottom: 1px solid #d3deed; }
.lecture-side-tabs button { min-width: 0; min-height: 46px; padding: .5rem .25rem; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: #53647a; background: #f5f7fa; font-size: .94rem; }
.lecture-side-tabs button[aria-selected=true] { color: #153e78; background: #fff; border-bottom-color: #285690; }
.lecture-side-tabs button:hover { color: #123d77; background: #edf3fc; }
.chapter-tabpage { display: flex; flex-direction: column; min-height: 0; }
.lecture-chapters [hidden], .lecture-note-reader [hidden] { display: none; }
.note-reader-home { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.lecture-note-reader { padding: .7rem; color: var(--nada-navy); background: #f4f6fa; }
.note-tools, .note-page-nav { display: flex; align-items: center; gap: .4rem; }
.note-tools { justify-content: flex-end; margin-bottom: .65rem; }
.note-tools button, .note-tools a, .note-page-nav button, .note-page-select { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .35rem .65rem; color: #1b3557; border: 1px solid #aebdd0; border-radius: .35rem; background-color: #fff; font-size: .9rem; font-family: inherit; font-weight: 650; }
.note-tools a { text-decoration: none; }
.note-tools button:hover, .note-tools a:hover, .note-page-nav button:hover { color: #123d77; border-color: #657fa5; background-color: #edf3fc; }
.note-tools .note-download { color: #fff; background-color: var(--nada-midnight); border-color: var(--nada-midnight); }
.note-tools .note-download:hover { color: #fff; background-color: #21477d; }
.note-page-select { flex: 1; min-width: 0; max-width: 100%; padding-inline-end: 1.35rem; text-overflow: ellipsis; }
.note-page-nav button { width: 40px; flex: 0 0 40px; font-size: 1.3rem; line-height: 1; }
.note-time-jump { min-height: 40px; padding: .3rem .15rem; color: #1e528e; background: transparent; border: 0; font-size: .9rem; font-variant-numeric: tabular-nums; }
.note-time-jump:hover { color: #123d77; background: transparent; text-decoration: underline; }
.note-sheet { position: relative; line-height: 0; background: #fff; box-shadow: 0 1px 4px #1c375327; }
.note-sheet-viewport { min-width: 0; max-width: 100%; }
.note-zoom-tools { display: none; }
.note-page-image { display: block; width: 100%; height: auto; margin: 0; }
.note-time-hotspot { position: absolute; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 2px; box-shadow: 0 1px 0 #416d8c; background: transparent; }
.note-time-hotspot:hover, .note-time-hotspot:focus-visible { outline: 2px solid #285690; outline-offset: 1px; background-color: rgb(94 154 243 / 12%); }
.note-preview-error { margin: .75rem 0; font-size: .9rem; }
.note-preview-error a { text-decoration: underline; }
.note-dialog { width: min(61rem, calc(100% - 1.5rem)); height: min(94vh, 74rem); height: min(94dvh, 74rem); max-width: none; max-height: none; margin: auto; padding: 0; color: var(--nada-navy); background: #f4f6fa; border: 1px solid #adbfd4; border-radius: .65rem; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; }
.note-dialog::backdrop { background: rgb(5 15 34 / 78%); }
.note-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.note-dialog-body, .note-dialog .lecture-note-reader { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.note-dialog .lecture-note-reader { padding: .45rem clamp(.5rem, 2vw, 1rem) .65rem; }
.note-dialog .note-tools { flex-wrap: wrap; padding-bottom: .35rem; background: #f4f6fa; border-bottom: 1px solid #d3deed; }
.note-dialog .note-zoom-tools { display: flex; gap: .2rem; align-items: center; margin-inline-end: auto; }
.note-dialog .note-zoom-tools button { min-width: 34px; padding-inline: .3rem; font-size: 1.15rem; }
.note-zoom-value { min-width: 3.1rem; text-align: center; font: 700 .92rem var(--nada-font); font-variant-numeric: tabular-nums; }
.note-dialog .note-tools, .note-dialog .note-page-nav, .note-dialog .note-time-jump { flex: none; }
.note-dialog .note-time-jump { align-self: flex-start; }
.note-dialog .note-sheet-viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.note-dialog .note-sheet { margin-inline: auto; }
@media (min-width:761px) {
  .lecture-workspace:has(.lecture-chapters.showing-notes:not([hidden])) { grid-template-columns: minmax(0, 1fr) clamp(20rem, 37%, 34rem); }
}
@media (max-width:760px) {
  .note-reader-home { overflow: visible; scrollbar-gutter: auto; }
  .lecture-note-reader { border-radius: 0 0 .55rem .55rem; }
  .note-tools button, .note-tools a, .note-page-nav button, .note-page-select, .note-time-jump, .lecture-note-open { min-height: 44px; }
  .lecture-with-chapters.is-player-fullscreen .note-reader-home { overflow-y: auto; max-height: 46dvh; }
}
@media (orientation:landscape) and (any-pointer:coarse) {
  .lecture-with-chapters.is-player-fullscreen .note-reader-home { overflow-y: auto; max-height: none; }
}
