/* Le lecteur officiel ne rejoint le document qu’après une ouverture explicite. */
.external-cinema-dialog:not([open]),
.ue-stop-button[hidden] {
  display: none !important;
}

.external-cinema-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: clamp(12px, 3vw, 32px);
  background: transparent;
  color: #f6f8f4;
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  place-items: center;
}

.external-cinema-dialog::backdrop {
  background: rgb(0 5 4 / 88%);
  animation: external-cinema-darken 360ms ease-out both;
}

.external-cinema-panel {
  width: min(70rem, 100%);
  min-height: 0;
  max-height: 100%;
  border: 1px solid #ffffff2e;
  border-radius: 20px;
  background: #0c1311;
  box-shadow: 0 28px 110px #000000b3;
  overflow: auto;
  overscroll-behavior: contain;
  transform-origin: center;
}

.external-cinema-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  padding: 20px 24px;
}

.external-cinema-heading {
  min-width: 0;
}

body .external-cinema-dialog .external-cinema-eyebrow {
  margin: 0 0 7px;
  color: #b3c7b8;
  font-size: 0.65rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body .external-cinema-dialog .external-cinema-title {
  max-width: none;
  margin: 0;
  color: #f6f8f4;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.external-cinema-close {
  min-height: 48px;
  min-width: 76px;
  padding: 11px 16px;
  border: 1px solid #ffffff47;
  border-radius: 999px;
  background: #ffffff0d;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
  cursor: pointer;
}

.external-cinema-close:hover {
  background: #ffffff26;
  border-color: #ffffff80;
}

.external-cinema-stage {
  position: relative;
  width: min(100%, var(--cinema-stage-width, 100%));
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  background: #000;
}

.external-cinema-stage .external-player-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.external-cinema-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: clamp(12px, 3vw, 28px);
  background: #08130f;
  pointer-events: none;
}

.external-cinema-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.external-cinema-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, #000000b3);
}

.external-cinema-loading {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 9px 15px;
  border: 1px solid #ffffff2e;
  border-radius: 999px;
  background: #0b1715e6;
  color: #eff6eb;
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

.external-cinema-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 18px 24px;
}

body .external-cinema-dialog .external-cinema-status {
  flex: 1 1 20rem;
  max-width: none;
  margin: 0;
  color: #c1cfc4;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
}

.external-cinema-source {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #f4f7ee;
  font-size: 0.8rem;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.external-cinema-dialog :is(button, a, iframe):focus-visible {
  outline: 2px solid #e9f6dc;
  outline-offset: 4px;
}

@keyframes external-cinema-darken {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 600px) {
  .external-cinema-dialog { padding: 12px; }
  .external-cinema-panel { border-radius: 16px; }
  .external-cinema-header { gap: 12px; padding: 16px; }
  .external-cinema-heading { display: contents; }
  .external-cinema-eyebrow { grid-column: 1; grid-row: 1; align-self: center; }
  .external-cinema-close { grid-column: 2; grid-row: 1; }
  .external-cinema-title { grid-column: 1 / -1; grid-row: 2; }
  .external-cinema-footer { padding: 12px 16px; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .external-cinema-dialog::backdrop { animation: none; }
}

body[data-motion="paused"] .external-cinema-dialog::backdrop {
  animation: none;
}
