/* Mappa storica a schermo intero: globo, comandi in vetro smerigliato, linea del tempo per epoche. */
.m-immersiva {
  --vetro: rgba(255, 251, 243, .78);
  --vetro-pieno: rgba(255, 251, 243, .96);
  --vetro-bordo: rgba(110, 80, 40, .16);
  --testo: #2b2118;
  --testo-2: #6f6253;
  --hover: rgba(110, 80, 40, .09);
  --ombra-m: 0 12px 32px rgba(20, 14, 8, .22), 0 2px 6px rgba(20, 14, 8, .10);
  --era: #b0563a;
  --dock-h: 130px;
  --gutter: 14px;
  --barra-h: 52px;
  --pannello-l: 400px;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  .m-immersiva {
    --vetro: rgba(24, 22, 19, .74);
    --vetro-pieno: rgba(28, 25, 21, .97);
    --vetro-bordo: rgba(255, 240, 210, .12);
    --testo: #f1e8d8;
    --testo-2: #b3a792;
    --hover: rgba(255, 240, 210, .08);
    --ombra-m: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  }
}

html:has(.m-immersiva) { height: 100%; }
.m-immersiva {
  margin: 0; height: 100%; overflow: hidden; color: var(--testo);
  background: #070a14; font-family: var(--sans);
  overscroll-behavior: none;
}

/* ---------- mappa e spazio intorno al globo */
.m-immersiva #mappa,
.m-immersiva #mappa.maplibregl-map {
  position: fixed; inset: 0; height: auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none;
  background:
    radial-gradient(1px 1px at 23px 41px, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1px 1px at 151px 97px, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 211px 183px, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1px 1px at 77px 221px, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 263px 21px, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 119px 151px, rgba(200,220,255,.7), transparent 60%),
    radial-gradient(ellipse at 50% 45%, #1a2a48 0%, #0c1328 45%, #05070e 100%);
  background-size: 290px 290px, 290px 290px, 290px 290px, 290px 290px, 290px 290px, 290px 290px, 100% 100%;
  font-family: var(--sans);
}

/* ---------- elementi in vetro */
.m-vetro {
  background: var(--vetro);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--vetro-bordo);
  box-shadow: var(--ombra-m);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .m-vetro { background: var(--vetro-pieno); }
}
.m-immersiva [hidden] { display: none !important; }
.m-nascosto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- barra in alto */
.m-barra {
  position: fixed; z-index: 30; top: calc(var(--gutter) + env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter);
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.m-barra > * { pointer-events: auto; }
.m-logo {
  display: inline-flex; align-items: center; gap: .5rem; height: var(--barra-h); padding: 0 1rem 0 .8rem;
  border-radius: 999px; color: var(--testo); text-decoration: none; font-weight: 700; white-space: nowrap;
}
.m-logo-icona { font-size: 1.4rem; }
.m-logo:hover { color: var(--era); }

.m-cerca {
  position: relative; flex: 1; max-width: 460px; height: var(--barra-h); margin: 0 auto;
  display: flex; align-items: center; border-radius: 999px; padding: 0 .9rem;
}
.m-cerca-icona { font-size: 1.35rem; color: var(--testo-2); margin-right: .45rem; line-height: 1; }
.m-cerca input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--testo);
  font: 500 .98rem var(--sans); padding: 0; margin: 0; box-shadow: none;
}
.m-cerca input::placeholder { color: var(--testo-2); }
.m-cerca input::-webkit-search-cancel-button { cursor: pointer; }
.m-cerca:focus-within { box-shadow: var(--ombra-m), 0 0 0 3px color-mix(in srgb, var(--era) 45%, transparent); }
.m-tasto {
  font: 600 .75rem var(--sans); color: var(--testo-2); border: 1px solid var(--vetro-bordo);
  border-radius: 6px; padding: .05rem .4rem; margin-left: .4rem;
}
.m-cerca:focus-within .m-tasto { display: none; }
.m-risultati {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; margin: 0; padding: .35rem; list-style: none;
  background: var(--vetro-pieno); border: 1px solid var(--vetro-bordo); border-radius: 18px; box-shadow: var(--ombra-m);
  max-height: min(60vh, 420px); overflow-y: auto;
}
.m-risultati li {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 12px; cursor: pointer;
}
.m-risultati li[aria-selected="true"], .m-risultati li:hover { background: var(--hover); }
.m-risultati .m-ris-icona { width: 1.8rem; text-align: center; font-size: 1.1rem; }
.m-risultati .m-ris-testo { display: flex; flex-direction: column; min-width: 0; }
.m-risultati .m-ris-testo strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-risultati .m-ris-testo small { color: var(--testo-2); }
.m-risultati mark { background: color-mix(in srgb, var(--era) 28%, transparent); color: inherit; border-radius: 3px; }
.m-risultati .m-ris-vuoto { cursor: default; color: var(--testo-2); font-size: .9rem; }
.m-risultati .m-ris-vuoto:hover { background: none; }

