/* Navigasi: rasa "jalan raya Malaysia". Papan tanda hijau lebuh raya untuk arahan,
   biru elektrik untuk laluan anda, kuning garisan jalan untuk amaran. */

@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/baloo-2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --sign: #00704a;        /* papan tanda lebuh raya */
  --sign-deep: #004d33;
  --route: #2563ff;       /* laluan & tindakan utama */
  --route-deep: #1740b8;
  --route-soft: #e3ebff;
  --line-yellow: #ffc629; /* garisan kuning tepi jalan */
  --line-yellow-deep: #c99400;
  --chili: #e63946;
  --chili-deep: #a8202c;
  --brand: #0f766e;

  --bg: #ffffff;
  --bg-2: #eef2f7;
  --ink: #14213d;
  --ink-2: #5a6782;
  --line: #dde3ec;
  --lift: 0 2px 0 rgba(20, 33, 61, .06), 0 10px 28px rgba(20, 33, 61, .18);
  --thumb: #ffffff;
  --garage-glow: rgba(255, 255, 255, .9);

  --display: "Baloo 2", "Plus Jakarta Sans", system-ui, sans-serif;
  --text: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --sheet-h: 200px;
  --panel-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17223a;
    --bg-2: #22304d;
    --ink: #f1f5fb;
    --ink-2: #9daac3;
    --line: #2f3e60;
    --route-soft: #1c2f66;
    --lift: 0 2px 0 rgba(0, 0, 0, .2), 0 10px 28px rgba(0, 0, 0, .5);
    --thumb: #34466c;
    --garage-glow: rgba(120, 150, 210, .22);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
/* PWA iOS + status bar lutsinar (WebKit bug 301108): iOS pendekkan kawasan halaman sebanyak tinggi
   status bar selagi halaman lebih pendek daripada skrin, jadi helaian bawah terhenti ≈47pt dari tepi.
   Tinggikan halaman sebanyak status bar (dihadkan 100lvh supaya tidak boleh skrol). */
@media (display-mode: standalone) {
  html { height: min(100lvh, calc(100% + env(safe-area-inset-top, 0px))); }
}
body {
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
/* Rasa aplikasi sebenar: saiz teks tetap (tidak membesar bila diputar), tiada sorotan teks,
   tiada menu tekan-lama (Salin/Look Up/simpan gambar), tiada zum dwi-ketik atau lantunan skrol.
   Hanya kotak input yang boleh dipilih & ditampal. Peta mengurus cubit-zum sendiri. */
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  overscroll-behavior: none;
}
html, body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
body { overscroll-behavior: none; }
img, svg, canvas { -webkit-user-drag: none; }
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
#map { position: fixed; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--route); outline-offset: 2px; }

/* ---- Carian (dalam helaian bawah, ala Waze) ---- */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border-radius: 999px; padding: 4px 6px 4px 18px;
}
.search:focus-within { box-shadow: 0 0 0 3px var(--route); background: var(--bg); }
.search-ico { color: var(--route); display: flex; }
.search input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 600 17px/1 var(--text); padding: 12px 0; min-width: 0;
}
.search input::placeholder { color: var(--ink-2); font-weight: 500; }
.search input::-webkit-search-cancel-button { display: none; }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.results { list-style: none; margin: 6px -10px 0; padding: 0; }
.results button, .recents button {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 10px; border-radius: 14px;
}
.results button:hover, .results button.active, .recents button:hover { background: var(--bg-2); }
.results .r-ico, .recents .r-ico {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2);
}
.results .r-ico { background: var(--route-soft); color: var(--route); }
/* Lencana jenama (stesen minyak / cas EV): warna jenama, cincin warna kategori seperti titik di peta */
.results .r-brand { font: 800 21px/1 var(--display); padding-top: 3px; box-shadow: inset 0 0 0 3px var(--cat), inset 0 0 0 4.5px rgba(255, 255, 255, .9); }
.results .r-brand[data-len="2"] { font-size: 16px; }
.results .r-brand[data-len="3"] { font-size: 12.5px; }
.results b, .recents b { display: block; font-weight: 700; }
.results small, .recents small { color: var(--ink-2); font-size: 13px; }
.results .empty { padding: 12px; color: var(--ink-2); }
.results .attrib { padding: 8px 10px 2px; font-size: 11px; color: var(--ink-2); }
.results .attrib a { color: inherit; }

