/* Load after lesson-stage-polish.css. Only the Reveal reading player is scoped here. */
.reveal-reader {
  container-type: inline-size;
  --reveal-top: calc(var(--lesson-density-topbar, 62px) + 14px);
  --reveal-height: min(600px, calc(100dvh - var(--reveal-top) - 8px));
  --reveal-media-height: min(34dvh, calc(var(--reveal-height) * .46));
}

.reveal-reader .reveal-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: var(--reveal-height);
  min-width: 0;
  align-items: start;
}

.reveal-reader .review-video.scene-video-shell {
  position: sticky !important;
  top: var(--reveal-top) !important;
  z-index: 2;
  width: min(100%, calc(var(--reveal-media-height) * var(--reveal-aspect, 1.777778)));
  max-width: none;
  min-height: 0;
  aspect-ratio: var(--reveal-aspect, 1.777778);
  margin: 0 auto;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  outline: 1px solid rgb(0 0 0 / .1);
  box-shadow: none;
  background: #0b0a12;
}

.reveal-reader .review-video.scene-video-shell > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-height: none !important;
  min-height: 0 !important;
  aspect-ratio: auto;
  object-fit: contain;
}

.reveal-reader .transcript-reader {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
}

.reveal-reader .transcript-reader .review-heading {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex: none;
  flex-wrap: wrap;
  gap: 0 12px;
  margin: 0;
  text-align: left;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--line, #e8e5ee);
}

.reveal-reader .transcript-reader .review-heading h3 {
  width: auto;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--ink, #0b0a12);
}

.reveal-reader .transcript-follow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: auto;
  padding: 0 2px;
  margin: 0;
  color: #514c60;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.reveal-reader .transcript-follow input {
  appearance: auto;
  width: 16px;
  height: 16px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent, #542aff);
  cursor: pointer;
}

.reveal-reader .transcript-reader .subtitle-panel {
  display: block;
  flex: 1;
  min-height: 0;
  max-height: none;
  padding: 8px 4px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #c5c0d3 transparent;
  scrollbar-gutter: stable;
  scroll-behavior: auto;
  overflow-anchor: none;
}

.reveal-reader .transcript-reader .subtitle-line {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 8px;
  margin: 0 0 4px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink, #0b0a12);
  cursor: pointer;
  transition: background-color 120ms ease;
}

.reveal-reader .transcript-reader .subtitle-line.is-current {
  background: #f0ecff;
  box-shadow: inset 3px 0 0 var(--accent, #542aff);
}

.reveal-reader .transcript-replay {
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  align-self: start;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #655d74;
}

.reveal-reader .transcript-replay .timecode {
  display: inline;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: inherit;
}

.reveal-reader .subtitle-line .transcript-dialogue {
  display: block;
  padding: 8px 0;
  min-width: 0;
  line-height: 1.55;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.reveal-reader .transcript-dialogue .transcript-speaker {
  display: block;
  margin: 0 0 2px;
  color: #655d74;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.reveal-reader .transcript-link {
  display: inline;
  color: var(--accent, #542aff);
  font-weight: 400;
  text-underline-offset: 3px;
}

.reveal-reader :is(.subtitle-panel, .transcript-replay, input):focus-visible {
  outline: 2px solid var(--accent, #542aff);
  outline-offset: -2px;
}

.reveal-reader .transcript-error:not([hidden]),
.reveal-reader .reveal-transcript-empty {
  flex: none;
  margin: 8px 4px;
  font-size: 14px;
  line-height: 1.5;
}

@container (min-width: 680px) {
  .reveal-reader .reveal-player {
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 24px;
    --reveal-media-height: var(--reveal-height);
  }
}

@media (max-width: 940px) {
  .reveal-reader {
    --reveal-top: calc(var(--mobile-topbar-height, 96px) + 12px);
  }
}

@media (max-height: 600px) {
  .reveal-reader {
    --reveal-media-height: min(30dvh, calc(var(--reveal-height) * .42));
  }

  .reveal-reader .reveal-player { gap: 6px; }
  .reveal-reader .transcript-reader .review-heading { padding-bottom: 0; }
}

@media (max-height: 420px) {
  .reveal-reader {
    --reveal-media-height: min(24dvh, calc(var(--reveal-height) * .38));
  }
}

@media (hover: hover) {
  .reveal-reader .subtitle-line:hover { background: #f7f6fa; }
  .reveal-reader .subtitle-line.is-current:hover { background: #f0ecff; }
  .reveal-reader .transcript-replay:hover { color: var(--accent, #542aff); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-reader .subtitle-line { transition: none; }
}
