/* Aba Rota em HUD (H1-H5). Vem DEPOIS de estilo.css e só mexe na Rota: mapa em tela cheia, faixa da manobra e da parada no topo,
   barra no polegar (tempo, distância, faltam, Entregue, Waze; puxar para cima abre os detalhes) e botões flutuantes à direita.
   Cores e fonte: as variáveis de estilo.css (claro e noturno). Alvos de toque >= 48 px. */
:root { --hud-h: 140px; }

/* o resumo antigo ("3 de 12" + barra) agora vive no HUD; os botões do topo viram botões flutuantes */
#rota > .topo-rota { display: contents; }
.topo-rota .resumo { display: none; }

/* ===== topo: manobra + parada atual ===== */
.hud { position: absolute; z-index: 6; left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + var(--topo-rota, 0px) + 8px); display: grid; gap: 6px; pointer-events: none; }
.hud-man { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 14px 6px 6px; border-radius: 18px; background: var(--cartao); border: 2px solid var(--tinta); box-shadow: var(--sombra); }
.hud-seta { flex: none; width: 52px; height: 52px; border-radius: 13px; background: var(--faixa); color: var(--sobre-faixa); display: grid; place-items: center; }
.hud-seta svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.hud-man-txt { min-width: 0; display: grid; line-height: 1.15; }
.hud-dist { font-size: 25px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hud-manobra { font-size: 16px; font-weight: 500; color: var(--mudo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-dist[hidden] + .hud-manobra { font-size: 19px; font-weight: 700; color: var(--tinta); }
.hud-parada { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px 0 7px; border-radius: 14px; background: var(--cartao); border: 2px solid var(--linha); box-shadow: var(--sombra); overflow: hidden; }
.hud-n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--faixa); color: var(--sobre-faixa); border: 2.5px solid var(--sobre-faixa); display: grid; place-items: center; font-weight: 800; font-size: 16px; }
/* a rua encolhe com reticências; o número da casa NUNCA é cortado (flex: none) */
.hud-end { flex: 1; min-width: 0; display: flex; align-items: baseline; font-weight: 700; font-size: 17px; }
.hud-rua { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-numero { flex: none; white-space: nowrap; }
.hud-prog { flex: none; font-size: 14px; font-weight: 700; color: var(--mudo); font-variant-numeric: tabular-nums; }
.hud-barra { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--entregue-btn); transition: width .5s var(--ease); }

/* avisos (horário, tempos, mapa) logo abaixo do HUD, sem tapar os botões da direita */
#rota > .rota-avisos { top: calc(var(--hud-h) + env(safe-area-inset-top) + var(--topo-rota, 0px) + 4px); right: 76px; }

/* ===== botões flutuantes à direita (>= 48 px) ===== */
.fab-rota, #rota > .mapa-seguir, #rota > .topo-rota > button.icone {
  position: absolute; z-index: 6; right: 12px; display: grid; place-items: center; padding: 0; border-radius: 50%;
  background: var(--cartao); color: var(--tinta); border: 2px solid var(--tinta); box-shadow: var(--sombra);
}
.fab-rota svg, #rota > .mapa-seguir svg, #rota > .topo-rota > button.icone svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fab-tema { top: calc(var(--hud-h) + env(safe-area-inset-top) + var(--topo-rota, 0px) + 4px); width: 48px; height: 48px; min-height: 48px; }
#rota > .topo-rota > #btnParadas { width: 56px; height: 56px; min-height: 56px; bottom: calc(var(--folga-mapa, 160px) - 10px); background: var(--faixa); color: var(--sobre-faixa); border-color: var(--sobre-faixa); }
#rota > .mapa-seguir { width: 52px; height: 52px; min-height: 52px; bottom: calc(var(--folga-mapa, 160px) + 56px); border: 2px solid var(--tinta); }
#rota > .mapa-seguir.ativo { background: var(--link); color: #fff; border-color: var(--link); }
:root[data-tema=escuro] #rota > .mapa-seguir.ativo { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-tema=claro]) #rota > .mapa-seguir.ativo { color: #0B1220; } }
#rota > .topo-rota > #menuRota { width: 48px; height: 48px; min-height: 48px; top: calc(var(--hud-h) + env(safe-area-inset-top) + var(--topo-rota, 0px) + 60px); }
#rota > .topo-rota > button:active { transform: scale(.95); box-shadow: var(--sombra); }
/* a lista aberta sobe acima da barra e não cobre os botões da direita */
#rota > #painelParadas { margin-right: 64px; }