.m-azioni { display: flex; align-items: center; gap: 8px; }
.m-ancora { position: relative; }
.m-tondo {
  width: var(--barra-h); height: var(--barra-h); border-radius: 50%; display: grid; place-items: center;
  font-size: 1.25rem; color: var(--testo); cursor: pointer; padding: 0;
  transition: transform .15s ease;
}
.m-tondo:hover { transform: translateY(-1px); }
.m-tondo[aria-pressed="false"] { filter: grayscale(.9); opacity: .8; }
#apri-pannello { display: none; }
body:not(.pannello-aperto) #apri-pannello { display: grid; }

.m-utente {
  display: flex; align-items: center; gap: .5rem; height: var(--barra-h); padding: 0 1rem 0 .55rem;
  border-radius: 999px; color: var(--testo); cursor: pointer; font: inherit;
}
.m-utente-icona { font-size: 1.6rem; }
.m-utente-testo { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.m-utente-testo small { color: var(--testo-2); font-size: .75rem; }
.m-accedi {
  display: inline-flex; align-items: center; height: var(--barra-h); padding: 0 1.3rem; border-radius: 999px;
  background: var(--era); color: #fff; font-weight: 700; text-decoration: none; box-shadow: var(--ombra-m);
  transition: background-color .6s ease, transform .15s ease;
}
.m-accedi:hover { transform: translateY(-1px); color: #fff; }

.m-pop {
  position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; min-width: 240px; padding: .8rem;
  border-radius: 18px; background: var(--vetro-pieno);
}
.m-pop-titolo { margin: 0 0 .4rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--testo-2); }
.m-pop-nota { margin: .7rem 0 0; font-size: .78rem; color: var(--testo-2); line-height: 1.45; }
.m-menu { display: flex; flex-direction: column; padding: .4rem; min-width: 200px; }
.m-menu a { color: var(--testo); text-decoration: none; padding: .55rem .75rem; border-radius: 10px; }
.m-menu a:hover { background: var(--hover); }
.m-interruttore { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; cursor: pointer; margin: 0; font-size: .95rem; }
.m-interruttore input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-interruttore span {
  position: relative; width: 38px; height: 22px; border-radius: 999px; background: rgba(128,128,128,.4); flex: none;
  transition: background-color .2s;
}
.m-interruttore span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.m-interruttore input:checked + span { background: var(--era); }
.m-interruttore input:checked + span::after { transform: translateX(16px); }
.m-interruttore input:focus-visible + span { outline: 2px solid var(--era); outline-offset: 2px; }
.m-campo { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: .4rem 0 0; font-size: .95rem; }
.m-campo select { width: auto; margin: 0; }

/* ---------- anno */
.m-tempo {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  top: calc(var(--gutter) * 2 + var(--barra-h) + env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  transition: left .35s ease;
}
.m-tempo > * { pointer-events: auto; }
.m-anno {
  display: flex; flex-direction: column; align-items: center; padding: .45rem 1.6rem .55rem; border-radius: 22px;
  min-width: 220px;
}
.m-era {
  font: 700 .7rem var(--sans); text-transform: uppercase; letter-spacing: .16em; color: var(--era);
  transition: color .6s ease;
}
.m-anno-valore {
  font: 700 clamp(2rem, 4.6vw, 3.3rem)/1.05 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.01em; white-space: nowrap;
}
#anno-suffisso { font-size: .42em; font-weight: 600; color: var(--testo-2); letter-spacing: .04em; }
.m-anno.caricamento .m-anno-valore { animation: m-respiro 1s ease-in-out infinite; }
@keyframes m-respiro { 50% { opacity: .55; } }
.m-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .85rem; border-radius: 999px;
  font: 600 .82rem var(--sans); color: var(--testo); cursor: pointer;
}
.m-chip-nota { cursor: default; font-weight: 500; color: var(--testo-2); font-size: .78rem; }
#chip-segui::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--era);
  box-shadow: 0 0 0 0 var(--era); animation: m-pulsa 1.8s ease-out infinite;
}
#chip-segui .m-chip-x { margin-left: .2rem; opacity: .6; }
#chip-segui.assente { opacity: .75; font-weight: 500; }
@keyframes m-pulsa {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--era) 70%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

