:root {
  --inchiostro: #14181f;
  --inchiostro-2: #1f2530;
  --carta: #ffffff;
  --carta-2: #f3f4f6;
  --linea: #dfe2e7;
  --testo: #14181f;
  --testo-2: #596070;
  --giallo: #ffc400;
  --giallo-scuro: #f2a900;
  --rosso: #d9381e;
  --verde: #1f9d55;
  --blu: #1e6fd9;
  --raggio: 14px;
  --ombra: 0 6px 22px rgba(10, 14, 20, 0.28);
  --alto-barra: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--inchiostro);
  color: var(--testo);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blu);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

#app {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--inchiostro);
}

/* ------------------------------------------------------------ testata e roadbook */

#testata {
  background: var(--inchiostro);
  color: #fff;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  z-index: 3;
}

.barra-alta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 6px;
}

.logo {
  flex: none;
  height: 38px;
  width: auto;
  padding: 3px 8px;
  border-radius: 10px;
  background: #fff;
}

.chip {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid #343b49;
  border-radius: 999px;
  background: var(--inchiostro-2);
  color: #e9ecf2;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icona-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
}
.icona-btn svg {
  width: 26px;
  height: 26px;
}

#roadbook {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 6px 12px 14px;
  transition: background 0.25s;
}
#roadbook.vicina {
  background: #2a2200;
}
#roadbook.vicina .rb-freccia {
  animation: pulsa 1s ease-in-out infinite;
}
@keyframes pulsa {
  50% { transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  #roadbook.vicina .rb-freccia { animation: none; }
}

.rb-freccia {
  width: 84px;
  height: 84px;
  color: var(--giallo);
  flex: none;
}
.freccia {
  width: 100%;
  height: 100%;
  display: block;
}

.rb-corpo {
  min-width: 0;
}
.rb-dist {
  font-size: clamp(38px, 11vw, 54px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.rb-nota {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.rb-dopo {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #b7bdc9;
  min-height: 20px;
}
.rb-dopo > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.freccia-mini {
  width: 20px;
  height: 20px;
  color: #e6c200;
  flex: none;
}

.rb-lista {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 6px;
  min-width: 56px;
  border: 1px solid #343b49;
  border-radius: 12px;
  background: var(--inchiostro-2);
  color: #e9ecf2;
  font-size: 11px;
  font-weight: 600;
}
.rb-lista svg {
  width: 24px;
  height: 24px;
}

/* ------------------------------------------------------------ mappa */

#area-mappa {
  position: relative;
  min-height: 0;
  background: #e8e4da;
}
#mappa {
  position: absolute;
  inset: 0;
}

.maplibregl-ctrl-attrib {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.85) !important;
}
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  margin-bottom: 0;
}

#avvisi {
  position: absolute;
  inset: 10px 10px auto 10px;
  display: grid;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}
.avviso {
  pointer-events: auto;
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  padding: 10px 12px;
  animation: entra 0.2s ease-out;
}
@keyframes entra {
  from { transform: translateY(-10px); opacity: 0; }
}
.avviso-errore {
  background: var(--rosso);
  color: #fff;
  display: grid;
  gap: 2px;
}
.avviso-errore strong {
  font-size: 18px;
}
.avviso-poi {
  background: var(--carta);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 6px solid var(--giallo-scuro);
}
.banner-emoji {
  font-size: 30px;
  line-height: 1;
}
.banner-testo {
  flex: 1;
  min-width: 0;
  display: grid;
}
.banner-testo strong {
  font-size: 18px;
  line-height: 1.2;
}
.banner-testo small {
  color: var(--testo-2);
  font-size: 12px;
}
.avviso-poi button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--inchiostro);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.avviso-poi button[disabled] {
  background: var(--carta-2);
  color: var(--testo-2);
  cursor: default;
}
.avviso-poi .banner-x {
  background: transparent;
  color: var(--testo-2);
  font-size: 24px;
  padding: 4px 8px;
  line-height: 1;
}

