/* 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);

  --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);
  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);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
#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); }
.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); }

/* ---- 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 { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 12px; }
@media (min-width: 900px) {
  .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 {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding: 4px 0 0;
  color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: none;
}
.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) {
  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,
  body.searching .fabs, body.searching .status-scrim { display: none; }
}
#top:has(.results:not([hidden])) ~ .recents { display: none; }
#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) { 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; }

/* ---- 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) { .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 {
  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 */
.nav-stats { display: flex; gap: 10px; align-items: center; }
.ns-main { flex: 1; min-width: 0; }
.ns-main b#remTime { display: block; font: 800 32px/1 var(--display); color: var(--sign); letter-spacing: -.01em; }
@media (prefers-color-scheme: dark) { .ns-main b#remTime { color: #5fd3a5; } }
.ns-sub { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.ns-sub b { color: var(--ink); font-weight: 800; }
.nav-stats .btn { min-width: 96px; min-height: 48px; }
.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) { 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: grid; place-content: center; text-align: center;
  background: var(--bg); color: var(--ink); border: 4px solid var(--ink);
  box-shadow: var(--lift);
}
.speedo b { font: 800 28px/0.9 var(--display); }
.speedo small { font-size: 10px; font-weight: 700; color: var(--ink-2); }
@media (min-width: 900px) { .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) { .fabs { bottom: 32px; right: 20px; } }
.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)); }
/* MapLibre mengawal transform elemen penanda, jadi gaya & animasi pada anak .rm */
.rep-marker { width: 38px; height: 46px; cursor: pointer; }
.rep-marker .rm {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  border: 3px solid #fff; box-shadow: 0 3px 8px rgba(20, 33, 61, .4);
  transform-origin: 50% 120%;
}
.rep-marker .rm::after {
  content: ""; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top: 7px solid #fff; border-bottom: 0;
}
.rep-marker.fresh .rm { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
/* Laporan yang ada penanda bergambar (banjir, kemalangan, jalan ditutup) */
.rep-marker:has(.rm-pin) { width: 42px; height: 47px; }
.rep-marker .rm.rm-pin { width: 42px; height: 47px; border: 0; border-radius: 0; box-shadow: none; display: block; filter: drop-shadow(0 3px 4px rgba(20, 33, 61, .35)); transform-origin: 50% 100%; }
.rep-marker .rm.rm-pin::after { content: none; }
.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) {
  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: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 6px; margin-bottom: 14px; }
.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-circle {
  width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2), 0 4px 10px rgba(20, 33, 61, .2);
  transition: transform .12s;
}
.rep-btn:active .r-circle { 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: 999px; 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) { .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; }
.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: 4px; 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); box-shadow: inset 0 0 0 1px var(--route); }
.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; }
.tile-body small { font-size: 11px; color: var(--ink-2); line-height: 1.2; }

.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.mode-tile .tile-body { padding: 12px 4px; border-radius: 999px; }
.mode-tile .tile-body b { font-size: 15px; }
.opt-group .switch { margin: 4px 0 0; }

.veh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.veh-tile .pic { height: 60px; display: grid; place-items: center; }
.veh-tile .pic img { display: block; width: 64px; height: 64px; }
.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); }
.color-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.color-tile .tile-body { border: 0; padding: 3px; border-radius: 50%; }
.color-tile input:checked + .tile-body { background: transparent; box-shadow: 0 0 0 3px var(--route); }
.sw { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18); }
@media (max-width: 380px) { .veh-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---- 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; }