/* ---------- dock con la linea del tempo */
.m-dock {
  position: fixed; z-index: 25; left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  max-width: 1060px; margin: 0 auto; padding: .7rem 1.1rem .55rem; border-radius: 26px; overflow: visible;
  transition: right .35s ease;
}
.m-carica {
  position: absolute; left: 22px; right: 22px; top: 0; height: 2px; border-radius: 2px; overflow: hidden; opacity: 0;
  transition: opacity .2s;
}
.m-carica::after {
  content: ""; position: absolute; inset: 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--era), transparent);
  animation: m-scorre 1s linear infinite;
}
body.carica .m-carica { opacity: 1; }
@keyframes m-scorre { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.m-comandi { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; }
.m-trasporto, .m-vai { display: flex; align-items: center; gap: 4px; }
.m-vai { gap: 8px; }
.m-btn {
  min-width: 38px; height: 36px; padding: 0 .55rem; border: 0; border-radius: 12px; background: transparent;
  color: var(--testo); font: 600 .9rem var(--sans); cursor: pointer; transition: background-color .15s;
}
.m-btn:hover { background: var(--hover); }
.m-btn[data-passo="-1"], .m-btn[data-passo="1"] { font-size: 1.35rem; line-height: 1; }
.m-play {
  position: relative; width: 50px; height: 50px; margin: 0 .35rem; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--era); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--era) 55%, transparent);
  transition: background-color .6s ease, transform .15s ease;
}
.m-play:hover { transform: scale(1.06); }
.m-play:active { transform: scale(.96); }
.m-play-icona {
  width: 0; height: 0; margin-left: 4px;
  border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff;
}
.m-play.attivo .m-play-icona {
  width: 14px; height: 18px; margin: 0; border: 0;
  background: linear-gradient(90deg, #fff 0 5px, transparent 5px 9px, #fff 9px 14px);
}
.m-play.attivo::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--era) 60%, transparent); animation: m-onda 1.6s ease-out infinite;
}
@keyframes m-onda { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.m-velocita, .m-vai select, .m-vai input {
  height: 36px; margin: 0; padding: 0 .6rem; width: auto; border-radius: 12px;
  border: 1px solid var(--vetro-bordo); background: transparent; color: var(--testo); font: 500 .88rem var(--sans);
}
.m-velocita { margin-left: .4rem; }
.m-vai select option, .m-velocita option { color: #2b2118; }
.m-form-anno { display: flex; align-items: center; gap: 4px; margin: 0; }
.m-form-anno input { width: 5.6rem; }
.m-btn-vai { border: 1px solid var(--vetro-bordo); }
#vai-capitolo { max-width: 220px; }
.m-solo-mobile { display: none; }

/* traccia: tacche dei capitoli, bande delle epoche, cursore */
.m-traccia { position: relative; height: 44px; margin-top: .35rem; --p: 0%; }
.m-tacche { position: absolute; left: 0; right: 0; top: 0; height: 12px; }
.m-tacca {
  position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; padding: 0; border: 0; background: none; cursor: pointer;
}
.m-tacca::before {
  content: ""; position: absolute; left: 50%; top: 3px; width: 2px; height: 9px; margin-left: -1px; border-radius: 2px;
  background: var(--testo-2); opacity: .7; transition: transform .15s, opacity .15s;
}
.m-tacca:hover::before, .m-tacca:focus-visible::before { opacity: 1; transform: scaleY(1.4); background: var(--era); }
.m-tacca::after {
  content: attr(data-titolo); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  padding: .35rem .6rem; border-radius: 10px; background: var(--vetro-pieno); color: var(--testo); box-shadow: var(--ombra-m);
  font: 600 .78rem var(--sans); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.m-tacca:hover::after, .m-tacca:focus-visible::after { opacity: 1; transform: translateX(-50%); }
.m-tacca.a-sinistra::after { left: 0; transform: translateY(4px); }
.m-tacca.a-sinistra:hover::after { transform: none; }
.m-tacca.a-destra::after { left: auto; right: 0; transform: translateY(4px); }
.m-tacca.a-destra:hover::after { transform: none; }

.m-ere { position: absolute; left: 0; right: 0; top: 16px; height: 8px; border-radius: 999px; overflow: hidden; display: flex; }
.m-ere span { height: 100%; }
.m-ere span + span { box-shadow: inset 2px 0 0 var(--vetro-pieno); }
.m-ere-spente { opacity: .28; }
.m-ere-accese { clip-path: inset(0 calc(100% - var(--p)) 0 0 round 999px); }
.m-ere-nomi { position: absolute; left: 0; right: 0; top: 28px; height: 16px; }
.m-ere-nomi span {
  position: absolute; top: 0; padding-left: 4px; font: 600 .68rem var(--sans); letter-spacing: .04em; color: var(--testo-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase;
}
.m-ere-nomi span.attiva { color: var(--era); }

.m-traccia input[type=range] {
  position: absolute; left: -11px; right: -11px; width: calc(100% + 22px); top: 9px; height: 22px; margin: 0; padding: 0;
  background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; border: 0; box-shadow: none;
}
.m-traccia input[type=range]:focus { outline: none; }
.m-traccia input[type=range]::-webkit-slider-runnable-track { height: 22px; background: transparent; border: 0; }
.m-traccia input[type=range]::-moz-range-track { height: 22px; background: transparent; border: 0; }
.m-traccia input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 5px solid var(--era); box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .12s;
}
.m-traccia input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  border: 5px solid var(--era); box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.m-traccia input[type=range]:active::-webkit-slider-thumb { transform: scale(1.2); }
.m-traccia input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--era) 40%, transparent); }

