:root {
  --bg: #101214;
  --card: #1a1d21;
  --line: #2c3036;
  --text: #eef0f2;
  --muted: #9aa1a9;
  --accent: #ff5c8a;
  --ok: #69db7c;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; }

.logo { font-weight: 800; letter-spacing: -.02em; color: var(--accent); margin: 0; font-size: 2.2rem; }
.small-logo { font-size: 1.2rem; }
.logo-btn { border: 0; background: none; padding: 0; font-family: inherit; line-height: inherit; }

/* start / join / gone screens over a dimmed map */
.card-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(16, 18, 20, .72); backdrop-filter: blur(3px); z-index: 20; overflow-y: auto; }
.card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 24px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lead { color: var(--text); margin: 8px 0 18px; }
.small { color: var(--muted); font-size: .85rem; margin: 16px 0 0; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); margin: -8px 0 16px; word-break: break-all; }
.error { background: #3a1820; color: #ffb3c6; border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.field { display: block; font-weight: 600; margin: 0 0 16px; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); outline: none; }
.field input:focus { border-color: var(--accent); }
.field input.invalid { border-color: #ff6b6b; box-shadow: 0 0 0 3px rgba(255,107,107,.2); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.seg button { padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 500; }
.seg button.on { border-color: var(--accent); background: #3a1824; color: #fff; }
.primary { display: block; width: 100%; text-align: center; text-decoration: none; padding: 14px; border: 0;
  border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; }
.primary:disabled { opacity: .6; }
.ic-btn { width: 18px; height: 18px; vertical-align: -3px; margin-right: 8px; }
.secondary { display: block; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; font-weight: 600; margin-top: 8px; }
.danger { color: #ff8fa8; }

/* meeting UI */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 12px 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; background: rgba(26,29,33,.92); padding: 6px 12px; border-radius: 999px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #666; }
.live.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(105,219,124,.25); }
.chip { background: rgba(26,29,33,.92); border: 0; border-radius: 999px; padding: 7px 12px; font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.warn { color: #101214; background: #ffd43b; font-weight: 700; }
.chip.urgent { color: #fff; background: #e03131; font-weight: 800; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(224,49,49,.35); } }
@media (prefers-reduced-motion: reduce) { .chip.urgent { animation: none; } }
.end-banner { position: fixed; left: 12px; right: 12px; top: calc(62px + var(--safe-t)); z-index: 11; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px;
  background: #ffd43b; color: #101214; font-weight: 700; font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.45); }
.end-banner span { flex: 1; min-width: 0; }
.end-banner.urgent { background: #e03131; color: #fff; }
.banner-btn { border: 0; border-radius: 10px; padding: 8px 12px; background: #101214; color: #fff; font-weight: 700; white-space: nowrap; }
.banner-x { border: 0; background: none; color: inherit; font-size: 1.4rem; line-height: 1; padding: 0 4px; opacity: .7; }
.end-banner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
body.has-banner .toast { top: calc(162px + var(--safe-t)); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(26,29,33,.92);
  display: grid; place-items: center; font-weight: 700; }

.bottombar { position: fixed; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); z-index: 10;
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 0 12px; }
.pill { border: 0; border-radius: 999px; padding: 12px 16px; background: rgba(26,29,33,.95); font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #666; }
.pill.on { background: #173322; }
.pill.on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(105,219,124,.3); }
.pill.paused { background: #3a3216; }
.pill.paused .dot { background: #ffd43b; }
.icon-pill { padding: 12px 13px; position: relative; }
.chat-pill .badge { position: absolute; top: -4px; right: -4px; }
.person.paused .bubble { border-style: dashed; filter: saturate(.4); }
.tap-hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(72px + var(--safe-b)); z-index: 9;
  margin: 0; background: rgba(26,29,33,.9); color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .85rem; white-space: nowrap; }

.test-badge { background: #ffd43b; color: #101214; font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; letter-spacing: .04em; }

/* markers */
.person { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.person .bubble { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  color: #101214; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.person.me .bubble { border-color: var(--ok); }
.person.stale { opacity: .5; }
.person .label { margin-top: 3px; background: rgba(16,18,20,.88); padding: 2px 8px 3px; border-radius: 9px; text-align: center; white-space: nowrap; }
.person .name { font-size: .78rem; font-weight: 700; line-height: 1.25; }
.person .meta { display: flex; justify-content: center; gap: 8px; color: #c9ced4; font-size: .7rem; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.person .meta span { display: inline-flex; align-items: center; gap: 3px; }
.ic { width: 11px; height: 11px; flex: none; vertical-align: -1px; }
.meet .name .ic { margin-right: 2px; }
.meet { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.meet svg { filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.meet .sub { background: rgba(16,18,20,.88); color: var(--text); padding: 1px 7px; border-radius: 7px; font-size: .75rem; margin-bottom: 2px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.meet .name { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; margin-bottom: 2px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.meet.draft { opacity: .65; }

/* arrows at the screen edge towards people outside the visible map */
#edges { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.edge { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; background: none; pointer-events: auto; }
.edge-arrow { position: absolute; inset: 0; }
.edge-arrow::after { content: ""; position: absolute; right: -7px; top: 50%; margin-top: -8px;
  border-left: 12px solid var(--c); border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.edge-dot { position: absolute; left: 6px; top: 6px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; color: #101214; font-weight: 800; font-size: .9rem;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.edge-meet .edge-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.edge-dist { position: absolute; top: 41px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: rgba(16,18,20,.88); color: var(--text); font-size: .75rem; font-weight: 700; padding: 1px 6px; border-radius: 7px; }
.edge-dist:empty { display: none; }

.panel-toggle { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(26,29,33,.94);
  display: grid; place-items: center; pointer-events: auto; color: var(--muted); }

/* chat at the bottom */
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .75rem;
  display: inline-grid; place-items: center; padding: 0 6px; }
.chat { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; max-width: 560px; margin: 0 auto; height: min(42vh, 380px);
  display: flex; flex-direction: column; background: rgba(26,29,33,.97); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5); padding-bottom: var(--safe-b); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px 16px; }
.chat-head .hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 14px; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { color: var(--muted); font-size: .9rem; text-align: center; margin: auto 0; }
.msg { max-width: 82%; align-self: flex-start; background: #24282e; border-radius: 14px 14px 14px 4px; padding: 6px 10px; }
.msg.mine { align-self: flex-end; background: #3a1824; border-radius: 14px 14px 4px 14px; }
.msg .who { font-size: .75rem; font-weight: 700; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: .8rem; text-align: center; padding: 2px 8px; }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .time { font-size: .7rem; color: var(--muted); margin-left: 6px; }
.chat-form { display: flex; gap: 8px; padding: 8px 12px 12px; }
.chat-form input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.chat-form input:focus { border-color: var(--accent); }
.chat-form .primary { width: 48px; padding: 0; display: grid; place-items: center; }

/* address search */
.search-input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; font-size: 1rem; }
.search-input:focus { border-color: var(--accent); }
.results { list-style: none; margin: 10px 0 0; padding: 0; min-height: 40vh; }
.results button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none;
  padding: 10px 4px; border-bottom: 1px solid var(--line); }
.results button:active { background: #24282e; }
.r-ic { font-size: 1.2rem; flex: none; width: 26px; text-align: center; }
.r-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.r-txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-txt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-d { color: var(--muted); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.results-hint { color: var(--muted); padding: 14px 4px; font-size: .9rem; }

/* imprint / privacy links and pages */
.legal-links { margin: 14px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }
.legal-links a { color: var(--muted); }
body.legal-page { overflow-y: auto; height: auto; }
.legal { max-width: 760px; margin: 0 auto; padding: 1.4rem 1rem 3rem; line-height: 1.6; }
.legal h1 { color: var(--accent); font-size: 1.4rem; margin: .4rem 0 .2rem; }
.legal h2 { color: var(--accent); font-size: 1rem; margin: 1.8rem 0 .4rem; }
.legal p, .legal li, .legal address { font-size: .95rem; }
.legal address { font-style: normal; }
.legal a { color: var(--accent); }
.legal .stand { color: var(--muted); font-size: .85rem; }
.legal .stand.end { margin-top: 2rem; }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 82vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 18px calc(18px + var(--safe-b));
  max-width: 560px; margin: 0 auto; box-shadow: 0 -8px 30px rgba(0,0,0,.5); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin: 0 0 12px; font-size: 1.15rem; }
.people { list-style: none; margin: 0 0 12px; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.people .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.people .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.linkbox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; word-break: break-all; margin: 0 0 12px; user-select: all; }

.toast { position: fixed; left: 50%; top: calc(112px + var(--safe-t)); transform: translateX(-50%); z-index: 40;
  background: #2a2e34; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.5); max-width: calc(100% - 32px); }

/* card when someone joins */
.notice { position: fixed; left: 16px; right: 16px; top: calc(70px + var(--safe-t)); z-index: 41; max-width: 460px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; cursor: pointer;
  background: #1f2328; border: 2px solid var(--c, var(--accent)); box-shadow: 0 10px 34px rgba(0,0,0,.6), 0 0 0 4px rgba(0,0,0,.15);
  font-weight: 700; font-size: 1.05rem; }
.notice.pop { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: translateY(-16px) scale(.92); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .notice.pop { animation: none; } }
body.has-banner .notice { top: calc(124px + var(--safe-t)); }
.notice-dots { display: flex; flex: none; }
.notice-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #101214; font-weight: 800;
  border: 2px solid #fff; margin-left: -10px; }
.notice-dot:first-child { margin-left: 0; }

.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-right { bottom: calc(64px + var(--safe-b)); }
