:root {
  --cl-accent: #ff3b30;
  --cl-fg: #fff;
  --cl-bar: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
  --cl-chip: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--cl-fg); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
html.cl-lock, html.cl-lock body { overflow: hidden; }

.cl { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; outline: none; user-select: none; -webkit-user-select: none; }
body:not(:has(.is-embed)) .cl { height: 100vh; height: 100dvh; }
.cl video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cl-poster { position: absolute; inset: 0; background: center / contain no-repeat; opacity: 0; transition: opacity .3s; pointer-events: none; }
.cl.show-poster .cl-poster, .cl.is-loading .cl-poster { opacity: 1; }
.cl.show-poster .cl-poster { filter: grayscale(.6) brightness(.55); }

.cl.is-pseudo-fs { position: fixed; inset: 0; z-index: 2147483647; width: 100vw; height: 100vh; height: 100dvh; }

/* Messaggi e caricamento */
.cl-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; z-index: 6; background: rgba(0, 0, 0, .35); }
.cl-msg[hidden] { display: none; }
.cl-msg p { margin: 0; max-width: 34em; font-size: clamp(14px, 2.4vw, 19px); text-shadow: 0 1px 3px #000; }
.cl-spinner { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: cl-spin .9s linear infinite; display: none; z-index: 5; }
.cl.is-loading .cl-spinner, .cl.is-buffering.is-playing .cl-spinner { display: block; }
@keyframes cl-spin { to { transform: rotate(360deg); } }
.cl-bigplay { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; z-index: 7; display: grid; place-items: center; }
.cl-bigplay[hidden] { display: none; }
.cl-bigplay svg { width: 40px; height: 40px; margin-left: 4px; }
.cl-bigplay:hover { background: var(--cl-accent); }
.cl-noscript { position: absolute; inset: 0; display: grid; place-items: center; }

.cl-pin { display: flex; gap: 8px; }
.cl-pin input { width: 9em; padding: 10px 12px; font-size: 18px; border-radius: 8px; border: 1px solid #555; background: #111; color: #fff; text-align: center; letter-spacing: .2em; }
.cl-pin button, .cl-msg button { padding: 10px 18px; font-size: 16px; border-radius: 8px; border: 0; background: var(--cl-accent); color: #fff; cursor: pointer; }

/* Barra controlli */
.cl-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 28px 10px 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--cl-bar); z-index: 8; opacity: 0; transition: opacity .25s; }
.cl.is-active .cl-controls, .cl:not(.is-playing) .cl-controls, .cl:focus-visible .cl-controls { opacity: 1; }
.cl.is-loading .cl-controls { opacity: 0; }
.cl-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.cl-btn:hover, .cl-btn:focus-visible { background: rgba(255, 255, 255, .15); outline: none; }
.cl-btn svg { width: 22px; height: 22px; }
.cl-live { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; background: var(--cl-accent); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.cl-live i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: cl-blink 1.6s infinite; }
.cl:not(.is-playing) .cl-live { background: #555; }
.cl:not(.is-playing) .cl-live i { animation: none; }
@keyframes cl-blink { 50% { opacity: .25; } }
.cl-viewers { font-size: 13px; padding: 3px 8px; border-radius: 4px; background: var(--cl-chip); }
.cl-viewers[hidden] { display: none; }
.cl-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 4px; text-shadow: 0 1px 2px #000; }
.cl-grow { flex: 1; }

/* Livello sopra il video: widget in 7 posizioni */
.cl-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.cl-slot { position: absolute; display: flex; flex-direction: column; gap: 6px; max-width: 46%; padding: 10px; }
.cl-slot-top-left { top: 0; left: 0; align-items: flex-start; }
.cl-slot-top-center { top: 0; left: 50%; transform: translateX(-50%); align-items: center; }
.cl-slot-top-right { top: 0; right: 0; align-items: flex-end; }
.cl-slot-center { top: 50%; left: 50%; transform: translate(-50%, -50%); align-items: center; }
.cl-slot-bottom-left { bottom: 46px; left: 0; align-items: flex-start; }
.cl-slot-bottom-center { bottom: 46px; left: 50%; transform: translateX(-50%); align-items: center; }
.cl-slot-bottom-right { bottom: 46px; right: 0; align-items: flex-end; }
.cl-w { pointer-events: auto; padding: 5px 10px; border-radius: 6px; background: var(--cl-chip); font-size: clamp(11px, 1.8vw, 16px); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); white-space: nowrap; }
.cl-w small { display: block; font-size: .72em; opacity: .85; }
.cl-w-weather { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-w-weather[hidden] { display: none; }
.cl-w-icon { font-size: 1.3em; }
.cl-w-countdown b { font-variant-numeric: tabular-nums; font-size: 1.15em; }
.cl-w-clock { font-variant-numeric: tabular-nums; }
.cl-w-text { white-space: normal; max-width: 100%; }
.cl-w-text.is-scroll { overflow: hidden; white-space: nowrap; max-width: 44vw; }
.cl-w-text.is-scroll span { display: inline-block; padding-left: 100%; animation: cl-marquee 18s linear infinite; }
@keyframes cl-marquee { to { transform: translateX(-100%); } }
.cl-w-image { padding: 0; background: none; min-width: 40px; }
.cl-w-image img { display: block; width: 100%; height: auto; }

/* Watermark */
.cl-watermark { position: absolute; z-index: 4; min-width: 36px; max-width: 50%; pointer-events: none; padding: 10px; }
.cl-watermark a { pointer-events: auto; }
.cl-watermark img { display: block; width: 100%; height: auto; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.cl-pos-top-left { top: 0; left: 0; }
.cl-pos-top-right { top: 0; right: 0; }
.cl-pos-top-center { top: 0; left: 50%; transform: translateX(-50%); }
.cl-pos-bottom-left { bottom: 46px; left: 0; }
.cl-pos-bottom-right { bottom: 46px; right: 0; }
.cl-pos-bottom-center { bottom: 46px; left: 50%; transform: translateX(-50%); }
.cl-pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* Sponsor: banner in basso, riquadro in alto a destra */
.cl-banner { position: absolute; left: 50%; bottom: 50px; transform: translate(-50%, 12px); z-index: 4; max-width: min(728px, 86%);
  opacity: 0; transition: opacity .5s, transform .5s; }
.cl-banner.is-in { opacity: 1; transform: translate(-50%, 0); }
.cl-banner[hidden] { display: none; }
.cl-banner img { display: block; max-width: 100%; max-height: min(90px, 16vh); width: auto; height: auto; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.cl.is-active .cl-banner { bottom: 56px; }
.cl-corner { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 4; width: min(18%, 220px); opacity: 0; transition: opacity .5s; }
.cl-corner.is-in { opacity: 1; }
.cl-corner[hidden] { display: none; }
.cl-corner img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.cl:has(.cl-slot-top-right .cl-w) .cl-corner { top: auto; bottom: 60px; transform: none; }

/* Video sponsor prima della diretta */
.cl-preroll { position: absolute; inset: 0; z-index: 9; background: #000; }
.cl-preroll-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cl-preroll-label { position: absolute; left: 12px; top: 10px; padding: 3px 8px; border-radius: 4px; background: rgba(0, 0, 0, .6); font-size: 12px; }
.cl-skip { position: absolute; right: 0; bottom: 56px; padding: 10px 16px; border: 1px solid rgba(255, 255, 255, .5); border-right: 0; background: rgba(0, 0, 0, .7); color: #fff; font-size: 14px; cursor: pointer; }
.cl-skip:disabled { cursor: default; opacity: .8; }
.cl-preroll-link { position: absolute; left: 12px; bottom: 56px; padding: 8px 14px; border-radius: 6px; background: var(--cl-accent); color: #fff; text-decoration: none; font-size: 14px; }

/* Schermi piccoli */
@media (max-width: 480px) {
  .cl-slot { max-width: 60%; padding: 6px; }
  .cl-title { display: none; }
  .cl-corner { width: 26%; }
}
@media (prefers-reduced-motion: reduce) {
  .cl-w-text.is-scroll span, .cl-live i, .cl-spinner { animation-duration: 0s; animation-iteration-count: 1; }
}

/* Il logo vive nell'area reale del video */
.cl-videobox { position: absolute; z-index: 4; pointer-events: none; }
.cl-videobox .cl-watermark { padding: 10px; }
.cl-videobox .cl-pos-bottom-left, .cl-videobox .cl-pos-bottom-right, .cl-videobox .cl-pos-bottom-center { bottom: 0; }
.cl-videobox .cl-pos-custom { padding: 0; }