#comandi {
  position: absolute;
  right: calc(10px + var(--safe-r));
  bottom: 34px;
  display: grid;
  gap: 10px;
  z-index: 2;
}
.tondo {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--carta);
  color: var(--inchiostro);
  box-shadow: var(--ombra);
}
.tondo svg {
  width: 26px;
  height: 26px;
}
.tondo.attivo {
  background: var(--blu);
  color: #fff;
}
.tondo-grande {
  width: 60px;
  height: 60px;
  background: var(--giallo);
}
.tondo-grande svg {
  width: 32px;
  height: 32px;
}
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--rosso);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.pill {
  position: absolute;
  left: 10px;
  bottom: 34px;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--ombra);
}
.pill-ok { background: #d7f3e1; color: #0c5a2e; }
.pill-no { background: var(--carta); color: var(--testo-2); }
.pill-rete { background: #ffe3a3; color: #5b3d00; }

#toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  width: min(92%, 440px);
  z-index: 4;
  padding: 12px 14px;
  border-radius: var(--raggio);
  background: var(--inchiostro);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--ombra);
  text-align: center;
}

.caricamento {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--inchiostro);
  color: #c7ccd6;
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid #343b49;
  border-top-color: var(--giallo);
  animation: gira 0.9s linear infinite;
}
@keyframes gira {
  to { transform: rotate(360deg); }
}

/* marker mappa */
.marker-estremo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.marker-partenza { background: var(--verde); }
.marker-arrivo { background: var(--inchiostro); }
.marker-poi {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 3px solid var(--giallo-scuro);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}
.marker-pos {
  width: 56px;
  height: 56px;
  position: relative;
}
.pos-punto {
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: var(--blu);
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px rgba(30, 111, 217, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
}
.pos-freccia {
  position: absolute;
  inset: 0;
  transition: transform 0.4s;
}
.pos-freccia::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-bottom: 16px solid var(--blu);
  border-top: 0;
}

/* ------------------------------------------------------------ barra in basso */

#barra {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: var(--alto-barra);
  padding: 8px calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l));
  background: var(--inchiostro);
  color: #fff;
  z-index: 3;
}
.b-riga {
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}
.b-riga strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.b-riga span {
  color: #b7bdc9;
  font-size: 14px;
}
.progresso {
  height: 6px;
  border-radius: 3px;
  background: #343b49;
  overflow: hidden;
  margin-top: 4px;
}
#progressoBarra {
  height: 100%;
  width: 0;
  background: var(--giallo);
  transition: width 0.4s;
}
.b-vel {
  display: grid;
  justify-items: center;
  line-height: 1;
}
.b-vel strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}
.b-vel span {
  font-size: 11px;
  color: #b7bdc9;
}
.in-marcia .b-vel strong {
  color: var(--giallo);
}
.btn-gps {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--giallo);
  color: var(--inchiostro);
  font-weight: 800;
  font-size: 15px;
}
.btn-gps.attivo {
  background: #343b49;
  color: #fff;
}
.btn-gps.cerca {
  animation: lampeggia 1.2s ease-in-out infinite;
}
@keyframes lampeggia {
  50% { opacity: 0.55; }
}

/* ------------------------------------------------------------ sheet */

#sipario {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.5);
  z-index: 10;
}
#sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 600px);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  z-index: 11;
  background: var(--carta);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  animation: sale 0.22s ease-out;
  padding-bottom: var(--safe-b);
}
@keyframes sale {
  from { transform: translate(-50%, 24px); opacity: 0; }
}
.sheet-testa {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 6px 18px;
  border-bottom: 1px solid var(--linea);
  flex: none;
}
.sheet-testa h2 {
  flex: 1;
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}
.sheet-corpo {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 14px 18px;
}

