/* Página do trajeto detalhado */
.tj-page .header-inner { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: nowrap; }
.tj-back {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  color: var(--gold); font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .95rem;
  padding: 6px 12px 6px 6px; border: 1px solid rgba(245,197,24,.45); background: rgba(0,0,0,.35); text-decoration: none;
}
.tj-back:hover { background: var(--gold); color: #111; }

.tj-main { padding: 96px 0 56px; min-height: 100vh; }
.tj-main .sec-title { margin: 0 0 18px; }
.tj-toggle { margin: 0 0 14px; }
.tj-head { margin: 0; text-align: center; color: var(--white); font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.5rem; letter-spacing: .04em; }
.tj-sub { margin: 2px 0 16px; text-align: center; color: var(--ink-soft); font-size: .9rem; }

.tj-map { width: 100%; height: 460px; border: 1px solid rgba(245,197,24,.25); background: #111; }
.tj-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 10px 0 18px; color: var(--ink-soft); font-size: .85rem; }
.tj-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.tj-dot.tj-city { background: #0a0a0b; box-shadow: 0 0 0 2px var(--gold); }
.tj-dot.tj-border { background: #4aa3ff; }
.tj-dot.tj-toll { background: #ff3b3b; }

/* Marcadores no mapa */
.tj-mk i { display: block; width: 10px; height: 10px; margin: 2px; border-radius: 50%; }
.tj-mk.tj-city i { background: #0a0a0b; box-shadow: 0 0 0 2px var(--gold); }
.tj-mk.tj-border i { background: #4aa3ff; box-shadow: 0 0 0 1.5px #000, 0 0 8px #4aa3ff; }
.tj-mk.tj-toll i { width: 6px; height: 6px; margin: 4px; background: #ff3b3b; box-shadow: 0 0 0 1px rgba(0,0,0,.7), 0 0 6px 1px #ff2b2b; }

/* Lista linha do tempo */
.tj-list { list-style: none; margin: 0; padding: 0; }
.tj-item {
  display: grid; grid-template-columns: 74px 22px 1fr auto; align-items: center; gap: 8px;
  padding: 9px 8px; cursor: pointer; position: relative; border-bottom: 1px solid rgba(255,255,255,.05);
}
.tj-item:hover, .tj-item.on { background: rgba(245,197,24,.08); }
.tj-km { color: var(--gold); font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: .95rem; text-align: right; white-space: nowrap; }
.tj-node { position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.tj-node::before { content: ''; position: absolute; top: -10px; bottom: -10px; left: 50%; width: 2px; margin-left: -1px; background: rgba(245,197,24,.35); }
.tj-item:first-child .tj-node::before { top: 50%; }
.tj-item:last-child .tj-node::before { bottom: 50%; }
.tj-node i { position: relative; width: 10px; height: 10px; border-radius: 50%; background: #0a0a0b; box-shadow: 0 0 0 2px var(--gold); }
.tj-border .tj-node i { background: #4aa3ff; box-shadow: 0 0 0 2px #0a0a0b, 0 0 8px #4aa3ff; }
.tj-toll .tj-node i { width: 7px; height: 7px; background: #ff3b3b; box-shadow: 0 0 0 2px #0a0a0b; }
.tj-start .tj-node i, .tj-end .tj-node i { width: 14px; height: 14px; background: var(--gold); box-shadow: 0 0 0 3px rgba(245,197,24,.3); }
.tj-txt { display: flex; flex-direction: column; min-width: 0; }
.tj-txt b { color: var(--white); font-weight: 600; font-size: .95rem; }
.tj-txt small { color: var(--ink-soft); font-size: .78rem; }
.tj-txt em { font-style: normal; font-weight: 600; }
.tj-toll .tj-txt em { color: #ff6b6b; }
.tj-border .tj-txt em { color: #4aa3ff; }
.tj-toll .tj-txt b { font-weight: 500; color: rgba(255,255,255,.82); }
.tj-border, .tj-start, .tj-end { background: rgba(255,255,255,.025); }
.tj-flag { width: 20px; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.tj-note { margin: 18px 0 0; text-align: center; color: var(--ink-soft); font-size: .8rem; }

@media (max-width: 640px) {
  .tj-main { padding-top: 78px; }
  .tj-back span { display: none; }
  .tj-back { padding: 6px; }
  .tj-map { height: 420px; }
  .tj-item { grid-template-columns: 62px 18px 1fr auto; gap: 6px; padding: 8px 4px; }
  .tj-km { font-size: .85rem; }
  .tj-head { font-size: 1.3rem; }
}

/* Mapa fixo no alto e lista rolando por dentro (sem rolar a pagina) */
.tj-main { height: 100vh; height: 100svh; min-height: 0; box-sizing: border-box; padding: 84px 0 12px; display: flex; overflow: hidden; }
.tj-main > .container { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.tj-main > .container > * { flex: none; }
.tj-main .sec-title { margin: 0 0 10px; }
.tj-toggle { margin: 0 auto 8px; }
.tj-sub { margin: 0 0 8px; }
.tj-map { height: 340px; }
.tj-main .route-map-hint { display: block; margin: 6px 0 0; }
.tj-legend { margin: 6px 0 8px; }
.tj-main > .container > .tj-list {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(245,197,24,.2); background: rgba(0,0,0,.25);
}
.tj-list::-webkit-scrollbar { width: 6px; }
.tj-list::-webkit-scrollbar-thumb { background: rgba(245,197,24,.5); border-radius: 3px; }
.tj-note { margin: 6px 0 0; font-size: .72rem; }
@media (max-width: 640px) {
  .tj-main { padding-top: 70px; padding-bottom: 8px; }
  .tj-main .sec-title { font-size: 1.5rem; margin-bottom: 8px; }
  .tj-head { font-size: 1.1rem; }
  .tj-sub { font-size: .8rem; margin-bottom: 6px; }
  .tj-map { height: 250px; }
  .tj-main .route-map-hint { font-size: .72rem; }
  .tj-legend { gap: 12px; font-size: .78rem; }
}
/* Cabecalho + conteudo cabem exatamente na tela */
body.tj-page { height: 100vh; height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
body.tj-page > .site-header { flex: none; }
.tj-main, body.tj-page .tj-main { flex: 1 1 auto; height: auto; padding: 14px 0 10px; }
@media (max-width: 640px) { .tj-main, body.tj-page .tj-main { padding: 10px 0 8px; } }
/* Titulo e Ida/Volta na mesma linha; espaco extra vai para o mapa */
.tj-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.tj-top .sec-title, .tj-main .tj-top .sec-title { margin: 0; white-space: nowrap; }
.tj-top .tj-toggle { margin: 0; padding: 3px; flex: none; }
.tj-top .rt-btn { padding: 5px 12px; font-size: .78rem; letter-spacing: .08em; }
.tj-map { height: 400px; }
@media (max-width: 640px) {
  .tj-main .tj-top .sec-title { font-size: 1.25rem; }
  .tj-top .rt-btn { padding: 4px 9px; font-size: .7rem; }
  .tj-map { height: 310px; }
}
/* Rota e resumo numa linha so, a esquerda */
.tj-info { margin: 0 0 8px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.tj-info .tj-head, .tj-main .tj-info .tj-head { display: inline; margin: 0; font-size: 1.15rem; text-align: left; }
.tj-info .tj-sub, .tj-main .tj-info .tj-sub { display: inline; margin: 0 0 0 8px; text-align: left; font-size: .85rem; }

/* Legenda dentro do mapa, embaixo a esquerda */
.tj-map-wrap { position: relative; flex: none; }
.tj-map-wrap .tj-legend {
  position: absolute; left: 8px; bottom: 8px; z-index: 500; margin: 0; justify-content: flex-start; gap: 10px;
  padding: 4px 8px; background: rgba(10,10,11,.82); border: 1px solid rgba(245,197,24,.25); font-size: .75rem; pointer-events: none;
}
.tj-map { height: 470px; }
@media (max-width: 640px) {
  .tj-info .tj-head, .tj-main .tj-info .tj-head { font-size: .95rem; }
  .tj-info .tj-sub, .tj-main .tj-info .tj-sub { font-size: .72rem; margin-left: 6px; }
  .tj-map-wrap .tj-legend { font-size: .68rem; gap: 8px; padding: 3px 6px; left: 6px; bottom: 6px; }
  .tj-map { height: 385px; }
}.tj-map-wrap .tj-legend { z-index: 1000; bottom: 26px; }
.tj-map .leaflet-control-attribution { font-size: 9px; line-height: 1.3; }
@media (max-width: 640px) {
  .tj-map-wrap .tj-legend { bottom: 32px; }
  .tj-info .tj-head, .tj-main .tj-info .tj-head { font-size: .84rem; }
  .tj-info .tj-sub, .tj-main .tj-info .tj-sub { font-size: .66rem; margin-left: 5px; }
}
/* Sentido da rota dentro do mapa, canto inferior direito */
.tj-dir {
  position: absolute; right: 8px; bottom: 26px; z-index: 1000; pointer-events: none;
  padding: 4px 8px; background: rgba(10,10,11,.82); border: 1px solid rgba(245,197,24,.25);
  color: var(--white); font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: .85rem; letter-spacing: .03em; white-space: nowrap;
}
.tj-map { height: 510px; }

/* Lista compacta: nome e rota na mesma linha */
.tj-list { position: relative; }
.tj-item { padding: 5px 8px; gap: 8px; }
.tj-txt { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tj-txt b { font-size: .9rem; }
.tj-txt small { font-size: .74rem; }
.tj-node::before { top: -6px; bottom: -6px; }
@media (max-width: 640px) {
  .tj-dir { bottom: 32px; right: 6px; font-size: .74rem; padding: 3px 6px; }
  .tj-map { height: 415px; }
  .tj-item { padding: 4px 4px; gap: 6px; grid-template-columns: 58px 16px 1fr auto; }
  .tj-txt b { font-size: .82rem; }
  .tj-txt small { font-size: .68rem; }
  .tj-km { font-size: .78rem; }
  .tj-flag { width: 16px; }
}@media (max-width: 640px) {
  .tj-map-wrap .tj-legend { font-size: .62rem; gap: 6px; padding: 3px 5px; left: 5px; }
  .tj-map-wrap .tj-legend .tj-dot { width: 8px; height: 8px; }
  .tj-dir { font-size: .66rem; padding: 3px 5px; right: 5px; letter-spacing: 0; }
}