/* ---- Helaian bawah / panel sisi ---- */
.sheet {
  position: fixed; z-index: 4; left: 0; right: 0; bottom: 0;
  background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: var(--lift);
  padding: 10px 0 0;
  max-height: 55vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; min-height: 0;
  padding: 0 16px max(12px, calc(var(--safe-b) - 12px));
}
.grab {
  display: block; position: relative; width: 100%; height: 24px; margin: -10px 0 4px; padding: 0;
  border: 0; background: none; cursor: grab; touch-action: none;
}
.grab::before { content: ""; position: absolute; left: 50%; top: 10px; width: 44px; height: 5px; margin-left: -22px; border-radius: 5px; background: var(--line); transition: background .15s, width .15s; }
.grab:hover::before, .sheet.dragging .grab::before { background: var(--ink-2); }
.grab:focus-visible { outline-offset: -3px; border-radius: 12px; }
/* Helaian kecil (ditarik turun): hanya logo, carian dan Rumah/Pejabat kelihatan */
.sheet { transition: transform .34s cubic-bezier(.2, .9, .3, 1); }
.sheet.peek { transform: translateY(var(--peek-t, 0px)); }
.sheet.dragging, .sheet.peek.dragging { transition: none; transform: translateY(var(--drag-t, 0px)); }
.sheet.peek .sheet-body { overflow: hidden; }
.idle-head { touch-action: none; }
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .sheet {
    top: 12px; left: 12px; right: auto; bottom: auto; width: 400px;
    max-height: calc(100vh - 24px); border-radius: 24px; padding-top: 16px;
  }
  body.navigating .sheet { top: auto; bottom: 24px; }
  .grab { display: none; }
}
.idle-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; min-height: 34px; }
.idle-head .logo { display: block; height: 28px; width: auto; }
.chip {
  display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px 6px 8px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--sign) 12%, var(--bg)); color: var(--ink); font-size: 13px;
}
.chip svg { color: var(--sign); }
@media (prefers-color-scheme: dark) { .chip svg { color: #5fd3a5; } }
.recents { list-style: none; padding: 0; margin: 6px -10px 0; }
.recents:empty { display: none; }
.org-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding-top: 4px; }
.org {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: none;
}
.org-privacy { color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.org-privacy:hover { color: var(--ink); }
.org img { display: block; height: 16px; width: auto; }

/* Carian di telefon: helaian naik ke atas skrin supaya hasil tidak dilindungi papan kekunci */
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  body.searching .sheet { top: 0; max-height: none; border-radius: 0; padding-top: calc(12px + var(--safe-t)); }
  body.searching .grab, body.searching .idle-head, body.searching .org-row, body.searching .places,
  body.searching .fabs, body.searching .status-scrim { display: none; }
}
#top:has(.results:not([hidden])) ~ .recents, #top:has(.results:not([hidden])) ~ .places { display: none; }

/* ---- Rumah & Pejabat: papan tanda kecil (hijau lebuh raya, biru jalan persekutuan) ---- */
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.place {
  --plate: var(--sign); --plate-deep: var(--sign-deep);
  min-width: 0; padding: 3px; border: 0; border-radius: 14px; text-align: left;
  background: var(--plate); color: #fff; box-shadow: 0 3px 0 var(--plate-deep);
  transition: transform .08s, box-shadow .08s; -webkit-touch-callout: none; user-select: none;
}
.place-pejabat { --plate: #1f57c3; --plate-deep: #133b8a; }
.place:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--plate-deep); }
.pl-in { display: flex; align-items: center; gap: 10px; height: 100%; padding: 7px 10px; border: 2px solid rgba(255, 255, 255, .92); border-radius: 11px; }
.pl-in svg { flex: none; }
.pl-text { min-width: 0; }
.pl-text b { display: block; font: 800 17px/1.1 var(--display); }
.pl-text small { display: block; margin-top: 1px; font-size: 12px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place.unset { background: transparent; color: var(--ink); box-shadow: none; }
.place.unset .pl-in { border: 2px dashed var(--line); }
.place.unset svg { color: var(--plate); }
.place.unset .pl-text small { font-size: 11.5px; }
.place.unset .pl-text small { color: var(--ink-2); opacity: 1; }
@media (prefers-color-scheme: dark) { .place-rumah.unset svg { color: #5fd3a5; } .place-pejabat.unset svg { color: #7fa6ff; } }

.pick-bar { flex-basis: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px 8px 8px; border-radius: 16px; background: var(--bg-2); }
.pick-bar b { display: block; font: 800 16px/1.15 var(--display); }
.pick-bar small { display: block; font-size: 12px; color: var(--ink-2); }
body.searching .pick-bar .link-btn { display: none; } /* telefon: butang Batal carian sudah ada */
.pick-bar .link-btn { margin-left: auto; text-decoration: none; font-size: 15px; padding: 6px 2px; }
.pick-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--sign); }
.pick-ico.pick-pejabat { background: #1f57c3; }
.pd-addr { margin: -6px 0 18px; color: var(--ink-2); line-height: 1.45; }
.pd-actions { display: grid; gap: 10px; }
.pd-actions .pd-remove { color: var(--chili); }
@media (prefers-color-scheme: dark) { .pd-actions .pd-remove { color: #ff7b84; } }
.pd-actions .pd-cancel { justify-self: center; padding: 10px; text-decoration: none; font-size: 16px; }
#top { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding-top: 3px; }
#top .search { flex: 1; min-width: 0; }
#top .results { flex-basis: 100%; }
.cancel-search { display: none; border: 0; background: none; color: var(--route); font-weight: 700; font-size: 16px; padding: 10px 4px 10px 10px; }
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) { body.searching .cancel-search { display: block; } }
.org:hover span { color: var(--ink); }

.dest-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dest-title small { color: var(--ink-2); display: block; font-size: 13px; }
.dest-title b { font: 700 24px/1.1 var(--display); display: block; }

.switch { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .knob { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .2s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .knob { background: var(--sign); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 3px solid var(--route); outline-offset: 2px; }

.route-cards { display: grid; gap: 8px; }
.route-card {
  display: grid; grid-template-columns: 1fr auto; gap: 0 10px; text-align: left;
  border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px 12px; background: var(--bg);
  transition: border-color .15s, background .15s;
}
.route-card:hover { border-color: color-mix(in srgb, var(--route) 45%, var(--line)); }
.route-card.sel { border-color: var(--route); background: var(--route-soft); box-shadow: inset 0 0 0 1px var(--route); }
.route-card .dur { font: 800 28px/1.1 var(--display); letter-spacing: -.01em; }
.route-card.sel .dur { color: var(--route); }
@media (prefers-color-scheme: dark) { .route-card.sel .dur { color: #8fb0ff; } }
.route-card .eta { color: var(--ink-2); font-size: 14px; font-weight: 600; align-self: center; text-align: right; }
.route-card .via { color: var(--ink-2); font-size: 13px; grid-column: 1 / -1; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; margin-top: 6px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.badge.toll { background: #ffe8cc; color: #8a3a00; }
.badge.free { background: #d6f5e6; color: #00573a; }
.badge.best { background: var(--route); color: #fff; }
@media (prefers-color-scheme: dark) {
  .badge.toll { background: #4a2300; color: #ffc48a; }
  .badge.free { background: #063d2a; color: #8de8bf; }
}
.loading, .error { padding: 16px; border-radius: 18px; background: var(--bg-2); color: var(--ink-2); font-weight: 600; }
.loading { position: relative; overflow: hidden; }
.loading::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--line-yellow) 0 18px, transparent 18px 32px);
  animation: dash 0.6s linear infinite;
}
@keyframes dash { to { background-position: 32px 0; } }
.error { color: var(--chili); }
.error button { margin-top: 10px; }

.notes { display: grid; gap: 6px; margin: 12px 0; }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border-radius: 14px; background: var(--bg-2); }
.note .n-ico { flex: none; display: flex; color: var(--ink-2); }
.note.solat .n-ico { color: var(--sign); }
.note.toll .n-ico { color: #c25400; }

/* Butang: tebal, dengan "tapak" bawah supaya terasa boleh ditekan */
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin: 14px 0 16px; }
.btn {
  --edge: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: var(--bg-2); color: var(--ink); min-height: 52px; padding: 12px 18px;
  border-radius: 999px; font: 800 17px/1 var(--display); letter-spacing: .01em;
  box-shadow: 0 4px 0 var(--edge);
  transform: translateY(0); transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn.primary { background: var(--route); color: #fff; --edge: var(--route-deep); font-size: 19px; }
.btn.danger { background: var(--chili); color: #fff; --edge: var(--chili-deep); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sub-head h3 { font: 700 19px/1.2 var(--display); margin: 8px 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 0; background: var(--bg-2); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.filters button.on { background: var(--ink); color: var(--bg); }
.poi-list { list-style: none; padding: 0; margin: 0; }
.poi-list li { display: flex; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.poi-list li:last-child { border-bottom: 0; }
.poi-list .p-pin { width: auto; height: 34px; flex: none; display: block; }
.poi-list .p-name { flex: 1; min-width: 0; }
.poi-list .p-name b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-list .p-name small { color: var(--ink-2); }
.poi-list .p-km { font: 700 15px/1 var(--display); color: var(--ink-2); white-space: nowrap; }
.poi-list .empty { color: var(--ink-2); font-size: 14px; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--route); font-weight: 700; text-decoration: underline; }

/* ---- Navigasi: banner papan tanda lebuh raya ---- */
.nav-top {
  position: fixed; z-index: 6; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; max-width: 540px;
  display: flex; flex-direction: column; align-items: flex-start; pointer-events: none;
}
.nav-top > * { pointer-events: auto; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .nav-top { left: 50%; right: auto; transform: translateX(-50%); width: 540px; } }
.nav-banner {
  position: relative; z-index: 1; width: 100%;
  display: flex; gap: 16px; align-items: center; padding: 18px 22px;
  background: var(--sign); color: #fff; border-radius: 22px;
  outline: 3px solid rgba(255, 255, 255, .92); outline-offset: -9px;
  box-shadow: 0 5px 0 var(--sign-deep), var(--lift);
}
.nav-icon { flex: none; display: grid; place-items: center; width: 60px; }
.nav-main { min-width: 0; }
.nav-dist { font: 800 42px/0.95 var(--display); letter-spacing: -.01em; }
.nav-text { font-size: 18px; font-weight: 700; line-height: 1.25; opacity: .95; }
.nav-then {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 6px; margin: 0 0 0 18px; max-width: calc(100% - 36px);
  background: var(--sign-deep); color: #fff; padding: 11px 14px 7px; border-radius: 0 0 14px 14px;
  font-size: 14px; font-weight: 700; box-shadow: var(--lift); white-space: nowrap;
}
.nav-then svg { flex: none; }
.nav-then .then-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Suara & paparan peta semasa memandu: kapsul kecil di bawah banner, bukan timbunan butang di bawah */
.nav-tools {
  align-self: flex-end; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; padding: 4px;
  background: var(--bg); border-radius: 999px; box-shadow: var(--lift);
}
.nav-tools:empty { display: none; }
.nav-tools .fab { width: 44px; height: 44px; box-shadow: none; background: transparent; }
.warn-pill {
  align-self: center; margin-top: 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--line-yellow); color: var(--ink); font-weight: 800; padding: 10px 18px 10px 12px; border-radius: 999px;
  box-shadow: 0 4px 0 var(--line-yellow-deep), var(--lift);
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}

/* Bar ETA bawah */
/* Bar bawah ala Waze: cari | masa tiba (besar, tengah) | tamat */
.nav-stats { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.nav-round {
  width: 52px; height: 52px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); color: var(--ink); box-shadow: 0 3px 0 var(--line);
}
.nav-round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.nav-end { width: auto; padding: 0 18px; border-radius: 999px; background: var(--chili); color: #fff; font: 800 17px/1 var(--display); box-shadow: 0 4px 0 var(--chili-deep); }
.nav-end:active { box-shadow: 0 1px 0 var(--chili-deep); }
.ns-main { min-width: 0; text-align: center; }
.ns-eta { display: block; font: 800 34px/1 var(--display); color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.ns-sub { display: inline-flex; align-items: center; gap: 8px; margin-top: 3px; color: var(--ink-2); font-size: 15px; white-space: nowrap; }
.ns-sub b { font-weight: 700; }
.ns-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55; }
.ns-main .sim-row { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 5px; }
.ns-main .sim-row[hidden] { display: none; }
.sim-row { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.sim-row button { border: 0; background: var(--line-yellow); color: var(--ink); border-radius: 999px; padding: 4px 12px; font: 800 14px/1.2 var(--display); box-shadow: 0 2px 0 var(--line-yellow-deep); }

/* Mod memandu: helaian bawah dipadatkan supaya peta dapat lebih ruang */
body.navigating .sheet { padding-top: 14px; border-radius: 24px 24px 0 0; }
body.navigating .grab { display: none; }
body.navigating .sheet-body { padding-bottom: max(10px, calc(var(--safe-b) - 14px)); }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { body.navigating .sheet { border-radius: 24px; } body.navigating .sheet-body { padding-bottom: 14px; } }
body.navigating .fabs #btnLocate { display: none; }
body.navigating.free-cam .fabs #btnLocate { display: grid; }

/* Bayang nipis di bawah status bar iOS supaya jam & bateri (putih) terbaca atas peta cerah */
.status-scrim {
  position: fixed; z-index: 7; top: 0; left: 0; right: 0; height: calc(var(--safe-t) * 1.7); pointer-events: none;
  background: linear-gradient(rgba(6, 30, 40, .5), rgba(6, 30, 40, 0));
}

/* Gelembung kelajuan */
.speedo {
  position: fixed; z-index: 4; left: 12px; bottom: calc(var(--sheet-h) + 34px);
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--bg); color: var(--ink);
  /* gelang dilukis sebagai bayang dalam (bukan border) & semua lukisan dikurung dalam bulatan:
     iOS kadang-kadang meninggalkan sisa segi empat bila nombor laju dilukis semula setiap saat */
  box-shadow: inset 0 0 0 4px var(--ink), var(--lift);
  overflow: hidden; contain: layout paint; isolation: isolate;
  transform: translateZ(0); -webkit-backface-visibility: hidden;
}
.speedo b { display: block; font: 800 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.speedo small { display: block; margin-top: 1px; font-size: 10px; line-height: 1; font-weight: 700; color: var(--ink-2); }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .speedo { left: 24px; bottom: calc(var(--panel-h) + 40px); } }

/* ---- Butang terapung ---- */
.fabs {
  position: fixed; z-index: 4; right: 12px; bottom: calc(var(--sheet-h) + 34px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .fabs { bottom: 32px; right: 20px; } }
.fabs { transition: bottom .34s cubic-bezier(.2, .9, .3, 1); }
body:has(.sheet.dragging) .fabs { transition: none; }
@media (prefers-reduced-motion: reduce) { .fabs { transition: none; } }
.fab {
  width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink);
  box-shadow: var(--lift); display: grid; place-items: center;
  transition: transform .1s;
}
.fab:active { transform: scale(.92); }
.fab-warn {
  width: 64px; height: 64px; background: var(--line-yellow); color: var(--ink);
  box-shadow: 0 4px 0 var(--line-yellow-deep), var(--lift);
}
.fab.pulse { box-shadow: 0 0 0 4px var(--route), var(--lift); color: var(--route); }

/* ---- Penanda ---- */
.me-dot { width: 40px; height: 40px; display: grid; place-items: center; }
.me-dot .halo { position: absolute; inset: -8px; border-radius: 50%; background: color-mix(in srgb, var(--route) 22%, transparent); }
.me-dot .puck {
  position: relative; width: 26px; height: 26px; border-radius: 50%;
  background: var(--route); border: 4px solid #fff; box-shadow: 0 3px 8px rgba(20, 33, 61, .45);
  display: grid; place-items: center; color: #fff;
}
.me-dot .puck svg { display: none; }
body.navigating .me-dot .puck { width: 42px; height: 42px; }
body.navigating .me-dot .puck svg { display: block; }
body.navigating .me-dot .halo { display: none; }
.from-dot { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 5px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.dest-pin { width: 40px; height: 50px; filter: drop-shadow(0 4px 4px rgba(20, 33, 61, .35)); }
/* Penanda laporan: ikon cakera dengan cincin putih & ekor. MapLibre mengawal transform elemen
   penanda, jadi gaya & animasi pada anak .rm */
.rep-marker { width: 46px; height: 56px; cursor: pointer; }
.rep-marker .rm {
  position: relative; width: 46px; height: 46px; border-radius: 50%; padding: 3px;
  background: #fff; box-shadow: 0 4px 10px rgba(20, 33, 61, .35);
  transform-origin: 50% 120%;
}
.rep-marker .rm img { display: block; width: 40px; height: 40px; border-radius: 50%; }
.rep-marker .rm::after {
  content: ""; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top: 9px solid #fff; border-bottom: 0;
  filter: drop-shadow(0 3px 2px rgba(20, 33, 61, .2));
}
.maplibregl-popup-content { border-radius: 14px; padding: 10px 14px; color: #14213d; font: 14px/1.35 var(--text); box-shadow: var(--lift); }
.maplibregl-popup-content b { font-weight: 800; }
.maplibregl-popup-content small { color: #5a6782; }

/* ---- Dialog laporan ---- */
dialog {
  border: 0; border-radius: 28px; padding: 20px; width: min(440px, calc(100vw - 24px));
  background: var(--bg); color: var(--ink); box-shadow: var(--lift);
}
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  dialog[open] {
    margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 28px 28px 0 0;
    padding-bottom: calc(20px + var(--safe-b));
    animation: rise .28s cubic-bezier(.2, .9, .3, 1.15);
  }
}
dialog::backdrop { background: rgba(20, 33, 61, .5); }
dialog h2 { font: 800 24px/1.1 var(--display); margin: 0 0 16px; }
.report-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 0; margin-bottom: 14px; }
.report-grid .rep-btn { flex: 0 0 33.333%; } /* 3 sebaris; baris terakhir yang tidak penuh berada di tengah */
.rep-btn {
  display: grid; justify-items: center; gap: 8px; padding: 10px 4px; border-radius: 18px;
  border: 0; background: transparent; font-size: 13px; font-weight: 700; line-height: 1.2;
}
.rep-btn:hover { background: var(--bg-2); }
.rep-btn .r-icon {
  display: block; width: 68px; height: 68px; border-radius: 50%;
  box-shadow: 0 6px 14px rgba(20, 33, 61, .22);
  transition: transform .12s;
}
.rep-btn:active .r-icon { transform: scale(.9); }
.small { color: var(--ink-2); font-size: 12px; margin: 0 0 12px; }

/* ---- Toast ---- */
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(var(--sheet-h) + 92px); transform: translate(-50%, 16px) scale(.96);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 22px; font-size: 14px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.3, 1.5, .5, 1);
  max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--lift);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .toast { bottom: 40px; } }

@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes rise { from { transform: translateY(40%); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Atribusi OSM: mesti sentiasa kelihatan, jadi letak di atas helaian bawah ---- */
.maplibregl-ctrl-bottom-right { bottom: var(--sheet-h); }
/* Wajib kelihatan (polisi OSM), tapi dibuat seringan mungkin: tiada kotak, teks kecil berhalo */
.maplibregl-ctrl.maplibregl-ctrl-attrib { background: none; padding: 0 8px 3px; margin: 0; font-size: 10px; line-height: 1.3; }
.maplibregl-ctrl-attrib a { color: #3d4a66; text-decoration: none; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl-attrib a { color: #c9d2e3; text-shadow: 0 0 2px #000, 0 0 3px #000; } }
.maplibregl-ctrl-attrib-inner { color: transparent; }


/* ---- Dialog paparan peta ---- */
.opt-dlg { max-height: min(88vh, 760px); overflow-y: auto; overscroll-behavior: contain; }
dialog h2:focus { outline: none; } /* fokus awal dialog diletak pada tajuk, bukan pada pilihan */
.opt-group { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.opt-group legend { font: 700 18px/1.2 var(--display); padding: 0; margin-bottom: 10px; }
.tile { position: relative; cursor: pointer; display: block; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-body {
  display: grid; justify-items: center; gap: 2px; text-align: center;
  border: 2px solid var(--line); border-radius: 16px; padding: 6px 4px 8px; height: 100%;
  transition: border-color .15s, background .15s;
}
.tile:hover .tile-body { border-color: color-mix(in srgb, var(--route) 45%, var(--line)); }
.tile input:checked + .tile-body { border-color: var(--route); background: var(--route-soft); }
.tile input:focus-visible + .tile-body { outline: 3px solid var(--route); outline-offset: 2px; }
.tile-body b { font-size: 13px; font-weight: 700; line-height: 1.2; }

/* Mod peta: satu trek, satu ibu jari yang timbul (pilihan tunggal jelas, bukan tiga butang) */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); }
.seg-opt .tile-body {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 9px 6px; color: var(--ink-2);
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg-opt .tile-body b { font-size: 15px; }
.seg-opt:hover .tile-body { color: var(--ink); }
.seg-opt input:checked + .tile-body { background: var(--thumb); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 33, 61, .14), 0 3px 10px rgba(20, 33, 61, .1); }
.seg-opt input:checked + .tile-body svg { color: var(--route); }
.seg-opt input[value="siang"]:checked + .tile-body svg { color: var(--line-yellow-deep); }
.seg-hint { margin: 8px 2px 4px; }
.opt-group .switch { margin: 6px 0 0; }

/* Garaj: kenderaan pilihan dalam 3D besar, boleh diseret untuk dipusing */
.garage {
  position: relative; border-radius: 22px; margin-bottom: 10px; padding-bottom: 12px; overflow: hidden;
  background:
    radial-gradient(70% 46% at 50% 74%, var(--garage-glow), transparent 70%),
    var(--bg-2);
}
#garageCv { display: block; width: 100%; height: 150px; touch-action: pan-y; cursor: grab; }
#garageCv:active { cursor: grabbing; }
.garage-puck { height: 150px; display: grid; place-items: center; }
.garage-puck svg { width: 64px; height: 64px; padding: 14px; border-radius: 50%; background: var(--route); color: #fff; border: 5px solid #fff; box-sizing: content-box; box-shadow: 0 6px 14px rgba(20, 33, 61, .35); }
.garage-cap { position: absolute; left: 16px; top: 12px; pointer-events: none; }
.garage-cap b { display: block; font: 800 21px/1.05 var(--display); }
.garage-cap small { display: block; font-size: 12.5px; color: var(--ink-2); }
.color-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 14px; }
.color-tile .tile-body { border: 0; padding: 0; border-radius: 50%; background: transparent; }
.color-tile input:checked + .tile-body { background: transparent; }
.sw { width: 30px; height: 30px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18); transition: box-shadow .15s; }
.color-tile input:checked + .tile-body .sw { box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18), 0 0 0 3px var(--bg-2), 0 0 0 5.5px var(--route); }

.veh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.veh-tile .pic { height: 50px; display: grid; place-items: center; }
.veh-tile .pic img { display: block; width: 64px; height: 64px; margin: -7px 0; }
.mini-puck { width: 28px; height: 28px; border-radius: 50%; background: var(--route); border: 3px solid #fff; color: #fff; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(20, 33, 61, .35); }
@media (max-width: 380px) { .veh-tile .pic img { width: 56px; height: 56px; } }

/* ---- Alu-aluan (kali pertama dibuka) ---- */
.onboard {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: color-mix(in srgb, #07817b 30%, rgba(20, 33, 61, .55));
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
}
.ob-card {
  width: min(440px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--bg); color: var(--ink); border-radius: 32px; box-shadow: var(--lift);
  padding: 20px 22px 22px; display: grid; gap: 4px; text-align: center;
}
.ob-art {
  display: grid; place-items: center; margin: 0 -6px 6px; padding: 12px 6px 0;
  border-radius: 24px; background: radial-gradient(120% 90% at 50% 100%, color-mix(in srgb, #2ccbb2 22%, var(--bg)) 0 55%, transparent 56%);
}
.ob-art img { display: block; width: 100%; max-width: 340px; height: auto; max-height: 34vh; object-fit: contain; }
.ob-card.turn .ob-art img, .ob-card.turn h2, .ob-card.turn p { animation: ob-in .35s cubic-bezier(.2, .8, .3, 1) both; }
.ob-card.turn h2 { animation-delay: .04s; }
.ob-card.turn p { animation-delay: .08s; }
@keyframes ob-in { from { opacity: 0; transform: translateX(18px); } }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .25s, background .25s; }
.ob-dots span.on { width: 26px; background: #07817b; }
.ob-card h2 { font: 800 27px/1.1 var(--display); margin: 4px 0 6px; letter-spacing: -.01em; text-wrap: balance; }
.ob-card p { margin: 0 auto 18px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; max-width: 34ch; text-wrap: pretty; }
.ob-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.ob-actions .btn:only-child, .ob-actions .btn[hidden] + .btn { grid-column: 1 / -1; }

/* ---- Kualiti udara (IPU JAS) ---- */
.ipu-badge {
  position: fixed; z-index: 4; top: calc(12px + var(--safe-t)); left: 12px; max-width: min(300px, calc(100vw - 96px));
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; text-align: left;
  border: 0; border-radius: 999px; background: var(--bg); color: var(--ink); box-shadow: var(--lift);
}
.ipu-num {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ipu); color: var(--ipu-ink); font: 800 19px/1 var(--display);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.ipu-text { min-width: 0; }
.ipu-text b { display: block; font-size: 15px; font-weight: 800; line-height: 1.15; }
.ipu-text small { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ipu-more { display: none; margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--ink); }
.ipu-badge[aria-expanded="true"] { align-items: flex-start; border-radius: 24px; padding: 8px 14px 10px 8px; }
.ipu-badge[aria-expanded="true"] .ipu-more { display: block; }
.ipu-badge[aria-expanded="true"] small { white-space: normal; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .ipu-badge { left: auto; right: 20px; top: 12px; } }
/* semasa memandu: bulatan sahaja, di atas meter laju (sekilas pandang) */
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  body.navigating .ipu-badge { top: auto; bottom: calc(var(--sheet-h) + 34px + 80px); left: 20px; padding: 4px; }
  body.navigating .ipu-badge:not([aria-expanded="true"]) .ipu-text { display: none; }
  body.searching .ipu-badge { display: none; }
}

/* Selubung jerebu di tepi peta bila udara tidak sihat; makin tebal ikut tahap. Statik, tiada animasi. */
.haze-veil { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
.haze-veil { background: radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(152, 128, 96, .6) 100%); }
body[data-haze="tidak-sihat"] .haze-veil { opacity: .75; }
body[data-haze="sangat-tidak-sihat"] .haze-veil { opacity: .8; }
body[data-haze="berbahaya"] .haze-veil { opacity: 1; }
@media (prefers-color-scheme: dark) { .haze-veil { background: radial-gradient(120% 90% at 50% 45%, transparent 48%, rgba(120, 100, 70, .5) 100%); } }

.note.ipu { align-items: center; }
.warn-pill.haze {
  background: var(--bg); color: var(--ink); border-radius: 20px; box-shadow: var(--lift);
  padding: 10px 14px 10px 10px; font-size: 14px; font-weight: 700; line-height: 1.3; max-width: calc(100% - 8px);
}
.note.ipu.bad { background: color-mix(in srgb, #f5c518 16%, var(--bg-2)); }
.ipu-dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 13px/1 var(--display); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }

/* ---- Cari berdekatan (kategori ala Waze) ---- */
.cats {
  display: flex; gap: 2px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 12px 4px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; width: 62px; display: grid; justify-items: center; gap: 5px; padding: 4px 0;
  border: 0; background: none; color: var(--ink); font-size: 12px; font-weight: 700; scroll-snap-align: start;
}
.cat .c-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); transition: transform .1s; }
.cat:active .c-ico { transform: scale(.9); }
#top:has(.results:not([hidden])) ~ .cats { display: none; }
.results .cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px 4px; font: 700 17px/1.2 var(--display); }
.results .cat-head b { white-space: nowrap; }
.results .cat-head .link-btn { display: inline; width: auto; padding: 4px 0; font: 700 14px var(--text); margin-left: auto; border-radius: 6px; }
.results .r-km { margin-left: auto; padding-left: 8px; font: 700 14px/1 var(--display); color: var(--ink-2); white-space: nowrap; }

/* "Cari di kawasan ini": terapung di atas helaian, sebaris dengan butang amaran (mudah dicapai ibu jari).
   Warna songsang seperti toast; cakera warna kategori menyamai titik di peta, jadi teks boleh ringkas. */
.area-search {
  position: fixed; z-index: 5; left: 50%; bottom: calc(var(--sheet-h) + 43px); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 176px);
  padding: 7px 16px 7px 7px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: var(--lift);
  font: 700 15px/1.1 var(--display); white-space: nowrap;
  animation: area-in .28s cubic-bezier(.3, 1.4, .5, 1);
  transition: bottom .34s cubic-bezier(.2, .9, .3, 1), transform .1s;
}
.area-search[hidden] { display: none; }
.area-search > span:last-child { overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }
.area-search:active:not(:disabled) { transform: translateX(-50%) scale(.95); }
.area-search:disabled { cursor: progress; }
.area-ico {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cat, var(--route)); color: #fff; box-shadow: 0 0 0 2px var(--bg);
}
/* sedang mencari: ikon kategori diganti gelang berputar warna kategori */
.area-search.busy .area-ico { background: none; box-shadow: none; border: 3px solid color-mix(in srgb, var(--cat) 30%, transparent); border-top-color: var(--cat); animation: spin .8s linear infinite; }
.area-search.busy .area-ico svg { display: none; }
@keyframes area-in { from { transform: translate(-50%, 14px) scale(.9); opacity: 0; } }
@keyframes spin { to { transform: rotate(1turn); } }
body:has(.sheet.dragging) .area-search { transition: none; }
body.searching .area-search, body.navigating .area-search { display: none; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  /* panel sisi 400 px di kiri: letak di tengah kawasan peta, bahagian atas */
  .area-search { bottom: auto; top: calc(var(--safe-t) + 20px); left: calc(50% + 206px); max-width: calc(100vw - 460px); }
}

/* ---- Singgah (hentian) ---- */
.stops { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; gap: 6px; }
.stops li { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 8px; border-radius: 14px; background: var(--bg-2); }
.stop-no, .stop-pin {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #087f74; color: #fff; font: 800 14px/1 var(--display); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(20, 33, 61, .35);
}
.stop-name { flex: 1; min-width: 0; }
.stop-name small { display: block; font-size: 11px; color: var(--ink-2); }
.stop-name b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-list .p-add {
  flex: none; border: 0; border-radius: 999px; padding: 7px 12px; font: 700 13px/1 var(--text);
  background: color-mix(in srgb, #087f74 14%, var(--bg)); color: #087f74; white-space: nowrap;
}
.poi-list .p-add.on { background: #087f74; color: #fff; opacity: 1; }
@media (prefers-color-scheme: dark) { .poi-list .p-add:not(.on) { color: #5fd3a5; } }
.pop-btn { display: block; width: 100%; margin-top: 8px; border: 0; border-radius: 999px; padding: 8px 12px; background: #087f74; color: #fff; font: 700 13px/1 var(--text); }

/* ---- Tiba: papan tanda terakhir perjalanan ---- */
.arrive-sign { position: relative; overflow: hidden; padding: 5px; border-radius: 20px; background: var(--sign); color: #fff; box-shadow: 0 4px 0 var(--sign-deep); }
.arrive-in { display: flex; align-items: center; gap: 14px; padding: 12px 16px 14px; border: 3px solid rgba(255, 255, 255, .95); border-radius: 15px; }
.arrive-flag { flex: none; }
.arrive-text { min-width: 0; }
.arrive-text small { display: block; font: 700 15px/1.2 var(--text); color: #d9f2e6; }
.arrive-text b { display: block; font: 800 26px/1.08 var(--display); overflow-wrap: anywhere; }
/* kiraan detik kembali ke skrin utama (30 s) */
.arrive-timer { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--line-yellow); transform-origin: left; animation: arrive-drain 30s linear forwards; }
@keyframes arrive-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .arrive-timer { animation: none; display: none; } }
.arrive-stats { margin: 14px 2px 14px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.arrive-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* ---- Singgah semasa memandu ---- */
.nav-stop { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 6px 4px 6px 8px; border-radius: 14px; background: var(--bg-2); }
.stop-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 0; overflow: visible; margin: 0 0 6px; padding: 0; }
.stop-cats .cat { width: auto; }
.stop-results { margin: 6px -10px 12px; max-height: 42vh; overflow-y: auto; }
/* Carian semasa memandu ("Singgah ke…"): skrin penuh di telefon, seperti carian utama */
.stop-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stop-top { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.stop-top .search { flex: 1; min-width: 0; }
.stop-cancel { flex: none; border: 0; background: none; color: var(--route); font-weight: 700; font-size: 16px; padding: 10px 4px 10px 10px; }
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  #stopDlg[open] {
    inset: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: none; border-radius: 0;
    padding: calc(12px + var(--safe-t)) 16px 0; overflow: hidden; display: flex; flex-direction: column;
  }
  #stopDlg form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  #stopDlg .stop-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -16px; padding: 0 16px calc(16px + var(--safe-b)); }
  #stopDlg .stop-results { max-height: none; }
}
.stop-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
/* Rumah/Pejabat sebagai hentian: papan tanda kecil, warna sama dengan papan di skrin utama */
.quick-place {
  --plate: var(--sign); --plate-deep: var(--sign-deep);
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; border: 0; border-radius: 999px;
  background: var(--plate); color: #fff; font: 800 16px/1 var(--display); box-shadow: 0 3px 0 var(--plate-deep);
}
.quick-place.place-pejabat { --plate: #1f57c3; --plate-deep: #133b8a; }
.quick-place:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--plate-deep); }
.stop-results .s-addr { display: block; margin-top: 1px; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-results .cat-head small { font: 600 12px/1.2 var(--text); color: var(--ink-2); }
.stop-results .s-main { min-width: 0; flex: 1; }
.s-road { font-weight: 500; color: var(--ink-2); }
.s-side { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; vertical-align: 1px; }
.s-side.left { background: color-mix(in srgb, var(--sign) 16%, transparent); color: var(--sign); }
.s-side.right { background: color-mix(in srgb, var(--line-yellow) 26%, transparent); color: var(--line-yellow-deep); }
.s-side.opp { background: var(--bg-2); color: var(--ink-2); }
/* masa tambahan: angka utama untuk membuat keputusan, jadi ia yang paling menonjol di kanan */
.s-detour { flex: none; margin-left: auto; padding-left: 8px; font: 800 17px/1 var(--display); color: var(--ink); white-space: nowrap; }
.stop-results li:has(.s-detour.off) button { opacity: .55; }
@media (prefers-color-scheme: dark) {
  .s-side.left { color: #5fd39c; }
  .s-side.right { color: var(--line-yellow); }
}

.stop-card {
  position: fixed; z-index: 9; left: 12px; right: 12px; bottom: max(12px, var(--safe-b));
  padding: 14px 14px 12px; border-radius: 24px; background: var(--bg); color: var(--ink); box-shadow: var(--lift);
  animation: rise .28s cubic-bezier(.2, .9, .3, 1.15);
}
.sc-head { display: flex; align-items: center; gap: 12px; }
.sc-ico { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sc-text { min-width: 0; flex: 1; }
.sc-text b { display: block; font: 800 18px/1.15 var(--display); }
.sc-text small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.sc-detour { flex: none; font: 800 24px/1 var(--display); color: var(--ink); }
.sc-detour.est { color: var(--ink-2); } /* anggaran sebelum masa tepat dari router */
.sc-eta { margin: 8px 0 12px 56px; font-size: 14px; color: var(--ink-2); min-height: 1.4em; }
.sc-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }
.sc-actions .btn { min-height: 52px; }
body.stop-preview .sheet, body.stop-preview .speedo, body.stop-preview .ipu-badge, body.stop-preview .nav-tools, body.stop-preview .fabs,
body.stop-browse .sheet, body.stop-browse .speedo, body.stop-browse .ipu-badge, body.stop-browse .nav-tools, body.stop-browse .fabs { visibility: hidden; }
body.stop-browse .warn-pill, body.stop-preview .warn-pill { display: none; } /* amaran kembali selepas memilih */

/* Pilih singgah atas peta: panel rendah supaya laluan & calon di hadapan kelihatan di atasnya */
.stop-list {
  position: fixed; z-index: 9; left: 0; right: 0; bottom: 0; max-height: 44vh;
  display: flex; flex-direction: column; padding: 12px 12px 0;
  border-radius: 26px 26px 0 0; background: var(--bg); color: var(--ink); box-shadow: var(--lift);
  animation: rise .28s cubic-bezier(.2, .9, .3, 1.15);
}
.stop-list[hidden] { display: none; }
.sl-head { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.sl-ico { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.sl-text { flex: 1; min-width: 0; }
.sl-text b { display: block; font: 800 19px/1.15 var(--display); }
.sl-text small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.3; color: var(--ink-2); }
.sl-btn { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink); }
.sl-btn:active { transform: scale(.92); }
.sl-items { flex: 1; min-height: 0; max-height: none; margin: 0 -12px; padding-bottom: max(10px, var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .stop-list { right: auto; width: 380px; left: max(8px, var(--safe-l)); bottom: max(8px, var(--safe-b)); max-height: calc(100vh - 24px); border-radius: 24px; }
}
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .stop-card { right: auto; width: 340px; left: max(8px, var(--safe-l)); bottom: max(8px, var(--safe-b)); }
}

/* ---- Panduan pasang PWA (dibuka dalam pelayar telefon) ---- */
.install { z-index: 31; }
.install-card { gap: 0; padding-top: 26px; }
.ins-icon {
  display: block; margin: 0 auto 14px; width: 84px; height: 84px; border-radius: 20px;
  box-shadow: 0 10px 24px rgba(11, 111, 124, .35), 0 2px 0 rgba(0, 0, 0, .06);
}
.install-card h2 { font: 800 25px/1.12 var(--display); margin: 0 0 6px; text-wrap: balance; }
.install-card h2:focus { outline: none; }
.ins-why { margin: 0 auto 16px; max-width: 32ch; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.ins-steps { list-style: none; counter-reset: ins; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; text-align: left; }
.ins-steps:empty { display: none; }
.ins-steps li { counter-increment: ins; display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 16px; background: var(--bg-2); }
.ins-no::before {
  content: counter(ins); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #0b6f7c; color: #fff; font: 800 15px/1 var(--display);
}
.ins-no { flex: none; }
.ins-steps b { display: block; font-size: 15px; font-weight: 700; line-height: 1.35; }
.ins-glyph {
  display: inline-grid; place-items: center; vertical-align: -6px; width: 28px; height: 26px; margin-left: 2px;
  border-radius: 7px; background: var(--bg); color: var(--route); box-shadow: inset 0 0 0 1px var(--line);
}
.ins-steps small { display: block; margin-top: 3px; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
#insInstall { margin-bottom: 4px; }
.ins-later { border: 0; background: none; color: var(--ink-2); font-weight: 700; font-size: 14px; padding: 12px; }

/* Anak panah ke arah bar pelayar (bawah untuk Safari, atas kanan untuk menu Chrome) */
.ins-arrow { position: fixed; width: 44px; height: 44px; color: #fff; pointer-events: none; }
.ins-arrow::before {
  content: ""; position: absolute; inset: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v15'/%3E%3Cpath d='M6 13l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v15'/%3E%3Cpath d='M6 13l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}
.ins-arrow[data-dir="down"] { left: calc(50% - 22px); bottom: calc(8px + var(--safe-b)); animation: ins-bob-down 1.4s ease-in-out infinite; }
.ins-arrow[data-dir="up"] { right: 14px; top: calc(8px + var(--safe-t)); transform: rotate(180deg); animation: ins-bob-up 1.4s ease-in-out infinite; }
@keyframes ins-bob-down { 50% { transform: translateY(8px); } }
@keyframes ins-bob-up { 0%, 100% { transform: rotate(180deg); } 50% { transform: rotate(180deg) translateY(8px); } }

/* ---- Anggaran tol ---- */
.note.toll .toll-rm { font: 800 18px/1 var(--display); color: #c25400; }
@media (prefers-color-scheme: dark) { .note.toll .toll-rm { color: #ffb36b; } }
.note.toll small { display: block; margin-top: 3px; color: var(--ink-2); }
.note.toll small.toll-cls { display: inline; margin: 0; }
.note.toll .toll-parts { color: var(--ink); opacity: .8; }
.note.toll .toll-miss { color: #9a5b00; }
@media (prefers-color-scheme: dark) { .note.toll .toll-miss { color: #ffc48a; } }

/* ---- Mod suara (ala Waze) ---- */
.voice-menu {
  position: fixed; z-index: 8; width: 236px; padding: 6px; display: grid; gap: 2px;
  background: var(--bg); color: var(--ink); border-radius: 20px; box-shadow: var(--lift);
  transform-origin: right center; animation: vm-in .16s ease-out;
}
@keyframes vm-in { from { opacity: 0; transform: scale(.94) translateX(8px); } }
.vm-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; text-align: left;
  border: 0; border-radius: 14px; background: transparent; color: inherit;
}
.vm-item:hover { background: var(--bg-2); }
.vm-item.on { background: var(--route-soft); }
.vm-ico { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink); }
.vm-item.on .vm-ico { background: var(--route); color: #fff; }
.vm-text b { display: block; font-weight: 800; font-size: 15px; line-height: 1.2; }
.vm-text small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.3; }
/* butang suara: tanda mod bukan "penuh" supaya pemandu tahu suara dikurangkan */
#btnMute[data-mode="senyap"], #btnMute[data-mode="amaran"] { color: #c25400; }
@media (prefers-color-scheme: dark) { #btnMute[data-mode="senyap"], #btnMute[data-mode="amaran"] { color: #ffb36b; } }

/* Amaran halangan semasa memandu: ikon laporan + teks, gaya kad seperti amaran jerebu */
.warn-pill.rep {
  background: var(--bg); color: var(--ink); border-radius: 22px; box-shadow: var(--lift);
  padding: 8px 16px 8px 8px; font-size: 15px; line-height: 1.3; gap: 10px;
}
.warn-pill .wp-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: block; }

/* ---- Kamera AES / AWAS ---- */
/* Papan tanda had laju Malaysia: bulatan putih, gelang merah, nombor hitam tebal (rupa sebenar di jalan) */
.speed-sign {
  --s: 44px;
  flex: none; width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #14213d; box-shadow: inset 0 0 0 calc(var(--s) * .13) #d62828, 0 2px 6px rgba(20, 33, 61, .3);
}
.speed-sign b { font: 800 calc(var(--s) * .44)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.5px; padding-top: calc(var(--s) * .05); }
.speed-sign.s3 b { font-size: calc(var(--s) * .36); }
.warn-pill.cam {
  background: var(--bg); color: var(--ink); border-radius: 26px; box-shadow: var(--lift);
  padding: 6px 18px 6px 6px; font-size: 15px; line-height: 1.3; gap: 12px; font-weight: 600;
}
.warn-pill.cam b { font-weight: 800; }
/* di sebelah meter laju: had laju zon kamera yang sedang dihampiri */
.speed-limit {
  position: fixed; z-index: 4; left: 88px; bottom: calc(var(--sheet-h) + 42px);
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}
.speed-limit[hidden] { display: none; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .speed-limit { left: 100px; bottom: calc(var(--panel-h) + 48px); } }
body.stop-preview .speed-limit, body.stop-browse .speed-limit { visibility: hidden; }
/* melebihi had dalam zon kamera: gelang & nombor meter laju bertukar merah */
.speedo.over { box-shadow: inset 0 0 0 4px #d62828, 0 0 0 4px rgba(214, 40, 40, .25), var(--lift); }
.speedo.over b { color: #d62828; }
@media (prefers-reduced-motion: no-preference) { .speedo.over { animation: over-pulse 1s ease-in-out infinite; } }
@keyframes over-pulse { 50% { box-shadow: inset 0 0 0 4px #d62828, 0 0 0 9px rgba(214, 40, 40, .12), var(--lift); } }

/* Pengesahan laporan */
.rep-confirm { display: grid; justify-items: center; text-align: center; gap: 6px; padding-top: 4px; }
.rep-confirm .rc-icon { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 8px 18px rgba(20, 33, 61, .25); margin-bottom: 6px; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.rep-confirm h2 { margin: 0; }
.rep-confirm p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; line-height: 1.45; max-width: 32ch; }
.rc-actions { width: 100%; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }

/* ---- "Masih ada?" ---- */
.still-card {
  position: relative; overflow: hidden; align-self: stretch; margin-top: 12px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px; padding: 12px 12px 14px;
  background: var(--bg); color: var(--ink); border-radius: 22px; box-shadow: var(--lift);
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}
.still-icon { width: 40px; height: 40px; border-radius: 50%; display: block; }
.still-card b { font: 800 19px/1.2 var(--display); }
.still-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.still-actions .btn { min-height: 48px; font-size: 16px; }
.still-timer { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--route); transform-origin: left; }
.still-card.run .still-timer { animation: still-countdown 12s linear forwards; }
@keyframes still-countdown { to { transform: scaleX(0); } }
.pop-vote { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.pop-vote .pop-btn { margin: 0; }
.pop-btn.alt { background: #eef2f7; color: #14213d; }

/* ---- Paparan laluan: bar tindakan tetap & cip elak tol ---- */
.route-bar {
  flex: none; display: grid; grid-template-columns: auto 1fr; gap: 10px;
  padding: 10px 16px max(12px, calc(var(--safe-b) - 12px));
  background: var(--bg); border-top: 1px solid var(--line);
}
.route-bar .btn { min-height: 56px; }
.route-bar .go-btn { font-size: 20px; gap: 10px; }
.route-bar .go-eta { font: 700 15px/1 var(--text); opacity: .85; padding-left: 10px; margin-left: 2px; border-left: 1.5px solid rgba(255, 255, 255, .45); }
.route-bar .go-eta:empty { display: none; }
.route-bar .sim-btn { padding: 12px 16px; font-size: 15px; }
@media (max-width: 380px) { .route-bar .sim-label { display: none; } }
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) { .route-bar { border-radius: 0 0 24px 24px; padding-bottom: 14px; } }

.dest-head { align-items: center; gap: 10px; margin-bottom: 8px; }
.dest-title { flex: 1; min-width: 0; }
.dest-title b { font-size: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toll-chip { flex: none; position: relative; cursor: pointer; user-select: none; }
.toll-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toll-chip span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.toll-chip span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 2px solid currentColor; box-sizing: border-box; }
.toll-chip input:checked + span { background: var(--sign); color: #fff; }
.toll-chip input:checked + span::before { background: #fff; border-color: #fff; box-shadow: inset 0 0 0 2px var(--sign); }
.toll-chip input:focus-visible + span { outline: 3px solid var(--route); outline-offset: 2px; }

/* kad laluan lebih padat supaya pilihan nampak tanpa skrol */
.route-cards { gap: 6px; }
.route-card { padding: 8px 12px 10px; border-radius: 16px; }
.route-card .dur { font-size: 24px; }
.route-card .badges { margin-top: 4px; }

/* Hasil kod Plus / koordinat / pautan Google Maps */
.results .r-kod .r-ico { background: var(--sign); color: #fff; }
.results .r-go { margin-left: auto; padding: 8px 14px; border-radius: 999px; background: var(--route); color: #fff; font: 800 14px/1 var(--display); }

/* ---- Amaran plaza tol ---- */
.toll-card {
  align-self: stretch; margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px;
  background: var(--bg); color: var(--ink); border-radius: 22px; box-shadow: var(--lift);
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}
.tc-ico { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #f07c1b; color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.tc-text { flex: 1; min-width: 0; }
.tc-text b { display: block; font-weight: 800; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-text small { display: block; color: var(--ink-2); font-size: 13px; }
.tc-rm { flex: none; font: 800 24px/1 var(--display); color: #c25400; letter-spacing: -.01em; }
@media (prefers-color-scheme: dark) { .tc-rm { color: #ffb36b; } }

.notes-foot { margin: 2px 4px 0; font-size: 12px; color: var(--ink-2); }

/* ---- Papan tanda keluar (ala papan tanda lebuh raya JKR) ---- */
.nav-sign { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; }
.ns-exit {
  flex: none; padding: 3px 8px 2px; border-radius: 6px; background: #ffd200; color: #14213d;
  font: 800 16px/1.1 var(--display); box-shadow: inset 0 0 0 2px #14213d;
}
.ns-exit[hidden] { display: none; }
.ns-toward {
  min-width: 0; padding: 3px 9px 2px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, .9);
  font: 700 14px/1.2 var(--text); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ns-toward:empty { display: none; }

/* ---- Panduan lorong (di bawah banner, atau di bawah "Kemudian" bila ada) ---- */
.nav-lanes {
  position: relative; z-index: 0; align-self: center; display: flex; gap: 2px; margin-top: -4px; padding: 8px 10px 6px;
  background: var(--sign-deep); border-radius: 0 0 16px 16px; box-shadow: var(--lift);
}
.nav-then:not([hidden]) + .nav-lanes { align-self: flex-start; margin-left: 30px; background: var(--sign); }
.lane { width: 40px; height: 38px; display: grid; place-items: center; color: rgba(255, 255, 255, .45); border-radius: 8px; }
.lane + .lane { border-left: 1.5px dashed rgba(255, 255, 255, .3); border-radius: 0; }
.lane.ok { color: #fff; }
.lane.ok svg { filter: drop-shadow(0 0 4px rgba(255, 255, 255, .35)); }

.badge.jam { background: #ffe1e1; color: #a1121a; }
@media (prefers-color-scheme: dark) { .badge.jam { background: #4a1416; color: #ffb3b5; } }

/* ================= Landscape telefon: panel sisi (ala Waze landscape) =================
   Panel di kiri (tinggi penuh), peta di kanan. Semasa memandu: banner & ETA di lajur kiri,
   kereta di tengah kawasan peta. Kawasan selamat notch (kiri/kanan) dihormati. */
@media (orientation: landscape) and (max-height: 520px) {
  .status-scrim { display: none; }
  .sheet {
    top: 8px; bottom: max(8px, var(--safe-b)); left: max(8px, var(--safe-l)); right: auto;
    width: 340px; max-height: none; border-radius: 22px; padding-top: 12px;
  }
  .sheet-body { padding: 0 14px 12px; }
  .route-bar { padding: 8px 12px 10px; }
  .route-bar .btn { min-height: 48px; }
  .route-bar .go-btn { font-size: 18px; }
  .idle-head { margin-bottom: 10px; }
  .cats { margin-left: -14px; margin-right: -14px; padding-left: 10px; }

  .ipu-badge { top: 8px; right: max(12px, var(--safe-r)); left: auto; }
  .fabs { right: max(12px, var(--safe-r)); bottom: max(12px, var(--safe-b)); gap: 8px; }
  .fab { width: 46px; height: 46px; }
  .fab-warn { width: 54px; height: 54px; }

  /* Memandu: lajur kiri = banner + kad amaran; bawah kiri = ETA */
  .nav-top { left: max(8px, var(--safe-l)); right: auto; top: 8px; width: 340px; max-width: none; transform: none; }
  .nav-banner { padding: 10px 14px; gap: 12px; border-radius: 18px; outline-offset: -7px; }
  .nav-icon { width: 46px; }
  .nav-icon svg { width: 44px; height: 44px; }
  .nav-dist { font-size: 30px; }
  .nav-text { font-size: 15px; }
  .nav-then { font-size: 13px; padding: 9px 12px 6px; }
  .nav-lanes { padding: 6px 8px 4px; }
  .lane { width: 34px; height: 32px; }
  .warn-pill, .toll-card, .still-card { margin-top: 8px; }
  .still-card { padding: 10px 10px 12px; }
  .still-actions .btn { min-height: 42px; }
  /* alat (lapor singgah, suara, paparan) ke sisi kanan peta */
  .nav-tools { position: fixed; top: 8px; right: max(12px, var(--safe-r)); margin: 0; }
  .nav-tools .fab { width: 42px; height: 42px; }
  body.navigating .sheet { top: auto; bottom: max(8px, var(--safe-b)); padding-top: 10px; border-radius: 18px; }
  body.navigating .sheet-body { padding-bottom: 10px; }
  .ns-eta { font-size: 28px; }
  .nav-stats { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .nav-round { width: 46px; height: 46px; }
  .nav-round.nav-end { width: auto; padding: 0 16px; }
  .speedo { left: calc(max(8px, var(--safe-l)) + 352px); bottom: max(12px, var(--safe-b)); width: 60px; height: 60px; }
  .speedo b { font-size: 24px; }
  .speed-limit { left: calc(max(8px, var(--safe-l)) + 420px); bottom: max(16px, calc(var(--safe-b) + 4px)); }
  .speed-limit .speed-sign { --s: 52px !important; }
  body:has(.speed-limit:not([hidden])) .ipu-badge { left: calc(max(8px, var(--safe-l)) + 482px); }
  body.navigating .ipu-badge { top: auto; right: auto; left: calc(max(8px, var(--safe-l)) + 420px); bottom: max(16px, calc(var(--safe-b) + 4px)); padding: 4px; }
  body.navigating .ipu-badge:not([aria-expanded="true"]) .ipu-text { display: none; }

  /* Dialog: di tengah, boleh skrol, grid lebih lebar */
  dialog { width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 16px); overflow-y: auto; padding: 14px 18px; }
  dialog h2 { margin-bottom: 10px; }
  .report-grid { grid-template-columns: repeat(6, 1fr); }
  .rep-btn .r-icon { width: 56px; height: 56px; }
  .rep-confirm .rc-icon { width: 64px; height: 64px; }
  .veh-wrap { display: grid; grid-template-columns: minmax(200px, 0.9fr) 1.1fr; gap: 10px; align-items: start; }
  .garage { margin: 0; }
  #garageCv, .garage-puck { height: 128px; }
  .color-row { gap: 7px; padding: 0 12px; }
  .sw { width: 26px; height: 26px; }
  .veh-tile .tile-body b { font-size: 12px; }
  .veh-tile .pic { height: 40px; }
  .veh-tile .pic img { width: 52px; height: 52px; margin: -6px 0; }
  .opt-dlg .opt-group { margin-bottom: 12px; }
  .onboard { padding: 8px max(16px, var(--safe-r)) 8px max(16px, var(--safe-l)); }
  .ob-card { width: min(640px, 100%); display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; column-gap: 16px; text-align: left; padding: 14px 18px; }
  .ob-card .ob-art { grid-row: 1 / span 5; margin: 0; }
  .ob-art img { max-height: 60vh; }
  .ob-dots { justify-content: flex-start; }
  .ob-card p { margin-left: 0; }
  .install-card { grid-template-columns: 1fr; text-align: center; max-height: calc(100vh - 16px); overflow-y: auto; }
  .install-card .ins-icon { width: 56px; height: 56px; margin-bottom: 8px; }
}
