.overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  background: var(--color-bg-page);
  display: flex;
  overflow: hidden;
  animation: overlayIn 0.2s ease-out;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ══════════════════════════════════════
   Left: Video player section
   ══════════════════════════════════════ */
.playerSection {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0 72px 20px 20px; /* right: space for close + arrows */
}

/* Close button — top-right, aligned with right panel header */
.closeBtn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 36px;
  height: 36px;
  background: var(--color-bg-card);
  border: none;
  color: var(--color-text-on-glass-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.closeBtn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-glass-hover);
}

.floatingActions {
  position: absolute;
  top: 68px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.floatingBtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bg-hover);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.floatingBtn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-glass-hover);
}

/* Video area — centres the player */
.videoArea {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 20px 0; /* vertical breathing room, matches bottom padding */
}

/* Rounded video container — sized by JS (ResizeObserver + aspect ratio) */
.videoContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  border-radius: 16px;
  background: var(--color-bg-video);
  position: relative;
}

.video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Controls bar — inside rounded container ── */
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  /* Note: gradient stops keep raw rgba — no exact var match for 0.8 black */
  border-radius: 0 0 16px 16px;
  padding: 24px 0 0;
  opacity: 0;
  transition: opacity 0.25s;
}

.controlsVisible {
  opacity: 1;
}

/* Progress bar — full width at top of controls */
.progressTrack {
  width: 100%;
  height: 4px;
  background: var(--color-progress-track);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.progressTrack:hover {
  height: 6px;
}

.progressFill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.1s linear;
}

/* Controls row — below progress bar */
.controlsRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 12px;
}

.controlBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--color-on-overlay);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
  transition: background 0.15s;
}

.controlBtn:hover {
  background: var(--color-border-card);
}

.timeDisplay {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.controlsSpacer {
  flex: 1;
}

/* Volume control */
.volumeControl {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.volumeSlider {
  width: 72px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-progress-track);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-on-overlay);
  cursor: pointer;
}

.volumeSlider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-on-overlay);
  border: none;
  cursor: pointer;
}

/* ── Nav arrows — in the right padding of playerSection ── */
.navArrows {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.navArrowBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--color-border-card);
  border: none;
  color: var(--color-text-on-glass);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.navArrowBtn:hover:not(.navArrowDisabled) {
  background: var(--color-progress-track);
  color: var(--color-on-overlay);
}

.navArrowDisabled {
  opacity: 0.3;
  cursor: default;
}

/* ══════════════════════════════════════
   Right: Info panel (glass style)
   ══════════════════════════════════════ */
.infoPanel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--color-border-modal-soft);
  background: var(--color-bg-glass);
  backdrop-filter: var(--bf-glass-lg);
  -webkit-backdrop-filter: var(--bf-glass-lg);
  box-shadow: inset 0 1px 0 var(--color-inset-highlight);
}

/* Header with download + icons */
.infoPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border-soft);
}

.headerIcons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.iconBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--color-text-on-glass-soft);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.iconBtn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-glass-hover);
}

/* More menu dropdown */
.moreMenuWrap {
  position: relative;
}

.moreDropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 120px;
  background: var(--color-bg-dropdown-elevated);
  border: 1px solid var(--color-border-modal-soft);
  border-radius: 8px;
  padding: 4px;
  z-index: 20;
  box-shadow: 0 8px 24px var(--color-shadow-dropdown);
}

.moreDropdownItem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--color-danger-text);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.15s;
}

.moreDropdownItem:hover {
  background: var(--color-bg-card);
}

.downloadBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 24px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.downloadBtn:hover {
  opacity: 0.85;
}

/* Scrollable content area */
.infoPanelContent {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
}

/* Prompt */
.promptSection {
  padding-top: 20px;
  padding-bottom: 16px;
}

.sectionLabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

.promptText {
  font-size: 14px;
  color: var(--color-text-primary);
  line-height: 1.7;
  word-break: break-word;
}

/* References */
.refSection {
  padding-bottom: 16px;
}

.refGrid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.refItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.refImg {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--color-bg-upload);
  border: 1px solid var(--color-border-soft);
}

.refAudioPlaceholder {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--color-bg-upload);
  border: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
}

.refLabel {
  font-size: 10px;
  color: var(--color-text-secondary);
}

/* ── Fixed bottom section ── */
.infoPanelBottom {
  flex-shrink: 0;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--color-border-soft);
}

/* Compact info bar — single-line meta */
.infoBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--color-bg-upload);
  border: 1px solid var(--color-border-soft);
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.infoBarDot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-progress-track);
  flex-shrink: 0;
}

/* Action buttons — ghost style */
.cardActions {
  display: flex;
  gap: 10px;
}

.cardBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 10px 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: 10px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
  justify-content: center;
}

.cardBtn:hover {
  color: var(--color-text-primary);
  background: var(--color-border-card);
}

/* ══════════════════════════════════════
   Mobile
   ══════════════════════════════════════ */
@media (max-width: 767px) {
  .overlay {
    left: 0;
  }
  .modal {
    flex-direction: column;
  }
  .playerSection {
    flex: none;
    height: 50vh;
    padding: 0 56px 12px 12px;
  }
  .infoPanel {
    flex: 1;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--color-border-soft);
  }
}