/* ---------- pannello laterale (foglio dal basso su telefono) */
.m-pannello {
  position: fixed; z-index: 35; top: calc(var(--gutter) * 2 + var(--barra-h) + env(safe-area-inset-top)); right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); width: var(--pannello-l);
  border-radius: 26px; display: flex; flex-direction: column; overflow: hidden; background: var(--vetro-pieno);
  transform: translateX(calc(100% + 40px)); visibility: hidden;
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .4s;
}
body.pannello-aperto .m-pannello { transform: none; visibility: visible; transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.m-pannello-testa { position: relative; flex: none; height: 14px; }
.m-maniglia { display: none; }
.m-chiudi {
  position: absolute; z-index: 2; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--hover); color: var(--testo); font-size: .95rem; cursor: pointer;
}
.m-chiudi:hover { background: color-mix(in srgb, var(--era) 20%, transparent); }
.m-pannello-corpo { flex: 1; overflow-y: auto; padding: .4rem 1.4rem 1.4rem; overscroll-behavior: contain; scrollbar-width: thin; }
.m-pannello-corpo > * { animation: m-entra .35s ease both; }
@keyframes m-entra { from { opacity: 0; transform: translateY(8px); } }
.m-pannello-corpo h2 {
  margin: .25rem 2.2rem .35rem 0; font: 700 1.6rem/1.15 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
.m-pannello-corpo h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--testo-2); margin: 1.4rem 0 .5rem; }
.m-pannello-corpo p, .m-pannello-corpo li { font-size: .97rem; line-height: 1.6; }
.m-pannello-corpo .sopratitolo { color: var(--era); transition: color .6s; }
.m-pannello-corpo .indietro { font: 600 .85rem var(--sans); text-decoration: none; margin: .2rem 0 .3rem; }
.m-pannello .descrizione { color: var(--testo-2); margin-top: 0; font-style: italic; }
.m-hero {
  position: relative; margin: .8rem -1.4rem 1rem; height: 220px; overflow: hidden; background: #222;
}
.m-hero::before {
  content: ""; position: absolute; inset: -20px; background: var(--img) center / cover; filter: blur(18px) brightness(.75); transform: scale(1.1);
}
.m-hero img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.m-hero figcaption {
  position: absolute; right: 0; bottom: 0; max-width: 100%; padding: .2rem .6rem; font-size: .7rem;
  background: rgba(0,0,0,.45); border-top-left-radius: 8px;
}
.m-hero figcaption a { color: #f3ead8; }
.m-pannello .riquadro { background: color-mix(in srgb, var(--era) 10%, transparent); border: 1px solid color-mix(in srgb, var(--era) 25%, transparent); border-radius: 14px; padding: .8rem 1rem; }
.m-pannello .tema { background: transparent; color: var(--testo); }
.m-pannello .tema:hover, .m-pannello .tema.attivo { background: var(--era); border-color: var(--era); color: #fff; }
.m-pannello .bottone { background: var(--era); transition: background-color .6s; }
.m-pannello .bottone.secondario { background: transparent; color: var(--era); border-color: var(--era); }
.m-pannello a { color: var(--era); }
.m-pannello a.bottone { color: #fff; }
.m-pannello a.bottone.secondario { color: var(--era); }
.m-pannello button.link { color: var(--era); }
.m-pannello .licenza-testo { font-size: .78rem; color: var(--testo-2); }
.m-azioni-scheda { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.m-azioni-scheda .bottone { display: inline-flex; align-items: center; gap: .35rem; }
.m-scheda-vuota { text-align: center; padding: 2rem 0; }
.m-scheda-vuota .m-grande { font-size: 2.6rem; }
.m-attesa { display: grid; gap: .7rem; padding: 1rem 0; }
.m-attesa span {
  display: block; height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--hover) 25%, color-mix(in srgb, var(--era) 18%, transparent) 50%, var(--hover) 75%);
  background-size: 300% 100%; animation: m-luccica 1.2s linear infinite;
}
.m-attesa span:first-child { height: 26px; width: 70%; }
.m-attesa span.m-alto { height: 170px; }
.m-attesa span:last-child { width: 55%; }
@keyframes m-luccica { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* benvenuto */
.m-benvenuto h2 { font-size: 1.85rem; margin-right: 2.4rem; }
.m-evidenza { color: var(--era); transition: color .6s; }
.m-passi { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .65rem; }
.m-passi li { display: flex; gap: .8rem; align-items: flex-start; font-size: .93rem; line-height: 1.45; }
.m-passi li > span {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--era) 14%, transparent); color: var(--era); font-weight: 700;
}
.m-invito, .m-premio {
  border-radius: 16px; padding: .9rem 1rem; margin: 1rem 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--era) 16%, transparent), color-mix(in srgb, var(--era) 5%, transparent));
  border: 1px solid color-mix(in srgb, var(--era) 25%, transparent);
}
.m-invito p { margin: .2rem 0 .6rem; font-size: .92rem; }
.m-invito p:last-child { margin-bottom: 0; }

