/* PARKBACK: dark drawn stage, glass panels, three colors with jobs:
   teal = parking, coral-pink = your car, violet = the place you go. */
:root {
  --stage: #05070b;
  --glass: linear-gradient(160deg, rgba(20, 26, 38, 0.86), rgba(8, 11, 18, 0.9));
  --glass-2: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  --line: rgba(255, 255, 255, 0.11);
  --line-2: rgba(255, 255, 255, 0.2);
  --ink: #eef2f8;
  --ink-2: #b4bfcf;
  --ink-3: #7f8a9c;
  --park: #2fe0c0;
  --park-2: #3aa8ff;
  --car: #ff5c48;
  --car-2: #ff2f7d;
  --dest: #a593ff;
  --dest-2: #6a7dff;
  --on-color: #0a0710;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sheet-h: 46dvh;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --stage: #eef1f5;
  --glass: linear-gradient(160deg, rgba(255, 255, 255, 0.93), rgba(240, 244, 249, 0.95));
  --glass-2: linear-gradient(160deg, rgba(10, 20, 40, 0.06), rgba(10, 20, 40, 0.025));
  --line: rgba(10, 20, 40, 0.12);
  --line-2: rgba(10, 20, 40, 0.24);
  --ink: #0c1320;
  --ink-2: #374356;
  --ink-3: #5d6879;
  --park: #00a88c;
  --park-2: #1f7fe0;
  --car: #ee3b2a;
  --car-2: #e0145f;
  --dest: #6a4cf0;
  --dest-2: #3e59e6;
  --shadow: 0 14px 40px rgba(10, 20, 40, 0.22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--stage); color: var(--ink); font-family: var(--ui); -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

#map { position: absolute; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(5, 7, 11, 0.55) !important; color: #aab3c2; }
.maplibregl-ctrl-attrib a { color: #cfd6e2 !important; }
:root[data-theme="light"] .maplibregl-ctrl-attrib { background: rgba(255, 255, 255, 0.7) !important; color: #333; }
:root[data-theme="light"] .maplibregl-ctrl-attrib a { color: #222 !important; }
.maplibregl-ctrl-bottom-left { transition: bottom 0.25s ease; }

/* ---------- top bar ---------- */
.bar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 10px;
  background: linear-gradient(180deg, rgba(5, 7, 11, 0.85), rgba(5, 7, 11, 0));
  pointer-events: none;
}
:root[data-theme="light"] .bar { background: linear-gradient(180deg, rgba(238, 241, 245, 0.92), rgba(238, 241, 245, 0)); }
.bar > * { pointer-events: auto; }
.mark { font-weight: 800; letter-spacing: 0.14em; font-size: 15px; margin-right: auto; color: var(--ink); }
.mark b { font-weight: 800; background: linear-gradient(90deg, var(--car), var(--car-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 17px; border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 13px; font-weight: 650; color: var(--ink);
}
.pill .led { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
.pill.ok .led { background: var(--park); box-shadow: 0 0 10px var(--park); }
.pill.part .led { background: linear-gradient(90deg, var(--park), var(--park-2)); }
.iconbtn, .fab {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px;
  border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--ink);
}
.fab { position: absolute; right: 12px; bottom: 50dvh; z-index: 4; width: 48px; height: 48px; border-radius: 16px; box-shadow: var(--shadow); transition: bottom 0.25s ease; }

/* ---------- bottom sheet ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  max-width: 560px; margin: 0 auto;
  background: var(--glass); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  padding: 0 12px calc(env(safe-area-inset-bottom) + 10px);
  display: flex; flex-direction: column; max-height: 62dvh;
}
.grip { display: grid; place-items: center; height: 22px; border: 0; background: none; width: 100%; padding: 0; }
.grip i { width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px 8px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--glass-2); color: var(--ink-2);
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
}
.tab[aria-selected="true"] { color: var(--on-color); border-color: transparent; }
.t-find[aria-selected="true"] { background: linear-gradient(135deg, var(--park), var(--park-2)); }
.t-park[aria-selected="true"] { background: linear-gradient(135deg, var(--car), var(--car-2)); }
.t-back[aria-selected="true"] { background: linear-gradient(135deg, var(--dest), var(--dest-2)); }
.t-back.has-car:not([aria-selected="true"]) { color: var(--ink); border-color: rgba(165, 147, 255, 0.55); }
.panes { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 2px 6px; }
.sheet.small .panes { display: none; }
.pane { display: none; }
.pane.on { display: block; }

.k { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 10px 0 6px; }
.v { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.hint { font-size: 15px; color: var(--ink-2); line-height: 1.45; margin: 10px 2px; }
.small { font-size: 13px; color: var(--ink-3); line-height: 1.45; margin: 8px 2px; }
.grow { flex: 1; min-width: 0; }
.grow .k { margin-top: 0; }
.swatch { width: 14px; height: 14px; border-radius: 5px; flex: none; margin-top: 4px; }
.swatch.dest { background: linear-gradient(135deg, var(--dest), var(--dest-2)); }
.swatch.car { background: linear-gradient(135deg, var(--car), var(--car-2)); }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; height: 48px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--glass-2);
  padding: 0 14px; font-size: 17px; outline: none;
}
.search input:focus { border-color: var(--park); }
.go { height: 48px; padding: 0 16px; border-radius: 15px; border: 0; font-weight: 800; color: var(--on-color); background: linear-gradient(135deg, var(--park), var(--park-2)); }

.results { list-style: none; margin: 8px 0 0; padding: 0; }
.results button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 11px 4px; }
.results b { display: block; font-size: 16px; }
.results span { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.dest-head, .saved-head { display: flex; gap: 10px; align-items: flex-start; padding: 2px 2px 4px; }
.dest-head .v, .saved-head .v { overflow-wrap: anywhere; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 4px; }
.chips button {
  height: 34px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--glass-2);
  font-size: 14px; font-weight: 650; color: var(--ink-2);
}
.chips button[aria-pressed="true"] { color: var(--on-color); border-color: transparent; background: linear-gradient(135deg, var(--park), var(--park-2)); }
.levels button { min-width: 46px; }
.levels button[aria-pressed="true"] { background: linear-gradient(135deg, var(--car), var(--car-2)); }

.update-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; }
.update-row .ghost { flex: none; gap: 6px; }
.update-row .ghost svg { width: 16px; height: 16px; }
.update-row .ghost:disabled { opacity: 0.6; }
.update-row .ghost:disabled svg { animation: spin 1s linear infinite; }
.update-row .small { margin: 0; flex: 1; min-width: 0; }
.lots { list-style: none; margin: 6px 0 0; padding: 0; }
.lots li { border-bottom: 1px solid var(--line); }
.lots button { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 11px 2px; }
.lots button.sel { background: var(--glass-2); border-radius: 14px; }
.badge {
  flex: none; width: 54px; text-align: center; border-radius: 13px; padding: 7px 0 6px; color: var(--on-color);
  font-family: var(--num); font-weight: 800; line-height: 1.05;
}
.badge.t-D, .badge.t-U { background: linear-gradient(135deg, var(--park), var(--park-2)); }
.badge.t-L, .badge.t-X { background: linear-gradient(135deg, rgba(47, 224, 192, 0.55), rgba(58, 168, 255, 0.45)); color: var(--ink); }
.badge.t-S { background: linear-gradient(135deg, var(--dest), var(--dest-2)); }
.badge b { display: block; font-size: 18px; }
.badge small { display: block; font-size: 11px; font-weight: 700; opacity: 0.85; }
.lots .txt { flex: 1; min-width: 0; }
.lots .txt b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.lots .txt span { display: block; font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.lots .private { opacity: 0.55; }

.detail { margin: 8px 0 6px; padding: 14px; border-radius: 18px; border: 1px solid rgba(47, 224, 192, 0.45); background: linear-gradient(160deg, rgba(47, 224, 192, 0.14), rgba(58, 168, 255, 0.06)); }
.detail h3 { margin: 0 0 4px; font-size: 18px; }
.detail p { margin: 6px 0; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.detail .walkline { color: var(--ink); font-weight: 650; }

.big {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; border-radius: 20px; border: 0;
  font-size: 20px; font-weight: 850; letter-spacing: 0.01em; color: var(--on-color); box-shadow: var(--shadow);
}
.big svg { width: 26px; height: 26px; }
.big.car { background: linear-gradient(135deg, var(--car), var(--car-2)); }
.big.park { background: linear-gradient(135deg, var(--park), var(--park-2)); }
.big:disabled { opacity: 0.55; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 14px; border-radius: 15px;
  border: 1px solid var(--line-2); background: var(--glass-2); font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; text-align: center;
}
.ghost.small { min-height: 34px; font-size: 13px; padding: 0 10px; border-radius: 11px; }
.ghost.wide { width: 100%; margin-top: 8px; }
.ghost.danger { color: var(--car); border-color: rgba(255, 92, 72, 0.45); }
a.ghost.primary, .ghost.primary { color: var(--on-color); border: 0; background: linear-gradient(135deg, var(--park), var(--park-2)); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.two input { height: 46px; min-width: 0; border-radius: 14px; border: 1px solid var(--line-2); background: var(--glass-2); padding: 0 12px; font-size: 16px; outline: none; }
.two input:focus { border-color: var(--car); }
.toggle { min-height: 46px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--glass-2); font-size: 15px; font-weight: 700; color: var(--ink-2); }
.toggle[aria-pressed="true"] { color: var(--on-color); border-color: transparent; background: linear-gradient(135deg, var(--dest), var(--dest-2)); }

.gpsbox { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--glass-2); margin-bottom: 8px; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--car); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.photo-btn {
  display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; padding: 10px; min-height: 64px; border-radius: 18px;
  border: 1px dashed rgba(255, 92, 72, 0.6); background: linear-gradient(160deg, rgba(255, 92, 72, 0.12), rgba(255, 47, 125, 0.05));
  font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.photo-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-btn img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex: none; }

/* homing dial */
.homing { display: flex; gap: 16px; align-items: center; }
.dial {
  position: relative; width: 132px; height: 132px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(165, 147, 255, 0.16), rgba(5, 7, 11, 0) 62%), var(--glass-2);
  border: 1px solid var(--line-2); box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.03);
}
.rose { position: absolute; inset: 6px; border-radius: 50%; transition: transform 0.2s linear; }
.rose .ticks { position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from -1deg, var(--line-2) 0 2deg, transparent 2deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 52px, #000 53px); mask: radial-gradient(circle, transparent 52px, #000 53px); }
.rose span { position: absolute; width: 16px; height: 14px; margin: -7px 0 0 -8px; text-align: center; font-size: 11px; font-weight: 800; line-height: 14px; color: var(--ink-3); }
.rose .n { left: 50%; top: 14px; color: var(--car); }
.rose .s { left: 50%; top: calc(100% - 14px); }
.rose .e { left: calc(100% - 14px); top: 50%; }
.rose .w { left: 14px; top: 50%; }
.needle { position: absolute; inset: 14px; width: auto; height: auto; transition: transform 0.2s linear; filter: drop-shadow(0 4px 10px rgba(255, 47, 125, 0.45)); }
.hub { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--ink); }
.readout { min-width: 0; flex: 1; }
.dist { font-family: var(--num); font-weight: 800; line-height: 0.95; display: flex; align-items: baseline; gap: 4px; }
#dNum { font-size: 56px; letter-spacing: -0.02em; background: linear-gradient(135deg, var(--car), var(--car-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#dUnit { font-size: 22px; color: var(--ink-2); }
.readout .v { margin-top: 6px; }
.where { margin: 12px 0 4px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--glass-2); font-size: 18px; font-weight: 800; line-height: 1.35; }
.where:empty { display: none; }
.backphoto { width: 100%; max-height: 220px; object-fit: cover; border-radius: 18px; margin-top: 8px; border: 1px solid var(--line-2); }

/* map markers */
.mk-me { width: 22px; height: 22px; border-radius: 50%; background: #3aa8ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(58, 168, 255, 0.28), 0 2px 8px rgba(0, 0, 0, 0.5); }
.mk-me.stale { background: #8a94a6; box-shadow: 0 0 0 6px rgba(138, 148, 166, 0.25); }
.mk-pin { width: 38px; height: 46px; transform-origin: 50% 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)); }
.mk-pin svg { width: 38px; height: 46px; stroke: none; }

/* modal, photo, toast */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: end center; padding: 12px; background: rgba(3, 4, 8, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal .card { width: 100%; max-width: 520px; max-height: calc(100dvh - 24px); overflow-y: auto; border-radius: 26px; border: 1px solid var(--line-2); background: var(--glass); padding: 20px 18px calc(env(safe-area-inset-bottom) + 14px); box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; }
.modal p { font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.keyrow { display: flex; gap: 8px; margin: 12px 0 4px; }
.keyrow input { flex: 1; min-width: 0; height: 48px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--glass-2); padding: 0 14px; font-size: 16px; outline: none; font-family: ui-monospace, Menlo, monospace; }
.keyrow input:focus { border-color: var(--park); }
.keyrow .ghost.small { min-height: 48px; }
.iconbtn.on { color: var(--on-color); border-color: transparent; background: linear-gradient(135deg, var(--park), var(--park-2)); }
.results .credit { font-size: 12px; color: var(--ink-3); padding: 8px 4px 0; }
.results .credit a { color: var(--ink-2); }
.meter { height: 12px; border-radius: 6px; background: var(--glass-2); border: 1px solid var(--line); overflow: hidden; margin: 14px 0 6px; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--park), var(--park-2)); transition: width 0.3s ease; }
.photoview { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.92); display: grid; place-items: center; padding: 12px; }
.photoview img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 60px); z-index: 40; transform: translate(-50%, -12px); opacity: 0;
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); font-size: 15px; font-weight: 650; box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .sheet { left: 16px; right: auto; bottom: 16px; width: 420px; margin: 0; border-radius: 26px; border-bottom: 1px solid var(--line); max-height: calc(100dvh - 96px); }
  .fab { bottom: 28px; }
  .maplibregl-ctrl-bottom-left { left: 452px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
