/* Tour cinematografico (hub-tour.js) e Telecomando (hub-telecomando.js).
   File aggiunto a mano: per toglierlo basta togliere il <link> da index.html. */

/* ---------- Tour: la mappa a schermo intero, sopra a tutto il resto ---------- */
/* La mappa resta dove React l'ha messa: allargo i suoi contenitori a tutto schermo e nascondo il resto */
html.tour-on .map-workspace { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100dvh !important; z-index: 3000 !important; margin: 0 !important; }
html.tour-on .map-workspace > :not(.atlas-map-view), html.tour-on .atlas-map-view > :not(.leaflet-container) { visibility: hidden !important; }
html.tour-on .atlas-map-view, .leaflet-container.tour-map { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; }
html.tour-on body > :not(#root):not(.tour-root):not(.hub-toast):not(.tc-toast):not(.tc-remote) { visibility: hidden !important; }
html.tour-on .tour-map .leaflet-control-container { display: none; }
html.tour-on .tour-map .leaflet-marker-pane, html.tour-on .tour-map .leaflet-tooltip-pane { opacity: .18; transition: opacity .4s; }
html.tour-on .tour-map .leaflet-marker-pane .tour-pin { opacity: 1; }
html.tour-on .hub-toast { z-index: 3200; }
.tour-pin i { display: block; width: 34px; height: 34px; border-radius: 50%; background: #ff50c5; border: 4px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 12px rgba(255, 80, 197, .25), 0 0 40px #ff50c5; animation: tour-pulse 2s ease-in-out infinite; }
html.tour-on .tour-map .leaflet-marker-pane:has(.tour-pin) { opacity: 1; }
html.tour-on .tour-map .leaflet-marker-icon:not(.tour-pin) { opacity: .18; }
@keyframes tour-pulse { 50% { box-shadow: 0 0 0 22px rgba(255, 80, 197, .08), 0 0 60px #ff50c5; } }

.tour-root { position: fixed; inset: 0; z-index: 3100; pointer-events: none; color: #fff; font-family: Montserrat, Inter, system-ui, sans-serif; }
.tour-root button { pointer-events: auto; }
.tour-vign { position: absolute; inset: 0; background: radial-gradient(ellipse at 60% 50%, transparent 35%, rgba(5, 2, 15, .78) 100%); }
.tour-bar { position: absolute; left: 0; right: 0; height: 9vh; max-height: 120px; background: #000; }
.tour-bar.top { top: 0; } .tour-bar.bot { bottom: 0; }
.tour-name { position: absolute; top: 0; left: 0; right: 0; height: 9vh; max-height: 120px; display: flex; align-items: center; justify-content: center; font: 700 13px Montserrat, Inter, sans-serif; letter-spacing: 4px; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.tour-txt { position: absolute; left: 6vw; bottom: calc(min(9vh, 120px) + 70px); max-width: min(60vw, 1100px); text-shadow: 0 6px 30px rgba(0, 0, 0, .7); }
.tour-txt.in { animation: tour-in .9s cubic-bezier(.2, .8, .2, 1); }
@keyframes tour-in { from { opacity: 0; transform: translateY(24px); } }
.tour-kick { font: 700 clamp(11px, 1vw, 16px) Montserrat, Inter, sans-serif; letter-spacing: .4em; text-transform: uppercase; color: #ff50c5; }
.tour-title { font: 700 clamp(44px, 7.5vw, 160px)/1 Oswald, Montserrat, sans-serif; text-transform: uppercase; letter-spacing: 1px; margin: 8px 0 10px; }
.tour-sub { font: 500 clamp(15px, 1.5vw, 30px)/1.35 Montserrat, Inter, sans-serif; color: rgba(255, 255, 255, .88); }
.tour-foto { position: absolute; right: 6vw; top: calc(min(9vh, 120px) + 40px); width: clamp(260px, 22vw, 640px); margin: 0; padding: 12px; border-radius: 22px; background: rgba(18, 12, 32, .82); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 18px 60px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: tour-in 1s; }
.tour-foto[hidden] { display: none; }
.tour-foto img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 14px; }
.tour-foto figcaption { margin-top: 8px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.tour-prog { position: absolute; left: 6vw; right: 6vw; bottom: calc(min(9vh, 120px) + 26px); display: flex; gap: 8px; }
.tour-prog i { flex: 1; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.tour-prog i b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7c5cff, #ff50c5); }
.tour-prog i.done b { width: 100%; }
.tour-prog i.now b { animation: tour-fill linear forwards; }
.tour-root.paused .tour-prog i.now b { animation-play-state: paused; }
@keyframes tour-fill { to { width: 100%; } }
.tour-help { position: absolute; left: 6vw; bottom: 0; height: min(9vh, 120px); display: flex; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .6); }
.tour-ctl { position: absolute; right: 6vw; bottom: 0; height: min(9vh, 120px); display: flex; align-items: center; gap: 10px; }
.tour-ctl button { min-height: 42px; padding: 0 18px; border-radius: 12px; cursor: pointer; color: #fff; font: 700 14px Montserrat, Inter, sans-serif; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); }
.tour-ctl button:hover { border-color: #ff50c5; }
.tour-ctl button.main { background: #ff50c5; border-color: #ff50c5; box-shadow: 0 0 22px rgba(255, 80, 197, .5); }
.tour-list li { align-items: center; }
.tour-list li > i { background: rgba(255, 255, 255, .08); font-size: 14px; }

@media (max-width: 900px) {
  .tour-bar, .tour-name { height: 64px; }
  .tour-name { font-size: 10px; letter-spacing: 2px; padding: 0 12px; text-align: center; }
  .tour-kick { letter-spacing: .14em; }
  .tour-foto img { max-height: 24vh; }
  .tour-txt { left: 18px; right: 18px; max-width: none; bottom: 150px; }
  .tour-foto { left: 18px; right: 18px; width: auto; top: 80px; padding: 8px; }
  .tour-foto img { aspect-ratio: 16 / 8; }
  .tour-prog { left: 18px; right: 18px; bottom: 120px; }
  .tour-help { display: none; }
  .tour-ctl { left: 0; right: 0; bottom: 64px; height: 50px; justify-content: center; }
  .tour-ctl button { min-height: 40px; padding: 0 14px; font-size: 13px; }
}

/* ---------- Telecomando ---------- */
.tc-remote { position: fixed; inset: 0; z-index: 3300; overflow-y: auto; background: #0b0716 !important; backdrop-filter: none !important; box-shadow: none !important; border: 0 !important; border-radius: 0 !important; max-width: none !important; max-height: none !important; color: #fff; font: 400 14px/1.4 Montserrat, Inter, system-ui, sans-serif; padding: max(18px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.tc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tc-head { flex-wrap: wrap; }
.tc-tabs { display: flex; gap: 6px; flex: 1 1 100%; min-width: 0; order: 3; }
.tc-stato { margin-right: auto; }
.tc-tabs button { flex: 1; min-height: 46px; white-space: nowrap; border-radius: 12px; cursor: pointer; color: #fff; font: 700 14px Montserrat, Inter, sans-serif; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); }
.tc-tabs button.on { background: #ff50c5; border-color: #ff50c5; box-shadow: 0 0 18px rgba(255, 80, 197, .45); }
.tc-scr { display: flex; flex-direction: column; gap: 12px; }
.tc-scr[hidden] { display: none; }
.tc-set { margin-top: 4px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 8px; }
.tc-set summary { cursor: pointer; font-weight: 700; color: rgba(255, 255, 255, .7); padding: 6px 0; }
.tc-set .tc-cod { margin: 8px 0; }
.tc-set input { width: 58%; max-width: 280px; height: 40px; padding: 0 10px; box-sizing: border-box; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); color: #fff; font: 600 14px Montserrat, Inter, sans-serif; text-align: right; }
.tc-set input[data-s="codice"] { width: 120px; text-align: center; letter-spacing: 4px; font: 700 18px Oswald, Montserrat, sans-serif; }
.tc-mini { min-height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer; color: #fff; font: 700 12px Montserrat, Inter, sans-serif; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); }
.tc-mini.on { background: #ff50c5; border-color: #ff50c5; }
.tc-head small { display: block; letter-spacing: 1.5px; font-weight: 700; font-size: 10px; color: rgba(255, 255, 255, .6); text-transform: uppercase; }
.tc-head h3 { margin: 0; font: 500 24px Oswald, Montserrat, sans-serif; }
.tc-stato { font: 700 12px Montserrat, Inter, sans-serif; padding: 6px 11px; border-radius: 99px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); color: #ffb547; }
.tc-stato.ok { color: #3ddc97; }
.tc-cod { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 13px; color: rgba(255, 255, 255, .75); }
.tc-cod input { width: 120px; height: 40px; text-align: center; letter-spacing: 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); color: #fff; font: 700 18px Oswald, Montserrat, sans-serif; }
.tc-codice { font: 700 24px Oswald, Montserrat, sans-serif; letter-spacing: 4px; color: #ff50c5; }
.tc-cerca { width: 100%; box-sizing: border-box; height: 46px; padding: 0 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); color: #fff; font: 500 16px Montserrat, Inter, sans-serif; }
.tc-cerca:focus { outline: none; border-color: #ff50c5; }
.tc-ris { display: flex; flex-direction: column; gap: 8px; }
.tc-ris button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 14px; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .05); border: 1px solid transparent; font: inherit; }
.tc-ris button.on { background: rgba(255, 80, 197, .15); border-color: #ff50c5; }
.tc-ris b { display: block; font-size: 14px; }
.tc-ris small { display: block; color: rgba(255, 255, 255, .6); font-size: 12px; }
.tc-ris span { flex: 1; min-width: 0; }
.tc-ris em { font-style: normal; font: 700 12px Montserrat, Inter, sans-serif; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); white-space: nowrap; }
.tc-ris button.on em { background: #ff50c5; }
.tc-pad { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 4px 0; }
.tc-dpad { position: relative; width: 176px; height: 176px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); }
.tc-dpad button, .tc-zoom button, .tc-grid button { cursor: pointer; color: #fff; font: 700 15px Montserrat, Inter, sans-serif; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tc-dpad button { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 0; background: transparent; font-size: 20px; }
.tc-dpad button:active, .tc-zoom button:active, .tc-grid button:active { background: rgba(255, 80, 197, .35); }
.tc-dpad [data-c="su"] { left: 62px; top: 4px; } .tc-dpad [data-c="giu"] { left: 62px; bottom: 4px; }
.tc-dpad [data-c="sx"] { left: 4px; top: 62px; } .tc-dpad [data-c="dx"] { right: 4px; top: 62px; }
.tc-dpad [data-c="qui"] { left: 56px; top: 56px; width: 64px; height: 64px; background: #ff50c5; font-size: 12px; box-shadow: 0 0 22px rgba(255, 80, 197, .5); }
.tc-zoom { display: flex; flex-direction: column; gap: 10px; }
.tc-zoom button { width: 64px; height: 60px; border-radius: 14px; font-size: 24px; }
.tc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tc-grid button { min-height: 46px; border-radius: 12px; font-size: 13px; }
.tc-grid button.main { background: #ff50c5; border-color: #ff50c5; }
.tc-muted { color: rgba(255, 255, 255, .55); font-size: 12px; margin: 0; }
.tc-card { padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.tc-card small { display: block; letter-spacing: 1.5px; font-weight: 700; font-size: 10px; color: rgba(255, 255, 255, .6); text-transform: uppercase; }
.tc-card h4 { margin: 2px 0; font: 500 24px Oswald, Montserrat, sans-serif; }
.tc-rad { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tc-rad-box { position: relative; width: min(100%, 62dvh); aspect-ratio: 1; margin: 0 auto; border-radius: 50px; overflow: hidden; background: #07040f; border: 4px solid rgba(255, 255, 255, .85); box-shadow: inset 0 0 90px rgba(0, 0, 0, .55), 0 14px 40px rgba(0, 0, 0, .5); touch-action: manipulation; }
.tc-rad-spin { position: absolute; left: 50%; top: 50%; width: 150%; height: 150%; margin: -75% 0 0 -75%; transform-origin: center; }
.tc-rad-map { width: 100%; height: 100%; background: #07040f; }
.tc-rad-box .leaflet-container { background: #1d6fa8; font: inherit; }
.tc-rad-box .leaflet-control-container { display: none; }
.tc-rad-me { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; z-index: 600; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }
.tc-rad-n { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; z-index: 600; border-radius: 50%; background: #111; border: 2px solid #fff; font: 800 14px/26px Oswald, sans-serif; text-align: center; pointer-events: none; }
.tc-rad-obj { position: absolute; z-index: 600; width: 32px; height: 32px; border-radius: 50%; background: #ffb547; border: 3px solid #fff; display: grid; place-items: center; font-size: 15px; pointer-events: none; }
.tc-rad-obj[hidden], .tc-rad-vuoto[hidden] { display: none; }
.tc-rad-vuoto { position: absolute; inset: 0; z-index: 700; display: grid; place-items: center; padding: 20px; text-align: center; background: rgba(7, 4, 15, .8); font-weight: 600; }
.tc-pk { width: 24px; height: 24px; border-radius: 6px; background: #4cc3ff; border: 2px solid #fff; color: #fff; font: 800 14px/20px Oswald, sans-serif; text-align: center; }
.tc-ob { font-size: 22px; line-height: 28px; text-align: center; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .7)); }
.tc-rad-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tc-rad-obt { font-size: 14px; margin: 6px 0; }
.tc-rad-obd { display: flex; justify-content: space-between; align-items: center; }
.tc-dist { font: 700 28px Oswald, Montserrat, sans-serif; color: #ff50c5; }
.tc-freccia { display: inline-block; font-style: normal; font-weight: 800; width: 22px; text-align: center; }
.tc-vrow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.tc-vrow:first-child { border-top: 0; }
.tc-vt { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-rad-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tc-raggi { grid-column: 1 / -1; display: flex; gap: 6px; }
.tc-rad-btns button { min-height: 44px; border-radius: 12px; cursor: pointer; color: #fff; font: 700 13px Montserrat, Inter, sans-serif; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); }
.tc-raggi button { flex: 1; min-height: 40px; padding: 0; }
.tc-rad-btns button.on { background: #ff50c5; border-color: #ff50c5; }
.tc-rad-btns button[hidden] { display: none; }
@media (min-width: 820px) and (orientation: landscape) {
  .tc-remote { padding-left: 28px; padding-right: 28px; }
  .tc-rad { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); align-items: start; }
  .tc-rad-box { width: min(100%, 78dvh); }
}
.tc-toast { position: fixed; left: 50%; top: 84px; transform: translate(-50%, -20px); z-index: 3400; opacity: 0; pointer-events: none; transition: .3s; display: flex; gap: 10px; align-items: center; padding: 11px 20px; border-radius: 99px; color: #fff; font: 600 14px Montserrat, Inter, sans-serif; background: rgba(18, 12, 32, .9); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 12px 40px rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); white-space: nowrap; }
.tc-toast.on { opacity: 1; transform: translate(-50%, 0); }
.tc-toast b { color: #ff50c5; }
