:root {
  --bg:#10141a; --surface:#1b2029; --surface2:#232936; --text:#e6e9ef; --muted:#8a93a2;
  --accent:#4c8dff; --accent-ink:#ffffff; --border:#262c37; --shadow:rgba(0,0,0,.45); --pink:#ff5a7a;
}
body.light {
  --bg:#eef1f5; --surface:#ffffff; --surface2:#f1f3f7; --text:#17202a; --muted:#5a6472;
  --accent:#2f6fe0; --accent-ink:#ffffff; --border:#e3e7ee; --shadow:rgba(20,30,50,.18); --pink:#e03e63;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, Roboto, "Segoe UI", sans-serif; }
#map { position: absolute; inset: 0; background: var(--bg); }

#topbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: flex-start; z-index: 5; pointer-events: none; }
#topbar > * { pointer-events: auto; }
#searchwrap { position: relative; flex: 1; max-width: 460px; background: var(--surface); border-radius: 26px;
  box-shadow: 0 2px 12px var(--shadow); display: flex; align-items: center; padding: 0 8px 0 14px; height: 48px; }
#searchwrap .ic { width: 20px; height: 20px; fill: var(--muted); flex: 0 0 auto; }
#search { flex: 1; border: 0; background: transparent; color: var(--text); font-size: 16px; outline: none; padding: 0 8px; }
#search::placeholder { color: var(--muted); }
#clear { border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; padding: 6px; }
#suggest { position: absolute; top: 54px; left: 0; right: 0; background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: 0 6px 20px var(--shadow); display: none; }
#suggest.open { display: block; }
.sug { padding: 11px 16px; color: var(--text); font-size: 14px; cursor: pointer; border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug:first-child { border-top: 0; }
.sug:hover { background: var(--surface2); }

.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 22px; height: 44px; padding: 0 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 12px var(--shadow); }
#account .who { display: flex; align-items: center; gap: 8px; background: var(--surface); color: var(--text); border-radius: 22px; height: 44px; padding: 0 14px 0 6px; box-shadow: 0 2px 12px var(--shadow); cursor: pointer; }
#account .who .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
#account .who .nm { font-size: 14px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#card { position: absolute; left: 12px; right: 12px; bottom: 16px; max-width: 460px; margin: 0 auto; background: var(--surface);
  color: var(--text); border-radius: 16px; box-shadow: 0 6px 24px var(--shadow); padding: 16px 18px; z-index: 5; }
#card h2 { margin: 0 0 4px; font-size: 18px; }
#card .sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
#card .stats { display: flex; gap: 22px; margin: 10px 0 14px; }
#card .stats b { font-size: 20px; display: block; }
#card .stats span { color: var(--muted); font-size: 12px; }
#card .row { display: flex; gap: 10px; }
#card .row .btn { flex: 1; }
.ghost { background: var(--surface2) !important; color: var(--text) !important; }

.fab { position: absolute; right: 16px; bottom: 120px; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--surface); box-shadow: 0 2px 12px var(--shadow); cursor: pointer; z-index: 5; display: grid; place-items: center; }
.fab svg { width: 24px; height: 24px; fill: var(--accent); }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* Account panel (Profile + Settings) — slides in from the right, map stays visible */
#scrim { position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 8; display: none; }
#scrim.open { display: block; }
#panel { position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 88vw; background: var(--bg);
  color: var(--text); box-shadow: -6px 0 24px var(--shadow); z-index: 9; transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; }
#panel.open { transform: none; }
#panel .phead { display: flex; align-items: center; gap: 12px; padding: 18px 18px 10px; }
#panel .phead .avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 20px; }
#panel .phead .nm { font-weight: 700; font-size: 16px; }
#panel .phead .em { color: var(--muted); font-size: 13px; }
#panel .pclose { margin-left: auto; background: transparent; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
#panel .tabs { display: flex; padding: 6px 18px 0; gap: 8px; border-bottom: 1px solid var(--border); }
#panel .tab { padding: 10px 4px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; }
#panel .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
#panel .pbody { padding: 18px; overflow: auto; }
#panel .field { margin-bottom: 16px; }
#panel .field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
#panel .field .val { font-size: 15px; word-break: break-all; }
#panel .seg { display: inline-flex; background: var(--surface2); border-radius: 12px; padding: 3px; }
#panel .seg button { border: 0; background: transparent; color: var(--muted); padding: 8px 16px; border-radius: 9px; font-weight: 600; cursor: pointer; }
#panel .seg button.on { background: var(--accent); color: var(--accent-ink); }
#panel .signout { margin-top: 8px; width: 100%; background: var(--surface2); color: var(--pink); border: 0; border-radius: 12px; padding: 13px; font-weight: 600; cursor: pointer; }
#panel[hidden] { display: none; }
