:root {
  --bg: #070708;
  --bg-elev: #121214;
  --bg-card: #1a1a1e;
  --line: #2a2a32;
  --text: #f4f1ea;
  --muted: #9a958c;
  --accent: #f4b942;
  --accent-2: #ff6b4a;
  --good: #3dd68c;
  --danger: #ff5d73;
  --map-overlay: rgba(7, 7, 8, 0.72);
  --radius: 18px;
  --nav-h: 68px;
  --safe: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --content-max: 760px;
  --wide-max: 1120px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

#app {
  width: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: var(--bg);
  position: relative;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  font-size: 16px;
}
button, a, .chip, .nav-btn, .role-card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { cursor: pointer; }
img, video { max-width: 100%; display: block; }

.ic { display: block; flex: none; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen.pad {
  max-width: 620px;
  margin: 0 auto;
}
/* Only centre vertically when the viewport is tall enough to avoid clipping */
@media (min-height: 720px) {
  .screen.pad { justify-content: center; }
}

.pad { padding: clamp(16px, 3.5vw, 32px); }
.pad-x {
  padding-left: clamp(16px, 3.5vw, 32px);
  padding-right: clamp(16px, 3.5vw, 32px);
}

.brand {
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(28px, 3vw, 34px);
}
.brand span { color: var(--accent); }

.splash {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  border: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
}
.splash-logo {
  width: 112px;
  height: 112px;
  animation: splash-pop 0.65s ease both;
}
.splash-brand {
  font-size: clamp(34px, 6vw, 48px);
  animation: splash-pop 0.65s ease 0.12s both;
}
.splash-slogan {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2.4vw, 20px);
  animation: splash-pop 0.65s ease 0.24s both;
}
@keyframes splash-pop {
  from { opacity: 0; transform: scale(0.84) translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-logo, .splash-brand, .splash-slogan { animation: none; }
}

.muted { color: var(--muted); }
.small { font-size: 13px; }

.hero-copy h1 {
  font-size: clamp(32px, 4.5vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 8px 0 12px;
}

.role-grid { display: grid; gap: 12px; margin-top: 28px; }
.role-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
  display: flex;
  gap: 14px;
  align-items: center;
}
.role-card:hover { border-color: var(--accent); }
.role-emoji {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: #26262c;
  color: var(--accent);
}
.role-card h3 { margin: 0 0 4px; }
.role-card p { margin: 0; color: var(--muted); font-size: 13px; }
.resume-hint {
  margin-top: 8px !important;
  color: var(--accent) !important;
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: #1a1408;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn.secondary { background: #26262c; color: var(--text); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.get-app {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.get-app h3 { margin: 0 0 10px; font-size: 16px; }
.get-app-steps {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.get-app-steps li { margin: 0 0 6px; }
.get-app-steps code {
  font-size: 11px;
  color: var(--text);
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 6px;
}
.get-app-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.get-app a.btn { text-decoration: none; }

.phone-url {
  display: block;
  margin: 10px 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  word-break: break-all;
  text-align: center;
}
.phone-qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 8px auto 12px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label { font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select {
  background: #101013;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}
.field textarea { min-height: 88px; resize: vertical; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #141418;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
}
.chip.active {
  background: var(--accent);
  color: #1a1408;
  border-color: var(--accent);
}

.tabs-page {
  padding-bottom: calc(var(--nav-h) + var(--safe) + 8px);
  height: 100dvh;
  height: -webkit-fill-available;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs-page > div:not(.map-wrap) {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
.tabs-page > div.page-wide { max-width: var(--wide-max); }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe));
  padding-bottom: var(--safe);
  padding-left: max(var(--safe-left), max(0px, calc((100vw - 560px) / 2)));
  padding-right: max(var(--safe-right), max(0px, calc((100vw - 560px) / 2)));
  background: rgba(12,12,14,.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  z-index: 30;
}
.nav-btn {
  background: none;
  border: 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
}
.nav-btn .ico { display: grid; place-items: center; line-height: 1; }
.nav-btn.active { color: var(--accent); }

.map-wrap {
  position: absolute;
  inset: var(--safe-top) 0 calc(var(--nav-h) + var(--safe)) 0;
}
#leaflet-map { height: 100%; width: 100%; background: #1b1b1f; touch-action: pan-x pan-y; position: relative; z-index: 0; }

.map-top {
  position: absolute;
  top: 12px; left: 12px; right: 64px;
  max-width: 560px;
  z-index: 1200;
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.map-top .chips {
  flex-wrap: wrap;
  overflow: visible;
}

.switch-role {
  position: fixed;
  top: max(12px, calc(var(--safe-top) + 8px)); right: max(12px, var(--safe-right));
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--map-overlay);
  border: 1px solid var(--line);
  color: var(--text);
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
  z-index: 600;
}
.switch-role:hover { border-color: var(--accent); color: var(--accent); }
.search-pill {
  background: var(--map-overlay);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-pill input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 16px;
}
.pill-ic { color: var(--muted); display: grid; place-items: center; }
.loc-status {
  margin-top: 8px;
  font-size: 11px;
  background: var(--map-overlay);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
}
.loc-status.loc-ask {
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  border-color: var(--accent);
  color: var(--accent);
  cursor: pointer;
}
.loc-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 42ch;
}
#range-count { display: block; width: max-content; margin-top: 6px; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(61,214,140,.7);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(61,214,140,0); }
}

.map-pin {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  color: #16161a;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
  border: 2px solid #fff;
}
.map-pin.user { background: #1a1408; border-color: var(--accent); color: var(--accent); }
.map-pin.dest { background: #2a120c; border-color: var(--accent-2); color: var(--accent-2); }
.map-pin.spot { background: #16161a; border-color: #fff; color: #fff; }

.sheet {
  position: absolute;
  left: 10px; right: 10px;
  max-width: 460px;
  bottom: calc(var(--nav-h) + var(--safe) + 10px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  z-index: 520;
  max-height: 42vh;
  overflow: auto;
}
.sheet h3 { margin: 0 0 4px; }
.sheet .close {
  position: absolute; top: 10px; right: 10px;
  background: #26262c; border: 0; width: 28px; height: 28px; border-radius: 50%;
}

.topbar {
  padding: 14px 64px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.topbar h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.card .body { padding: 12px; }
.grid-explore {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 118px;
  gap: 2px;
  padding: 2px;
}
.grid-explore .tile-wrap {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #222;
}
.grid-explore .tile {
  position: relative;
  z-index: 0;
  aspect-ratio: auto;
  height: 100%;
  width: 100%;
  border: 0;
  padding: 0;
  background: #222;
  overflow: hidden;
}
.grid-explore .tile-wrap.tall {
  grid-row: span 2;
}
.grid-explore img, .grid-explore video {
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none;
}
.tile .badge {
  position: absolute; top: 7px; right: 7px;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.8));
}
.tile-likes {
  position: absolute;
  left: 7px;
  bottom: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.8));
}

.post-hero { width: 100%; max-height: 70vh; object-fit: cover; background: #111; }
.actions { display: flex; gap: 16px; padding: 12px 4px; }
.actions button {
  background: none;
  border: 0;
  color: var(--text);
  padding: 2px;
  display: grid;
  place-items: center;
}
.actions button.liked { color: var(--danger); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; background: #333;
  flex: none;
}
.avatar.lg { width: 86px; height: 86px; }
.avatar.placeholder {
  display: grid;
  place-items: center;
  background: #26262c;
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
}
.avatar.lg.placeholder { font-size: 28px; }

.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-bio { margin: 8px 0 0; font-size: 14px; line-height: 1.4; }
.tile-del {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1100;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 7, 8, 0.65);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  pointer-events: auto;
}
.tile-del:hover,
.actions [data-del-post]:hover { color: var(--danger); }
.photo-chip .tile-del {
  width: 22px;
  height: 22px;
}
.photo-chip {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #222;
}
.photo-chip img, .photo-chip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-row { flex-wrap: wrap; }

.people-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 0 2px;
  scrollbar-width: none;
}
.people-strip::-webkit-scrollbar { display: none; }
.person {
  flex: 0 0 auto;
  width: 66px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.person .avatar {
  width: 58px; height: 58px;
  border: 2px solid var(--line);
}
.person span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person:hover .avatar { border-color: var(--accent); }

.mini-map {
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 8px;
}
.mini-map > div { height: 100%; width: 100%; }

.comment {
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid #222;
}

.biz-hero {
  height: clamp(180px, 24vw, 300px);
  background-size: cover;
  background-position: center;
  position: relative;
}
.biz-hero.empty { background: var(--bg-card); }
.biz-hero .shade {
  position: absolute; inset: 0;
  background: linear-gradient(transparent, #070708);
}

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat-row strong { display: block; font-size: 18px; }
.stat-row span { font-size: 11px; color: var(--muted); }

.msg-thread { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #26262c;
  font-size: 14px;
}
.bubble.me { margin-left: auto; background: #3a2a10; }

.cal-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #121214;
}
.event-dot { color: var(--accent); }

.month-cal { margin: 4px 0 12px; }
.cal-week, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-week { font-size: 11px; color: var(--muted); margin: 8px 0 4px; }
.cal-cell {
  min-height: 38px;
  border-radius: 8px;
  background: #101013;
  font-size: 11px;
  padding: 4px 2px;
}
.cal-cell.empty { background: transparent; }
.cal-cell.has { border: 1px solid var(--accent); }
.cal-cell i {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 1px;
}

.hidden { display: none !important; }
.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 24px);
  background: #fff;
  color: #111;
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 80;
  font-size: 13px;
  font-weight: 700;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #222;
}
.stars { color: var(--accent); letter-spacing: 2px; }

.list-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #222;
  background: none;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  text-align: left;
}

.perm-note {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.45;
}
.perm-screen {
  max-width: 620px;
  margin: 0 auto;
  padding-bottom: 40px;
}
.perm-screen h1 {
  font-size: clamp(26px, 3.4vw, 36px);
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin: 10px 0 12px;
}
.perm-list { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 18px; }
.perm-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.perm-ico {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: #26262c;
  color: var(--accent);
  display: grid;
  place-items: center;
}
.perm-copy p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.perm-copy strong { font-size: 14px; }
.perm-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 88px;
}
.perm-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.perm-status[data-status="granted"] { color: var(--good); }
.perm-status[data-status="denied"] { color: var(--danger); }
.perm-status[data-status="asking"] { color: var(--accent); }
.perm-screen .btn.block { margin-top: 8px; }

@media (max-width: 520px) {
  .perm-row { grid-template-columns: 44px 1fr; }
  .perm-side { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; min-width: 0; }
}

.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.85) saturate(0.4); }
.leaflet-container { background: #0b0b0d; }

/* Tablets and large phones in landscape */
@media (min-width: 600px) {
  .grid-explore { grid-auto-rows: 150px; gap: 3px; }
  .role-grid { grid-template-columns: 1fr 1fr; }
  .role-card { flex-direction: column; align-items: flex-start; }
}

/* Laptops and desktops: side rail instead of a bottom bar */
@media (min-width: 900px) {
  :root { --content-max: 900px; }

  .bottom-nav {
    top: 0; bottom: 0;
    right: auto;
    width: var(--sidebar-w);
    height: 100dvh;
    padding: 20px 12px calc(20px + var(--safe));
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 4px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 14px;
    padding: 12px 14px;
    border-radius: 14px;
  }
  .nav-btn.active { background: var(--bg-card); }

  .tabs-page {
    padding-left: calc(var(--sidebar-w) + 20px);
    padding-right: 20px;
    padding-bottom: 0;
  }
  .map-wrap { inset: 0 0 0 var(--sidebar-w); }
  .sheet { left: calc(var(--sidebar-w) + 18px); right: auto; bottom: 18px; max-height: 60vh; }
  .toast { left: calc(50% + var(--sidebar-w) / 2); bottom: 28px; }

  .grid-explore {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 180px;
    gap: 4px;
  }
  .post-hero { max-height: 62vh; }
}

/* Wide desktops */
@media (min-width: 1280px) {
  :root { --content-max: 1040px; --wide-max: 1280px; }
  .grid-explore {
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 200px;
  }
}
