:root {
  /* Premium near-black neutral base (SPECS-leaning), warm fun accents */
  --bg: #08080a;
  --panel: #0f0f11;
  --panel-2: #17171a;
  --ink: #f6f6f7;
  --muted: #97979e;
  --line: #232327;
  --specs: #fffc00;   /* SPECS / Snap signature yellow — brand tie-in */
  --pop: #ff4fa3;     /* squeaky pink — our fun */
  --pop-2: #6c5cff;   /* capsule purple */
  --mint: #46e6c4;    /* seek green */
  --gold: #fffc00;    /* early-adopter badge uses the SPECS yellow */
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  --header-h: 66px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(8, 8, 10, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.logo {
  font-size: 25px; font-weight: 700; letter-spacing: -0.4px;
  color: var(--ink); cursor: pointer; transition: opacity .12s;
}
.logo:hover { opacity: 0.8; }
.tagline {
  color: var(--muted); font-size: 11px; font-family: 'Space Mono', monospace;
  text-transform: uppercase; letter-spacing: 1.6px;
}
@media (max-width: 1080px) { .tagline { display: none; } }

.header-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.header-right .who { color: #fff; font-weight: 600; font-size: 14px; }
.header-right .who.ea { color: var(--gold); }

/* Username hover/tap menu */
.user-menu-wrap { position: relative; }
.who-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 6px 2px; color: inherit; font: inherit; cursor: pointer;
}
.who-caret { color: var(--muted); transition: transform .15s; }
.user-menu-wrap.open .who-caret { transform: rotate(180deg); }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.user-menu-wrap.open .user-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.um-badge {
  display: flex; align-items: center; gap: 10px; padding: 9px;
  background: var(--panel-2); border-radius: 10px; margin-bottom: 6px;
}
.um-badge img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.um-badge strong { display: block; font-size: 13px; color: var(--gold); }
.um-badge span { font-size: 11px; color: var(--muted); }
.um-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; color: var(--ink); padding: 10px 9px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.um-item:hover { background: var(--panel-2); }
.um-item svg { color: var(--muted); flex: 0 0 auto; }
.um-logout { color: var(--danger); }
.um-logout svg { color: var(--danger); }
.um-ships { padding: 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.um-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 8px; }
.um-ship-opts { display: flex; gap: 8px; }
.um-ship {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 6px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.um-ship img { width: 40px; height: 40px; object-fit: contain; }
.um-ship.active { border-color: var(--ink); color: var(--ink); }
.um-ship:not(:disabled):hover { border-color: var(--muted); }
.um-ship:disabled { opacity: .5; cursor: not-allowed; }
.um-lock { font-size: 8.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.chip-logout {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.chip-logout:hover { border-color: var(--muted); color: var(--ink); }
.chip-login {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.chip-login:hover { border-color: var(--muted); background: #1c1c20; }

/* SPECS brand tie-in pill */
.specs-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase; font-weight: 500;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; white-space: nowrap;
}
.specs-tag::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7;
  transition: background .15s, box-shadow .15s;
}
/* Clickable SPECS tag -> specs.com */
a.specs-tag {
  text-decoration: none; cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s, background .15s;
}
a.specs-tag:hover {
  color: var(--ink); border-color: var(--ink); background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}
a.specs-tag:hover::before { background: var(--specs); box-shadow: 0 0 8px rgba(255, 252, 0, 0.8); }
@media (max-width: 720px) { .specs-tag { display: none; } }

/* Central location search + popular quick-links — one inline group */
.search-hero {
  flex: 0 1 auto; display: flex; flex-direction: row; align-items: center; gap: 12px;
  min-width: 0;
}
.search-box { position: relative; width: 300px; max-width: 38vw; flex: 0 0 auto; }
.search-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
#locSearch {
  width: 100%; height: 42px; padding: 0 16px 0 40px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-size: 14px;
}
#locSearch::placeholder { color: var(--muted); }
#locSearch:focus { outline: none; border-color: var(--muted); background: #1c1c20; }

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 320px; overflow-y: auto;
}
.sr-item {
  padding: 11px 16px; font-size: 13.5px; color: var(--ink); cursor: pointer;
  border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover { background: var(--panel-2); }
.sr-empty { padding: 12px 16px; font-size: 13px; color: var(--muted); }
.sr-item.sr-snap { display: flex; align-items: center; gap: 10px; white-space: normal; }
.sr-tag { flex: 0 0 auto; font-size: 9px; font-weight: 700; letter-spacing: 1px; color: #1a1a1a; background: var(--specs); border-radius: 5px; padding: 3px 6px; }
.sr-tag-loc { background: var(--mint); color: #06231c; display: inline-flex; align-items: center; padding: 4px 5px; }
.sr-main { display: flex; flex-direction: column; min-width: 0; }
.sr-name { font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.popular { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.pop-chip {
  height: 42px; display: inline-flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 1px; white-space: nowrap;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 16px; color: var(--ink); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.pop-chip:hover { border-color: var(--muted); background: var(--panel-2); }
.pop-name { font-weight: 600; font-size: 12.5px; line-height: 1.15; }
.pop-count { color: var(--muted); font-size: 10.5px; line-height: 1.15; }
@media (max-width: 900px) { .popular { display: none; } }

/* Category filter */
.filter { position: relative; flex: 0 0 auto; }
.filter-btn {
  height: 42px; display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.filter-btn:hover { border-color: var(--muted); }
.filter-count { background: var(--ink); color: #0b0b0d; border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 16px; text-align: center; font-weight: 700; }
.filter-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 10px;
}
.filter-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); }
.filter-link { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.filter-link:hover { color: var(--ink); }
.filter-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.filter-row:hover { background: var(--panel-2); }
.filter-row input { accent-color: var(--ink); width: 16px; height: 16px; }
.filter-label { flex: 1; font-size: 13px; color: var(--ink); }
.filter-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .filter { display: none; } }
@media (max-width: 680px) { .search-hero { flex-basis: 240px; } .specs-tag { display: none; } }

/* ── Stage layout ───────────────────────────────────── */
.stage { display: flex; height: calc(100% - var(--header-h)); }
.map-wrap { position: relative; flex: 1 1 auto; }
#map { position: absolute; inset: 0; }

.panel {
  width: 380px; flex: 0 0 380px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Tabs ───────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; background: none; border: 0; color: var(--muted);
  padding: 16px 8px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.3px;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.count-badge {
  background: #fff; color: #0b0b0d; border-radius: 10px;
  padding: 1px 7px; font-size: 12px; margin-left: 4px; font-weight: 700;
}
.tab-body { padding: 18px; overflow-y: auto; flex: 1; }

.lede { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.lede strong { color: var(--ink); }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 14px; line-height: 1.5; }

/* ── Dropzone ───────────────────────────────────────── */
.dropzone {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--panel-2); padding: 26px; text-align: center;
  transition: border-color .15s, transform .15s, box-shadow .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag {
  border-color: rgba(255,255,255,.32);
  background: var(--panel);
  transform: translateY(-1px);
}
/* Capsule icon (real capsule.png) that tints to the hovered file type */
.dz-cap {
  position: relative; width: 56px; height: 56px; margin: 0 auto 10px; isolation: isolate;
  transition: transform .2s cubic-bezier(.2, 1.4, .5, 1);
}
.dz-cap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dz-cap-tint {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(/capsule.png) center / contain no-repeat;
  mask: url(/capsule.png) center / contain no-repeat;
  mix-blend-mode: color; opacity: 0; transition: opacity .2s;
}
.dz-cap.pop { transform: scale(1.18); }

/* A few example formats — hover one to tint the capsule to that type */
.dz-examples { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.dz-examples span {
  cursor: pointer; transition: color .15s, transform .15s; display: inline-block;
}
.dz-examples span[data-type]:hover { transform: scale(1.12); font-weight: 600; }
/* "more" -> rainbow cycle on the capsule */
.dz-more {
  background: linear-gradient(90deg, #ff5da2, #ffd25d, #46e6c4, #5cc8ff, #b98cff, #ff5da2);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 600;
}
.dz-more:hover { animation: moreShift 1.1s linear infinite; transform: scale(1.12); }
@keyframes moreShift { to { background-position: 300% 0; } }
.dz-cap.rainbow { transform: scale(1.18); }
/* `hue` blend keeps the capsule's own brightness, so the rainbow cycles the
   colour without gamma blow-out the way `color` did. */
.dz-cap.rainbow .dz-cap-tint {
  opacity: 1; background: #ff0048; mix-blend-mode: hue;
  animation: capHue 1.2s linear infinite;
}
@keyframes capHue { to { filter: hue-rotate(360deg); } }
.dz-max { font-size: 12px; color: var(--muted); }
.dz-text { color: var(--muted); font-size: 14px; line-height: 1.4; }
.dz-text strong { color: var(--ink); }

/* ── Preview ────────────────────────────────────────── */
.preview { margin-top: 14px; }
#placeCapsule, #cardCanvas {
  width: 100%; aspect-ratio: 1 / 1; display: block;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 35%, #241f38, #110f1c 70%);
}

/* ── To-scale upload preview (three.js orbit scene) ──── */
.scale-stage { width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; position: relative; background: #0c0c11; }
.scale-stage canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.scale-stage canvas:active { cursor: grabbing; }
.ss-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 11px;
  background: #0b0b0fcc; border: 1px solid var(--line); border-radius: 12px; padding: 8px 13px; backdrop-filter: blur(8px);
}
.ss-bar button { background: none; border: 0; color: var(--ink); cursor: pointer; display: flex; padding: 0; }
.ss-bar svg { width: 18px; height: 18px; fill: currentColor; }
.ss-bar input[type="range"] { flex: 1; accent-color: var(--ink); }
.ss-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-meta { margin: 10px 2px; }
.filename {
  font-family: 'Space Mono', monospace; font-size: 15px; word-break: break-all; color: var(--ink);
}
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Drop tab: placement state fills the panel, Place button pinned to bottom */
.tab-body[data-body="drop"] { display: flex; flex-direction: column; }
.place-state { display: flex; flex-direction: column; flex: 1; }
.back-btn { align-self: flex-start; margin-bottom: 14px; }
.place-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }

/* Early-adopter selfie flow */
.selfie { display: flex; flex-direction: column; gap: 12px; }
.selfie-head { text-align: center; }
.selfie-badge { display: inline-block; font-size: 10px; letter-spacing: 1.6px; font-weight: 700;
  color: var(--specs); border: 1px solid var(--specs); border-radius: 999px; padding: 4px 11px; margin-bottom: 8px; }
.selfie-title { font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.selfie-head p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.selfie-cam { width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: #000; }
.selfie-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.selfie-actions { display: flex; flex-direction: column; gap: 8px; }

/* Floating vs ground anchor toggle */
.anchor-toggle { display: flex; gap: 6px; margin-top: 10px; }
.anchor-toggle button {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.anchor-toggle button.active { color: var(--ink); border-color: var(--ink); background: #1c1c20; }

/* My Seeks: center the single login button when logged out */
.seeks-body { display: flex; flex-direction: column; }
.seeks-body.centered { justify-content: center; }

/* ── Buttons ────────────────────────────────────────── */
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--ink); }
.btn.primary { background: var(--ink); color: #0b0b0d; }
.btn.primary:hover { background: #ffffff; }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.primary.block { padding: 13px; }
.btn:disabled { cursor: default; opacity: .8; }
.btn.primary:disabled { animation: btnPulse 1.1s ease-in-out infinite; }
@keyframes btnPulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
.place-state.posting .preview { opacity: .55; transition: opacity .2s; }

/* ── Placement overlay ──────────────────────────────── */
.place-overlay { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.fence-msg {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 18;
  background: var(--specs); color: #1a1a1a; font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none;
}
.place-reticle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -100%);
  width: 96px; height: auto; pointer-events: none;
}
/* The crane: claw + clear capsule, pivoting from the top so it swings as you pan */
.crane {
  transform-origin: 50% 3px; /* pivot at the claw top, where the ship holds it */
  transition: transform .38s cubic-bezier(.34, .7, .4, 1.5);
  will-change: transform;
}
.claw-img {
  display: block; width: 40px; aspect-ratio: 256 / 346; margin: 0 auto -5px; position: relative; z-index: 3;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45));
}
.clear-cap { position: relative; width: 44px; margin: 0 auto; }
.cap-clear-img {
  position: relative; z-index: 2; width: 100%; aspect-ratio: 128 / 129; display: block;
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, .5));
}
.cap-glow {
  position: absolute; z-index: 0; inset: 22% 22% 24%; border-radius: 50%;
  filter: blur(11px); opacity: .55;
}
.cap-inner {
  position: absolute; z-index: 1; inset: 16% 18% 22%;
  display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 12px;
}
.cap-inner .pc-media { width: 100%; height: 100%; object-fit: cover; }
.cap-inner .pc-glyph { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.reticle-pin {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ink);
  margin: 4px auto 0; box-shadow: 0 0 0 6px rgba(255,255,255,.22), 0 6px 10px rgba(0,0,0,.4);
}

/* Empty-state graphic (no seeks / no speeks yet) */
.empty-graphic { text-align: center; padding: 20px 12px; }
.empty-graphic img {
  width: 112px; height: auto; display: block; margin: 0 auto 12px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}
.empty-graphic p { margin: 0; color: var(--muted); font-size: 14px; }
.place-hud {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; width: min(420px, 90%); text-align: center; pointer-events: auto; box-shadow: var(--shadow);
}
.place-hud p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.place-actions { display: flex; gap: 8px; justify-content: center; }

/* ── Capsule markers on map ─────────────────────────── */
/* The root element is positioned by Mapbox (inline transform) every frame —
   it must NOT have a CSS transition or it lags behind the map. Hover/scale
   animation lives on the inner .cap instead. */
/* Don't set `position` here — Mapbox sets position:absolute on the marker
   element to track the map; overriding it makes markers drift on zoom.
   Its absolute positioning already anchors the inset cap-tint overlay. */
.speek-marker { width: 36px; height: 36px; cursor: pointer; isolation: isolate; }
.speek-marker img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transform-origin: 50% 60%; transition: transform .12s;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
  -webkit-user-drag: none; user-select: none;
}
/* Type-coloured tint, masked to the capsule shape, blended onto the image */
.speek-marker .cap-tint {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(/capsule.png) center / contain no-repeat;
  mask: url(/capsule.png) center / contain no-repeat;
  mix-blend-mode: color; opacity: 0.85;
  transform-origin: 50% 60%; transition: transform .12s;
}
.speek-marker:hover img, .speek-marker:hover .cap-tint { transform: scale(1.18); }

/* The user's own location — an alien standing on the spot */
.user-marker { width: 34px; cursor: default; }
.user-marker img {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.65));
  transition: opacity .4s ease, transform .4s ease;
}
/* "Boarding" — the alien shrinks away as it becomes the ship at takeoff */
.user-marker.boarding img { opacity: 0; transform: scale(.45) translateY(-6px); }
.speek-marker.seeked img {
  filter: drop-shadow(0 0 5px var(--mint)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}

/* ── Ships: live presence on the map ──────────────────── */
/* Your own ship hovers at the centre of the view — the world flies past it. */
.my-ship {
  position: absolute; left: 50%; top: 50%;
  width: 66px; margin-left: -33px; margin-top: -34px;
  z-index: 16; pointer-events: none;
  transition: left .1s linear, top .1s linear;
}
.my-ship img {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 9px 12px rgba(0, 0, 0, 0.5));
  animation: ship-bob 3.4s ease-in-out infinite;
}
.my-ship.dropping img { animation: ship-drop .6s ease-in; }
@keyframes ship-bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-6px) rotate(1.5deg); }
}
@keyframes ship-drop {
  0% { transform: translateY(0); }
  40% { transform: translateY(9px) scale(.95); }
  100% { transform: translateY(0); }
}

/* Other people's ships — Mapbox controls the root transform, so flip/bob live
   on inner wrappers to avoid fighting the positioning transform. */
.ship-marker { width: 66px; cursor: pointer; }
.ship-inner { width: 100%; }
.ship-marker img {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  animation: ship-bob 3.4s ease-in-out infinite;
}
.ship-marker:hover img {
  filter: drop-shadow(0 0 6px var(--specs)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

/* ── Selected speek card ────────────────────────────── */
.speek-card {
  position: fixed; left: 0; top: 0; z-index: 30;
  transform: translate(-50%, calc(-100% - 46px)); /* sit above the marker */
  width: min(300px, 86vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
/* little tail pointing down at the capsule */
.speek-card::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 10px solid var(--panel);
}
.speek-card::before {
  content: ''; position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent; border-right: 10px solid transparent;
  border-top: 11px solid var(--line);
}
/* Flipped: card sits below the marker, tail points up */
.speek-card.below { transform: translate(-50%, 0); }
.speek-card.below::after {
  bottom: auto; top: -9px;
  border-top: 0; border-bottom: 10px solid var(--panel);
}
.speek-card.below::before {
  bottom: auto; top: -11px;
  border-top: 0; border-bottom: 11px solid var(--line);
}

/* You (alien) popup — reuses the card shell, sits higher to clear the alien */
.user-card { transform: translate(-50%, calc(-100% - 66px)); width: min(260px, 84vw); }
.uc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.uc-alien { width: 32px; height: auto; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
.uc-title { font-size: 16px; font-weight: 700; line-height: 1.1; }
.uc-sub { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 3px; }
.uc-loc {
  font-family: 'Space Mono', monospace; font-size: 12px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; line-height: 1.4; word-break: break-word;
}
.card-close {
  position: absolute; top: 8px; right: 10px; background: none; border: 0;
  color: var(--muted); font-size: 24px; line-height: 1;
}
/* Card capsule stage: a frosted teaser of the content sits behind the capsule. */
.card-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1; margin-bottom: 10px;
  border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #241f38, #110f1c 70%);
}
.card-preview-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(16px) saturate(1.25) brightness(0.72); transform: scale(1.3);
  opacity: 0; transition: opacity .45s ease;
}
.card-preview-bg.show { opacity: 0.7; }
.card-stage #cardCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  aspect-ratio: auto; background: transparent; border-radius: 0;
}
/* Card transcript snippet (under the title) */
.card-desc { color: var(--muted); font-size: 12.5px; font-style: italic; line-height: 1.4; margin: -4px 0 12px; }

/* ── Audio description (drop panel) ──────────────────── */
.audio-desc { margin: 9px 0 4px; }
.ad-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.05); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ad-add:hover { border-color: var(--specs); }
.ad-recording { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.ad-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: ad-pulse 1s infinite; flex: none; }
@keyframes ad-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.ad-timer { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.ad-live { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-stop { background: var(--danger); color: #fff; border: 0; border-radius: 999px; padding: 4px 13px; font-size: 12px; font-weight: 700; cursor: pointer; flex: none; }
.ad-result {
  position: relative; display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 30px 8px 9px; font-size: 12.5px; color: var(--muted);
}
.ad-text { line-height: 1.4; flex: 1; min-width: 0; max-height: 3.8em; overflow: hidden; }
.ad-play {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #0b0b0d; border: 0; cursor: pointer;
}
.ad-play .ad-ic-stop { display: none; }
.ad-play.playing .ad-ic-play { display: none; }
.ad-play.playing .ad-ic-stop { display: inline; }
.ad-remove {
  position: absolute; top: 3px; right: 6px; background: none; border: 0;
  color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 2px;
}
.ad-remove:hover { color: var(--ink); }

/* Voice-note playback on the info card */
.card-ad-play {
  display: inline-flex; align-items: center; gap: 7px; margin: -2px 0 12px;
  background: rgba(255, 255, 255, 0.05); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.card-ad-play:hover { border-color: var(--muted); }
.card-ad-play .ad-ic-stop { display: none; }
.card-ad-play.playing .ad-ic-play { display: none; }
.card-ad-play.playing .ad-ic-stop { display: inline; }

/* ── Report modal ────────────────────────────────────── */
.modal.report { width: min(450px, 94vw); text-align: left; max-height: 88vh; overflow-y: auto; }
.report-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.report-lede { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.4; }
.report-cats { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.rcat { display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.rcat:hover { border-color: var(--muted); }
.rcat input { margin-top: 2px; accent-color: var(--specs); flex: none; }
.report-details {
  width: 100%; box-sizing: border-box; background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  padding: 9px 11px; font-size: 13px; font-family: inherit; resize: vertical; margin-bottom: 12px;
}
.dmca-fields {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.03);
}
.dmca-note { margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.dmca-fields input:not([type=checkbox]) {
  width: 100%; box-sizing: border-box; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 9px; color: var(--ink); padding: 9px 11px; font-size: 13px;
}
.dmca-sworn { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.dmca-sworn input { margin-top: 2px; accent-color: var(--specs); flex: none; }

/* Localhost-only dev button on the card */
.dev-regen { width: 100%; margin-top: 8px; opacity: 0.7; font-size: 11px; }
.dev-delete { width: 100%; margin-top: 6px; opacity: 0.75; font-size: 11px; color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }
.dev-delete:hover { opacity: 1; border-color: var(--danger); }
.card-filename { font-family: 'Space Mono', monospace; font-size: 14px; word-break: break-all; }
.card-by { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.card-by span#cardUploader { color: var(--ink); font-weight: 600; }
.badge {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; margin-left: 4px;
}
.card-scores { display: flex; gap: 10px; margin-bottom: 10px; }
.score {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; text-align: center;
}
.score .num { display: block; font-size: 22px; font-weight: 700; }
.score .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.card-sealed { font-size: 12px; color: var(--muted); text-align: center; margin: 0 0 12px; }
.card-actions { display: flex; flex-direction: column; gap: 8px; }
.card-sub { display: flex; gap: 8px; }
.card-sub .btn { flex: 1; }
.seeked-state .btn.primary { background: var(--panel-2); border: 1px solid var(--mint); color: var(--mint); }
.ask-row { display: flex; gap: 6px; margin-top: 8px; }
.ask-row input { flex: 1; }

/* ── Seeks list ─────────────────────────────────────── */
.seek-list { display: flex; flex-direction: column; gap: 10px; }
.seek-item {
  display: flex; align-items: center; gap: 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer;
}
.seek-item:hover { border-color: var(--muted); }
.seek-item .mini-cap { position: relative; width: 32px; height: 32px; flex: 0 0 auto; isolation: isolate; }
.seek-item .mini-cap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.seek-item .mini-cap-tint {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(/capsule.png) center / contain no-repeat;
  mask: url(/capsule.png) center / contain no-repeat;
  mix-blend-mode: color; opacity: 0.85;
}
.seek-item .si-name { font-family: 'Space Mono', monospace; font-size: 13px; word-break: break-all; }
.seek-item .si-by { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 10px; }
.context-auth { display: flex; flex-direction: column; gap: 10px; padding: 18px 0; }
.context-auth p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 6px; }
.context-sub { font-size: 12px !important; text-align: center; margin: 4px 0 0 !important; }
.btn.ghost.block { width: 100%; }
.account-row {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 13px; gap: 10px;
}
.account-row strong { color: var(--ink); }
.seek-requests { margin-top: 18px; }
.req-title { font-size: 13px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Speek grid (My Speeks + profiles) ──────────────── */
.my-speeks { margin-top: 20px; }
.ms-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ms-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); }
.ms-count {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px; font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.speek-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-cap {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 10px; cursor: pointer; text-align: center; color: var(--ink);
  transition: border-color .12s, transform .12s;
}
.grid-cap:hover { border-color: var(--muted); transform: translateY(-2px); }
.gc-cap { position: relative; width: 96px; height: 96px; isolation: isolate; }
.gc-canvas { width: 100%; height: 100%; display: block; }
.gc-cap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gc-tint {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(/capsule.png) center / contain no-repeat;
  mask: url(/capsule.png) center / contain no-repeat;
  mix-blend-mode: color; opacity: 0.85;
}
.gc-name { font-family: 'Space Mono', monospace; font-size: 11px; word-break: break-all; line-height: 1.3; }
.gc-loc { font-size: 10px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; text-align: center; padding: 20px 8px; line-height: 1.5; }

/* Profile view inside the panel */
.panel.profiling .tabs, .panel.profiling .tab-body { display: none; }
.panel-profile { padding: 18px; overflow-y: auto; flex: 1; }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.profile-id { display: flex; flex-direction: column; }
.profile-name { font-size: 18px; font-weight: 700; line-height: 1.1; }
.profile-count { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Clickable uploader name on the Speek card */
#cardUploader { cursor: pointer; }
#cardUploader:hover { text-decoration: underline; }

/* ── Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: #06050bcc; z-index: 50;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px);
}
.modal {
  width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px; position: relative; box-shadow: var(--shadow);
}
.auth-alien { width: 88px; margin: 12px auto 10px; position: relative; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }
.auth-alien #alienVid { display: none; }
.auth-alien #alienCanvas { width: 100%; height: auto; display: block; }
.auth-alien #alienFallback { display: none; width: 100%; height: auto; }
.auth-alien.fallback #alienCanvas { display: none; }
.auth-alien.fallback #alienFallback { display: block; }
.auth-title { text-align: center; font-size: 21px; font-weight: 700; margin: 0 0 18px; letter-spacing: -0.3px; }
.modal-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.mtab { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  padding: 9px; border-radius: 10px; font-weight: 600; }
.mtab.active { color: var(--ink); border-color: var(--muted); }
.mform { display: flex; flex-direction: column; gap: 10px; }
.modal-lede { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 4px; }
.mform input, .ask-row input {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; color: var(--ink); font-size: 14px; font-family: 'Space Mono', monospace;
}
.mform input:focus, .ask-row input:focus { outline: none; border-color: var(--muted); }
.order-hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.order-hint strong { color: var(--gold); }

/* Phone-auth bits */
.consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.consent input { margin: 2px 0 0; accent-color: var(--ink); flex: 0 0 auto; width: 16px; height: 16px; }
.consent-fine { font-size: 10.5px; color: var(--muted); line-height: 1.4; margin-top: -2px; }
.dev-code {
  font-size: 12px; color: var(--mint); background: rgba(70, 230, 196, 0.08);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-family: 'Space Mono', monospace;
}
#codeForm input[name="code"] { letter-spacing: 8px; text-align: center; font-size: 18px; }

/* Live username availability — takes zero space until it has a message */
.uname-status { font-size: 12px; margin: -4px 0 0; }
.uname-status:empty { display: none; }
.uname-status.checking { color: var(--muted); }
.uname-status.good { color: var(--mint); }
.uname-status.bad, .uname-status.taken { color: var(--danger); }

/* Phone fields are fully removed until the handle is confirmed, then fade in */
.reg-rest { display: none; }
.reg-rest.show {
  display: flex; flex-direction: column; gap: 10px;
  animation: revealRest .28s ease;
}
@keyframes revealRest { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.form-error { color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
.form-error:not(:empty) { margin-top: 8px; }

/* ── Welcome / intro modal ──────────────────────────── */
.modal.intro { width: min(474px, 94vw); text-align: center; }
.intro-visual {
  position: relative; background: #000; overflow: hidden;
  border-radius: 14px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: center; min-height: 0;
}
.intro-anim { width: 100%; height: auto; display: block; }
.intro-specs-svg { width: 80%; max-width: 240px; height: auto; margin: 22px auto; }
.intro-tag {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255, 255, 255, 0.72); color: #15151a; border-color: rgba(0, 0, 0, 0.12);
}
.intro-title { font-size: 24px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.4px; }
.intro-body { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 18px; }
.intro-body strong { color: var(--ink); }
.intro-steps { display: flex; flex-direction: column; gap: 11px; text-align: left; margin-bottom: 20px; }
.istep { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.istep div strong { color: var(--ink); font-weight: 700; }
.istep-n {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
}
.intro-go { padding: 14px; font-size: 15px; }

/* ── Share modal ────────────────────────────────────── */
.modal.share { width: min(440px, 94vw); }
.share-title { font-size: 20px; font-weight: 700; margin: 0 0 14px; }
.share-preview {
  position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  margin-bottom: 14px; background: var(--panel-2);
  aspect-ratio: 1200 / 630;            /* reserve the final image size up front */
  display: flex; align-items: center; justify-content: center;
}
.share-preview img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .25s; }
.share-preview.loading img { opacity: 0; }
.share-spinner {
  position: absolute; width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
.share-preview:not(.loading) .share-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.share-text { color: var(--muted); font-size: 14px; margin: 0 0 12px; line-height: 1.5; }
.share-link { display: flex; gap: 8px; margin-bottom: 14px; }
.share-link input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--ink); font-family: 'Space Mono', monospace; font-size: 12px;
}
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.share-net {
  flex: 1 1 auto; min-width: 84px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 11px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.share-net:hover { border-color: var(--muted); background: #1c1c20; }

/* ── Early adopter (order ID) modal ─────────────────── */
.modal.ea { width: min(380px, 92vw); text-align: center; }
.ea-badge-img { display: block; width: 120px; height: auto; margin: 4px auto 14px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }
.ea-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.ea-body { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.ea-body strong { color: var(--ink); }
#eaOrderId { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; color: var(--ink); font-family: 'Space Mono', monospace; font-size: 14px;
  margin-bottom: 10px; text-align: center; letter-spacing: 1px; }
#eaOrderId:focus { outline: none; border-color: var(--muted); }
.modal.ea .btn { margin-bottom: 8px; }

/* Change-handle modal */
.namechg-title { font-size: 21px; font-weight: 700; margin: 0 0 8px; }
.modal.namechg input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; color: var(--ink); font-size: 14px; font-family: 'Space Mono', monospace; margin: 10px 0 4px;
}
.modal.namechg input:focus { outline: none; border-color: var(--muted); }
.modal.namechg .btn { margin-top: 10px; }

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  padding: 12px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow);
  font-size: 14px; max-width: 90vw;
}
.toast.good { border-color: var(--mint); }
.toast.bad { border-color: var(--danger); }

/* Geofence creation tool (localhost only) */
.fence-tool {
  position: fixed; left: 14px; bottom: 14px; z-index: 45; width: 240px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.ft-head { font-size: 12px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.ft-dev { font-size: 9px; letter-spacing: 1px; font-weight: 700; color: var(--mint); border: 1px solid var(--mint); border-radius: 5px; padding: 1px 5px; }
.ft-draw.active { border-color: var(--mint); color: var(--mint); }
.ft-row { display: flex; gap: 6px; }
.ft-row .btn { flex: 1; }
.ft-status { font-size: 11px; color: var(--muted); min-height: 14px; }
.ft-out { width: 100%; height: 64px; resize: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: 'Space Mono', monospace; font-size: 10px; padding: 7px; }

.intro-legal { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.intro-legal a { color: var(--muted); text-decoration: none; }
.intro-legal a:hover { color: var(--ink); text-decoration: underline; }

.hidden { display: none !important; }

/* ── Mobile bottom sheet + nav (hidden on desktop) ──── */
.sheet-grabber { display: none; }
.sheet-backdrop { display: none; }
.mobile-nav { display: none; }

/* ── Responsive ─────────────────────────────────────── */
/* Tablet: stack the panel under the map. */
@media (min-width: 769px) and (max-width: 820px) {
  .stage { flex-direction: column-reverse; }
  .panel { width: 100%; flex: 0 0 auto; max-height: 46%; border-left: 0; border-top: 1px solid var(--line); }
}

/* Phone: native-app feel — bare header, full-screen map, bottom nav + sheet. */
@media (max-width: 768px) {
  :root { --mobile-nav-h: 64px; }

  /* 1) Header: just the logo on the left, the user on the right. */
  .topbar { padding: 0 16px; gap: 10px; }
  .brand { flex: 0 0 auto; gap: 8px; }
  .specs-tag { display: none; }
  .search-hero { display: none; }            /* search lives in the search sheet now */
  .header-right { flex: 1 1 auto; min-width: 0; }
  .header-right .who { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 2) Map fills the entire area under the header. */
  .stage { display: block; height: calc(100% - var(--header-h)); }
  .map-wrap { position: absolute; inset: var(--header-h) 0 0 0; }
  /* Keep Mapbox/MapLibre attribution + controls above the floating nav. */
  .mapboxgl-ctrl-bottom-left, .mapboxgl-ctrl-bottom-right,
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right {
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) - 2px);
  }

  /* The bottom nav is the tab selector on mobile — drop the in-sheet tabs. */
  .panel .tabs { display: none; }

  /* The panel becomes a slide-up bottom sheet that rests on top of the nav bar
     (so the nav stays visible + tappable while a sheet is open). */
  .panel {
    position: fixed; left: 0; right: 0; top: auto;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    width: 100%; flex: none;
    max-height: calc(100vh - var(--header-h) - var(--mobile-nav-h) - 12px);
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
    transform: translateY(130%);
    transition: transform .3s cubic-bezier(.22, .61, .36, 1), max-height .25s ease;
    z-index: 24;
  }
  body.sheet-open .panel { transform: translateY(0); }
  /* While placing a Speek, keep the sheet short so the map centre (the drop
     point) stays visible above it, and let the map be dragged behind. */
  body.placing .panel { max-height: 46vh; }

  .tab-body, .panel-profile { -webkit-overflow-scrolling: touch; }

  .sheet-grabber {
    display: block; width: 42px; height: 5px; border-radius: 3px;
    background: var(--line); margin: 9px auto 3px; flex: 0 0 auto;
  }

  /* Dim behind the sheet. Tapping it (the map, header, or dim) closes the sheet.
     Sits below the nav (25) and panel (24) so both stay interactive. */
  .sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 22;
    background: rgba(4, 4, 8, 0.42);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  body.placing .sheet-backdrop { opacity: 0; pointer-events: none; } /* free the map while positioning */

  /* 3) Bottom nav bar — above the sheet + dim so it's always tappable. */
  .mobile-nav {
    display: flex; align-items: stretch; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(8, 8, 10, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .mnav-btn {
    flex: 1; height: 100%; position: relative;
    background: none; border: 0; padding: 0; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .2px;
    font-family: inherit;
  }
  .mnav-btn svg { display: block; }
  .mnav-btn.active { color: var(--ink); }

  /* Centre "Drop" is a raised capsule — the capsule art is the whole button. */
  .mnav-drop { color: var(--ink); }
  .mnav-fab {
    width: 58px; height: 58px;
    display: flex; align-items: center; justify-content: center;
    margin-top: -26px; margin-bottom: 1px;
    background: none; border: 0; box-shadow: none;
  }
  .mnav-fab img {
    width: 58px; height: 58px; object-fit: contain; display: block;
    filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.55));
  }
  .mnav-badge {
    position: absolute; top: 7px; left: 50%; transform: translateX(8px);
    background: #fff; color: #0b0b0d; border-radius: 10px;
    font-size: 10px; font-weight: 700; padding: 0 5px; min-width: 16px;
    text-align: center; line-height: 16px;
  }

  /* Lift the floating speek card so the bottom nav doesn't cover its actions. */
  .speek-card { z-index: 30; }

  /* Search-as-sheet: drops down from under the header when Search is tapped.
     Row 1 = search field; row 2 = top locations (scroll) + filters. */
  body.search-open .search-hero {
    display: flex; flex-flow: row wrap; align-items: center; gap: 10px;
    position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 19;
    padding: 12px 16px 14px;
    background: rgba(8, 8, 10, 0.97); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  body.search-open .search-box { flex: 1 1 100%; width: 100%; max-width: none; }
  body.search-open .popular {
    display: flex; flex: 1 1 auto; min-width: 0; gap: 8px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  body.search-open .popular::-webkit-scrollbar { display: none; }
  body.search-open .pop-chip { flex: 0 0 auto; }
  body.search-open .filter { display: block; flex: 0 0 auto; position: relative; }

  /* The localhost geofence tool would cover the nav — tuck it up. */
  .fence-tool { bottom: calc(var(--mobile-nav-h) + 14px); }
}