.elenco {
  display: grid;
}
.riga {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 6px;
  border: 0;
  border-bottom: 1px solid var(--linea);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
}
.riga:last-child {
  border-bottom: 0;
}
.riga-attiva {
  background: #fff6d6;
  border-radius: 10px;
}
.riga-emoji {
  font-size: 26px;
  width: 36px;
  text-align: center;
  flex: none;
}
.riga-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--inchiostro);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: none;
}
.riga-testo {
  flex: 1;
  min-width: 0;
  display: grid;
}
.riga-testo strong {
  font-size: 16px;
  line-height: 1.25;
}
.riga-testo small {
  color: var(--testo-2);
  font-size: 13px;
}
.riga-freccia {
  color: var(--testo-2);
  font-size: 22px;
}
.riga-freccia-nota {
  width: 40px;
  height: 40px;
  color: var(--inchiostro);
  flex: none;
  background: var(--carta-2);
  border-radius: 10px;
  padding: 5px;
}
.freccia-lista {
  width: 100%;
  height: 100%;
}
.riga-km {
  display: grid;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.riga-km small {
  color: var(--testo-2);
}
.vuoto {
  color: var(--testo-2);
  padding: 20px 6px;
}

.riga-switch {
  position: relative;
}
.riga-switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.interruttore {
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: #b9bec8;
  position: relative;
  transition: background 0.2s;
}
.interruttore::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.riga-switch input:checked ~ .interruttore {
  background: var(--verde);
}
.riga-switch input:checked ~ .interruttore::after {
  transform: translateX(20px);
}
.riga-switch input:focus-visible ~ .interruttore {
  outline: 3px solid var(--blu);
  outline-offset: 2px;
}

.blocco {
  background: var(--carta-2);
  border-radius: var(--raggio);
  padding: 12px 14px;
  margin: 6px 0 10px;
}
.blocco h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.blocco p {
  margin: 4px 0;
}
.piccolo {
  font-size: 13px;
  color: var(--testo-2);
}
.stato-ok,
.stato-no {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.punto {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b9bec8;
}
.stato-ok .punto {
  background: var(--verde);
}
.errore {
  color: var(--rosso);
  font-weight: 600;
}
.barra-dl {
  height: 12px;
  background: #d5d9e0;
  border-radius: 6px;
  overflow: hidden;
  margin: 10px 0 6px;
}
#dlBarra {
  height: 100%;
  width: 0;
  background: var(--verde);
  transition: width 0.2s;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--inchiostro);
  border-radius: 12px;
  background: var(--carta);
  color: var(--inchiostro);
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.btn-primario {
  background: var(--inchiostro);
  color: #fff;
}
.btn-piccolo {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}
.azioni {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.scheda {
  padding: 8px 4px 0;
}
.scheda-tag {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--carta-2);
  font-size: 13px;
  font-weight: 600;
}
.tag-cat {
  background: #fff1bf;
}
.scheda-testo {
  font-size: 17px;
  line-height: 1.5;
  margin: 8px 0;
}
.scheda-foto {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 4px 0 10px;
}
.scheda-foto img {
  height: 160px;
  width: auto;
  max-width: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.scheda-dati {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 12px 0;
}
.scheda-dati dt {
  color: var(--testo-2);
  font-weight: 600;
}
.scheda-dati dd {
  margin: 0;
}
.scheda-hotel {
  margin: 8px 0;
  font-size: 20px;
}
.crediti {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--testo-2);
  line-height: 1.5;
}
.crediti a {
  color: inherit;
}
.bozza {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff1bf;
  color: #5b3d00;
  font-size: 13px;
  font-weight: 600;
}
.avviso-sicurezza {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdeceb;
  color: #7a1b10;
}
.passi {
  padding-left: 22px;
  display: grid;
  gap: 10px;
}
.testo-info h3 {
  margin: 14px 0 6px;
  font-size: 17px;
}
.testo-info p {
  margin: 10px 0;
}

/* ------------------------------------------------------------ simulatore */

#sim {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  width: 230px;
  background: rgba(20, 24, 31, 0.94);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--ombra);
  font-size: 13px;
  padding: 8px 10px 10px;
}
.sim-testa {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sim-testa button {
  border: 0;
  background: #343b49;
  color: #fff;
  border-radius: 8px;
  width: 28px;
  height: 28px;
}
.sim-riga {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.sim-riga input[type='range'] {
  width: 100%;
}
label.sim-riga {
  display: grid;
  gap: 2px;
}
#sim .btn {
  background: #343b49;
  border-color: #343b49;
  color: #fff;
  flex: 1;
}
#sim.ridotto .sim-corpo {
  display: none;
}

@media (min-width: 720px) {
  #app {
    max-width: 760px;
    margin: 0 auto;
  }
}

