.pwvca-library {
  display: grid;
  gap: 24px;
  grid-template-columns: var(--pwvca-library-columns, 1fr);
}

.pwvca-library > h2,
.pwvca-library > p {
  grid-column: 1 / -1;
}

.pwvca-course-card {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--pwvca-primary, #1b4332) 20%, #ffffff);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--pwvca-card-bg-start, #fffdf8) 0%, var(--pwvca-card-bg-end, #f4efe3) 100%);
  box-shadow: 0 24px 50px rgba(16, 24, 40, 0.09);
}

.pwvca-course-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.pwvca-course-header h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.pwvca-course-header p {
  margin: 0;
  color: rgba(15, 23, 42, 0.72);
}

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

.pwvca-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--pwvca-primary, #1b4332);
  color: #fff;
  font-size: 12px;
}

.pwvca-player-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.pwvca-player-shell-selfhosted {
  grid-template-columns: minmax(0, 1fr);
}

.pwvca-player-shell-embedded {
  grid-template-columns: minmax(0, 1fr);
}

.pwvca-player-shell.is-theater {
  display: grid;
}

.pwvca-chapters-panel {
  position: relative;
  width: min(320px, 100%);
  transition: width 0.22s ease;
}

.pwvca-chapters-panel.is-collapsed {
  width: 40px;
}

.pwvca-chapters-tab {
  position: absolute;
  top: 16px;
  right: -40px;
  z-index: 4;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border: 0;
  border-radius: 12px 12px 0 0;
  padding: 12px 8px;
  background: var(--pwvca-primary, #1b4332);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.pwvca-chapters-inner {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.pwvca-chapters-panel.is-collapsed .pwvca-chapters-inner {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.pwvca-panel-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.55);
}

.pwvca-chapters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(60vh, 420px);
  overflow: auto;
  padding-top: 12px;
}

.pwvca-chapter {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ede6d6;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.pwvca-chapter:hover,
.pwvca-chapter.is-active {
  transform: translateX(2px);
  background: var(--pwvca-primary, #1b4332);
  color: #fff;
}

.pwvca-chapter-time {
  font-size: 12px;
  opacity: 0.75;
}

.pwvca-chapter-label {
  font-weight: 600;
}

.pwvca-player-frame {
  position: relative;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
}

.pwvca-video-stage {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #050505;
  min-height: clamp(360px, 54vw, 720px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pwvca-video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
}

.pwvca-video.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.pwvca-embed-stage {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 1;
}

.pwvca-embed-stage.is-active {
  display: block;
}

.pwvca-embed-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

.pwvca-watermark {
  position: absolute;
  z-index: 4;
  top: 10%;
  left: 8%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.54);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: top 0.6s ease, left 0.6s ease, right 0.6s ease, bottom 0.6s ease;
}

.pwvca-overlay-toggle {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.22s ease;
}

.pwvca-overlay-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
}

.pwvca-overlay-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent #fff;
}

.pwvca-player-shell.is-playing .pwvca-overlay-toggle {
  opacity: 0;
  pointer-events: none;
}

.pwvca-topbar,
.pwvca-controls,
.pwvca-watermark {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.pwvca-player-shell.is-ui-hidden .pwvca-topbar,
.pwvca-player-shell.is-ui-hidden .pwvca-controls,
.pwvca-player-shell.is-playing.is-ui-hidden .pwvca-overlay-toggle {
  opacity: 0;
  pointer-events: none;
}

.pwvca-player-shell.is-ui-hidden .pwvca-topbar {
  transform: translateY(-10px);
}

.pwvca-player-shell.is-ui-hidden .pwvca-controls {
  transform: translateY(10px);
}

.pwvca-player-shell.is-embed .pwvca-overlay-toggle,
.pwvca-player-shell.is-embed .pwvca-progress-wrap,
.pwvca-player-shell.is-embed .pwvca-controls,
.pwvca-player-shell.is-embed .pwvca-chapters-panel,
.pwvca-player-shell.is-embed .pwvca-topbar,
.pwvca-player-shell.is-embed .pwvca-gradient,
.pwvca-player-shell.is-embed [data-action="backward"],
.pwvca-player-shell.is-embed [data-action="forward"],
.pwvca-player-shell.is-embed .pwvca-volume-wrap,
.pwvca-player-shell.is-embed .pwvca-speed,
.pwvca-player-shell.is-embed .pwvca-subtitles {
  display: none;
}

.pwvca-player-shell.is-embed .pwvca-video-stage {
  min-height: auto;
  background: #000;
}

.pwvca-player-shell.is-embed .pwvca-video.is-hidden {
  display: none;
}

.pwvca-player-shell.is-embed .pwvca-embed-stage {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.pwvca-player-shell.is-embed .pwvca-embed-frame {
  position: absolute;
  inset: 0;
}

.pwvca-player-shell.is-embed .pwvca-player-frame {
  max-width: 1100px;
}

.pwvca-player-shell.is-embed .pwvca-watermark {
  top: 14px;
  left: 14px;
  z-index: 6;
}

.pwvca-topbar,
.pwvca-controls,
.pwvca-gradient {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
}

.pwvca-topbar {
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  color: #fff;
}

.pwvca-topbar-title {
  font-weight: 700;
}

.pwvca-topbar-status {
  font-size: 12px;
  opacity: 0.8;
}

.pwvca-gradient {
  bottom: 0;
  height: 45%;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.82) 100%);
  pointer-events: none;
}

