/* Telefono: maniglia del pannello, layout verticale e orizzontale */

/* maniglia del pannello (solo mobile): trascina su per chiudere la mappa, giu' per aprirla */
.grab { display: none; }

@media (max-width: 760px) {
  html:not(.land) #map { bottom: auto; height: 44vh; height: calc(var(--app-h, 100dvh) * 0.44); }
  html:not(.land) .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 58vh; height: calc(var(--app-h, 100dvh) * 0.58); border-radius: 22px 22px 0 0; border-width: 1px 0 0;
           transition: height .28s cubic-bezier(0.22, 1, 0.36, 1); }
  html:not(.land) body.dragging .panel { transition: none; }
  html:not(.land) body.dragging #map { visibility: visible !important; }
  html:not(.land) .grab { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 0 2px; color: var(--muto); touch-action: none; cursor: grab; }
  html:not(.land) .grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--muto); opacity: .5; }
  html:not(.land) .grab svg { width: 14px; height: 14px; transition: transform .25s; }
  html:not(.land) body:not(.map-on) .grab svg { transform: rotate(180deg); }
  /* mappa intera: del pannello restano solo maniglia e testata in basso */
  html:not(.land) body.map-max #map { height: 100vh; height: var(--app-h, 100dvh); }
  html:not(.land) body.map-max .panel { height: calc(112px + env(safe-area-inset-bottom)); }
  html:not(.land) body.map-max .scroll, html:not(.land) body.map-max .dock { display: none; }
  html:not(.land) .plate { margin: 4px 12px 0; touch-action: none; padding: 11px 12px; }
  html:not(.land) .plate p { display: none; }
  /* testata compatta: titolo, Mappa/Dettagli e i due pulsanti tondi devono stare su una riga */
  html:not(.land) .brand-wrap { gap: 8px; min-width: 0; }
  html:not(.land) .brand-badge { width: 34px; height: 34px; border-radius: 10px; }
  html:not(.land) .plate h1 { font-size: 21px; }
  html:not(.land) .plate-actions { gap: 6px; }
  html:not(.land) .maptoggle { padding: 6px 11px; }
  html:not(.land) .brand-wrap > div { min-width: 0; }
  html:not(.land) .plate h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html:not(.land) .maptoggle { display: block; }
  html:not(.land) .map-chips { top: calc(10px + env(safe-area-inset-top)); left: 0; right: 52px; padding: 0 10px 10px; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; pointer-events: auto; }  /* quattro chip: scorrono di lato */
  html:not(.land) .map-chips::-webkit-scrollbar { display: none; }
  html:not(.land) body:not(.map-on) .map-chips { display: none; }
  html:not(.land) .scroll { padding: 14px 14px max(20px, env(safe-area-inset-bottom, 0px)); }
  /* mappa nascosta finche' non serve: i settaggi usano tutto lo schermo */
  html:not(.land) body:not(.map-on) #map { visibility: hidden; }
  html:not(.land) body:not(.map-on) .panel { height: 100vh; height: var(--app-h, 100dvh); border-radius: 0; border-width: 0; padding-top: env(safe-area-inset-top); }
}
@media (max-width: 380px) {
  .brand-badge { display: none; }  /* telefoni stretti: spazio ai pulsanti */
}

/* telefono in orizzontale: pannello stretto a sinistra e mappa sempre visibile a destra;
   in guida indicazioni e arrivo in colonna a sinistra, la mappa con la freccia a destra */
/* (classe .land sull'html: vedi landPhone() all'inizio della pagina) */
  html.land .map-chips { top: 8px; left: calc(8px + env(safe-area-inset-left) + min(380px, 46vw) + 12px); }
  html.land .panel { top: 8px; left: calc(8px + env(safe-area-inset-left)); bottom: 8px; width: min(380px, 46vw); border-radius: 12px; }
  html.land .plate { margin: 8px 8px 0; padding: 7px 10px; }
  html.land .plate p { display: none; }
  html.land .brand-badge { width: 30px; height: 30px; border-radius: 9px; }
  html.land .brand-badge svg { width: 24px; height: 18px; }
  html.land .plate h1 { font-size: 19px; }
  html.land .scroll { padding: 10px 10px 14px; }
  html.land .dock { padding: 8px 10px; }
  html.land .actions a, html.land .actions button { height: 38px; }
  html.land .actions .nav-start { height: 40px; font-size: 15px; }
  html.land .engine-card { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 22px; max-width: 540px; padding: 16px 22px; text-align: left; }
  html.land .engine svg { width: 82px; grid-row: span 2; }
  html.land .engine-msg { margin: 0; align-self: end; }
  html.land .engine-sub { align-self: start; }
  html.land .nav-head, html.land .nav-foot { left: calc(8px + env(safe-area-inset-left)); right: auto; width: min(360px, 44vw); }
  html.land .nav-head { top: 8px; gap: 6px; }
  html.land .nav-foot { bottom: 8px; }
  html.land .nav-top { padding: 9px 12px; }
  html.land .nav-icon { width: 48px; height: 48px; }
  html.land .nav-icon svg { width: 38px; height: 38px; }
  html.land .nav-man b { font-size: 17px; }
  html.land .nav-main b { font-size: 21px; -webkit-line-clamp: 1; }
  html.land .nav-then { margin: 2px -12px -9px; padding: 5px 12px 6px; }
  html.land .nav-curve, html.land .nav-poi { padding: 7px 10px; font-size: 14px; }
  html.land .nav-bottom { padding: 7px 10px; }
  html.land .nav-eta b { font-size: 21px; }
  html.land .nav-btn { height: 40px; }
  /* velocita' in basso a sinistra, nella stessa colonna delle indicazioni: un solo punto da guardare */
  html.land .nav-foot-row { gap: 8px; }
  /* comandi tondi sul bordo destro, in colonna sopra le scritte della mappa (come Google Maps), lontani dalle indicazioni;
     ricerca e soste nella colonna di sinistra al posto delle indicazioni, cosi' i tasti restano liberi */
  html.land .nav-lato { position: fixed; right: calc(10px + env(safe-area-inset-right)); bottom: 28px; gap: 8px; }
  html.land .nav-tondo { width: 48px; height: 48px; }
  html.land .nav-meta { top: 8px; left: calc(8px + env(safe-area-inset-left)); right: auto; width: min(360px, 44vw); }