/* codice del viaggio */
.schermo-codice { width: min(92vw, 380px); text-align: center; }
.schermo-codice h2 { color: #fff; margin: 0 0 8px; }
.form-codice { display: grid; gap: 10px; text-align: left; }
.form-codice input { font-size: 20px; letter-spacing: 2px; text-transform: uppercase; text-align: center; padding: 12px; border-radius: 10px; border: 1px solid #ccc; width: 100%; box-sizing: border-box; }
.errore-codice { color: #b3261e; font-weight: 600; margin: 0; }
.schermo-codice .errore-codice { color: #ffb4a9; }
.link-chiaro { color: #c7ccd6; }

/* mappa non disponibile (WebGL spento) */
.mappa-assente { padding: 28px 22px; text-align: center; color: #3b4352; background: #e9ecf1; height: 100%; box-sizing: border-box; font-size: 16px; line-height: 1.5; }
.mappa-assente p { margin: 0 0 16px; }

/* ------------------------------------------------------------ home (senza viaggio aperto) */
#home { position: fixed; inset: 0; z-index: 10; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--inchiostro); color: #fff; }
.home-sfondo {
  position: relative; min-height: 100%; overflow: hidden;
  background:
    radial-gradient(120% 70% at 88% 0%, rgba(255, 196, 0, 0.26), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(217, 56, 30, 0.2), transparent 60%),
    linear-gradient(180deg, #14181f, #1b212b);
}
.home-sole {
  position: absolute; right: -70px; top: -60px; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe27a, #ffc400 55%, #f2a900);
  box-shadow: 0 0 100px rgba(255, 196, 0, 0.5); opacity: 0.95;
}
.home-strada { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 58%; opacity: 0.6; pointer-events: none; }
.home-contenuto {
  position: relative; z-index: 1; max-width: 480px; margin: 0 auto;
  padding: calc(var(--safe-t) + 22px) 20px calc(var(--safe-b) + 30px);
}
.home-logo { height: 52px; box-shadow: var(--ombra); }
.home-contenuto h1 { margin: 34px 0 10px; font-size: clamp(32px, 9.5vw, 46px); line-height: 1.04; font-weight: 800; letter-spacing: -0.02em; }
.home-contenuto h1 span { color: var(--giallo); }
.home-sotto { margin: 0; color: #c7ccd6; font-size: 17px; max-width: 34ch; }
.home-card { display: block; margin: 20px 0; padding: 18px; border-radius: 18px; background: #fff; color: var(--testo); box-shadow: var(--ombra); }
.home-card h2 { margin: 0 0 6px; font-size: 19px; }
.home-card p { margin: 0 0 8px; color: #4b5361; }
.home-card input { width: 100%; box-sizing: border-box; margin: 8px 0 12px; padding: 14px; border: 2px solid var(--linea); border-radius: 12px; font-size: 20px; letter-spacing: 2px; text-align: center; text-transform: uppercase; background: #fff; color: var(--testo); }
.home-card input:focus { outline: 3px solid rgba(255, 196, 0, 0.6); border-color: var(--giallo-scuro); }
.home-card #inpEmail { font-size: 17px; letter-spacing: normal; text-align: left; text-transform: none; }
.btn-largo { width: 100%; }
.home-card .btn-primario { background: var(--giallo); border-color: var(--giallo-scuro); color: var(--inchiostro); }
.home-email summary { cursor: pointer; font-weight: 700; list-style: none; }
.home-email summary::-webkit-details-marker { display: none; }
.home-email summary::after { content: '  ›'; color: var(--giallo-scuro); }
.home-email[open] summary { margin-bottom: 10px; }
.home-viaggi { margin: 8px 0 0; padding: 0; list-style: none; }
.home-viaggio { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--linea); }
.home-viaggio:first-child { border-top: 0; }
.home-viaggio-testo { flex: 1; min-width: 0; }
.home-viaggio-testo strong { display: block; overflow-wrap: anywhere; }
.home-viaggio-testo small { color: #6a7280; }
.home-rimuovi { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eef0f3; color: #4b5361; font-size: 20px; line-height: 1; cursor: pointer; }
.home-messaggio { margin: 22px 0 0; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.home-messaggio-errore { background: rgba(217, 56, 30, 0.18); border: 1px solid rgba(217, 56, 30, 0.55); color: #ffc7bd; }
.home-messaggio-ok { background: rgba(31, 157, 85, 0.2); border: 1px solid rgba(31, 157, 85, 0.55); color: #b6f0cd; }
.home-esito { margin: 10px 0 0; font-weight: 600; }
.home-esito-ok { color: #0d5b30; }
.home-esito-errore { color: #b3261e; }
.home-card .errore-codice { margin: 0 0 8px; color: #b3261e; }
.home-demo { margin: 6px 0 0; text-align: center; }
.home-piede { margin: 26px 0 0; text-align: center; color: #8a93a1; font-size: 13px; }

.home-contenuto h1 { font-size: clamp(30px, 8.6vw, 42px); text-wrap: balance; }
.home-informativa .titolo-piccolo { font-size: 26px; margin: 22px 0 12px; }
.home-informativa .home-card p { margin: 0 0 12px; color: #2b3340; }

.pin-schermata { position: fixed; inset: 0; z-index: 9999; overflow: auto; }
.pin-schermata .home-card input { text-transform: none; }

.avviso-agenzia { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: #f1f4f8; border-left: 4px solid #6b7686; }
.avviso-agenzia.importante { background: #fff4d6; border-left-color: #d89b00; }
.avviso-agenzia p { margin: 4px 0 6px; }
.avviso-agenzia small { color: #5b6573; }
.pallino-nuovo { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #d93025; color: #fff; font-size: 12px; text-align: center; }
.riga-emergenza .riga-km strong { font-size: 18px; }
.riga-check { cursor: pointer; }
.riga-check input { width: 22px; height: 22px; margin-right: 12px; }
.tag-oggi { background: var(--giallo); color: var(--inchiostro); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.btn-torna { display: inline-block; margin-top: 8px; padding: 10px 14px; border-radius: 10px; background: #fff; color: #7a1a12; font-weight: 700; text-decoration: none; }

/* Roadbook stampabile (Menu › Roadbook in PDF) */
#areaStampa { display: none; }
@media print {
  body.in-stampa > *:not(#areaStampa) { display: none !important; }
  body.in-stampa { background: #fff; overflow: visible; height: auto; }
  body.in-stampa #areaStampa { display: block !important; position: static; font: 11pt/1.4 system-ui, sans-serif; color: #000; padding: 0; }
  #areaStampa h1 { font-size: 22pt; margin: 0 0 6pt; }
  #areaStampa h2 { font-size: 14pt; margin: 0 0 4pt; border-bottom: 1px solid #000; }
  #areaStampa h3 { font-size: 11pt; margin: 8pt 0 2pt; }
  .rb-tappa { break-before: page; }
  .rb-tappa:first-of-type { break-before: auto; }
  .rb-dati { color: #333; margin: 0 0 6pt; }
  .rb-note { width: 100%; border-collapse: collapse; margin: 6pt 0; }
  .rb-note th, .rb-note td { text-align: left; padding: 2pt 4pt; border-bottom: 0.5pt solid #bbb; vertical-align: top; }
  .rb-note .num { width: 44pt; text-align: right; white-space: nowrap; }
  .rb-note tr { break-inside: avoid; }
  .rb-piede { margin-top: 14pt; font-size: 9pt; color: #555; }
}
.diario-foto { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin: 6px 0; }
.voce-diario { padding: 10px 0; border-bottom: 1px solid #e3e7ee; }
.voce-diario p { margin: 4px 0; }
.azioni-diario { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.scelta-tappe { margin: 8px 0; }
.scelta-tappe summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* Telefoni: la testata del roadbook occupa meno spazio e lascia più mappa (il testo completo resta nell'elenco «Roadbook») */
@media (max-width: 520px) {
  .barra-alta { padding: 6px 12px 4px; }
  .logo { height: 34px; }
  #roadbook { gap: 10px; padding: 2px 12px 8px; }
  .rb-freccia { width: 62px; height: 62px; }
  .rb-dist { font-size: clamp(28px, 8.2vw, 38px); }
  .rb-nota { margin-top: 2px; font-size: 16px; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .rb-dopo { margin-top: 3px; min-height: 16px; font-size: 12.5px; }
  .freccia-mini { width: 16px; height: 16px; }
  .rb-lista { min-width: 50px; padding: 6px 4px; }
  .rb-lista svg { width: 22px; height: 22px; }
  /* «Inizio tappa» / «Fine tappa»: sempre su una riga sola; il carattere si adatta alla larghezza (spazio = schermo − freccia − pulsante Roadbook) */
  .rb-dist-parole { white-space: nowrap; font-size: min(36px, calc((100vw - 170px) / 6.6)); }
}

/* mappa «lontana» (zoom basso): i luoghi sono puntini, così non coprono il percorso */
#mappa.lontana .marker-poi { width: 20px; height: 20px; border-width: 2px; font-size: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }

