:root{--bg:#f8faf9;--surface:#fff;--soft:#f1f6f5;--ink:#172f3a;--muted:#5d7178;--accent:#1d617e;--line:#dfe8e7;--air:#6b3fd4;--air-soft:#efe9fd;--road:#1d6fd6;--walk:#18794e;--warn:#9a5b00;--warn-bg:#fff4dc;--bad:#a0443e;--bad-bg:#fbefed;--tabs:58px;--safe:env(safe-area-inset-bottom,0px);color-scheme:light}
@media(prefers-color-scheme:dark){:root{--bg:#101d24;--surface:#162831;--soft:#1c333d;--ink:#e5efef;--muted:#a2b8bf;--accent:#9bd6e7;--line:#2c434e;--air:#b79cff;--air-soft:#2b2547;--road:#7db4ff;--walk:#6fd3a3;--warn:#ffd28a;--warn-bg:#40341c;--bad:#f0a7a0;--bad-bg:#402d30;color-scheme:dark}}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%;margin:0}
body{font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans Sinhala","Noto Sans Tamil",sans-serif;color:var(--ink);background:var(--bg);overflow:hidden;-webkit-tap-highlight-color:transparent}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.muted{color:var(--muted)}
#map{position:fixed;inset:0 0 calc(var(--tabs) + var(--safe)) 0;background:#cfe0ee}
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

.top{position:fixed;z-index:5;left:0;right:0;top:0;padding:calc(env(safe-area-inset-top,0px) + 10px) 10px 0;pointer-events:none;max-width:520px}
.top>*{pointer-events:auto}
.search-card{display:flex;align-items:center;gap:6px;background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:8px;box-shadow:0 6px 24px rgba(20,50,60,.16)}
.brand{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:var(--accent);color:var(--surface);flex:none}
.brand svg{width:28px;height:28px}
.fields{flex:1;min-width:0;display:grid;gap:6px}
.field{display:flex;align-items:center;gap:8px;background:var(--soft);border-radius:11px;padding:0 6px 0 10px;min-height:40px}
.field input{flex:1;min-width:0;border:0;background:none;outline:0;padding:8px 0;font-size:16px}
.field:focus-within{box-shadow:0 0 0 2px var(--accent)}
.dot{width:10px;height:10px;border-radius:50%;flex:none}
.dot.from{border:3px solid var(--accent)}
.dot.to{background:var(--bad)}
.icon{display:grid;place-items:center;width:36px;height:36px;border:0;background:none;border-radius:10px;color:var(--accent);flex:none}
.icon:active{background:var(--soft)}
.icon.busy svg{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.suggest{list-style:none;margin:6px 0 0;padding:4px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 6px 24px rgba(20,50,60,.16);max-height:46vh;overflow:auto}
.suggest button{display:block;width:100%;text-align:left;border:0;background:none;padding:9px 10px;border-radius:10px}
.suggest button:active,.suggest button:focus-visible{background:var(--soft);outline:0}
.suggest b{display:block;font-weight:600}
.suggest small{color:var(--muted)}
.tag{display:inline-block;font-size:11px;font-weight:700;letter-spacing:.02em;padding:1px 6px;border-radius:99px;background:var(--air-soft);color:var(--air);margin-left:6px;vertical-align:1px}

.modes{display:flex;gap:6px;margin-top:8px}
.modes button{flex:1;display:grid;gap:0;justify-items:center;border:1px solid var(--line);background:var(--surface);border-radius:14px;padding:6px 4px;box-shadow:0 4px 16px rgba(20,50,60,.12)}
.mode-name{font-size:12px;font-weight:700;letter-spacing:.03em;color:var(--muted)}
.mode-time{font-size:15px;font-weight:700}
.modes button[aria-selected=true]{border-color:var(--accent);background:var(--accent);color:var(--surface)}
.modes button[aria-selected=true] .mode-name{color:inherit;opacity:.85}
.modes button[data-mode=evtol][aria-selected=true]{background:var(--air);border-color:var(--air);color:#fff}
@media(prefers-color-scheme:dark){.modes button[data-mode=evtol][aria-selected=true]{color:#16102c}}

.sheet{position:fixed;z-index:4;left:0;right:0;bottom:calc(var(--tabs) + var(--safe));max-width:520px;background:var(--surface);border:1px solid var(--line);border-bottom:0;border-radius:20px 20px 0 0;box-shadow:0 -8px 30px rgba(20,50,60,.16);padding:0 14px 12px;max-height:46vh;overflow:auto;overscroll-behavior:contain}
.sheet.small{max-height:132px;overflow:hidden}
.grip{display:block;width:100%;height:22px;border:0;background:none;position:sticky;top:0;z-index:1;background:var(--surface)}
.grip::after{content:"";display:block;width:42px;height:4px;border-radius:4px;background:var(--line);margin:0 auto}
.sheet h1{font-size:18px;margin:0 0 4px;line-height:1.25}
.sheet p{margin:0 0 8px}
.chips{display:flex;gap:6px;overflow-x:auto;padding:2px 0 4px;scrollbar-width:none}
.chips button{flex:none;border:1px solid var(--line);background:var(--soft);border-radius:99px;padding:7px 12px;font-size:13px;font-weight:600}
.status{display:flex;align-items:center;gap:10px;padding:6px 0 10px;color:var(--muted)}
.status::before{content:"";width:16px;height:16px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .8s linear infinite;flex:none}
.status.plain::before{display:none}

.headline{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.headline .big{font-size:26px;font-weight:800;letter-spacing:-.01em}
.headline .sub{color:var(--muted);font-weight:600}
.saving{display:inline-block;margin:6px 0 2px;padding:3px 9px;border-radius:99px;font-size:13px;font-weight:700;background:var(--air-soft);color:var(--air)}
.saving.none{background:var(--soft);color:var(--muted)}
.actions{display:flex;gap:8px;margin:10px 0}
.btn{flex:1;border:1px solid var(--accent);background:var(--accent);color:var(--surface);border-radius:12px;padding:10px 12px;font-weight:700}
.btn.ghost{background:none;color:var(--accent)}
.btn:disabled{opacity:.5}
.row{display:flex;gap:8px;align-items:center;margin:8px 0}
.row label{font-size:13px;color:var(--muted);font-weight:600}
.row select{flex:1;min-width:0;border:1px solid var(--line);background:var(--soft);border-radius:10px;padding:8px}

.legs{list-style:none;margin:10px 0 0;padding:0}
.leg{position:relative;padding:0 0 12px 30px}
.leg::before{content:"";position:absolute;left:9px;top:20px;bottom:0;width:4px;border-radius:4px;background:var(--road)}
.leg.walk::before{background:repeating-linear-gradient(var(--walk) 0 5px,transparent 5px 9px)}
.leg.air::before{background:var(--air)}
.leg::after{content:"";position:absolute;left:4px;top:4px;width:14px;height:14px;border-radius:50%;background:var(--surface);border:3px solid var(--road)}
.leg.walk::after{border-color:var(--walk)}
.leg.air::after{border-color:var(--air)}
.leg.end{padding-bottom:0}
.leg.end::before{display:none}
.leg.end::after{background:var(--bad);border-color:var(--bad)}
.leg-title{font-weight:700}
.leg-meta{color:var(--muted);font-size:13px}
.leg details{margin-top:4px}
.leg summary{color:var(--accent);font-size:13px;font-weight:600;cursor:pointer}
.steps{list-style:none;margin:6px 0 0;padding:0;font-size:14px}
.steps li{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-top:1px solid var(--line)}
.steps span:last-child{color:var(--muted);white-space:nowrap}
.facts{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:8px 0}
.fact{background:var(--soft);border-radius:10px;padding:6px 8px}
.fact b{display:block;font-size:15px}
.fact span{font-size:11.5px;color:var(--muted)}
.flag{margin:6px 0;padding:7px 10px;border-radius:10px;font-size:13px;background:var(--warn-bg);color:var(--warn)}
.flag.bad{background:var(--bad-bg);color:var(--bad)}
.notice{margin:10px 0 0;padding:8px 10px;border-radius:10px;background:var(--soft);font-size:12.5px;color:var(--muted)}
.credit{margin:8px 0 0;font-size:11px;color:var(--muted)}
.credit a{color:inherit}

.guide{position:fixed;z-index:6;left:10px;right:10px;top:calc(env(safe-area-inset-top,0px) + 10px);max-width:500px;display:flex;align-items:center;gap:8px;background:var(--accent);color:#fff;border-radius:16px;padding:10px 8px 10px 14px;box-shadow:0 6px 24px rgba(20,50,60,.25)}
.guide.air{background:var(--air)}
.guide-main{flex:1;min-width:0;display:grid}
.guide-leg{font-size:11.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;opacity:.85}
.guide strong{font-size:17px;line-height:1.25}
.guide-main span:last-child{font-size:13px;opacity:.9}
.guide .icon{color:#fff;font-size:24px}
body.guiding .top{display:none}

.tabs{position:fixed;z-index:7;left:0;right:0;bottom:0;height:calc(var(--tabs) + var(--safe));padding-bottom:var(--safe);display:flex;background:var(--surface);border-top:1px solid var(--line)}
.tabs a{flex:1;display:grid;place-items:center;align-content:center;gap:1px;font-size:11.5px;font-weight:600;color:var(--muted);text-decoration:none}
.tabs a.on{color:var(--accent)}

.toast{position:fixed;z-index:9;left:50%;transform:translateX(-50%);bottom:calc(var(--tabs) + var(--safe) + 16px);background:var(--ink);color:var(--bg);padding:9px 14px;border-radius:12px;font-size:14px;max-width:88vw;text-align:center}
.pin{width:18px;height:18px;border-radius:50%;border:4px solid var(--accent);background:#fff;box-shadow:0 1px 5px rgba(0,0,0,.35)}
.pin.to{border-color:#a0443e;background:#a0443e}
.me{width:18px;height:18px;border-radius:50%;background:#1d6fd6;border:3px solid #fff;box-shadow:0 0 0 6px rgba(29,111,214,.22)}
.craft{width:26px;height:26px;border-radius:50%;background:#6b3fd4;border:3px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.35)}
.maplibregl-ctrl-bottom-right{bottom:6px}
.maplibregl-popup-content{border-radius:12px;padding:10px 12px;font:inherit;color:#172f3a}
.pop b{display:block;margin-bottom:6px}
.pop button{border:1px solid #1d617e;background:#1d617e;color:#fff;border-radius:9px;padding:6px 10px;font-weight:600;margin-right:6px}
.pop button.ghost{background:none;color:#1d617e}

@media(min-width:800px){
  .sheet{left:10px;bottom:calc(var(--tabs) + 10px);width:400px;border-radius:20px;border-bottom:1px solid var(--line);max-height:calc(100vh - 290px)}
  .top{width:420px}
  .grip{display:none}
  .sheet{padding-top:14px}
}

.btn.narrow{flex:0 0 auto;padding-inline:14px}
.lang{display:flex;align-items:center;gap:8px;margin-top:6px;font-size:13px;color:var(--muted);font-weight:600}
.lang select{border:1px solid var(--line);background:var(--soft);border-radius:10px;padding:6px 8px}
.actions{flex-wrap:wrap}

/* Sinhala / Tamil place labels drawn as HTML (see drawLocalLabels in nav.js) */
.lk-label{pointer-events:none;white-space:nowrap;font:500 12px/1.2 system-ui,"Noto Sans Sinhala","Iskoola Pota","Noto Sans Tamil","Latha",sans-serif;color:#333;text-shadow:0 0 2px #fff,0 0 2px #fff,0 0 3px #fff}
.lk-label.r0{font-size:15px;font-weight:700;color:#222}
.lk-label.r1{font-size:13px;font-weight:600}
.lk-label.r3{font-size:11px;color:#6b3fd4;font-style:normal}
