:root {
  --bg: #0e1116; --panel: #171b22; --panel2: #1e232c; --line: #2a3039;
  --txt: #e8ecf2; --muted: #9aa4b2; --accent: #38b6ff; --accent2: #2b8fd6;
  --cam: #ff4d5e; --route: #38b6ff; --route-avoid: #35d07f; --go: #35d07f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--txt); overflow: hidden; }
#map { position: fixed; inset: 0; z-index: 1; background: #0b0e12; }
.hidden { display: none !important; }

/* top panel */
#panel { position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(14,17,22,.98), rgba(14,17,22,.92));
  padding: calc(env(safe-area-inset-top) + 10px) 12px 12px; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px); }
.brand { font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.brand .logo { font-size: 1.15rem; }
.brand .tag { font-weight: 500; font-size: .68rem; color: var(--muted); background: var(--panel2);
  padding: 2px 8px; border-radius: 20px; margin-left: auto; }
.field { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 3px 6px 3px 3px; margin-bottom: 7px; }
.field .ico { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; background: var(--accent);
  color: #04121c; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.field .ico.b { background: var(--cam); color: #200; }
.field input { flex: 1; background: transparent; border: 0; color: var(--txt); font-size: 1rem; padding: 9px 2px; outline: none; }
.field button { background: transparent; border: 0; color: var(--muted); font-size: 1rem; padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.field button:active { background: var(--panel2); }

.suggest { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; margin: -2px 0 7px; overflow: hidden; max-height: 44vh; overflow-y: auto; }
.suggest .s { padding: 11px 13px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .92rem; }
.suggest .s:last-child { border-bottom: 0; }
.suggest .s:active { background: var(--panel2); }
.suggest .s .sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }

.avoid { display: flex; align-items: center; gap: 10px; margin: 4px 2px 10px; cursor: pointer; user-select: none; }
.avoid input { display: none; }
.avoid .track { width: 42px; height: 24px; border-radius: 20px; background: var(--line); position: relative; transition: background .15s; flex: 0 0 42px; }
.avoid .knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.avoid input:checked + .track { background: var(--go); }
.avoid input:checked + .track .knob { left: 20px; }
.avoid .lbl { font-size: .9rem; }

.row { display: flex; gap: 8px; }
#mode { flex: 0 0 auto; background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 11px; padding: 0 10px; font-size: .95rem; }
.go { flex: 1; background: var(--go); color: #04160c; border: 0; border-radius: 11px; padding: 13px; font-size: 1rem; font-weight: 800; cursor: pointer; }
.go:active { filter: brightness(.9); }
.go.full { width: 100%; margin-top: 12px; }
.go:disabled { opacity: .5; }
.status { font-size: .8rem; color: var(--muted); margin-top: 8px; min-height: 1em; }
.status.err { color: #ff9a9a; }

/* bottom result sheet */
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-height: 62vh;
  background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 8px 14px calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; box-shadow: 0 -8px 30px rgba(0,0,0,.5); }
.sheet-grip { width: 40px; height: 4px; border-radius: 3px; background: var(--line); margin: 4px auto 8px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#sum-main { font-size: 1.4rem; font-weight: 800; }
#sum-main .em { color: var(--route-avoid); }
.sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
#sheet-close { background: var(--panel2); color: var(--muted); border: 0; border-radius: 10px; padding: 8px 12px; font-size: 1rem; cursor: pointer; }
.cam-note { font-size: .84rem; margin: 10px 0 4px; padding: 9px 11px; border-radius: 10px; background: var(--panel2); border-left: 3px solid var(--cam); }
.cam-note.ok { border-left-color: var(--route-avoid); }
#steps { list-style: none; counter-reset: s; margin: 8px 0 0; padding: 0; overflow-y: auto; }
#steps li { counter-increment: s; padding: 11px 4px 11px 40px; border-bottom: 1px solid var(--line); position: relative; font-size: .92rem; }
#steps li::before { content: counter(s); position: absolute; left: 0; top: 10px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel2); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; }
#steps li .d { color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* settings */
#settings-btn { position: fixed; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); z-index: 9;
  width: 46px; height: 46px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line);
  color: var(--txt); font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(6,8,11,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 20px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; }
.modal-card h2 { margin: 0 0 12px; font-size: 1.15rem; display: flex; justify-content: space-between; align-items: center; }
.modal-card .x { background: var(--panel2); border: 0; color: var(--muted); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: .95rem; }
.muted { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.muted.small { font-size: .76rem; margin-top: 12px; }
.lf { display: block; font-size: .82rem; color: var(--muted); margin: 14px 0 0; }
.lf input[type=text] { width: 100%; margin-top: 6px; background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 10px; padding: 11px; font-size: .95rem; }
.lf input[type=range] { width: 100%; margin-top: 8px; }

/* live navigation overlay */
#nav-top { position: fixed; top: 0; left: 0; right: 0; z-index: 14;
  background: linear-gradient(180deg, #12331f, #0e2a1a); border-bottom: 1px solid #1f6b3f;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 14px; display: flex; align-items: center; gap: 14px; }
#nav-top .nav-arrow { font-size: 2.2rem; line-height: 1; color: var(--route-avoid); flex: 0 0 auto; }
#nav-instr { font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.nav-dist { color: #9fdcb8; font-size: .95rem; margin-top: 2px; }
#nav-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 14;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); display: flex; align-items: center; justify-content: space-between; }
#nav-eta { font-size: 1.05rem; font-weight: 700; }
.nav-btns { display: flex; gap: 8px; align-items: center; }
#nav-mute { font-size: 1.05rem; padding: 9px 12px; }
#nav-mute.off { opacity: .5; }
.danger { background: #b23; color: #fff; border: 0; border-radius: 10px; padding: 11px 16px; font-size: .95rem; font-weight: 700; cursor: pointer; }

/* camera report */
#report-btn { position: fixed; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 68px); z-index: 9;
  width: 46px; height: 46px; border-radius: 50%; background: var(--cam); border: 2px solid #fff;
  font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
#report-bar { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); z-index: 15;
  background: var(--panel); border: 1px solid var(--cam); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
#report-msg { flex: 1; font-size: .9rem; }
.go.sm, .ghost.sm { flex: 0 0 auto; padding: 9px 14px; font-size: .9rem; border-radius: 9px; }
.ghost.sm { background: var(--panel2); color: var(--muted); border: 0; cursor: pointer; }
.report-dot { background: #ff8c1a; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(255,140,26,.4); }

/* map markers */
.cam-dot { background: var(--cam); width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(255,77,94,.35), 0 1px 4px rgba(0,0,0,.5); }
.me-dot { background: var(--accent); width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(56,182,255,.25); }
.leaflet-container { background: #0b0e12; }
.pin { font-size: 26px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
