.scene-media {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: inherit;
}

#sceneAnimationVideo {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#sceneAnimationVideo[hidden],
.scene-animation-settings[hidden] {
  display: none;
}

.scene-animation-settings {
  min-width: 0;
  padding: 14px 0;
  border-block: 1px solid var(--line, #464646);
}

.scene-animation-settings h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0;
}

.scene-animation-playback,
.scene-animation-toggle,
.scene-animation-confirm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scene-animation-playback {
  justify-content: space-between;
  margin-bottom: 12px;
}

.scene-animation-toggle {
  min-width: 0;
  font-size: 13px;
}

.scene-animation-toggle input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent, #e57785);
}

.scene-animation-volume {
  display: block;
  margin-top: 12px;
  font-size: 13px;
}

.scene-animation-volume-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4ch;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.scene-animation-volume-row input {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--teal);
}

.scene-animation-volume-row output {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.scene-animation-settings .scene-animation-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  text-align: center;
}

.scene-animation-settings .theme-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.scene-animation-settings select,
.scene-animation-settings .theme-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.scene-controls .scene-animation-action {
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  color: var(--paper);
  background: rgba(var(--ink-rgb), 0.78);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.scene-controls .scene-animation-action:hover,
.scene-controls .scene-animation-action:focus-visible {
  color: var(--paper);
  border-color: rgba(var(--gold-rgb), 0.78);
  background: rgba(var(--gold-rgb), 0.18);
  outline: none;
}

.scene-controls .scene-animation-action[data-mode="replay"] {
  border-color: rgba(var(--teal-rgb), 0.52);
  color: var(--teal);
}

.scene-controls .scene-animation-action:disabled {
  opacity: 0.46;
}

.scene-controls .scene-animation-action[hidden] {
  display: none;
}

.scene-animation-settings p,
.scene-animation-settings button,
.scene-animation-confirm p,
.scene-animation-confirm button {
  white-space: normal;
  overflow-wrap: anywhere;
}

#openaiQueueText {
  min-width: 0;
  white-space: pre-line;
}

.scene-animation-confirm {
  box-sizing: border-box;
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line, #646464);
  border-radius: 8px;
  background: var(--panel, #242424);
  color: var(--text, #fff);
  letter-spacing: 0;
}

.scene-animation-confirm::backdrop {
  background: #000a;
}

.scene-animation-confirm h2 {
  margin: 0;
  font-size: 20px;
}

.scene-animation-confirm p {
  font-size: 14px;
  line-height: 1.6;
}

.scene-animation-confirm-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scene-animation-confirm-actions button {
  flex: 1 1 140px;
  min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  #sceneAnimationVideo {
    display: none;
  }
}