/* ---------- comandi della mappa, popup e città */
.m-immersiva .maplibregl-ctrl-top-right { top: calc(var(--gutter) * 2 + var(--barra-h) + env(safe-area-inset-top)); right: calc(var(--gutter) - 10px); transition: right .35s ease; }
body.pannello-aperto .maplibregl-ctrl-top-right { right: calc(var(--pannello-l) + var(--gutter) * 2 - 10px); }
.m-immersiva .maplibregl-ctrl-bottom-left, .m-immersiva .maplibregl-ctrl-bottom-right {
  bottom: calc(var(--dock-h) + var(--gutter) * 2 + env(safe-area-inset-bottom));
}
.m-immersiva .maplibregl-ctrl-group {
  background: var(--vetro-pieno); border-radius: 14px; box-shadow: var(--ombra-m); border: 1px solid var(--vetro-bordo); overflow: hidden;
}
.m-immersiva .maplibregl-ctrl-group button { width: 38px; height: 38px; }
@media (prefers-color-scheme: dark) {
  .m-immersiva .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
}
.m-immersiva .maplibregl-ctrl-attrib {
  background: var(--vetro); color: var(--testo-2); border-radius: 10px; font-size: .68rem;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.m-immersiva .maplibregl-ctrl-attrib a { color: var(--testo-2); }
.m-immersiva .maplibregl-ctrl-scale { background: var(--vetro); border-color: var(--testo-2); color: var(--testo); border-radius: 0 0 4px 4px; }

.m-immersiva .popup-nome .maplibregl-popup-content {
  background: rgba(20, 16, 12, .88); color: #f6eedf; border-radius: 12px; padding: .45rem .75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); font: .86rem/1.35 var(--sans);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.m-immersiva .popup-nome .maplibregl-popup-content small { color: #cdbfa6; }
.m-immersiva .popup-nome .maplibregl-popup-tip { display: none; }

.m-immersiva .citta { display: flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; cursor: pointer; }
.m-immersiva .citta .punto {
  position: relative; width: 9px; height: 9px; border-radius: 50%; background: #fffaf0; border: 2px solid #3a2a1a; flex: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s;
}
.m-immersiva .citta-1 .punto { width: 13px; height: 13px; background: #e0a526; border-color: #4a2e0c; }
.m-immersiva .citta-1 .punto::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(224, 165, 38, .7);
  animation: m-capitale 2.6s ease-out infinite;
}
@keyframes m-capitale { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.m-immersiva .citta:hover .punto { transform: scale(1.3); }
.m-immersiva .citta .nome-citta {
  display: none; background: none; padding: 0; color: #22180e; white-space: nowrap;
  font: 700 11.5px var(--sans); letter-spacing: .01em;
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 5px rgba(255,255,255,.9), 0 0 8px rgba(255,255,255,.7);
}
.m-immersiva .citta-1 .nome-citta { font-size: 12.5px; }
.m-immersiva .citta.con-nome .nome-citta, .m-immersiva .citta:hover .nome-citta { display: inline; }
body.senza-citta .citta { display: none !important; }

.m-toast {
  bottom: calc(var(--dock-h) + var(--gutter) * 2 + 10px + env(safe-area-inset-bottom)); border-radius: 999px;
  padding: .7rem 1.3rem; background: rgba(20, 16, 12, .92); color: #f6eedf; font-size: .92rem;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: m-toast .35s cubic-bezier(.2, .8, .2, 1);
  max-width: calc(100vw - 2 * var(--gutter)); text-align: center;
}
@keyframes m-toast { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- schermi larghi con pannello aperto: il resto si sposta per non finirci sotto */
@media (min-width: 1000px) {
  body.pannello-aperto .m-dock { right: calc(var(--pannello-l) + var(--gutter) * 2); }
  body.pannello-aperto .m-tempo { left: calc((100% - var(--pannello-l) - var(--gutter)) / 2); }
}

/* ---------- tablet */
@media (min-width: 721px) and (max-width: 999px) {
  .m-pannello { bottom: calc(var(--dock-h) + var(--gutter) * 2 + env(safe-area-inset-bottom)); }
}
@media (max-width: 1180px) {
  .m-logo-testo { display: none; }
  .m-logo { width: var(--barra-h); padding: 0; justify-content: center; }
}
@media (max-width: 999px) {
  .m-salto { display: none; }
  #vai-capitolo { max-width: 160px; }
}

/* ---------- telefono */
@media (max-width: 720px) {
  .m-immersiva { --gutter: 10px; --barra-h: 46px; }
  .m-utente-testo, .m-tasto { display: none; }
  .m-utente { width: var(--barra-h); padding: 0; justify-content: center; }
  .m-accedi { padding: 0 1rem; font-size: .9rem; }
  .m-barra { gap: 6px; }
  .m-cerca { padding: 0 .75rem; min-width: 0; }
  .m-cerca-icona { margin-right: .3rem; }
  .m-cerca input { font-size: 16px; }
  #btn-globo { display: none; }
  .m-pop { position: fixed; top: calc(var(--gutter) * 2 + var(--barra-h) + env(safe-area-inset-top)); right: var(--gutter); left: var(--gutter); min-width: 0; }
  .m-tempo { top: calc(var(--gutter) * 2 + var(--barra-h) + env(safe-area-inset-top)); gap: 6px; }
  .m-anno { flex-direction: row; align-items: baseline; gap: .6rem; padding: .35rem 1rem; min-width: 0; border-radius: 999px; }
  .m-anno-valore { font-size: 1.6rem; }
  .m-era { font-size: .62rem; letter-spacing: .12em; white-space: nowrap; }
  .m-chip { max-width: calc(100vw - 40px); }
  #chip-segui strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
  .m-dock { padding: .5rem .7rem .35rem; border-radius: 22px; }
  .m-comandi { justify-content: center; }
  .m-trasporto { width: 100%; justify-content: space-between; }
  .m-btn { min-width: 34px; padding: 0 .35rem; }
  .m-play { width: 46px; height: 46px; }
  .m-velocita { margin-left: 0; padding: 0 .3rem; font-size: .8rem; max-width: 92px; }
  .m-solo-mobile { display: inline-block; }
  .m-vai { display: none; width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .m-dock.vai-aperto .m-vai { display: flex; }
  #vai-capitolo { flex: 1; max-width: none; min-width: 0; }
  .m-tacca::after { display: none; }
  .m-immersiva .maplibregl-ctrl-top-right { display: none; }

  .m-pannello {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62vh; height: 62dvh;
    border-radius: 24px 24px 0 0; transform: translateY(105%); padding-bottom: env(safe-area-inset-bottom);
    transition: transform .4s cubic-bezier(.2, .8, .2, 1), height .3s ease, visibility 0s linear .4s;
  }
  body.pannello-aperto .m-pannello { transition: transform .4s cubic-bezier(.2, .8, .2, 1), height .3s ease; }
  body.pannello-espanso .m-pannello { height: 92vh; height: 92dvh; }
  .m-pannello-testa { height: 26px; touch-action: none; }
  .m-maniglia { display: block; position: absolute; left: 0; right: 0; top: 0; height: 26px; cursor: grab; }
  .m-maniglia::before {
    content: ""; position: absolute; left: 50%; top: 9px; width: 44px; height: 5px; margin-left: -22px;
    border-radius: 999px; background: var(--testo-2); opacity: .45;
  }
  .m-chiudi { top: 8px; width: 32px; height: 32px; }
  .m-pannello-corpo { padding: 0 1.1rem 1.4rem; }
  .m-pannello-corpo h2 { font-size: 1.4rem; }
  .m-hero { margin: .7rem -1.1rem .9rem; height: 190px; }
  .m-benvenuto h2 { font-size: 1.5rem; }
}
@media (max-width: 430px) {
  .m-btn[data-passo="-10"], .m-btn[data-passo="10"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .m-immersiva *, .m-immersiva *::before, .m-immersiva *::after { animation: none !important; transition: none !important; }
}

/* segnalazione dalla scheda della mappa */
.m-segnala { margin: 1.4rem 0 0; font-size: .85rem; }
.m-pannello .m-segnala .link { color: var(--testo-2); }
.m-pannello .m-segnala .link:hover { color: var(--era); }

/* ruolo della città nell'anno mostrato */
.m-pannello .m-ruolo-citta { margin: .2rem 0 .8rem; font-weight: 500; }

/* città nascoste dietro il globo: invisibili e non cliccabili */
.m-immersiva .citta[style*="opacity: 0;"] { pointer-events: none; }

/* aiuto e link nel pannello di benvenuto */
.m-aiuto { font: 700 1.25rem "Segoe UI", system-ui, sans-serif; }
.m-link-benvenuto { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 0; }
.m-link-benvenuto a { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--vetro-bordo); text-decoration: none; font-size: .85rem; color: var(--testo); }
.m-link-benvenuto a:hover { border-color: var(--era); color: var(--era); }
@media (max-width: 720px) { .m-logo { display: none; } }

/* i menu della barra in alto (opzioni, aiuto, utente) devono stare sopra il pannello laterale */
.m-barra { z-index: 40; }
