:root {
  --bus: #1c64d6;
  --tram: #e8590c;
  --metro: #c2255c;
  --treno: #2b8a3e;
  --altro: #7048e8;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --card: rgba(255, 255, 255, .95);
  --hair: rgba(0, 0, 0, .08);
  --font: "Roboto Condensed", "Arial Narrow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: var(--font); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; background: #ecebe7; }
/* mappa un po' piu' tenue, cosi' i mezzi colorati si vedono meglio */
.leaflet-tile-pane { filter: saturate(.55) brightness(1.04) contrast(.95); }

.card {
  background: var(--card);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .12), 0 0 0 .5px var(--hair);
}

/* ---------- barra in alto ---------- */
#top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1000;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 0;
  pointer-events: none;
  max-width: 560px; margin: 0 auto;
}
#top > * { pointer-events: auto; }
#panel { border-radius: 16px; overflow: hidden; }

#search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 14px; margin: 0; }
#search svg { flex: none; color: var(--muted); }
#q {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: 17px/1.2 var(--font); color: var(--ink);   /* 17px: niente zoom automatico su iPhone */
  -webkit-appearance: none; appearance: none;
}
#q::-webkit-search-cancel-button { display: none; }
#q::placeholder { color: #8e8e93; }
#clear {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(118, 118, 128, .16); color: var(--muted); font-size: 20px; line-height: 1;
}

#suggest { max-height: min(52vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch; border-top: .5px solid var(--hair); }
.sug {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px; border: 0; background: none; text-align: left; color: var(--ink);
  font: 15px/1.25 var(--font);
}
.sug + .sug { border-top: .5px solid var(--hair); }
.sug:active { background: rgba(0, 0, 0, .05); }
.sug .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3a3a3c; }
.sug .live { flex: none; font-size: 13px; color: var(--muted); }
.sug .live.on { color: #1f8a3b; font-weight: 600; }
.empty { padding: 14px; color: var(--muted); font-size: 15px; }

#row { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 0 6px; }
#row::-webkit-scrollbar { display: none; }

.seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 12px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: 600 14px/1 var(--font); padding: 9px 14px; border-radius: 9px;
}
.seg button.on { background: var(--ink); color: #fff; }

#chips { display: flex; gap: 8px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 38px; padding: 0 4px 0 5px; border-radius: 19px; border: 0;
  font: 600 14px/1 var(--font); color: var(--ink);
}
.chip .x { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); }
.chip.all { padding: 0 14px; color: var(--bus); }

.badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 34px; height: 28px; padding: 0 7px; border-radius: 14px;
  color: #fff; background: var(--bus); font: 700 14px/1 var(--font); letter-spacing: -.2px;
}
.k-bus { --c: var(--bus); background-color: var(--bus); }
.k-tram { --c: var(--tram); background-color: var(--tram); }
.k-metro { --c: var(--metro); background-color: var(--metro); }
.k-treno { --c: var(--treno); background-color: var(--treno); }
.k-altro { --c: var(--altro); background-color: var(--altro); }

/* ---------- stato in basso ---------- */
#status {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 30px);
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 120px);
  padding: 9px 14px; border-radius: 20px;
  font: 500 13px/1.2 var(--font); color: #3a3a3c; white-space: nowrap;
}
#status-text { overflow: hidden; text-overflow: ellipsis; }
#status .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; }
#status.ok .dot { background: #2fb344; animation: pulse 2s infinite; }
#status.warn .dot { background: #f59f00; }
#status.err .dot { background: #e03131; }
#status.hint { cursor: pointer; color: var(--ink); }
#status.hint .dot { background: var(--bus); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 179, 68, .55); }
  70% { box-shadow: 0 0 0 7px rgba(47, 179, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 179, 68, 0); }
}

#locate {
  position: fixed; z-index: 1000; right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 26px);
  width: 46px; height: 46px; border: 0; border-radius: 14px; color: var(--bus);
  display: flex; align-items: center; justify-content: center;
}

.leaflet-control-attribution { font-size: 10px !important; background: rgba(255, 255, 255, .75) !important; }
.leaflet-bottom.leaflet-right { margin-bottom: env(safe-area-inset-bottom); }

/* ---------- mezzi sulla mappa ---------- */
.vm { background: none; border: 0; }
.veh {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  font: 700 12px/1 var(--font); letter-spacing: -.3px; white-space: nowrap;
}
.veh.long { font-size: 10.5px; padding: 0 4px; }
.veh b { position: relative; z-index: 1; font-weight: 700; }
.veh .dir {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  pointer-events: none;
}
.veh .dir::before {
  content: ""; position: absolute; left: 50%; top: -1px; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 7px solid var(--c);
}
.z-low .veh { min-width: 0; width: 13px; height: 13px; padding: 0; border-width: 2px; border-radius: 50%; }
.z-low .veh b, .z-low .veh .dir { display: none; }

.moving .leaflet-marker-icon.vm { transition: transform 1s linear; }
.leaflet-zoom-anim .leaflet-marker-icon.vm { transition: none !important; }

/* ---------- scheda del mezzo ---------- */
.vpop .leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: 0 4px 20px rgba(0, 0, 0, .18); }
.vpop .leaflet-popup-content { margin: 14px 16px 14px; font: 14px/1.35 var(--font); color: var(--ink); min-width: 190px; }
.vpop a.leaflet-popup-close-button { top: 6px; right: 6px; font-size: 22px; color: var(--muted); }
.pp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding-right: 18px; }
.pp-kind { color: var(--muted); font-weight: 600; font-size: 13px; }
.pp-to { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.pp-meta { color: var(--muted); font-size: 13px; }
.pp-btn {
  display: block; width: 100%; margin-top: 12px; padding: 10px 12px;
  border: 0; border-radius: 10px; background: rgba(28, 100, 214, .1); color: var(--bus);
  font: 600 14px/1 var(--font);
}

.me { width: 16px; height: 16px; border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(10, 132, 255, .2); margin: -8px 0 0 -8px; }

#fatal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center; font: 16px/1.4 var(--font); color: #3a3a3c; background: #f6f5f2; z-index: 2000; }

/* ---------- fermate sulla mappa ---------- */
.z-far .stop::after { width: 6px; height: 6px; border-width: 2px; }
.sm { background: none; border: 0; }
.stop {
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.stop::after {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2.5px solid #2c2c2e; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9), 0 1px 3px rgba(0, 0, 0, .3);
}
.stop.sel::after { width: 14px; height: 14px; border: 4px solid #1d1d1f; background: #fff; box-shadow: 0 0 0 5px rgba(29, 29, 31, .18), 0 2px 6px rgba(0, 0, 0, .35); }
.stopic { flex: none; width: 34px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.stopic::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid #2c2c2e; }
.veh.focus { transform: translate(-50%, -50%) scale(1.25); box-shadow: 0 0 0 4px rgba(255, 255, 255, .95), 0 0 0 9px rgba(47, 179, 68, .5), 0 2px 8px rgba(0, 0, 0, .35); }
.z-low .veh.focus { width: auto; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; }
.z-low .veh.focus b { display: inline; }

/* ---------- pannello della fermata ---------- */
.sheet {
  position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 480px;
  display: flex; flex-direction: column; max-height: 76vh; max-height: 76dvh;
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .06);
  padding: 6px 0 calc(env(safe-area-inset-bottom) + 10px);
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
.sheet.open { transform: translateY(0); }
@media (min-width: 760px) {
  .sheet { left: 16px; right: auto; bottom: 16px; width: 400px; border-radius: 24px; max-height: calc(100vh - 150px); }
}
body.sheet-open #status, body.sheet-open #locate { opacity: 0; pointer-events: none; }
#status, #locate { transition: opacity .2s; }

#sh-grab { padding: 0 18px; touch-action: none; }
.sh-grip { width: 40px; height: 5px; border-radius: 3px; background: #d8d8dc; margin: 2px auto 10px; }
.sh-head { display: flex; align-items: center; gap: 12px; }
.sh-pin {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: #1d1d1f;
  display: flex; align-items: center; justify-content: center;
}
.sh-pin::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #1d1d1f; border: 3.5px solid #fff; }
.sh-title { flex: 1; min-width: 0; }
.sh-code { font: 600 12px/1.2 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sh-name { margin: 2px 0 0; font: 700 21px/1.15 var(--font); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-x {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  background: #f0f0f3; color: #48484a; display: flex; align-items: center; justify-content: center;
}

.sh-tabs {
  display: flex; gap: 8px; overflow-x: auto; flex: none;
  padding: 14px 18px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, #000 90%, transparent); mask-image: linear-gradient(to right, #000 90%, transparent);
}
.sh-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px 0 5px;
  border: 0; border-radius: 19px; background: #f2f2f5; color: #3a3a3c; font: 600 13px/1 var(--font);
  transition: background .15s, color .15s;
}
.tab .badge { min-width: 30px; height: 28px; border-radius: 14px; font-size: 13px; }
.tab .nx { font-variant-numeric: tabular-nums; }
.tab .nx.rt { color: #1f8a3b; }
.tab.on { background: #1d1d1f; color: #fff; }
.tab.on .nx.rt { color: #6fe08f; }
.tab.none { opacity: .55; }
span.tab { padding-right: 5px; }

.sh-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 18px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sh-body::-webkit-scrollbar { display: none; }
.sh-dir { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.sh-dir .badge { min-width: 34px; height: 28px; font-size: 14px; }
.sh-dir .to { flex: 1; min-width: 0; font: 600 15px/1.2 var(--font); color: #3a3a3c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards { display: flex; flex-direction: column; gap: 10px; }

/* riquadro di un passaggio: il colore dice dove si trova il mezzo */
.crd {
  display: grid; grid-template-columns: minmax(92px, auto) 1fr; column-gap: 0; align-items: stretch;
  padding: 13px 14px 12px; border-radius: 20px; background: #fff; border: 1.5px solid #e3e3e8;
}
.crd.st-arrivo { background: #ebf8ef; border-color: #93d8a7; }
.crd.st-term { background: #fff2e3; border-color: #f6c58f; }
.crd.st-trip { background: #fff; border-color: #dedee4; }
.crd.st-sched { background: #f1f1f5; border-color: transparent; }
.crd.st-gone { background: #fff5f5; border-color: #f3c2c2; }
.crd.has-v { cursor: pointer; }
.crd.has-v:active { transform: scale(.99); }
.crd.on { box-shadow: 0 0 0 3px rgba(31, 138, 59, .35); }

.cr-time { padding-right: 12px; border-right: 1.5px solid rgba(0, 0, 0, .09); display: flex; flex-direction: column; justify-content: center; }
.cr-big { font: 700 34px/1 var(--font); letter-spacing: -.5px; color: #1d1d1f; font-variant-numeric: tabular-nums; }
.st-arrivo .cr-big { color: #1f9a46; }
.st-term .cr-big { color: #e8590c; }
.st-sched .cr-big { color: #8e8e93; }
.st-gone .cr-big { color: #aeaeb2; text-decoration: line-through; }
.cr-sub { margin-top: 5px; font: 400 15.5px/1.2 var(--font); color: #3a3a3c; }
.cr-sub b { font-weight: 700; color: #1d1d1f; }
.st-sched .cr-sub { color: #6e6e73; font-size: 13.5px; }
.cr-time .alt { margin-top: 4px; font-size: 12.5px; color: #48484a; }

.cr-where { min-width: 0; padding-left: 12px; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.cr-pill { display: flex; justify-content: flex-end; }
.cr-txt { font: 400 14px/1.3 var(--font); color: #3a3a3c; }
.cr-txt b { font-weight: 700; color: #1d1d1f; }
.cr-txt b.h { color: #8e8e93; font-size: 15px; }
.cr-txt .old { color: #e8590c; }

.tg2 {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: 15px;
  font: 700 13.5px/1 var(--font); letter-spacing: .3px; white-space: nowrap;
}
.tg2 i { display: inline-flex; }
.tg2 svg { height: 15px; width: auto; display: block; }
.tg2.green { background: #c9efd5; color: #0f3d1f; }
.tg2.orange { background: #ffdcb3; color: #3b1d00; }
.tg2.solid-orange { background: #f59f00; color: #1d1d1f; }
.tg2.blue { background: #1c64d6; color: #fff; }
.tg2.red { background: #e03131; color: #fff; }

.cr-foot {
  grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap;
  margin-top: 10px; font: 400 15px/1.2 var(--font);
}
.cr-foot .d-ok { color: #1f9a46; }
.cr-foot .d-late { color: #d9480f; }
.cr-foot .d-early { color: #1c64d6; }
.cr-foot .who { font-size: 12.5px; font-style: italic; color: #48484a; }
.or-dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f59f00; }

.sh-empty { padding: 22px 14px; border-radius: 18px; background: #f5f5f7; text-align: center; color: var(--muted); font-size: 14.5px; }
.sh-foot {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 12px 18px 0; font-size: 11.5px; color: var(--muted);
}
.sh-foot span { display: inline-flex; align-items: center; gap: 5px; }
.sh-foot .upd { margin-left: auto; }
.sh-foot .warn { color: #e8590c; }
.rt-dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2fb344; }
.gr-dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #aeaeb2; }
.cr-w1.ok { color: #1f8a3b; }
.cr-w1.warn { color: #d9480f; }
.cr-w2 b { color: #1f8a3b; font-weight: 700; }
.cr-w3 { margin-top: 3px; font-size: 11.5px; line-height: 1.3; color: #8e8e93; }
/* mezzo fuori linea (rientro in deposito) */
.veh.off { background: #aeaeb2 !important; border: 2px dashed #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); opacity: .9; }
.veh.off b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.z-low .veh.off { opacity: .6; }
.pp-off { display: inline-block; margin-bottom: 6px; padding: 3px 8px; border-radius: 8px; background: #f0f0f3; color: #48484a; font-weight: 700; font-size: 13px; }

/* ---------- pannello del mezzo ---------- */
.vmf { background: none; border: 0; }
.sh-pin.veh-pin { background: var(--c); color: #fff; font: 800 16px/1 var(--font); letter-spacing: -.3px; }
.sh-pin.veh-pin::after { display: none; }
.vs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font: 650 12.5px/1 var(--font); background: #f2f2f5; color: #636366; }
.vchip.live, .vchip.ontime { background: #e3f6e8; color: #1f8a3b; }
.vchip.live .rt-dot { animation: pulse 2s infinite; }
.vchip.late { background: #fff0e6; color: #d9480f; }
.vchip.early { background: #e7f0ff; color: #1c64d6; }

.trk { background: #f5f5f7; border-radius: 18px; padding: 4px 14px; }
.trk-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.trk-ic { position: relative; z-index: 1; flex: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid #1d1d1f; }
.trk-row.next .trk-ic, .trk-row.start .trk-ic { border-color: #2fb344; box-shadow: 0 0 0 5px rgba(47, 179, 68, .16); }
.trk-row.end .trk-ic { border-radius: 5px; }
.trk-row.dep .trk-ic { border-color: #aeaeb2; }
.trk-line { width: 3px; height: 16px; margin: -11px 0 -11px 6.5px; border-radius: 2px;
  background: repeating-linear-gradient(to bottom, #c7c7cc 0 4px, transparent 4px 8px); }
.trk-txt { flex: 1; min-width: 0; }
.trk-l { font: 650 11px/1.2 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.trk-n { margin-top: 3px; font: 650 15.5px/1.2 var(--font); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-t { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.trk-t b { font: 750 21px/1 var(--font); letter-spacing: -.3px; }
.trk-t span { margin-top: 4px; font-size: 12.5px; font-weight: 600; }
.trk-depbox { flex: none; margin-left: 2px; padding-left: 12px; border-left: 1.5px solid rgba(0, 0, 0, .08); text-align: right; font-variant-numeric: tabular-nums; }
.trk-dep { margin-top: 3px; font: 750 19px/1 var(--font); }
.trk-s { margin-top: 3px; font-size: 11px; color: var(--muted); }
.trk .ok, .trk-dep.ok, .rl-t.ok { color: #1f8a3b; }
.trk .gray, .trk-dep.gray, .rl-t.gray { color: #8e8e93; }

.vs-btns { display: flex; gap: 8px; margin-top: 12px; }
.vbtn { flex: 1; height: 46px; border: 0; border-radius: 14px; background: #f2f2f5; color: var(--ink); font: 650 14.5px/1 var(--font); }
.vbtn.primary { background: #1d1d1f; color: #fff; }
.vbtn.primary.on { background: #e8e8ed; color: var(--ink); }
.vbtn:active { transform: scale(.98); }

.rlist { margin-top: 12px; }
.rl { position: relative; display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.rl::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 3px; background: #d1d1d6; }
.rl.first::before { top: 50%; }
.rl.last::before { bottom: 50%; }
.rl.first.last::before { display: none; }
.rl-dot { position: relative; z-index: 1; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 3px solid var(--c); background: #fff !important; }
.rl.first .rl-dot { background: var(--c) !important; }
.rl.last .rl-dot { border-radius: 5px; }
.rl-n { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl.first .rl-n { font-weight: 650; }
.rl-t { flex: none; font: 650 14px/1 var(--font); font-variant-numeric: tabular-nums; }

/* percorso restante sulla mappa */
.rsm { background: none; border: 0; }
.rs { position: absolute; left: 0; top: 0; width: 11px; height: 11px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; border: 3px solid var(--c); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.rs.end { width: 18px; height: 18px; border-width: 4.5px; border-radius: 6px; }
.leaflet-marker-icon.vm, .leaflet-marker-icon.sm { transition: opacity .25s; }
.route-focus .leaflet-marker-icon.vm, .route-focus .leaflet-marker-icon.sm { opacity: .15; }
.verbox { margin-top: 8px; padding: 10px 14px; border-radius: 14px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #48484a; background: #fff4e5; box-shadow: 0 2px 12px rgba(0,0,0,.12), 0 0 0 .5px rgba(217,72,15,.25); }
.verbox b { color: #d9480f; font-size: 14px; }
.sh-empty b { color: var(--ink); }

/* ---------- sul PC: link per il telefono ---------- */
.linkbox { position: fixed; z-index: 1050; right: 16px; top: 16px; width: 210px; padding: 14px 16px 16px; border-radius: 20px; text-align: center; }
.lb-x { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; background: none; font-size: 20px; color: var(--muted); }
.lb-t { font: 700 15px/1.2 var(--font); color: var(--ink); }
.lb-s { margin-top: 2px; font-size: 12px; color: var(--muted); }
.lb-qr { margin: 10px auto 6px; width: 160px; min-height: 20px; line-height: 0; }
.lb-qr svg { width: 160px; height: 160px; display: block; }
.lb-url { display: block; font-size: 11.5px; color: var(--bus); word-break: break-all; text-decoration: none; }
.lb-copy { margin-top: 10px; width: 100%; height: 36px; border: 0; border-radius: 12px; background: #1d1d1f; color: #fff; font: 600 13px/1 var(--font); }
@media (max-width: 759px) { .linkbox { display: none; } }
.cr-map { align-self: flex-start; margin-top: -2px; padding: 0; border: 0; background: none; color: #1c64d6; font: 600 13px/1.2 var(--font); }

/* ---------- simbolo (i) e legenda ---------- */
.sh-foot { justify-content: space-between; }
.sh-foot .upd { margin-left: 0; }
.info-btn {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  background: #f0f0f3; color: #48484a; display: inline-flex; align-items: center; justify-content: center;
}
.info-btn svg { width: 20px; height: 20px; }
.info-btn:active { background: #e3e3e8; }

.lg-back {
  position: fixed; inset: 0; z-index: 1300; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0); transition: background .2s;
}
.lg-back.open { background: rgba(0, 0, 0, .38); }
.lg-card {
  width: 100%; max-width: 480px; max-height: 84vh; max-height: 84dvh; overflow-y: auto; scrollbar-width: none;
  background: #fff; border-radius: 24px 24px 0 0; padding: 16px 18px calc(env(safe-area-inset-bottom) + 18px);
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain;
}
.lg-card::-webkit-scrollbar { display: none; }
.lg-back.open .lg-card { transform: none; }
@media (min-width: 760px) {
  .lg-back { align-items: center; }
  .lg-card { max-width: 460px; border-radius: 24px; max-height: 86vh; }
}
.lg-head { display: flex; align-items: center; justify-content: space-between; font: 700 22px/1 var(--font); color: var(--ink); }
.lg-sec { margin-top: 18px; }
.lg-sec h3 { margin: 0 0 6px; font: 700 12.5px/1 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.lg-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: .5px solid var(--hair); }
.lg-row:last-child { border-bottom: 0; }
.lg-k { flex: none; width: 168px; display: flex; align-items: center; }
.lg-v { flex: 1; min-width: 0; font: 400 14px/1.3 var(--font); color: #3a3a3c; }
.lg-k .tg2 { height: 26px; font-size: 12px; padding: 0 10px 0 8px; }
.lg-k .tg2 svg { height: 13px; }
.lg-t { font: 700 26px/1 var(--font); letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.lg-t.g { color: #1f9a46; }
.lg-t.o { color: #e8590c; }
.lg-t.s { color: #8e8e93; }
.lg-small { font: 400 14px/1.25 var(--font); color: #3a3a3c; }
.lg-small.d-ok { color: #1f9a46; }
.lg-small.d-late { color: #d9480f; }
.lg-small.d-early { color: #1c64d6; }
.lg-tab { height: 32px; pointer-events: none; }
.lg-m { position: relative; width: 60px; height: 30px; display: inline-block; }
.lg-m .veh { left: 30px; top: 15px; }
.lg-stop { position: absolute; left: 30px; top: 15px; width: 13px; height: 13px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; border: 2.5px solid #2c2c2e; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.lg-note { margin-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; }
@media (max-width: 380px) { .lg-k { width: 140px; } }

/* ---------- telefono: vista sul mezzo con freccia per tornare ---------- */
.bv-block { position: fixed; inset: 0; z-index: 1400; background: transparent; touch-action: none; }
.bv-back {
  position: fixed; z-index: 1450; left: 12px; top: calc(env(safe-area-inset-top) + 12px);
  display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 16px 0 10px; border: 0; border-radius: 23px;
  color: var(--ink); font: 700 15px/1 var(--font);
}
.bv-back svg { width: 22px; height: 22px; }
body.bus-view #top, body.bus-view #status, body.bus-view #locate { opacity: 0; pointer-events: none; }
body.bus-view .sheet { pointer-events: none; }

/* ---------- metropolitana ---------- */
.mm { background: none; border: 0; }
.metro-st {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 6px; background: var(--metro); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font: 800 13px/1 var(--font);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35); cursor: pointer;
}
.z-low .metro-st { width: 16px; height: 16px; font-size: 10px; border-radius: 4px; }
.lg-metro { left: 30px; top: 15px; }
.tab .dir { font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.on .dir { color: #fff; }
.metro-note { margin: -2px 0 10px; padding: 9px 12px; border-radius: 12px; background: #fdeef4; color: #8a1c46; font: 400 13px/1.3 var(--font); }

/* ---------- tipo di mezzo (elettrico, metano, diesel, tram) ---------- */
.ft { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font: 700 12.5px/1 var(--font); background: #f2f2f5; color: #48484a; white-space: nowrap; }
.ft i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ft.sm { padding: 4px 8px; font-size: 11.5px; border-radius: 8px; }
.ft-el { background: #e3f6e8; color: #1f8a3b; }
.ft-el i { display: none; }
.ft-cng { background: #e7f0ff; color: #1c64d6; }
.ft-dsl { background: #f3ece6; color: #7a4e2d; }
.ft-tram_new { background: #e3f6e8; color: #1f8a3b; }
.ft-tram_lf { background: #e6f6f7; color: #0b7285; }
.ft-tram_old { background: #f3ece6; color: #7a4e2d; }
.ft-tram_hist { background: #f8f0e3; color: #8a5a00; }
.cr-fuel { display: flex; }
.veh.ev::after {
  content: "⚡"; position: absolute; right: -7px; top: -8px; width: 15px; height: 15px; border-radius: 50%;
  background: #2fb344; border: 1.5px solid #fff; font-size: 8px; line-height: 13px; text-align: center; color: #fff;
}
.z-low .veh.ev::after { display: none; }
.veh.tn::after {
  content: "★"; position: absolute; right: -7px; top: -8px; width: 15px; height: 15px; border-radius: 50%;
  background: #2fb344; border: 1.5px solid #fff; font-size: 9px; line-height: 13px; text-align: center; color: #fff;
}
.veh.to::after {
  content: ""; position: absolute; right: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  background: #7a4e2d; border: 1.5px solid #fff;
}
.z-low .veh.tn::after, .z-low .veh.to::after { display: none; }

/* ---------- disegno / foto del mezzo nel pannello ---------- */
.vpic { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 10px 12px; border-radius: 18px; background: linear-gradient(180deg, #f7f8fa, #eef0f3); }
.vpic-img { flex: none; width: 46%; max-width: 190px; display: flex; align-items: center; justify-content: center; }
.vpic-img svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .12)); }
.vpic-img img { width: 100%; height: 86px; object-fit: cover; border-radius: 12px; display: block; }
.vpic-t { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.vpic-m { font: 700 14px/1.2 var(--font); color: var(--ink); }
.vpic-n { font: 400 11px/1.2 var(--font); color: var(--muted); font-style: italic; }
.vpic-n a { color: var(--muted); text-decoration: underline; }
.vpic-img img { background: #dde1e6; }
