: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; }
/* posizione stimata: GTT da' gli orari ma non il GPS del mezzo */
.veh.est { opacity: .78; border: 2px dashed #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25); }
.vchip.est { background: #fff4e0; color: #9a5b00; }
.vest { margin-bottom: 12px; padding: 10px 12px; border-radius: 14px; background: #fff7e8; color: #6b4a12; font: 400 13px/1.35 var(--font); }
.vest b { display: block; font-weight: 700; margin-bottom: 2px; color: #9a5b00; }
.veh.focus::after { content: ""; position: absolute; inset: -10px; border-radius: 22px; border: 3px solid rgba(47, 179, 68, .9); animation: focusPulse 1.4s ease-out infinite; pointer-events: none; }
@keyframes focusPulse { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.vb-stop { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 8px 12px 8px 8px; border: 0; border-radius: 12px; background: #f2f2f5; color: var(--ink); font: 650 13.5px/1 var(--font); cursor: pointer; }
.vb-stop svg { width: 16px; height: 16px; }

/* pannello spostato di lato ("Percorso restante" / "Solo la linea") */
#sheet.away { transform: translateX(115%) !important; pointer-events: none; }
@media (min-width: 760px) { #sheet.away { transform: translateX(calc(-100% - 40px)) !important; } }
.away-btn { position: fixed; z-index: 1200; right: 0; top: calc(130px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px;
  padding: 12px 14px 12px 10px; border: 0; border-radius: 16px 0 0 16px; background: #15171c; color: #fff;
  font: 700 14px/1 var(--font); box-shadow: 0 6px 20px rgba(0,0,0,.28); cursor: pointer; }
.away-btn svg { width: 18px; height: 18px; }
.away-btn[hidden] { display: none; }
@media (min-width: 760px) { .away-btn { right: auto; left: 0; top: 120px; bottom: auto; border-radius: 0 16px 16px 0; padding: 12px 10px 12px 14px; flex-direction: row-reverse; } }
/* stazioni metro: fermate normali, solo il bordo nel colore della metro */
.stop.metro::after { border-color: var(--metro, #c2255c); }
.lg-stop.metro { border-color: var(--metro, #c2255c); }

/* icone delle fermate: bus, tram, bus/tram, metro */
.stop svg { width: 22px; height: 22px; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.stop.st-bus::after, .stop.st-tram::after, .stop.st-mix::after, .stop.st-metro::after { content: none; }
.stop-m { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 5px; background: var(--metro); color: #fff;
  font: 800 13px/1 var(--font); border: 1.6px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.z-low .stop svg { width: 18px; height: 18px; }
.z-low .stop-m { width: 17px; height: 17px; font-size: 11px; }
.stop.sel::after { width: 30px; height: 30px; border: 3.5px solid #1d1d1f; background: transparent; box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 2px 6px rgba(0,0,0,.35); }
.lg-st { position: absolute; left: 30px; top: 15px; }
.tg2 svg[viewBox='0 0 46 20'] { height: 17px; }
.d-busy { font-weight: 600; white-space: nowrap; }
.vchip.busy { background: #fdeaea; color: #b42318; }
/* in anticipo: blu al posto del verde */
.tab .nx.rt.early { color: #1c64d6; }
.tab.on .nx.rt.early { color: #8fb8ff; }
.crd.early.st-arrivo .cr-big { color: #1c64d6; }
.trk .early, .trk-dep.early, .rl-t.early, .cr-w1.early { color: #1c64d6; }
/* bus al posto del tram */
.veh.sub::before {
  content: ""; position: absolute; left: -8px; top: -8px; width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid #fff; z-index: 2;
  background: var(--bus) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Crect x='3' y='2' width='12' height='12' rx='2.5' fill='%23fff'/%3E%3Crect x='4.6' y='3.8' width='8.8' height='4' rx='.8' fill='%231c64d6'/%3E%3Crect x='4' y='14' width='2.6' height='2.4' rx='.8' fill='%23fff'/%3E%3Crect x='11.4' y='14' width='2.6' height='2.4' rx='.8' fill='%23fff'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.z-low .veh.sub::before { display: none; }
.sub-chip { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 3px 8px 3px 6px; border-radius: 10px; background: #e7f0ff; color: #1c64d6; font: 600 12px/1.2 var(--font); }
.sub-chip svg { width: 13px; height: 13px; color: #1c64d6; }
.cr-fuel { flex-wrap: wrap; gap: 4px 0; }

/* ---------- barra in basso: Indicazioni / Mappa / News ---------- */
:root { --tb-h: 66px; --tb-gap: calc(env(safe-area-inset-bottom) + 10px); }
#tabbar {
  position: fixed; z-index: 1100; left: 0; right: 0; bottom: var(--tb-gap); margin: 0 auto;
  width: calc(100% - 20px); max-width: 440px; height: var(--tb-h); border-radius: 22px; background: #fff;
  display: flex; align-items: center; justify-content: space-around; padding: 0 6px;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
#tabbar button {
  position: relative; z-index: 1; flex: 1; height: 100%; border: 0; background: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #6b6b70; font: 600 12.5px/1 var(--font); -webkit-tap-highlight-color: transparent; --tb-hole: #fff;
}
#tabbar .tb-ic { width: 52px; height: 32px; display: flex; align-items: center; justify-content: center; transition: color .25s; }
#tabbar svg { width: 26px; height: 26px; }
#tabbar button.on { color: #1d1d1f; --tb-hole: #1d1d1f; }
#tabbar button.on .tb-ic { color: #fff; }
#tabbar button.on .tb-ic svg { animation: tbPop .45s cubic-bezier(.3, 1.6, .5, 1); }
#tabbar button:active .tb-ic svg { transform: scale(.88); }
#tabbar .tb-pill {
  position: absolute; z-index: 0; left: 0; top: 9px; width: 52px; height: 32px; border-radius: 16px; background: #1d1d1f;
  transition: transform .45s cubic-bezier(.3, 1.35, .5, 1);
}
#tabbar button.on .tb-dash { animation: tbDash 1.2s linear infinite; }
@keyframes tbPop { 0% { transform: scale(.7) rotate(-8deg); } 60% { transform: scale(1.15) rotate(3deg); } 100% { transform: scale(1); } }
@keyframes tbDash { to { stroke-dashoffset: -9.2; } }

/* gli altri elementi in basso salgono sopra la barra */
#status { bottom: calc(var(--tb-gap) + var(--tb-h) + 14px); }
#locate { bottom: calc(var(--tb-gap) + var(--tb-h) + 10px); }
.leaflet-bottom.leaflet-right { margin-bottom: calc(var(--tb-gap) + var(--tb-h) + 2px); }
/* sul telefono il pannello della fermata/mezzo copre la barra */
@media (max-width: 759px) {
  body.sheet-open #tabbar { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
}
body.bus-view #tabbar { opacity: 0; pointer-events: none; }

/* pagine (vuote per ora) */
.page {
  position: fixed; z-index: 1090; inset: 0; background: #f6f5f2; overflow: auto;
  padding: calc(env(safe-area-inset-top) + 28px) 22px calc(var(--tb-gap) + var(--tb-h) + 24px);
  opacity: 0; transform: translateY(18px); transition: opacity .28s, transform .38s cubic-bezier(.2, .8, .2, 1);
}
.page.show { opacity: 1; transform: none; }
.pg-title { margin: 0; font: 800 32px/1.1 var(--font); color: #1d1d1f; letter-spacing: -.3px; }
body.on-page #top, body.on-page #status, body.on-page #locate, body.on-page .linkbox { opacity: 0; pointer-events: none; }

/* ---------- stile "vetro liquido" (come Apple) ---------- */
#tabbar {
  background: rgba(255, 255, 255, .42);
  -webkit-backdrop-filter: blur(22px) saturate(190%) brightness(1.06);
  backdrop-filter: blur(22px) saturate(190%) brightness(1.06);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08),
    inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .35), inset 0 0 22px rgba(255, 255, 255, .25);
  overflow: hidden; touch-action: none;
}
#tabbar::before {                       /* riflesso di luce sul vetro */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .08) 45%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, .18) 100%);
}
#tabbar .tb-pill {
  top: 6px; width: 92px; height: 54px; border-radius: 27px; background: none;
  transition: transform .55s cubic-bezier(.25, 1.4, .45, 1);
}
#tabbar.dragging .tb-pill { transition: none; }
#tabbar .tb-lens {                      /* la "goccia" di vetro sotto il tasto scelto */
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, .85) 0%, rgba(255, 255, 255, .35) 38%, rgba(255, 255, 255, .18) 70%, rgba(255, 255, 255, .3) 100%);
  -webkit-backdrop-filter: blur(4px) saturate(220%) brightness(1.12);
  backdrop-filter: blur(4px) saturate(220%) brightness(1.12);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 4px 14px rgba(28, 100, 214, .16), 0 1px 2px rgba(0, 0, 0, .12),
    inset 0 1px 1px rgba(255, 255, 255, 1), inset 0 -2px 6px rgba(28, 100, 214, .12), inset 0 0 0 .5px rgba(255, 255, 255, .6);
  transition: transform .3s cubic-bezier(.3, 1.5, .5, 1);
}
#tabbar .tb-lens::after {               /* luce che scorre sul bordo della goccia */
  content: ""; position: absolute; left: 12%; right: 12%; top: 3px; height: 38%; border-radius: 40px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0)); opacity: .8;
}
#tabbar.jelly .tb-lens { animation: tbJelly .6s cubic-bezier(.3, 1.2, .4, 1); }
#tabbar.press .tb-lens { transform: scale(1.12, 1.08); }
@keyframes tbJelly {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.32, .8); }
  55% { transform: scale(.92, 1.08); }
  78% { transform: scale(1.04, .97); }
  100% { transform: scale(1, 1); }
}
#tabbar button { color: #3a3a3c; --tb-hole: rgba(255, 255, 255, .9); }
#tabbar button.on { color: var(--bus); --tb-hole: #eef3fc; }
#tabbar button.on .tb-ic { color: var(--bus); }
#tabbar .tb-tx { font-weight: 700; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #tabbar { background: rgba(255, 255, 255, .94); }
}

/* ---------- luoghi di OpenStreetMap ---------- */
.poi { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.poi span { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 1.5px rgba(255, 255, 255, .9); }
.poi i { margin-top: 2px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11px/1.1 var(--font);
  font-style: normal; color: #3a3a3c; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.poi.sel span { width: 40px; height: 40px; font-size: 22px; box-shadow: 0 0 0 5px rgba(232, 89, 12, .28), 0 3px 10px rgba(0, 0, 0, .35); animation: tbPop .45s cubic-bezier(.3, 1.6, .5, 1); }
.poi.sel i { font-size: 12.5px; color: #1d1d1f; max-width: 170px; }
.sug-h { padding: 9px 14px 3px; font: 700 11px/1 var(--font); letter-spacing: .6px; text-transform: uppercase; color: #8e8e93; border-top: .5px solid var(--hair); }
.sug-h:first-child { border-top: 0; }
.sug.pl .pl-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; background: #f2f2f5; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sug.pl .nm { display: flex; flex-direction: column; gap: 2px; color: #1d1d1f; }
.sug.pl .nm small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug.pl.more .nm { color: var(--bus); font-weight: 600; }
.pf-chip { height: 36px; padding: 0 12px; border: 0; border-radius: 18px; font: 600 14px var(--font); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pf-chip span { color: var(--muted); font-size: 18px; }
.pf-chip[hidden] { display: none; }
.sh-pin.place-pin { background: #fff3e8; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.pl-addr { font: 500 14.5px/1.35 var(--font); color: #3a3a3c; margin: 2px 0 10px; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pch { padding: 6px 10px; border-radius: 12px; background: #f2f2f5; font: 600 13px/1.2 var(--font); color: #3a3a3c; text-decoration: none; }
.pch.open { background: #e7f6ea; color: #1f8a3b; }
.pch.closed { background: #fdeaea; color: #b42318; }
.pch.link { color: var(--bus); background: #e7f0ff; }
.pl-h { font: 700 12px/1 var(--font); letter-spacing: .5px; text-transform: uppercase; color: #8e8e93; margin: 4px 0 6px; }
.pl-stop { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 2px; border: 0; border-top: .5px solid var(--hair); background: none; text-align: left; cursor: pointer; font: inherit; }
.pl-sn { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pl-sn b { font: 700 15px var(--font); color: #1d1d1f; }
.pl-lines { display: flex; flex-wrap: wrap; gap: 4px; }
.pl-lines .badge { min-width: 26px; height: 20px; font-size: 11.5px; padding: 0 6px; }
.pl-d { flex: none; text-align: right; font: 500 12.5px/1.3 var(--font); color: var(--muted); }
.pl-src { font-size: 12px; color: var(--muted); }

/* ======================================================================
   Indicazioni: stile futuristico ma leggibile
   ====================================================================== */
.page.dir { background: #eef1f8; padding-left: 16px; padding-right: 16px; overflow-x: hidden; }
.dir-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.dir-bg i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(60px); opacity: .55; animation: blob 18s ease-in-out infinite alternate; }
.dir-bg i:nth-child(1) { background: #8fb6ff; left: -20vmax; top: -25vmax; }
.dir-bg i:nth-child(2) { background: #c8a8ff; right: -25vmax; top: 10vmax; animation-delay: -6s; }
.dir-bg i:nth-child(3) { background: #9fe7d6; left: 5vmax; bottom: -35vmax; animation-delay: -12s; }
@keyframes blob { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vmax, 4vmax) scale(1.12); } 100% { transform: translate(-4vmax, 7vmax) scale(.95); } }
.glass { background: rgba(255, 255, 255, .62); -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .8); box-shadow: 0 10px 30px rgba(40, 60, 120, .14), inset 0 1px 0 rgba(255, 255, 255, .9); }
.dir-hero { margin: 6px 4px 16px; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.dir-greet { font: 800 30px/1.1 var(--font); letter-spacing: -.4px; color: #12141a; }
.dir-sub { margin-top: 6px; font: 500 17px/1.3 var(--font);
  background: linear-gradient(90deg, #1c64d6, #7b4dff 60%, #10a37f); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.dir-search { width: 100%; height: 60px; border-radius: 20px; display: flex; align-items: center; gap: 12px; padding: 0 18px; cursor: pointer;
  font: 600 18px var(--font); color: #5b6170; text-align: left; animation: rise .55s .05s cubic-bezier(.2, .8, .2, 1) both; position: relative; overflow: hidden; }
.dir-search svg { width: 22px; height: 22px; color: #1c64d6; }
.dir-search::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(120deg, #1c64d6, #7b4dff, #10a37f, #1c64d6); background-size: 300% 100%; animation: sheen 5s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
@keyframes sheen { to { background-position: 300% 0; } }
.dir-form { position: relative; border-radius: 22px; padding: 8px 60px 8px 8px; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.dir-fields { display: flex; flex-direction: column; }
.dir-field { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; width: 100%;
  padding: 9px 10px; border: 0; background: none; border-radius: 14px; text-align: left; cursor: pointer; transition: background .2s; }
.dir-field:active { background: rgba(28, 100, 214, .08); }
.dir-field .dot { grid-row: span 2; width: 14px; height: 14px; border-radius: 50%; justify-self: center; }
.dir-field .dot.from { background: #fff; border: 4px solid #1c64d6; box-shadow: 0 0 0 4px rgba(28, 100, 214, .15); }
.dir-field .dot.to { background: #e03131; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 0 0 4px rgba(224, 49, 49, .15); }
.dir-field .lbl { font: 700 11px/1 var(--font); letter-spacing: .6px; text-transform: uppercase; color: #7b8090; }
.dir-field .val { margin-top: 3px; font: 700 17px/1.2 var(--font); color: #12141a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-field .val.empty { color: #e03131; font-weight: 600; }
.dir-field.here .val { color: #1c64d6; }
.dir-sep { height: 1px; margin: 0 10px 0 44px; background: linear-gradient(90deg, rgba(28, 100, 214, .25), rgba(123, 77, 255, .25)); }
.dir-swap { position: absolute; right: 10px; top: 50%; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(140deg, #1c64d6, #7b4dff); box-shadow: 0 6px 16px rgba(91, 77, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
  display: flex; align-items: center; justify-content: center; }
.dir-swap svg { width: 22px; height: 22px; }
.dir-swap.spin svg { animation: spin180 .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes spin180 { from { transform: rotate(0); } to { transform: rotate(180deg); } }
.dir-form.swapping .val { animation: swapVal .36s ease; }
@keyframes swapVal { 0% { opacity: 1; transform: none; } 45% { opacity: 0; transform: translateY(6px); } 55% { opacity: 0; transform: translateY(-6px); } 100% { opacity: 1; transform: none; } }
.dir-warn { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: #fff1f0; color: #b42318; border: 1px solid #ffc9c5;
  font: 600 14.5px/1.35 var(--font); display: flex; gap: 8px; }
.dir-warn::before { content: "⚠️"; }
.dir-warn.shake { animation: shake .45s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.dir-results { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.dir-count { font: 700 12px/1 var(--font); letter-spacing: .6px; text-transform: uppercase; color: #7b8090; margin: 2px 4px -2px; }
.dir-empty { padding: 18px; border-radius: 18px; background: rgba(255, 255, 255, .7); color: #48484a; font: 500 15px/1.4 var(--font); }
.dcard { position: relative; padding: 14px 16px 12px; border-radius: 20px; background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 8px 24px rgba(40, 60, 120, .12); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.dcard:active { transform: scale(.985); }
.dcard.enter { animation: rise .5s calc(var(--i) * 70ms) cubic-bezier(.2, .8, .2, 1) both; }
.dcard.open { box-shadow: 0 10px 30px rgba(28, 100, 214, .22), 0 0 0 2px rgba(28, 100, 214, .35); }
.dc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dc-times { font: 800 26px/1 var(--font); color: #12141a; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.dc-arrow { margin: 0 8px; color: #9aa0ad; font-weight: 600; }
.dc-dur { flex: none; padding: 6px 11px; border-radius: 12px; font: 800 15px/1 var(--font); color: #fff; background: linear-gradient(140deg, #1c64d6, #7b4dff); }
.dc-tag { display: inline-block; margin-top: 8px; padding: 4px 9px; border-radius: 10px; font: 700 12px/1 var(--font); color: #0b7a55; background: #dff7ee; }
.dc-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; }
.dc-chain .badge { min-width: 32px; height: 26px; font-size: 14px; padding: 0 8px; }
.lc.walk { display: inline-flex; align-items: center; gap: 1px; font: 700 13px var(--font); color: #5b6170; }
.lc.walk svg { width: 18px; height: 18px; }
.lc-sep { color: #b8bdc8; font-weight: 700; }
.dc-start { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font: 500 14.5px/1.35 var(--font); color: #3a3a3c; }
.ds-when { font-weight: 800; color: #5b6170; display: inline-flex; align-items: center; gap: 6px; }
.ds-when.live { color: #1f9a46; }
.ds-sched { font-size: 12.5px; color: #8e8e93; }
.ds-x { font-weight: 700; color: #b42318; }
.dc-foot { display: flex; gap: 14px; margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(0, 0, 0, .06); font: 600 13px var(--font); color: #6b6b70; }
.dc-more { margin-left: auto; color: #1c64d6; }
.dc-steps { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; animation: rise .35s ease both; }
.st { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 9px 0; border-top: 1px dashed rgba(0, 0, 0, .1); font: 500 14.5px/1.4 var(--font); color: #3a3a3c; }
.st b { color: #12141a; }
.st span { color: #6b6b70; }
.st-ic { font-style: normal; display: flex; justify-content: center; font-size: 20px; }
.st-row { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; flex-wrap: wrap; }
.st .st-t { flex: none; min-width: 44px; font: 800 15px var(--font); color: #12141a; font-variant-numeric: tabular-nums; }
.st-live { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: #1f9a46 !important; }
.dc-map { margin-top: 10px; height: 46px; border: 0; border-radius: 14px; cursor: pointer; font: 700 15px var(--font); color: #fff;
  background: linear-gradient(140deg, #1c64d6, #7b4dff); box-shadow: 0 6px 16px rgba(91, 77, 255, .3); }
.dcard.skel { cursor: default; }
.sk { height: 14px; margin: 8px 0; border-radius: 7px; background: linear-gradient(90deg, #e6e9f0 25%, #f5f7fb 50%, #e6e9f0 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk.w60 { width: 60%; height: 22px; } .sk.w90 { width: 90%; } .sk.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }
/* scelta partenza / arrivo */
.dir-pick { position: fixed; z-index: 1200; inset: 0; background: rgba(238, 241, 248, .96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: calc(env(safe-area-inset-top) + 12px) 14px 20px; display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transform: translateY(16px); transition: opacity .22s, transform .3s cubic-bezier(.2, .8, .2, 1); }
.dir-pick.show { opacity: 1; transform: none; }
.dir-pick-bar { display: flex; align-items: center; gap: 6px; height: 56px; border-radius: 18px; padding: 0 8px; }
.dir-back { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: #1c64d6; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dir-back svg { width: 20px; height: 20px; }
#dir-q { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font: 600 17px var(--font); color: #12141a; }
.dir-pick-list { overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 6px; padding-bottom: 20px; }
.pk { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, .85);
  text-align: left; cursor: pointer; animation: rise .3s calc(var(--i, 0) * 25ms) ease both; }
.pk.here { background: linear-gradient(140deg, rgba(28, 100, 214, .12), rgba(123, 77, 255, .12)); }
.pk-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; background: #f2f3f7; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pk-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pk-t b { font: 700 15.5px/1.2 var(--font); color: #12141a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-t small { font: 500 13px/1.2 var(--font); color: #6b6b70; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-d { flex: none; font: 600 12.5px var(--font); color: #6b6b70; }
.pk-load { padding: 14px; text-align: center; color: #6b6b70; font: 500 14px var(--font); }
.dir-stop { position: absolute; transform: translate(-50%, -50%); min-width: 14px; height: 14px; border-radius: 8px; background: #fff; border: 3px solid #12141a;
  font: 800 10px/8px var(--font); color: #12141a; display: flex; align-items: center; justify-content: center; padding: 0 2px; white-space: nowrap; }
body.on-page .pf-chip { pointer-events: auto; }
.ds-when .rt-dot, .st-live .rt-dot { animation: pulse 2s infinite; }

/* passo in mezzo: barra colorata della linea a sinistra */
.st.ride { position: relative; }
.st.ride::before { content: ''; position: absolute; left: 18px; top: 40px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--c, #1c64d6); opacity: .55; }
.st .st-ic .badge { color: #fff; font-size: 13px; align-self: flex-start; }
.st .st-n { margin: 3px 0 0 52px; font: 600 12.5px var(--font); color: #7b8090; }
.dir-focus .leaflet-marker-icon.vm, .dir-focus .leaflet-marker-icon.sm { opacity: .2; }
.dir-start { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.dir-start i { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 5px solid #1c64d6; box-shadow: 0 0 0 5px rgba(28, 100, 214, .2), 0 2px 6px rgba(0, 0, 0, .25); }
.dir-start span { margin-top: 4px; padding: 2px 7px; border-radius: 8px; background: rgba(255, 255, 255, .92); font: 700 12px var(--font); color: #1c64d6; white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.dir-start span { position: absolute; top: 18px; }
/* PC / tablet: colonna centrale leggibile invece di righe lunghe tutto schermo */
@media (min-width: 760px) {
  .page.dir > :not(.dir-bg) { max-width: 620px; margin-left: auto !important; margin-right: auto !important; }
  .page.dir > .dir-hero { padding-left: 4px; }
  .dir-pick > * { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }
}
.pk-h { margin: 10px 6px 2px; font: 800 11.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: #8a8fa0; }
