:root { --bg:#fff; --fg:#14181f; --muted:#5b6574; --line:#d7dce4; --brand:#0b5fff; --brand-fg:#fff; --warn:#b54708; --danger:#d92d20; --shadow:0 4px 18px rgba(16,24,40,.22); }
@media (prefers-color-scheme: dark) { :root { --bg:#161b22; --fg:#eef1f6; --muted:#9aa5b5; --line:#2c3441; --shadow:0 4px 18px rgba(0,0,0,.55); } }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; overflow:hidden; font:16px/1.35 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color:var(--fg); background:#e8ebef; }
#map { position:fixed; inset:0; }
[hidden] { display:none !important; }
button { font:inherit; cursor:pointer; border:0; border-radius:14px; min-height:48px; padding:0 18px; color:var(--fg); background:var(--bg); }
button.primary { background:var(--brand); color:var(--brand-fg); font-weight:700; }
button.secondary { background:transparent; color:var(--brand); border:2px solid var(--brand); font-weight:600; }
button.ghost { background:transparent; color:var(--muted); }
button:disabled { opacity:.5; }

#top { position:fixed; z-index:5; top:max(10px, env(safe-area-inset-top)); left:10px; right:10px; max-width:560px; margin:0 auto; }
#searchRow { display:flex; gap:8px; background:var(--bg); border-radius:16px; padding:6px; box-shadow:var(--shadow); }
#q { flex:1; min-width:0; border:0; outline:0; background:transparent; color:var(--fg); font-size:17px; padding:0 10px; height:48px; }
#goBtn { background:var(--brand); color:var(--brand-fg); font-weight:700; }
#results { list-style:none; margin:8px 0 0; padding:4px; background:var(--bg); border-radius:16px; box-shadow:var(--shadow); max-height:45vh; overflow:auto; }
#results li button { width:100%; text-align:left; border-radius:12px; padding:12px; min-height:52px; font-size:15px; }
#results li + li { border-top:1px solid var(--line); }
#chips { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.chip { font-size:12px; background:var(--bg); color:var(--muted); padding:4px 10px; border-radius:999px; box-shadow:0 1px 6px rgba(16,24,40,.2); }
.chip.ok { color:#067647; } .chip.bad { color:var(--danger); } .chip.warn { color:var(--warn); font-weight:700; }

#banner { position:fixed; z-index:6; top:max(10px, env(safe-area-inset-top)); left:10px; right:10px; max-width:560px; margin:0 auto; display:flex; gap:14px; align-items:center; background:#0b2a66; color:#fff; border-radius:18px; padding:14px 16px; box-shadow:var(--shadow); }
#bArrow { font-size:54px; line-height:1; width:64px; text-align:center; }
#bDist { font-size:34px; font-weight:800; }
#bInstr { font-size:19px; font-weight:600; }
#bRoad { font-size:14px; opacity:.8; margin-top:2px; }
body.navigating #top { display:none; }

#hud { position:fixed; z-index:6; left:10px; right:10px; bottom:max(10px, env(safe-area-inset-bottom)); max-width:560px; margin:0 auto; display:flex; gap:8px; align-items:stretch; background:var(--bg); border-radius:18px; padding:10px; box-shadow:var(--shadow); }
.hBox { flex:1; text-align:center; } #hSpeed, #hEta, #hRem { font-size:26px; font-weight:800; } #hSpeedUnit, .hSmall { font-size:12px; color:var(--muted); }
#hEnd { background:var(--danger); color:#fff; font-weight:700; min-width:76px; }

#preview { position:fixed; z-index:6; left:10px; right:10px; bottom:max(10px, env(safe-area-inset-bottom)); max-width:560px; margin:0 auto; background:var(--bg); border-radius:20px; padding:14px; box-shadow:var(--shadow); }
#pTitle { font-weight:700; margin-bottom:8px; }
#pCards { display:flex; flex-direction:column; gap:8px; }
.card { text-align:left; border:2px solid var(--line); border-radius:14px; padding:10px 14px; width:100%; display:flex; justify-content:space-between; align-items:center; }
.card.sel { border-color:var(--brand); background:rgba(11,95,255,.08); }
.card b { font-size:20px; } .card small { color:var(--muted); }
#pNote { font-size:12px; color:var(--muted); margin:8px 0; }
.row { display:flex; gap:8px; flex-wrap:wrap; } .row .primary { flex:1; }

#offer { position:fixed; z-index:7; left:10px; right:10px; bottom:calc(max(10px, env(safe-area-inset-bottom)) + 96px); max-width:560px; margin:0 auto; background:var(--bg); border:2px solid var(--warn); border-radius:18px; padding:14px; box-shadow:var(--shadow); }
#offerText { font-weight:600; margin-bottom:10px; }
.cardWarn { font-size:12px; font-weight:600; color:var(--warn); margin-top:2px; }
#fabs { position:fixed; z-index:5; right:10px; bottom:calc(max(10px, env(safe-area-inset-bottom)) + 96px); display:flex; flex-direction:column; gap:10px; align-items:flex-end; }
body.previewing #fabs { bottom:calc(max(10px, env(safe-area-inset-bottom)) + 250px); }
.fab { width:56px; height:56px; padding:0; border-radius:50%; font-size:24px; box-shadow:var(--shadow); }
.fab.report { width:auto; padding:0 20px; border-radius:28px; background:var(--danger); color:#fff; font-weight:700; display:flex; align-items:center; gap:8px; font-size:20px; }
.fab.report span { font-size:16px; }
.fab.active { background:var(--brand); color:#fff; }

.overlay { position:fixed; inset:0; z-index:20; background:rgba(10,14,20,.55); display:flex; align-items:flex-end; justify-content:center; padding:10px; }
.panel { background:var(--bg); width:100%; max-width:560px; border-radius:22px; padding:18px; max-height:92vh; overflow:auto; }
.panelTitle { font-size:20px; font-weight:800; margin-bottom:10px; }
#sheetGrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
#sheetGrid button { min-height:72px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border:2px solid var(--line); font-size:15px; font-weight:600; }
#sheetGrid button span { font-size:26px; }
.hint { font-size:13px; color:var(--muted); margin:12px 0; }
.field { display:block; margin:12px 0; font-weight:600; } .field select { display:block; width:100%; margin-top:6px; height:48px; border-radius:12px; border:1px solid var(--line); background:var(--bg); color:var(--fg); font-size:16px; padding:0 8px; }
.field.check { display:flex; align-items:center; gap:10px; } .field.check input { width:24px; height:24px; }
.panel .primary { width:100%; margin-top:8px; } .panel .secondary { width:100%; }

#toast { position:fixed; z-index:30; left:50%; transform:translateX(-50%); top:max(90px, calc(env(safe-area-inset-top) + 80px)); background:#14181f; color:#fff; padding:12px 16px; border-radius:14px; max-width:90vw; box-shadow:var(--shadow); text-align:center; }

.rm { width:38px; height:38px; border-radius:50%; background:#fff; border:3px solid var(--danger); display:flex; align-items:center; justify-content:center; font-size:20px; box-shadow:0 2px 8px rgba(0,0,0,.35); cursor:pointer; }
.me { width:26px; height:26px; }
.me svg { width:26px; height:26px; filter:drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.popup b { display:block; font-size:16px; } .popup p { margin:4px 0; font-size:13px; color:#333; word-break:break-word; }
.popup .row { margin-top:8px; flex-wrap:nowrap; } .popup button { min-height:40px; padding:0 10px; font-size:14px; background:#eef1f6; color:#14181f; }