.pwvca-controls {
  bottom: 0;
  padding: 18px 18px 16px;
  color: #fff;
}

.pwvca-progress-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.pwvca-progress,
.pwvca-volume {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.pwvca-progress::-webkit-slider-thumb,
.pwvca-volume::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.pwvca-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.pwvca-thumbnail-preview {
  position: absolute;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  width: 132px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(9, 12, 19, 0.95);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.pwvca-thumbnail-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.pwvca-thumbnail-time {
  font-size: 11px;
  text-align: center;
}

.pwvca-controls-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.pwvca-controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwvca-control {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.pwvca-control:hover {
  background: rgba(255, 255, 255, 0.24);
}

.pwvca-control-label {
  font-size: 12px;
  font-weight: 700;
}

.pwvca-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
}

.pwvca-icon-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-42%, -50%);
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
}

.pwvca-player-shell.is-playing .pwvca-icon-play::before {
  width: 10px;
  height: 12px;
  border: 0;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%);
}

.pwvca-icon-volume::before {
  content: "";
  position: absolute;
  inset: 3px 6px 3px 0;
  background: currentColor;
  clip-path: polygon(0 30%, 35% 30%, 65% 0, 65% 100%, 35% 70%, 0 70%);
}

.pwvca-icon-settings::before,
.pwvca-icon-theater::before,
.pwvca-icon-picture::before,
.pwvca-icon-fullscreen::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.pwvca-icon-settings::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.pwvca-icon-picture::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 5px;
  background: currentColor;
  border-radius: 1px;
}

.pwvca-icon-fullscreen::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 999px transparent;
}

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

.pwvca-settings-menu {
  position: relative;
}

.pwvca-settings-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: grid;
  gap: 12px;
  min-width: 220px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(9, 12, 19, 0.94);
  color: #fff;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.pwvca-settings-panel label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.pwvca-settings-panel select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 8px 10px;
}

.pwvca-player-shell.is-sticky .pwvca-player-frame {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(420px, calc(100vw - 40px));
  z-index: 9999;
}

.pwvca-player-shell.is-sticky .pwvca-video-stage {
  min-height: auto;
  border-radius: 18px;
}

.pwvca-course-notice {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}

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

  .pwvca-chapters-panel {
    width: 100%;
  }

  .pwvca-chapters-panel.is-collapsed {
    width: 100%;
  }

  .pwvca-chapters-tab {
    position: static;
    writing-mode: horizontal-tb;
    transform: none;
    border-radius: 12px;
    margin-bottom: 8px;
  }

  .pwvca-course-card {
    padding: 16px;
    border-radius: 18px;
  }

  .pwvca-video-stage {
    min-height: auto;
    border-radius: 18px;
  }

  .pwvca-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pwvca-controls-group {
    justify-content: space-between;
  }

  .pwvca-watermark {
    font-size: 10px;
    padding: 6px 10px;
  }
}

@media (max-width: 640px) {
  .pwvca-topbar {
    padding: 12px;
  }

  .pwvca-controls {
    padding: 12px;
  }

  .pwvca-overlay-icon {
    width: 64px;
    height: 64px;
  }

  .pwvca-progress-wrap {
    margin-bottom: 10px;
  }

  .pwvca-thumbnail-preview {
    width: 108px;
  }
}
