.video-page {
  background: #101923;
  overflow: hidden;
}

.video-page .appbar {
  position: relative;
  z-index: 20;
}

.video-page main {
  height: calc(100svh - 52px);
}

.video-feed {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
}

.video-feed::-webkit-scrollbar { display: none; }

.video-slide {
  position: relative;
  height: 100%;
  min-height: 420px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #101923;
  isolation: isolate;
}

.video-slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101923;
  cursor: pointer;
}

.video-audio-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  padding: .8rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  color: #fff;
  background: rgba(16, 25, 35, .82);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.video-audio-prompt:hover,
.video-audio-prompt:focus-visible { background: rgba(1, 116, 199, .95); }

.video-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity .2s ease, visibility .2s ease;
}

.video-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.video-spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: .28rem solid rgba(255, 255, 255, .28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: video-spin .8s linear infinite;
  filter: drop-shadow(0 1px 5px rgba(0, 0, 0, .5));
}

@keyframes video-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .video-spinner { animation: none; }
}

.video-actions {
  position: absolute;
  right: .85rem;
  bottom: max(1.35rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: .55rem;
  z-index: 7;
}

.video-action {
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
  color: #fff;
  background: rgba(16, 25, 35, .7);
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.video-action:hover,
.video-action:focus-visible { background: rgba(1, 116, 199, .9); }

.video-action.is-active {
  border-color: #7dd3fc;
  background: rgba(1, 116, 199, .92);
}

.caption-control {
  position: relative;
  margin-bottom: 1.15rem;
}

.caption-menu {
  position: absolute;
  right: calc(100% + .55rem);
  bottom: 0;
  display: grid;
  gap: .2rem;
  width: max-content;
  min-width: 12rem;
  padding: .35rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: .7rem;
  background: rgba(16, 25, 35, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.caption-menu[hidden] { display: none; }
.caption-menu button {
  padding: .55rem .65rem;
  border: 0;
  border-radius: .45rem;
  color: #fff;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.caption-menu button:hover,
.caption-menu button:focus-visible { background: rgba(1, 116, 199, .8); }

.lesson-panel {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow-y: auto;
  padding: max(1.1rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  color: #162535;
  background: rgba(247, 250, 252, .97);
}

.lesson-panel-inner {
  width: min(100%, 38rem);
  margin: 0 auto;
  padding: .3rem 0 1.5rem;
}

.lesson-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.lesson-panel h2 {
  margin: .15rem 0 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.15;
}

.lesson-panel h3 {
  margin: 1.35rem 0 .65rem;
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #42627d;
}

.lesson-kicker {
  margin: 0;
  color: #087eae;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lesson-close {
  flex: 0 0 auto;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid #b9c9d5;
  border-radius: 50%;
  color: #173147;
  background: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.lesson-close:hover,
.lesson-close:focus-visible { border-color: #087eae; color: #087eae; }

.lesson-dialogue {
  display: grid;
  gap: .7rem;
}

.lesson-line {
  padding: .85rem .95rem;
  border: 1px solid #d7e2e9;
  border-radius: .8rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(22, 37, 53, .06);
}

.lesson-line p { margin: .18rem 0 0; }

.lesson-khmer {
  color: #162535;
  font-size: 1.2rem;
  font-weight: 800;
}

.lesson-transliteration {
  color: #087eae;
  font-size: .94rem;
  font-style: italic;
}

.lesson-english { color: #3d5265; font-size: .95rem; }

.lesson-audio {
  margin-top: .7rem;
  padding: .48rem .75rem;
  border: 1px solid #9cc9df;
  border-radius: 999px;
  color: #075e88;
  background: #edf8fd;
  font: inherit;
  font-size: .86rem;
  font-weight: 800;
  cursor: pointer;
}

.lesson-audio:hover,
.lesson-audio:focus-visible,
.lesson-audio[aria-pressed="true"] {
  border-color: #087eae;
  color: #fff;
  background: #087eae;
}

.lesson-vocabulary {
  display: grid;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-vocabulary li {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(6rem, 1.2fr);
  gap: .55rem;
  align-items: baseline;
  padding: .65rem .75rem;
  border-bottom: 1px solid #d7e2e9;
  background: rgba(255, 255, 255, .72);
}

.lesson-vocabulary .lesson-khmer { font-size: 1.05rem; }

.lesson-panel-cta {
  display: grid;
  gap: .65rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #d7e2e9;
}

.lesson-panel-cta a {
  display: block;
  padding: .75rem 1rem;
  border-radius: .7rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.lesson-panel-link {
  border: 1px solid #9cc9df;
  color: #075e88;
  background: #edf8fd;
}

.lesson-panel-buy {
  color: #17212b;
  background: #fcd42f;
}

.lesson-panel-cta a:hover,
.lesson-panel-cta a:focus-visible { filter: brightness(.97); }

@media (max-width: 460px) {
  .lesson-vocabulary li { grid-template-columns: 1fr 1fr; }
  .lesson-vocabulary .lesson-english { grid-column: 1 / -1; }
}

.video-page .wrap.muted { display: none; }

@media (min-width: 700px) {
  .video-page main { height: calc(100svh - 60px); }
  .video-slide video { max-width: 560px; margin: 0 auto; }
  .video-actions { right: max(calc(50% - 280px), .85rem); }
}
