.dialogue-screen {
  display: flex;
  flex-direction: row;
  gap: var(--space-8);
  max-width: 900px;
  margin: 0 auto;
}
.dialogue-scene {
  flex: 1;
  position: relative;
  margin-top: var(--space-8);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  max-width: 400px;
  align-self: flex-start;
  margin:auto
}
.dialogue-scene-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}
.dialogue-controls {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.5) 100%);
}
.dialogue-play-btn {
  background: white;
  color: var(--primary);
  border: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-lg);
}
.dialogue-play-btn:hover, .dialogue-play-btn:focus-visible {
  transform: scale(1.1);
  background: var(--primary);
  color: white;
}
.dialogue-play-btn.playing {
  animation: pulse 1.2s infinite;
}
.dialogue-play-btn svg {
  width: 50px;
  height: 50px;
  fill: currentColor;
}
.dialogue-transcript-container {
  flex: 1.5;
  margin-top: var(--space-8);
  padding: var(--space-6);
  background-color: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--space-3); /* Reduced gap for tighter lines */
}
.dialogue-line {
  display: flex;
  flex-direction: row;
  align-items: flex-start; /* Align to top for multi-line text */
  gap: var(--space-2);
}
.speaker-name {
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--primary-dark);
  flex-shrink: 0; /* Prevent shrinking */
  min-width: 60px; /* Give some minimum width */
}
.line-text {
  font-size: var(--font-size-base);
  line-height: 1.7;
  flex-grow: 1; /* Allow text to take available space */
}

@media screen and (max-width: 768px) {
  .dialogue-screen {
    flex-direction: column;
  }
  .dialogue-transcript-container{
    margin-top: auto;
  }
}

/* Adaptive Layout for modalites */
.dialogue-screen:not(.has-modalite-texte) {
  justify-content: center;
}

.dialogue-screen:not(.has-modalite-texte) .dialogue-scene {
  margin-left: auto;
  margin-right: auto;
  max-width: 600px;
  /* Allow a larger image if no text */
}

.dialogue-screen:not(.has-modalite-image):not(.has-modalite-audio) .dialogue-transcript-container {
  flex: 1;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.dialogue-screen.has-modalite-audio:not(.has-modalite-image) .dialogue-scene {
  aspect-ratio: auto;
  background: none;
  box-shadow: none;
  border: none;
  max-width: none;
  align-self: center;
}

.dialogue-screen.has-modalite-audio:not(.has-modalite-image) .dialogue-play-btn {
  position: static;
  margin: var(--space-4) auto;
}

.dialogue-screen.has-modalite-audio:not(.has-modalite-image) .dialogue-controls {
  position: static;
  background: none;
}

/* Editor mode: allow clicking through controls to reach image */
.editor-mode-active .dialogue-controls {
  pointer-events: none;
}

.editor-mode-active .dialogue-play-btn {
  pointer-events: auto;
}

/* Editor mode: highlight the image on hover */
.editor-mode-active .dialogue-scene-image[data-sict-id] {
  cursor: pointer;
  transition: outline 0.2s ease;
}

.editor-mode-active .dialogue-scene-image[data-sict-id]:hover {
  outline: 2px solid #3498db;
  outline-offset: -2px;
}
