html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}

/* Wrapper a schermo intero (è lui che va in fullscreen) */
#tvRoot {
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* browser mobile: esclude la barra degli indirizzi */
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

/* Lo stage: proporzione fissa, sempre interamente visibile */
#tvStage {
  --ratio: 1.7778;
  position: relative;
  aspect-ratio: var(--ratio);
  width: min(100vw, calc(100vh * var(--ratio)));
  width: min(100vw, calc(100dvh * var(--ratio)));
  background: #000;
  overflow: hidden;
  container-type: size; /* abilita le unità cqw per logo e OSD */
}

#videoPlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
#videoPlayer .vjs-tech {
  object-fit: contain;
}
.vjs-big-play-button {
  display: none !important;
}

/* Modalità kiosk: dopo qualche secondo senza movimenti spariscono cursore e controlli */
#tvRoot.idle,
#tvRoot.idle * {
  cursor: none !important;
}
#tvRoot.idle .vjs-control-bar {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Logo */
#tvLogo {
  position: absolute;
  z-index: 5;
  width: calc(var(--logo-size, 12) * 1cqw);
  pointer-events: none;
  user-select: none;
}
#tvLogo[hidden] {
  display: none;
}
#tvLogo[data-pos="top-right"] {
  top: calc(var(--logo-margin, 2) * 1cqw);
  right: calc(var(--logo-margin, 2) * 1cqw);
}
#tvLogo[data-pos="top-left"] {
  top: calc(var(--logo-margin, 2) * 1cqw);
  left: calc(var(--logo-margin, 2) * 1cqw);
}
#tvLogo[data-pos="bottom-right"] {
  bottom: calc(var(--logo-margin, 2) * 1cqw);
  right: calc(var(--logo-margin, 2) * 1cqw);
}
#tvLogo[data-pos="bottom-left"] {
  bottom: calc(var(--logo-margin, 2) * 1cqw);
  left: calc(var(--logo-margin, 2) * 1cqw);
}

/* Messaggio temporaneo (cambio formato, errori...) */
#osd {
  position: absolute;
  z-index: 6;
  top: 2cqw;
  left: 2cqw;
  padding: 0.6cqw 1.4cqw;
  font:
    600 2cqw/1.2 system-ui,
    sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 0.6cqw;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
#osd.visible {
  opacity: 1;
}

#playButton {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #007bff;
  color: #fff;
  font-size: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: none;
  outline: none;
}