/* ===== barra de baixo (zona do polegar) ===== */
#rota > #proxima { top: auto; bottom: auto; margin: 0 -12px -12px; width: auto; max-width: none; max-height: none; overflow: visible; }
.placa-caixa { border-radius: 24px 24px 0 0; box-shadow: 0 -8px 26px rgba(0, 0, 0, .28); }
.fundo-entregue { border-radius: 24px 24px 0 0; }
.placa-hud { border: 0; border-top: 2px solid var(--tinta); border-radius: 24px 24px 0 0; padding: 0 14px 12px; }
.placa-hud::before { display: none; }
.cabeca-barra { touch-action: none; user-select: none; -webkit-user-select: none; }
.alca-barra { position: relative; display: grid; place-items: center; width: 100%; height: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: inherit; }
.alca-barra::after { content: ''; position: absolute; inset: -8px 0; }
.alca-barra i { width: 46px; height: 5px; border-radius: 3px; background: var(--mudo); opacity: .6; }
.alca-barra:active:not(:disabled) { transform: none; box-shadow: none; background: none; }
.stats-barra { display: flex; align-items: baseline; padding: 0 4px 10px; font-variant-numeric: tabular-nums; }
.stats-barra .stat { flex: 1; text-align: center; }
.stats-barra b { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.stats-barra small { font-size: 13px; font-weight: 500; color: var(--mudo); margin-left: 4px; }
.stats-barra .sep { width: 1px; align-self: stretch; background: var(--linha); }
/* detalhes: recolhidos até a barra ser puxada; rolam sozinhos se forem altos (parada de carro) */
.det-barra { height: 0; overflow: hidden; }
.det-barra.rola { overflow-y: auto; overscroll-behavior: contain; }
.det-dentro { padding: 4px 2px 12px; display: grid; gap: 14px; }
.det-rot { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mudo); margin-bottom: 3px; }
.det-val { font-size: 18px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.det-val small { display: block; font-size: 14px; font-weight: 400; color: var(--mudo); margin-top: 2px; }
.det-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.det-obs { font-size: 16px; line-height: 1.4; padding: 10px 12px; border-radius: 12px; background: var(--chip); overflow-wrap: anywhere; }
.det-obs.vazia { color: var(--mudo); }
.det-linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.det-btn { min-height: 48px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.acoes-placa { grid-template-columns: 1.25fr 1fr; gap: 10px; margin: 0; }
.placa-hud .acoes-placa .grande { min-height: 58px; border-radius: 16px; font-size: 19px; font-weight: 800; }
.placa-hud .acoes-placa .grande.entregue { background: var(--entregue-btn); color: var(--sobre-entregue); border-color: var(--entregue-btn); }
.placa-hud .acoes-placa .btn-waze { background: var(--chip); color: var(--tinta); border: 2px solid var(--linha); box-shadow: none; }

/* pinos um pouco menores para o mapa dominar a tela */
.pin .corpo { width: 40px; height: 40px; font-size: 18px; }
.pin .ponta { border-width: 7px; border-top-width: 10px; }
.pin .qtd { top: -10px; left: 28px; font-size: 12px; }
.pin.prox .corpo { width: 56px; height: 56px; font-size: 27px; }
.pin.prox .qtd { left: 40px; top: -12px; font-size: 13px; }
.pin.feito .corpo { width: 32px; height: 32px; }
.pin.feito .corpo svg { width: 19px; height: 19px; }

/* sem rota (ou fora da aba Rota) o botão de tema some */
body:not(.rota-hud-on) .fab-tema { display: none; }
@media (prefers-reduced-motion: reduce) { .hud-barra, .fab-rota { transition: none; } }

/* barra aberta: o mapa fica pequeno, então o botao do menu da rota sai da frente (continua no menu pelo ⋯ ao fechar a barra) */
#rota:has(.placa-hud.aberta) > .topo-rota > #menuRota { visibility: hidden; }
