/* Player della presentazione RC88 · palcoscenico 16:9 su canvas.
   Il fotogramma è disegnato dal motore dello Studio Slideshow: qui restano
   solo il formato e i controlli. */

.rc88-stage-host { display: block; }

.rc88-stage {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 11px;
  overflow: hidden;
  background: #071013;
  isolation: isolate;
  cursor: pointer;
}

.rc88-stage-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #071013;
}

/* Stato di composizione: un piccolo chip in alto. Il fotogramma è già in
   riproduzione, quindi il messaggio non deve coprire l'immagine. */
.rc88-stage-status {
  position: absolute;
  left: 12px;
  top: 12px;
  margin: 0;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(244, 236, 228, .24);
  background: rgba(7, 16, 19, .68);
  color: #f4ece4;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: .02em;
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.rc88-stage-status[hidden] { display: none; }

/* Cartello di caricamento: grande, in movimento e con il conto dei secondi.
   Sta sopra il fotogramma solo mentre le scene complete si compongono e non
   intercetta i tocchi: play/pausa continuano a funzionare anche durante
   l'attesa. */
.rc88-stage-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: radial-gradient(circle at 50% 45%, rgba(7, 16, 19, .58), rgba(7, 16, 19, .86));
  pointer-events: none;
}

.rc88-stage-loading[hidden] { display: none; }

.rc88-stage-loading-card {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(100%, 420px);
  padding: 16px 18px 14px;
  border-radius: 16px;
  border: 1px solid rgba(232, 144, 104, .45);
  background: rgba(11, 22, 26, .92);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
  text-align: center;
  animation: rc88-loading-breathe 2.6s ease-in-out infinite;
}

.rc88-stage-loading-ring {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 3px solid rgba(244, 236, 228, .18);
  border-top-color: #e89068;
  border-right-color: rgba(232, 144, 104, .55);
  animation: rc88-loading-spin 1s linear infinite;
}

.rc88-stage-loading-title {
  margin: 0;
  color: #f4ece4;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(16px, 3.2vw, 21px);
  line-height: 1.25;
}

.rc88-stage-loading-hint {
  margin: 0;
  color: rgba(244, 236, 228, .74);
  font-size: 12.5px;
  line-height: 1.35;
}

.rc88-stage-loading-meter {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(244, 236, 228, .16);
  overflow: hidden;
}

.rc88-stage-loading-fill {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(232, 144, 104, 0), #e89068, rgba(232, 144, 104, 0));
  animation: rc88-loading-sweep 1.5s ease-in-out infinite;
}

.rc88-stage-loading-time {
  margin: 0;
  color: #e89068;
  font-size: clamp(21px, 4.6vw, 27px);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  animation: rc88-loading-pulse 1.6s ease-in-out infinite;
}

.rc88-stage-loading-music {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgba(244, 236, 228, .82);
  font-size: 12px;
  line-height: 1.3;
}

.rc88-stage-loading-music.is-off { color: rgba(244, 236, 228, .6); }

.rc88-stage-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 13px;
}

.rc88-stage-eq i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: #e89068;
  transform-origin: bottom;
  animation: rc88-eq 1s ease-in-out infinite;
}

.rc88-stage-eq i:nth-child(2) { animation-delay: .18s; }
.rc88-stage-eq i:nth-child(3) { animation-delay: .36s; }

.rc88-stage-loading-music.is-off .rc88-stage-eq i { animation-play-state: paused; opacity: .45; }

@keyframes rc88-loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes rc88-loading-sweep {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(270%); }
}

@keyframes rc88-loading-pulse {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}

@keyframes rc88-loading-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes rc88-eq {
  0%, 100% { transform: scaleY(.35); }
  50% { transform: scaleY(1); }
}

/* Comandi sotto il fotogramma: su smartphone non coprono mai il video. */
.rc88-stage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(244, 236, 228, .16);
  border-radius: 999px;
  background: rgba(7, 16, 19, .72);
}

.rc88-stage-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(244, 236, 228, .28);
  background: rgba(7, 16, 19, .62);
  color: #f4ece4;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.rc88-stage-btn:hover { background: rgba(232, 144, 104, .34); border-color: rgba(232, 144, 104, .6); }
.rc88-stage-btn:focus-visible { outline: 3px solid rgba(232, 144, 104, .55); outline-offset: 2px; }
.rc88-stage-btn[aria-pressed="false"] { opacity: .58; }

.rc88-stage-time {
  margin-left: auto;
  color: rgba(244, 236, 228, .86);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Allineamento delle scene alla voce: due frecce e il valore dello scarto. */
.rc88-stage-sync {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(244, 236, 228, .16);
  border-radius: 999px;
}

.rc88-stage-btn.is-sync {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.rc88-stage-sync-value {
  min-width: 64px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: rgba(244, 236, 228, .78);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.rc88-stage-sync-value.is-set { color: #e89068; font-weight: 600; }

.rc88-stage-sync-value:focus-visible {
  outline: 3px solid rgba(232, 144, 104, .55);
  outline-offset: 2px;
  border-radius: 999px;
}

.rc88-stage-sync-hint {
  margin: 7px 2px 0;
  color: rgba(107, 98, 89, .95);
  font-size: 12px;
  line-height: 1.45;
}

.rc88-stage-audio {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.rc88-stage-audio[hidden] { display: none; }

/* Nota di servizio: salvataggio del video, errori e messaggi brevi. */
.rc88-stage-note {
  margin: 9px 2px 0;
  color: var(--muted, #6b6259);
  font-size: 13px;
  line-height: 1.5;
}

.rc88-stage-note[hidden] { display: none; }

@media (max-width: 560px) {
  .rc88-stage { border-radius: 9px; }
  .rc88-stage-status { left: 8px; top: 8px; padding: 5px 11px; font-size: 12px; }
  .rc88-stage-loading { padding: 8px; }
  .rc88-stage-loading-card { gap: 5px; padding: 11px 13px 10px; border-radius: 13px; }
  .rc88-stage-loading-ring { width: 30px; height: 30px; border-width: 2.5px; }
  .rc88-stage-loading-hint { display: none; }
  .rc88-stage-loading-time { font-size: 19px; }
  .rc88-stage-loading-music { font-size: 11px; }
  .rc88-stage-controls { gap: 6px; margin-top: 8px; padding: 7px 10px; }
  .rc88-stage-time { font-size: 11px; }
  .rc88-stage-btn { width: 42px; height: 42px; }
  .rc88-stage-btn.is-sync { width: 36px; height: 36px; }
  .rc88-stage-sync-hint { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .rc88-stage-btn { transition: none; }
  .rc88-stage-loading-card { animation: none; }
  .rc88-stage-loading-ring { animation-duration: 2.4s; }
  .rc88-stage-loading-time { animation: none; opacity: 1; }
  .rc88-stage-loading-fill { animation-duration: 2.6s; }
  .rc88-stage-eq i { animation: none; transform: scaleY(.7); }
}
