/* Friend Tracker: design tokens, then components. */

:root {
  --ink: #12282b;
  --muted: #5b7073;
  --paper: #eef3f1;
  --surface: #ffffff;
  --surface-2: #f4f8f7;
  --line: #dbe5e2;
  --lagoon: #0b7a75;
  --lagoon-strong: #085f5b;
  --lagoon-tint: #dff1ef;
  --ping: #f3b23c;
  --danger: #b93232;
  --danger-tint: #fbe9e7;
  --shadow: 0 10px 34px rgba(18, 40, 43, .18), 0 2px 6px rgba(18, 40, 43, .08);
  --map-land: #e4ece7; --map-water: #cbe4ec; --map-park: #d3e6d1; --map-street: #fff;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --panel-full: 392px;                 /* the panel's real width */
  --panel-w: var(--panel-full);        /* how much room it takes up (shrinks to a circle when minimized) */
  --peek: calc(76px + env(safe-area-inset-bottom));
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e5f0ee; --muted: #93aaa8; --paper: #0e1819; --surface: #152325; --surface-2: #1b2b2e;
    --line: #28393b; --lagoon: #3cc2b7; --lagoon-strong: #6fd8cf; --lagoon-tint: #17393a;
    --danger: #ff8a80; --danger-tint: #3a2020;
    --shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    --map-land: #1c2b2c; --map-water: #17333c; --map-park: #1d3a2c; --map-street: #2a3d40;
  }
  .leaflet-tile-pane { filter: brightness(.78) contrast(1.05) saturate(.85); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--ping); outline-offset: 2px; border-radius: 8px; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 12px;
  font-weight: 600; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--lagoon); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--lagoon-strong); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #08201f; } }
.btn-soft { background: var(--lagoon-tint); color: var(--lagoon-strong); }
.btn-soft:hover { filter: brightness(.96); }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.btn-large { min-height: 52px; padding: 0 24px; font-size: 16px; border-radius: 14px; }

.icon-btn {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink);
}
.icon-btn:hover { background: var(--lagoon-tint); }
.unread-dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--ping); box-shadow: 0 0 0 2px var(--surface); }

/* ------------------------------------------------------------ avatars */
.avatar {
  --size: 40px; position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden; border: 0; padding: 0;
  background: hsl(var(--hue, 180) 45% 88%); color: hsl(var(--hue, 180) 55% 24%);
  font: 700 calc(var(--size) * .38)/1 var(--font-display);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 34px; } .avatar-md { --size: 40px; } .avatar-lg { --size: 46px; } .avatar-xl { --size: 64px; }
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--hue, 180) 30% 26%); color: hsl(var(--hue, 180) 60% 82%); } }

.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--ping); color: #2c2000; font-size: 11.5px; font-weight: 700; }

/* ------------------------------------------------------------ forms */
input[type="email"], textarea {
  width: 100%; min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); outline: none;
}
input[type="email"]:focus-visible, textarea:focus-visible { outline: none; }
input[type="email"]:focus, textarea:focus { border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); }
::placeholder { color: var(--muted); opacity: .8; }
.form-msg { margin: 6px 2px 0; min-height: 0; font-size: 13.5px; color: var(--muted); }
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--lagoon-strong); }
.form-msg:empty { display: none; }

.switch { position: relative; flex: none; width: 52px; height: 30px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 15px; background: var(--line); transition: background .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--lagoon); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--ping); outline-offset: 2px; }
.switch input:disabled { cursor: wait; }

/* ------------------------------------------------------------ brand + login */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; color: var(--lagoon); }
.brand-name { font: 700 18px/1 var(--font-display); letter-spacing: -.01em; }

.login { display: grid; grid-template-columns: minmax(320px, 520px) minmax(0, 560px); gap: 56px; align-items: center; justify-content: center; height: 100%; padding: 32px; overflow: auto; }
.login-copy h1 { margin: 36px 0 14px; font: 800 clamp(34px, 4.6vw, 54px)/1.04 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.login-lead { margin: 0 0 28px; max-width: 46ch; color: var(--muted); font-size: 17px; }
.login-fine { margin: 18px 0 0; color: var(--muted); font-size: 13.5px; }
.google-g { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #4285f4; font: 800 15px/1 Arial, sans-serif; }
.login-art { width: 100%; height: auto; border-radius: 28px; box-shadow: var(--shadow); }
.art-land { fill: var(--map-land); } .art-water { fill: var(--map-water); } .art-park { fill: var(--map-park); }
.art-streets path { fill: none; stroke: var(--map-street); stroke-width: 12; } .art-streets .thin { stroke-width: 6; }
.art-route { stroke: var(--lagoon); stroke-width: 3; stroke-dasharray: 2 8; stroke-linecap: round; }
.art-chip { fill: var(--ping); } .art-chip-text { font: 700 14px var(--font-display); fill: #2c2000; }
.art-pin text { font: 700 13px var(--font-display); fill: #12282b; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; gap: 28px; align-content: start; padding: 24px 20px 40px; }
  .login-art { order: -1; max-height: 220px; }
  .login-copy h1 { margin-top: 24px; }
}

/* ------------------------------------------------------------ app shell + map */
.app { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; z-index: 0; isolation: isolate; background: var(--map-land); }

.gps-chip {
  position: absolute; z-index: 20; left: calc(var(--panel-w) + 28px); bottom: 20px;
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
}
.gps-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.gps-chip[data-state="active"] .gps-dot { background: #22a559; }
.gps-chip[data-state="searching"] .gps-dot { background: var(--ping); animation: blink 1.2s infinite; }
.gps-chip[data-state="denied"] .gps-dot, .gps-chip[data-state="unavailable"] .gps-dot { background: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }

.map-tools { position: absolute; z-index: 20; right: 12px; bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.map-btn { display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.map-btn:hover { background: var(--lagoon-tint); }

/* Leaflet adjustments */
.leaflet-top.leaflet-right { top: 8px; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 14px !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-popup-content-wrapper { border-radius: 14px; background: var(--surface); color: var(--ink); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; }
.popup { display: grid; gap: 6px; justify-items: start; font-family: var(--font-body); }
.popup span { color: var(--muted); font-size: 13px; }

.me-marker, .pin-wrap { background: none; border: 0; }
.me-dot { position: absolute; inset: 8px; border-radius: 50%; background: var(--lagoon); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
.me-pulse { position: absolute; inset: 0; border-radius: 50%; background: var(--lagoon); opacity: .35; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .5; } to { transform: scale(2.2); opacity: 0; } }
.accuracy-circle { fill: var(--lagoon); fill-opacity: .1; stroke: var(--lagoon); stroke-opacity: .4; }

.pin { position: relative; display: flex; flex-direction: column; align-items: center; width: 140px; height: 86px; --ring: hsl(var(--hue) 62% 42%); }
.pin-chip { display: flex; gap: 6px; align-items: baseline; max-width: 140px; padding: 3px 10px; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.28); font: 600 12px/1.3 var(--font-body); white-space: nowrap; }
.pin-chip b { overflow: hidden; text-overflow: ellipsis; max-width: 100px; font-weight: 700; }
.pin-chip span { color: var(--lagoon-strong); font-weight: 700; }
.pin-face { --size: 46px; position: relative; display: grid; place-items: center; width: 46px; height: 46px; margin-top: 4px; border: 3px solid var(--ring); border-radius: 50%; background: hsl(var(--hue) 45% 88%); color: hsl(var(--hue) 55% 24%); font: 700 17px/1 var(--font-display); box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.pin-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.pin-tip { width: 0; height: 0; margin-top: -1px; border: 6px solid transparent; border-top: 9px solid var(--ring); border-bottom: 0; }
.pin.is-stale { opacity: .6; filter: grayscale(.7); }

/* ------------------------------------------------------------ panel */
.panel {
  position: absolute; z-index: 30; top: 12px; left: 12px; bottom: 12px; width: var(--panel-full);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow);
}
.sheet-handle { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.me-chip { cursor: pointer; }
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1;
  height: 44px; border: 0; background: none; color: var(--muted); font-weight: 600; border-radius: 10px 10px 0 0;
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--lagoon); }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 24px; scrollbar-width: thin; }

.add-form { display: flex; gap: 8px; }
.group { margin-top: 22px; }
.group:first-child { margin-top: 4px; }
.group h3 { margin: 0 0 6px; font: 700 15px/1.3 var(--font-display); }

.empty { display: grid; gap: 4px; justify-items: center; margin-top: 36px; padding: 0 18px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); font: 700 16px var(--font-display); }
.empty.compact { margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* friends */
.friend-list, .request-list { margin: 0; padding: 0; list-style: none; }
.friend-list { margin-top: 8px; }
.friend { display: flex; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.friend:last-child { border-bottom: 0; }
.friend-main { flex: 1; min-width: 0; }
.friend-top { display: flex; justify-content: space-between; gap: 10px; }
.friend.has-location .friend-top { cursor: pointer; }
.friend-text { display: grid; min-width: 0; }
.friend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.friend-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.friend-sub-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-sub.is-unread { color: var(--ink); font-weight: 600; }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ping); box-shadow: 0 0 0 0 rgba(243,178,60,.7); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(243,178,60,0); } 100% { box-shadow: 0 0 0 0 rgba(243,178,60,0); } }

.meter { flex: none; display: grid; justify-items: end; line-height: 1.2; }
.meter-distance { font: 800 20px/1.1 var(--font-display); letter-spacing: -.02em; }
.meter-dir { display: inline-flex; align-items: center; gap: 4px; color: var(--lagoon-strong); font-size: 12.5px; font-weight: 700; }
.meter-arrow { display: inline-grid; transition: transform .6s ease; }
.meter-trend { color: var(--muted); font-size: 12px; }
.meter-trend:empty { display: none; }
.friend[data-mode="stale"] .meter { opacity: .55; }

.friend-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.menu-wrap { position: relative; margin-left: auto; }
.menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 210px; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.menu-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: none; text-align: left; font-weight: 500; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }

/* requests */
.request { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.request:last-child { border-bottom: 0; }
.request-text { display: grid; flex: 1; min-width: 0; }
.request-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-text span { color: var(--muted); font-size: 13.5px; }
.request-actions { display: flex; gap: 6px; flex: none; }

/* me */
.me-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; }
.me-head div { display: grid; min-width: 0; }
.me-head strong { font: 700 19px var(--font-display); }
.me-head span:not(.avatar) { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border-radius: 16px; background: var(--lagoon-tint); }
.share-row div { display: grid; gap: 2px; }
.share-row strong { font: 700 16px var(--font-display); }
.share-row span { color: var(--muted); font-size: 13.5px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.share-choice { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.share-choice:has(input:checked) { border-color: var(--lagoon); background: var(--lagoon-tint); }
.share-choice input[type="radio"] { accent-color: var(--lagoon); width: 18px; height: 18px; flex: none; }
.share-time { margin-left: auto; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.dialog .share-hint { min-height: 1.4em; margin: 6px 2px 16px; font-size: 13.5px; }
.dialog .share-hint.is-error { color: var(--danger, #b3261e); }
.friend[data-mode="paused"] .meter { opacity: .55; }
.gps-status { margin: 0; font-weight: 600; }
.gps-detail { margin: 2px 0 8px; color: var(--muted); font-size: 13.5px; }
.signout { width: 100%; margin-top: 28px; }

/* ------------------------------------------------------------ chat */
.chat {
  position: absolute; z-index: 50; top: 12px; bottom: 12px; right: 12px; width: min(440px, calc(100vw - var(--panel-w) - 48px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow);
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-who { display: grid; min-width: 0; }
.chat-who span { color: var(--muted); font-size: 13px; }
.chat-messages { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); }
.chat-note { margin: auto; display: grid; gap: 4px; text-align: center; color: var(--muted); }
.chat-note strong { color: var(--ink); font: 700 16px var(--font-display); }
.chat-note.error { color: var(--danger); }
.day { align-self: center; margin: 10px 0 6px; padding: 2px 12px; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; }
.msg { display: grid; max-width: 82%; margin-bottom: 4px; }
.msg.mine { align-self: flex-end; justify-items: end; }
.msg.theirs { align-self: flex-start; }
.bubble { padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.msg.mine .bubble { background: var(--lagoon); color: #fff; border-bottom-right-radius: 6px; }
.msg.theirs .bubble { border-bottom-left-radius: 6px; }
@media (prefers-color-scheme: dark) { .msg.mine .bubble { color: #08201f; } }
.msg.pending .bubble { opacity: .7; }
.msg-time { margin: 2px 6px 0; color: var(--muted); font-size: 11.5px; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.chat-form textarea { resize: none; max-height: 120px; line-height: 1.4; border-radius: 20px; }
.send-btn { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--lagoon); color: #fff; }
@media (prefers-color-scheme: dark) { .send-btn { color: #08201f; } }
.send-btn:disabled { opacity: .5; }

/* ------------------------------------------------------------ toasts + dialog */
.toasts { position: fixed; z-index: 200; bottom: 24px; left: calc(50% + var(--panel-w) / 2); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-weight: 500; cursor: pointer; animation: toast-in .22s ease; }
.toast-success { background: var(--lagoon-strong); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transition: opacity .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.dialog { width: min(400px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(8, 20, 22, .5); }
.dialog h2 { margin: 0 0 8px; font: 700 20px var(--font-display); }
.dialog p { margin: 0 0 20px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------ phones: bottom sheet */
@media (max-width: 899px) {
  .gps-chip { left: 12px; top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
  .map-tools { bottom: calc(var(--peek) + 14px); transition: bottom .3s; }
  .leaflet-top.leaflet-right { display: none; }
  .leaflet-bottom { margin-bottom: var(--peek); }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 24px 24px 0 0;
    height: var(--peek); transition: height .3s cubic-bezier(.2, .8, .2, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel[data-open="true"] { height: min(78dvh, 680px); }
  .panel:not([data-open="true"]) .panel-head { display: none; }
  .panel[data-open="true"] .panel-head { padding-top: 4px; }
  .sheet-handle { display: grid; place-items: center; width: 100%; height: 24px; flex: none; border: 0; background: none; }
  .sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .panel-body { padding-bottom: 32px; }

  .chat { inset: 0; width: auto; border-radius: 0; z-index: 60; padding-top: env(safe-area-inset-top); }
  .toasts { top: auto; left: 50%; bottom: calc(var(--peek) + 14px); z-index: 300; }
}

@media (min-width: 900px) and (max-width: 1180px) { :root { --panel-full: 360px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}


/* ============================================================ movement animation */
.activity-icon .arm, .activity-icon .leg { transform-origin: 12px 13.6px; }
.activity-icon .arm { transform-origin: 12px 8.8px; }
@keyframes swing { from { transform: rotate(-34deg); } to { transform: rotate(34deg); } }
@keyframes swing-big { from { transform: rotate(-52deg); } to { transform: rotate(52deg); } }
@keyframes bob { 50% { transform: translateY(-1.1px); } }
.activity-icon.is-walking .leg-a, .activity-icon.is-walking .arm-b { animation: swing .45s ease-in-out infinite alternate; }
.activity-icon.is-walking .leg-b, .activity-icon.is-walking .arm-a { animation: swing .45s ease-in-out infinite alternate-reverse; }
.activity-icon.is-running .leg-a, .activity-icon.is-running .arm-b { animation: swing-big .26s ease-in-out infinite alternate; }
.activity-icon.is-running .leg-b, .activity-icon.is-running .arm-a { animation: swing-big .26s ease-in-out infinite alternate-reverse; }
.activity-icon.is-walking .walker { animation: bob .45s ease-in-out infinite; }
.activity-icon.is-running .walker { animation: bob .26s ease-in-out infinite; }
.activity-icon.is-riding .car { animation: bob .35s ease-in-out infinite; }

.me-walker { position: absolute; inset: 3px; display: grid; place-items: center; border-radius: 50%; background: var(--lagoon); border: 3px solid #fff; color: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
.pin-activity { position: absolute; right: -9px; bottom: -6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ping); color: #2c2000; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.avatar-wrap { position: relative; flex: none; display: inline-flex; height: fit-content; }
.activity-badge { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ping); color: #2c2000; box-shadow: 0 0 0 2px var(--surface); }
.activity-badge:empty { display: none; }
.chip-activity { display: inline-flex; color: var(--lagoon-strong); }
.chip-activity:empty { display: none; }
.me-activity { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; color: var(--lagoon-strong); font-weight: 600; }
.me-activity[hidden] { display: none; }
.popup-actions { display: flex; gap: 6px; }
.friend-actions .btn-primary { gap: 5px; }
.friend-actions { flex-wrap: wrap; }

/* ============================================================ trips */
.trip-bar { position: absolute; z-index: 25; top: calc(14px + var(--dock-h, 0px)); left: calc(var(--panel-w) + 28px); width: min(470px, calc(100vw - var(--panel-w) - 120px)); display: grid; gap: 10px; }
.trip-card { touch-action: pan-y; user-select: none; cursor: grab; display: flex; gap: 12px; padding: 12px 14px 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.trip-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.trip-title { font: 700 15px/1.3 var(--font-display); }
.trip-sub { color: var(--muted); font-size: 13.5px; }
.trip-track { position: relative; height: 6px; margin: 24px 10px 6px; border-radius: 3px; background: var(--line); }
.trip-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--lagoon); transition: width .8s ease; }
.trip-walker { position: absolute; top: -26px; transform: translateX(-50%); color: var(--lagoon-strong); transition: left .8s ease; }
.trip-stop { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); transform: translate(-50%, -50%); transition: background .3s, border-color .3s; }
.trip-stop[data-at="0"] { left: 0; } .trip-stop[data-at="50"] { left: 50%; } .trip-stop[data-at="100"] { left: 100%; }
.trip-stop.on { background: var(--lagoon); border-color: var(--lagoon); }
.trip-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.trip-actions { display: flex; align-items: flex-start; }
.trip-line { stroke: var(--lagoon); stroke-opacity: .85; }

/* ============================================================ pop-up notices */
.notices { position: fixed; z-index: 250; top: 14px; right: 64px; width: min(390px, calc(100vw - 28px)); display: grid; gap: 10px; pointer-events: none; }
.notice { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); animation: notice-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.notice.leaving { opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
@keyframes notice-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.notice-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notice-text span { color: var(--muted); font-size: 13.5px; }
.notice-actions { display: flex; gap: 8px; margin-top: 8px; }
.notice-close { flex: none; width: 28px; height: 28px; background: none; color: var(--muted); }
.notice-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ping); color: #2c2000; }
.notice-trip { box-shadow: var(--shadow), 0 0 0 2px var(--lagoon); }
.notice-arrived { box-shadow: var(--shadow), 0 0 0 3px var(--ping); }

/* ============================================================ chat media */
.attach-tray { display: flex; gap: 8px; padding: 10px 12px 2px; overflow-x: auto; border-top: 1px solid var(--line); }
.attach-tray:not([hidden]) + .chat-form { border-top: 0; }
.attach-item { position: relative; flex: none; width: 66px; height: 66px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.attach-item img, .attach-item video { display: block; width: 100%; height: 100%; object-fit: cover; }
.attach-badge { position: absolute; left: 4px; bottom: 6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.62); color: #fff; }
.attach-remove { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; }
.attach-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.4); display: none; }
.attach-progress i { display: block; height: 100%; width: 0; background: var(--ping); transition: width .2s; }
.attach-item.uploading .attach-progress { display: block; }
.attach-item.uploading .attach-remove { display: none; }
.chat-form .icon-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; }

.bubble.has-media { padding: 4px; }
.chat-photo { display: block; width: 260px; max-width: min(100%, 62vw); padding: 0; border: 0; border-radius: 15px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.chat-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-video { display: block; width: 260px; max-width: min(100%, 62vw); border-radius: 15px; background: #000; }
.caption { padding: 6px 9px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

.lightbox { max-width: 96vw; max-height: 96vh; padding: 0; border: 0; background: transparent; overflow: visible; }
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox img, .lightbox video { display: block; max-width: 96vw; max-height: 92vh; border-radius: 12px; }
.lightbox-close { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; }

/* ============================================================ settings rows */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row div { display: grid; min-width: 0; }
.setting-row span { color: var(--muted); font-size: 13.5px; }

@media (max-width: 899px) {
  .trip-bar { top: calc(56px + env(safe-area-inset-top) + var(--dock-h, 0px)); left: 12px; right: 12px; width: auto; }
  .notices { top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; }
}


/* ============================================================ swipeable friend deck */
.deck { position: absolute; z-index: 22; left: calc(var(--panel-w) + 28px); right: 80px; bottom: 20px; pointer-events: none; }
.deck-track {
  position: relative; display: flex; gap: 12px; overflow-x: auto; padding: 4px calc(50% - 160px) 8px;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; pointer-events: auto; outline: none;
}
.deck-track::-webkit-scrollbar { display: none; }
.deck-card {
  position: relative; flex: none; width: 320px; display: flex; gap: 12px; padding: 12px 14px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); scroll-snap-align: center; cursor: pointer;
  opacity: .78; transform: scale(.95); transition: opacity .25s, transform .25s, box-shadow .25s;
}
.deck-card.is-active { opacity: 1; transform: none; box-shadow: var(--shadow), 0 0 0 2px var(--lagoon); }
.deck-main { flex: 1; min-width: 0; display: grid; gap: 10px; }
.deck-top { display: flex; justify-content: space-between; gap: 10px; }
.deck-text { display: grid; min-width: 0; }
.deck-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.deck-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.deck-actions { display: flex; gap: 8px; }
.deck-actions[hidden] { display: none; }
.deck-nav {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; margin-top: -24px;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); pointer-events: auto;
}
.deck-prev { left: 4px; } .deck-next { right: 4px; }
.deck-nav:hover { background: var(--lagoon-tint); }
.app.has-deck .gps-chip { bottom: 140px; }
@media (pointer: coarse) { .deck-nav { display: none; } }

@media (max-width: 899px) {
  .deck { left: 0; right: 0; bottom: calc(var(--peek) + 10px); }
  .deck-track { padding-inline: calc(50% - 150px); }
  .deck-card { width: 300px; }
  .app.has-deck .map-tools { bottom: calc(var(--peek) + 150px); }
  .app.has-deck .gps-chip { bottom: auto; }
}


/* ============================================================ photo / video preview before sending */
.attach-tray { display: block; padding: 10px 12px 2px; }
.attach-stage { position: relative; display: grid; place-items: center; height: min(300px, 40dvh); border-radius: 16px; overflow: hidden; background: #0d1517; }
.attach-big { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.attach-name { position: absolute; left: 10px; bottom: 10px; max-width: 70%; padding: 3px 10px; overflow: hidden; border-radius: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.attach-stage:has(video) .attach-name { bottom: 54px; }
.attach-remove.big { top: 10px; right: 10px; width: 32px; height: 32px; }
.attach-progress.big { left: 0; right: 0; bottom: 0; height: 6px; }
.attach-strip { display: flex; gap: 8px; padding: 8px 0 4px; overflow-x: auto; }
.attach-item { padding: 0; border: 0; cursor: pointer; }
.attach-item.is-active { outline: 3px solid var(--lagoon); outline-offset: -3px; }
.attach-tray.uploading .attach-progress { display: block; }
.attach-tray.uploading .attach-remove { display: none; }
.attach-item.uploading .attach-progress { display: none; }

/* ============================================================ chat header + call log lines */
.chat-who { flex: 1; }
.call-start { flex: none; }
.bubble.call-log { background: var(--lagoon-tint); color: var(--lagoon-strong); box-shadow: none; }
.msg.mine .bubble.call-log { background: var(--lagoon-tint); color: var(--lagoon-strong); }
.call-line { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* ============================================================ calls */
.incoming {
  position: fixed; z-index: 420; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(380px, calc(100vw - 24px)); display: grid; justify-items: center; gap: 14px; padding: 20px;
  border-radius: 24px; background: var(--surface); color: var(--ink); text-align: center;
  box-shadow: var(--shadow), 0 0 0 3px var(--lagoon); animation: ring-pulse 1s ease-in-out infinite alternate;
}
@keyframes ring-pulse { from { box-shadow: var(--shadow), 0 0 0 3px var(--lagoon); } to { box-shadow: var(--shadow), 0 0 0 8px rgba(11,122,117,.25); } }
.incoming-avatar .avatar { --size: 84px; }
.incoming-text { display: grid; gap: 2px; }
.incoming-title { font: 700 19px var(--font-display); }
.incoming-sub { color: var(--muted); }
.incoming-actions { display: flex; gap: 28px; }

.call { position: fixed; inset: 0; z-index: 400; display: grid; background: #0b1214; color: #fff; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0b1214; }
.call[data-mode="audio"] .call-remote { opacity: 0; }
.call-stage { position: relative; z-index: 2; align-self: center; justify-self: center; display: grid; justify-items: center; gap: 10px; padding: 0 24px; text-align: center; }
.call-avatar .avatar { --size: 128px; }
.call-name { font: 700 26px var(--font-display); }
.call-status { color: rgba(255,255,255,.75); font-size: 16px; font-variant-numeric: tabular-nums; }
.call[data-mode="video"] .call-stage { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 0; right: 0; align-self: start; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.call[data-mode="video"] .call-avatar { display: none; }
.call[data-mode="video"] .call-name { font-size: 18px; }
.call-local { position: absolute; z-index: 3; right: 14px; bottom: calc(120px + env(safe-area-inset-bottom)); width: min(30vw, 150px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; background: #1b2a2d; transform: scaleX(-1); box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.call[data-type="audio"] .call-local { display: none; }
.call-controls { position: absolute; z-index: 4; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 18px; }
.call-btn { display: grid; place-items: center; width: 62px; height: 62px; border: 0; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; backdrop-filter: blur(8px); transition: transform .1s, background .15s; }
.call-btn:active { transform: scale(.93); }
.call-btn[hidden] { display: none; }
.call-btn.is-off { background: #fff; color: #0b1214; }
.incoming .call-btn { width: 64px; height: 64px; }
.call-end { background: #e5484d; }
.call-accept { background: #22a559; }

/* the swipe deck steps aside while a chat is open */
body.chat-open .deck { display: none; }
body.chat-open .app.has-deck .gps-chip { bottom: 20px; }
.btn { white-space: nowrap; }
.deck-actions .btn { padding: 0 10px; }


/* ============================================================ send errors + lazy videos */
.attach-error { margin-bottom: 8px; padding: 9px 12px; border-radius: 12px; background: var(--danger-tint); color: var(--danger); font-size: 13.5px; font-weight: 500; }
.chat-video-lazy { display: grid; place-content: center; justify-items: center; gap: 8px; width: 260px; max-width: min(100%, 62vw); padding: 0; border: 0; color: #fff; background: #12282b; cursor: pointer; font-size: 13px; }
.chat-video-lazy:disabled { cursor: progress; opacity: .85; }

.version { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 12px; }


/* ============================================================ seen + typing */

/* The friend's small avatar under the latest message they have read */
.seen { display: inline-flex; margin: 3px 3px 0 0; border-radius: 50%; line-height: 0; }
.seen .avatar { --size: 16px; box-shadow: 0 0 0 2px var(--surface-2); font-size: 7px; }

/* "..." bubble while the friend is typing */
.typing-row {
  display: flex; align-items: flex-end; gap: 8px; align-self: flex-start; margin-bottom: 4px;
  animation: typing-in .3s cubic-bezier(.2, .8, .2, 1) both;
}
.typing-row.leaving { animation: typing-out .18s ease-in forwards; }
.typing-row .avatar { --size: 26px; font-size: 10px; }
.typing-bubble { display: inline-flex; align-items: center; gap: 5px; padding: 13px 15px; border-bottom-left-radius: 6px; }
.typing-bubble i, .chat-who .dots i {
  display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: typing-dot 1.2s infinite ease-in-out;
}
.typing-bubble i:nth-child(2), .chat-who .dots i:nth-child(2) { animation-delay: .16s; }
.typing-bubble i:nth-child(3), .chat-who .dots i:nth-child(3) { animation-delay: .32s; }

/* "typing…" in the chat header */
.chat-who span.is-typing { display: inline-flex; align-items: center; gap: 6px; color: var(--lagoon-strong); font-weight: 600; }
.chat-who .dots { display: inline-flex; gap: 3px; }
.chat-who .dots i { width: 4px; height: 4px; background: var(--lagoon-strong); }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes typing-in {
  from { opacity: 0; transform: translateY(10px) scale(.9); transform-origin: left bottom; }
  to { opacity: 1; transform: none; transform-origin: left bottom; }
}
@keyframes typing-out {
  to { opacity: 0; transform: translateY(4px) scale(.92); transform-origin: left bottom; }
}

/* Reduced motion: the dots stay still, so only their presence says "typing" */
@media (prefers-reduced-motion: reduce) {
  .typing-bubble i, .chat-who .dots i { animation: none; opacity: .75; }
}


/* ============================================================ weather */
.map-chips { position: absolute; z-index: 20; left: calc(var(--panel-w) + 28px); bottom: 20px; display: flex; align-items: center; gap: 8px; }
.map-chips .gps-chip { position: static; }
.app.has-deck .map-chips { bottom: 140px; }
body.chat-open .app.has-deck .map-chips { bottom: 20px; }
.weather-chip { display: flex; align-items: center; gap: 6px; padding: 5px 13px 5px 8px; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; }
.weather-chip[hidden] { display: none; }
.weather-chip:hover { background: var(--lagoon-tint); }
.weather-word { color: var(--muted); font-weight: 500; }
.weather-icon { flex: none; }

.weather-panel { position: absolute; z-index: 40; left: calc(var(--panel-w) + 28px); bottom: 66px; width: min(400px, calc(100vw - var(--panel-w) - 130px)); max-height: calc(100dvh - 110px); overflow-y: auto; padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.weather-panel[hidden] { display: none; }
.app.has-deck .weather-panel { bottom: 186px; }
.weather-panel h3 { margin: 18px 0 6px; font: 700 15px var(--font-display); }
.weather-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.weather-head strong { font: 700 17px var(--font-display); }
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-now-text { display: grid; }
.weather-big { font: 800 40px/1.05 var(--font-display); letter-spacing: -.03em; }
.weather-now-text .muted, .weather-panel .muted { color: var(--muted); font-size: 13.5px; }
.weather-rain { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 500; }
.weather-rain.wet { background: #e3effb; color: #1f5f9f; }
@media (prefers-color-scheme: dark) { .weather-rain.wet { background: #16314a; color: #8fc2f2; } }
.weather-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.weather-stats div { display: grid; gap: 2px; padding: 9px 10px; border-radius: 12px; background: var(--surface-2); }
.weather-stats span { color: var(--muted); font-size: 12px; }
.weather-stats strong { font-size: 14px; }
.hours { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.hour { display: grid; justify-items: center; gap: 2px; min-width: 56px; padding: 8px 6px; border-radius: 14px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.hour strong { color: var(--ink); font-size: 14px; }
.hour .pop { min-height: 14px; color: #1f78c8; font-weight: 700; }
.weather-friends { margin: 0; padding: 0; list-style: none; }
.weather-friends li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.weather-friends li:last-child { border-bottom: 0; }
.weather-friends strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather-friend-now { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.friend-weather { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; }
.friend-weather[hidden] { display: none; }

@media (max-width: 899px) {
  .map-chips { left: 12px; top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
  .app.has-deck .map-chips, body.chat-open .app.has-deck .map-chips { bottom: auto; }
  .weather-panel { left: 12px; right: 12px; top: calc(58px + env(safe-area-inset-top)); bottom: auto; width: auto; max-height: calc(100dvh - var(--peek) - 80px); z-index: 45; }
  .app.has-deck .weather-panel { bottom: auto; }
}
@media (max-width: 430px) { .weather-word { display: none; } }

/* ============================================================ reactions, message menu, unsend */
.bubble-row { display: flex; align-items: center; gap: 6px; }
.msg.theirs .msg-more { order: 2; }
.msg-more { flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: 0; transition: opacity .15s, background .15s; }
.msg-more[hidden] { display: none; }
.msg:hover .msg-more, .msg-more:focus-visible, .msg-more[aria-expanded="true"] { opacity: 1; }
.msg-more:hover { background: var(--surface); color: var(--ink); }
@media (hover: none) { .msg-more { opacity: .5; } }
.msg.has-reactions { margin-bottom: 10px; }
.reactions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; margin: -9px 10px 0; }
.reactions[hidden] { display: none; }
.msg.mine .reactions { justify-content: flex-end; }
.reaction { display: inline-flex; align-items: center; gap: 3px; min-height: 24px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.2; box-shadow: 0 1px 3px rgba(0,0,0,.14); animation: reaction-pop .3s cubic-bezier(.3, 1.7, .5, 1); }
.reaction.mine { border-color: var(--lagoon); background: var(--lagoon-tint); }
.reaction span { color: var(--muted); font-size: 12px; font-weight: 700; }
@keyframes reaction-pop { from { transform: scale(.3); opacity: 0; } }

.bubble.unsent { background: transparent !important; color: var(--muted) !important; box-shadow: inset 0 0 0 1px var(--line) !important; font-style: italic; }
.unsent-line { display: flex; align-items: center; gap: 7px; }

.msg-menu { position: fixed; z-index: 500; display: grid; gap: 6px; max-width: min(330px, calc(100vw - 16px)); padding: 8px; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); animation: menu-in .15s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(4px) scale(.96); } }
.react-bar { display: flex; align-items: center; gap: 2px; }
.react-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; transition: transform .12s, background .12s; }
.react-btn:hover, .react-btn:focus-visible { transform: scale(1.22); background: var(--surface-2); }
.react-btn.is-on { background: var(--lagoon-tint); box-shadow: inset 0 0 0 2px var(--lagoon); }
.react-plus { color: var(--muted); }
.react-more { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); }
.react-more[hidden] { display: none; }
.react-more .react-btn { width: 34px; height: 34px; font-size: 20px; }
.msg-menu-actions { display: grid; padding-top: 4px; border-top: 1px solid var(--line); }
.msg-menu .menu-item { display: flex; align-items: center; gap: 10px; }


/* the chips, weather panel and map buttons sit above the swipe deck, whatever its height */
.app.has-deck .map-chips { bottom: calc(var(--deck-h, 130px) + 30px); }
.app.has-deck .weather-panel { bottom: calc(var(--deck-h, 130px) + 76px); }
body.chat-open .app.has-deck .map-chips { bottom: 20px; }
@media (max-width: 899px) {
  .app.has-deck .map-chips, body.chat-open .app.has-deck .map-chips { bottom: auto; }
  .app.has-deck .weather-panel { bottom: auto; }
  .app.has-deck .map-tools { bottom: calc(var(--peek) + var(--deck-h, 130px) + 24px); }
}


/* ============================================================ journeys: boat / plane */
.journey-start { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 12px 0 4px; padding: 12px 14px; border-radius: 16px; background: var(--lagoon-tint); }
.journey-start-text { display: grid; flex: 1 1 160px; min-width: 0; }
.journey-start-text strong { font: 700 15px/1.3 var(--font-display); }
.journey-start-text span { color: var(--muted); font-size: 13.5px; }
.journey-start-actions { display: flex; flex: 1 1 100%; gap: 8px; }
.journey-start-actions .btn { flex: 1; }

.journey-badge { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #d8ebf8; color: #1f6aa8; }
.journey-badge.is-plane { background: #e6e1f7; color: #5a44b0; }
.journey-badge.is-arrived { background: #def4e4; color: #1f8a4c; }
@media (prefers-color-scheme: dark) {
  .journey-badge { background: #1a3a52; color: #8fc2f2; }
  .journey-badge.is-plane { background: #2b2650; color: #b9acf2; }
  .journey-badge.is-arrived { background: #1b3c2a; color: #7fdba0; }
}
.journey-badge svg { transform-origin: 50% 60%; }
.journey-badge.is-boat:not(.is-arrived) svg { animation: boat-rock 2.6s ease-in-out infinite; }
.journey-badge.is-plane:not(.is-arrived) svg { animation: plane-glide 3.2s ease-in-out infinite; }
@keyframes boat-rock { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(6deg) translateY(1.5px); } }
@keyframes plane-glide { 0%, 100% { transform: translate(-1.5px, 1.5px); } 50% { transform: translate(1.5px, -1.5px); } }

.journey-card { align-items: center; }
.journey-card .journey-actions { flex-direction: column; gap: 6px; }
.journey-card .btn { white-space: nowrap; }
.friend-journey { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.friend-journey[hidden] { display: none; }
.journey-icon { display: inline-grid; color: #1f6aa8; }
.journey-icon.is-plane { color: #5a44b0; }
@media (prefers-color-scheme: dark) { .journey-icon { color: #8fc2f2; } .journey-icon.is-plane { color: #b9acf2; } }

/* the "tell your friends" form */
.journey-dialog { width: min(440px, calc(100vw - 32px)); }
.journey-dialog .dialog-lead { margin: -2px 0 14px; color: var(--muted); }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--surface-2); }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 600; }
.seg-btn.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.18), inset 0 0 0 2px var(--lagoon); }
.field-label { display: block; margin: 12px 0 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.journey-dialog input[type="text"], .journey-dialog input[type="datetime-local"] { width: 100%; min-height: 44px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); outline: none; }
.journey-dialog input:focus { border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); }
.place-list { margin: 6px 0 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-height: 200px; overflow-y: auto; }
.place-list[hidden] { display: none; }
.place-btn { display: grid; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ink); text-align: left; }
.place-btn:hover, .place-btn:focus-visible { background: var(--lagoon-tint); }
.place-btn span { color: var(--muted); font-size: 12.5px; }
.place-note { padding: 8px 10px; color: var(--muted); font-size: 13.5px; }
.journey-hint { min-height: 18px; margin: 8px 2px 0; color: var(--muted); font-size: 13px; }
.journey-dialog .dialog-actions { margin-top: 18px; }


/* ============================================================ the map looks like the weather */
.wx-tint, .wx-canvas { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.wx-canvas { width: 100%; height: 100%; }          /* a canvas doesn't stretch from inset alone */
.wx-tint { background-color: rgba(0, 0, 0, 0); transition: background-color 1.6s ease; }
.wx-tint i { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
.app { --wx-extra: grayscale(0); }
.leaflet-tile-pane { filter: var(--wx-extra); transition: filter 1.6s ease; }
@media (prefers-color-scheme: dark) { .leaflet-tile-pane { filter: brightness(.78) contrast(1.05) saturate(.85) var(--wx-extra); } }

/* sunshine: warm light from the top-left that gently breathes */
.wx-sun { background: radial-gradient(circle at 14% 5%, rgba(255, 230, 140, .6) 0, rgba(255, 214, 102, .26) 20%, transparent 52%), linear-gradient(rgba(255, 236, 170, .1), rgba(255, 236, 170, .03)); }
.wx-sun::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 14% 5%, rgba(255, 248, 210, .55), transparent 28%); animation: sun-breathe 6s ease-in-out infinite alternate; }
@keyframes sun-breathe { from { opacity: .3; } to { opacity: 1; } }

/* drifting cloud shadows */
.wx-clouds { background: radial-gradient(ellipse 42% 22% at 20% 28%, rgba(88, 99, 114, .32), transparent 70%), radial-gradient(ellipse 46% 26% at 72% 66%, rgba(88, 99, 114, .26), transparent 70%), radial-gradient(ellipse 30% 18% at 55% 12%, rgba(88, 99, 114, .2), transparent 70%); background-size: 170% 170%; animation: cloud-drift 70s linear infinite alternate; }
@keyframes cloud-drift { from { background-position: 0% 0%; } to { background-position: 100% 35%; } }

/* fog: a pale haze that slides slowly sideways */
.wx-haze { background: linear-gradient(rgba(236, 241, 244, .55), rgba(236, 241, 244, .32)), repeating-linear-gradient(100deg, rgba(255, 255, 255, .2) 0 90px, rgba(255, 255, 255, 0) 90px 210px); background-size: 100% 100%, 420px 100%; animation: haze-drift 45s linear infinite; }
@keyframes haze-drift { to { background-position: 0 0, 420px 0; } }

/* night: stars and a moon glow */
.wx-stars { background-image:
  radial-gradient(circle at 88% 9%, rgba(222, 232, 255, .55) 0, rgba(200, 215, 255, .2) 12%, transparent 30%),
  radial-gradient(1.6px 1.6px at 12% 11%, #fff 50%, transparent 55%), radial-gradient(1.2px 1.2px at 27% 22%, #fff 50%, transparent 55%),
  radial-gradient(1.8px 1.8px at 41% 8%, #fff 50%, transparent 55%), radial-gradient(1.2px 1.2px at 56% 19%, #fff 50%, transparent 55%),
  radial-gradient(1.6px 1.6px at 68% 12%, #fff 50%, transparent 55%), radial-gradient(1.2px 1.2px at 33% 36%, #fff 50%, transparent 55%),
  radial-gradient(1.4px 1.4px at 7% 31%, #fff 50%, transparent 55%), radial-gradient(1.2px 1.2px at 78% 28%, #fff 50%, transparent 55%),
  radial-gradient(1.4px 1.4px at 49% 33%, #fff 50%, transparent 55%); animation: twinkle 4.5s ease-in-out infinite alternate; }
@keyframes twinkle { from { filter: brightness(.65); } to { filter: brightness(1.35); } }

/* lightning */
.wx-tint .wx-flash { background: rgba(255, 255, 255, .7); transition: opacity .17s ease-out; }
.wx-tint .wx-flash.on { opacity: 1; }

/* ---- each kind of weather ---- */
.app[data-mood="sunny"] { --wx-extra: saturate(1.32) brightness(1.07) contrast(1.03) sepia(.1); }
.app[data-mood="sunny"] .wx-sun { opacity: 1; }
.app[data-mood="partly"] { --wx-extra: saturate(1.1) brightness(1.02); }
.app[data-mood="partly"] .wx-sun { opacity: .5; }
.app[data-mood="partly"] .wx-clouds { opacity: .55; }
.app[data-mood="cloudy"] { --wx-extra: saturate(.6) brightness(.95) contrast(.98); }
.app[data-mood="cloudy"] .wx-tint { background-color: rgba(120, 132, 146, .16); }
.app[data-mood="cloudy"] .wx-clouds { opacity: 1; }
.app[data-mood="fog"] { --wx-extra: saturate(.4) brightness(1.06) contrast(.86); }
.app[data-mood="fog"] .wx-haze { opacity: 1; }
.app[data-mood="drizzle"] { --wx-extra: saturate(.72) brightness(.9) contrast(1.02); }
.app[data-mood="drizzle"] .wx-tint { background-color: rgba(52, 78, 112, .13); }
.app[data-mood="drizzle"] .wx-clouds { opacity: .8; }
.app[data-mood="rain"] { --wx-extra: saturate(.68) brightness(.84) contrast(1.05) hue-rotate(-6deg); }
.app[data-mood="rain"] .wx-tint { background-color: rgba(34, 58, 92, .2); }
.app[data-mood="rain"] .wx-clouds { opacity: 1; }
.app[data-mood="rain"][data-intensity="3"] { --wx-extra: saturate(.6) brightness(.74) contrast(1.08) hue-rotate(-8deg); }
.app[data-mood="rain"][data-intensity="3"] .wx-tint { background-color: rgba(24, 42, 74, .32); }
.app[data-mood="storm"] { --wx-extra: saturate(.55) brightness(.64) contrast(1.12); }
.app[data-mood="storm"] .wx-tint { background-color: rgba(10, 18, 40, .42); }
.app[data-mood="storm"] .wx-clouds { opacity: 1; }
.app[data-mood="snow"] { --wx-extra: saturate(.5) brightness(1.1) contrast(.94); }
.app[data-mood="snow"] .wx-tint { background-color: rgba(228, 238, 250, .24); }

/* rain is coming: banks of cloud roll in from the west across the map, thicker and faster the closer the rain is.
   Two layers at different speeds give depth. Set by app.js as data-incoming="1|2|3" (see rainComing in lib/mapmood.js). */
.app { --cloud-rgb: 84, 96, 114; --cloud-lite: 130, 144, 162; }
@media (prefers-color-scheme: dark) { .app { --cloud-rgb: 150, 164, 186; --cloud-lite: 190, 202, 220; } }
.wx-tint .wx-rolling { overflow: hidden; opacity: 0; transition: opacity 3s ease;
  /* keep the middle of the map clearer: clouds are strongest toward the edges */
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0, 0, 0, .35), #000 100%); mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0, 0, 0, .35), #000 100%); }
.wx-rolling::before, .wx-rolling::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 200%; background-repeat: repeat-x; background-size: 50% 100%; will-change: transform; }
.wx-rolling::before {
  background-image:
    radial-gradient(ellipse 26% 14% at 22% 22%, rgba(var(--cloud-rgb), .36), transparent 72%),
    radial-gradient(ellipse 18% 10% at 31% 27%, rgba(var(--cloud-rgb), .33), transparent 72%),
    radial-gradient(ellipse 22% 12% at 60% 58%, rgba(var(--cloud-rgb), .33), transparent 72%),
    radial-gradient(ellipse 16% 9% at 69% 63%, rgba(var(--cloud-rgb), .29), transparent 72%),
    radial-gradient(ellipse 24% 13% at 80% 14%, rgba(var(--cloud-rgb), .29), transparent 72%);
  animation: cloud-roll 120s linear infinite;
}
.wx-rolling::after {
  background-image:
    radial-gradient(ellipse 20% 11% at 16% 70%, rgba(var(--cloud-lite), .26), transparent 72%),
    radial-gradient(ellipse 14% 8% at 22% 74%, rgba(var(--cloud-lite), .23), transparent 72%),
    radial-gradient(ellipse 22% 12% at 45% 38%, rgba(var(--cloud-lite), .26), transparent 72%),
    radial-gradient(ellipse 15% 8% at 53% 42%, rgba(var(--cloud-lite), .22), transparent 72%),
    radial-gradient(ellipse 18% 10% at 85% 80%, rgba(var(--cloud-lite), .23), transparent 72%);
  animation: cloud-roll 75s linear infinite;
}
@keyframes cloud-roll { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.app[data-incoming="1"] .wx-rolling { opacity: .45; }
.app[data-incoming="2"] .wx-rolling { opacity: .65; }
.app[data-incoming="3"] .wx-rolling { opacity: .8; }
.app[data-incoming="2"] .wx-rolling::before { animation-duration: 95s; }
.app[data-incoming="2"] .wx-rolling::after { animation-duration: 60s; }
.app[data-incoming="3"] .wx-rolling::before { animation-duration: 70s; }
.app[data-incoming="3"] .wx-rolling::after { animation-duration: 45s; }
.app[data-incoming="2"] .wx-tint { background-color: rgba(70, 84, 106, .03); }
.app[data-incoming="3"] .wx-tint { background-color: rgba(60, 74, 98, .06); }
body.map-satellite .app[data-incoming] .wx-rolling { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .wx-rolling::before, .wx-rolling::after { animation: none; } }

/* night overrides the daytime look for every kind of weather */
.app[data-time="night"] { --wx-extra: saturate(.8) brightness(.58) contrast(1.06) hue-rotate(8deg); }
.app[data-time="night"] .wx-tint { background-color: rgba(6, 14, 46, .42); }
.app[data-time="night"] .wx-sun { opacity: 0; }
.app[data-time="night"][data-mood="clear"] .wx-stars, .app[data-time="night"][data-mood="partly"] .wx-stars { opacity: 1; }
.app[data-time="night"][data-mood="storm"] { --wx-extra: saturate(.5) brightness(.46) contrast(1.1); }
.app[data-time="night"][data-mood="snow"] { --wx-extra: saturate(.45) brightness(.8) contrast(.95); }
.app[data-time="night"][data-mood="snow"] .wx-tint { background-color: rgba(30, 44, 86, .38); }

.weather-note { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; color: var(--muted); font-size: 12.5px; }


/* weather sounds */
.map-btn[aria-pressed="true"] { background: var(--lagoon-tint); color: var(--lagoon-strong); }
.setting-row input[type="range"] { width: 150px; accent-color: var(--lagoon); }
.setting-row[hidden] { display: none; }


/* big uploads: how far along, and a way out */
.attach-size { position: absolute; right: 10px; bottom: 16px; display: none; padding: 3px 10px; border-radius: 10px; background: rgba(0,0,0,.68); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
.attach-cancel { position: absolute; top: 10px; left: 10px; display: none; padding: 6px 12px; border: 0; border-radius: 12px; background: rgba(0,0,0,.7); color: #fff; font-weight: 600; }
.attach-tray.uploading .attach-size, .attach-tray.uploading .attach-cancel { display: inline-block; }
.attach-stage:has(video) .attach-size { bottom: 56px; }


/* ============================================================ map search */
.map-search { position: absolute; z-index: 30; top: 14px; right: 64px; width: min(380px, calc(100vw - var(--panel-w) - 120px)); min-width: 300px; display: grid; gap: 8px; }
.map-search[hidden], .map-search-results[hidden] { display: none; }
.map-search-bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.map-search-bar input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: transparent; color: var(--ink); font: 500 15px var(--font-body); }
.map-search-bar input::placeholder { color: var(--muted); }
.map-search-close { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.map-search-close:hover { background: var(--lagoon-tint); }
.map-search-results { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 360px); overflow-y: auto; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.map-search-results li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; cursor: pointer; }
.map-search-results li:hover, .map-search-results li:focus-visible { background: var(--lagoon-tint); outline: 0; }
.map-search-results li > svg { flex: none; margin-top: 2px; color: var(--lagoon-strong); }
.map-search-results strong { display: block; font: 700 14.5px/1.3 var(--font-display); }
.map-search-results span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.map-search-results li.is-note { cursor: default; color: var(--muted); font-size: 13.5px; }
.map-search-results li.is-note:hover { background: none; }
.search-pin { color: var(--danger); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.search-pin svg { display: block; }
.search-popup { display: grid; gap: 6px; min-width: 150px; }
.search-popup strong { font: 700 14px var(--font-display); }
.search-popup span { color: #5b7073; font-size: 12.5px; }
.search-popup a { font-weight: 700; color: #085f5b; }
.search-popup button { justify-self: start; border: 0; background: none; padding: 0; color: #b93232; font: 600 12.5px var(--font-body); cursor: pointer; }
@media (max-width: 899px) {
  .map-search { top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; min-width: 0; }
}

/* ============================================================ satellite look */
/* Photos are already vivid, so skip the warm "sunny" tint and sun glow that made them look hazy. A touch of contrast sharpens detail. */
body.map-satellite .leaflet-tile-pane { filter: contrast(1.12) saturate(1.1) brightness(1.03); }
/* ...but keep the weather's darkening for night, rain and storms */
body.map-satellite .app[data-time="night"] .leaflet-tile-pane,
body.map-satellite .app[data-mood="rain"] .leaflet-tile-pane,
body.map-satellite .app[data-mood="storm"] .leaflet-tile-pane,
body.map-satellite .app[data-mood="drizzle"] .leaflet-tile-pane { filter: var(--wx-extra) contrast(1.08); }
body.map-satellite .app .wx-sun { opacity: 0; }
body.map-satellite .app[data-mood="fog"] .wx-haze { opacity: .4; }
body.map-satellite .app .wx-clouds { opacity: .35; }
body.map-satellite .app[data-mood="rain"] .wx-clouds, body.map-satellite .app[data-mood="storm"] .wx-clouds { opacity: .8; }
/* labels: a dark outline so street and place names stay readable on any photo */
.map-satellite .leaflet-labels-pane { filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 2px rgba(0, 0, 0, .75)); }
.map-satellite .map { background: #1b2a2c; }
.map-btn[aria-pressed="true"] { background: var(--lagoon-tint); color: var(--lagoon-strong); }

@media (max-width: 899px) {
  .map-tools { gap: 8px; }
  .map-btn { width: 44px; height: 44px; touch-action: manipulation; }
  .map-tools { z-index: 28; }          /* above the trip cards, so no button is ever covered */
}

/* ============================================================ place pictures */
.map-search-results li { align-items: center; }
.place-thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--lagoon-tint); }
.search-popup .place-photo { display: block; width: 100%; height: 130px; border-radius: 10px; object-fit: cover; background: #dfeceb; }
.search-popup .place-photo[hidden] { display: none; }
.search-popup .place-credit { color: #5b7073; font-size: 11px; margin-top: -2px; }
.search-popup .place-credit a { font-weight: 600; color: #5b7073; }
.popup-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.search-popup .popup-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid #b9d9d6; border-radius: 999px; background: #eef8f7; color: #085f5b; font: 600 12.5px var(--font-body); cursor: pointer; }
.search-popup .popup-chip:active { background: #d9efed; }
.search-popup .popup-link-danger[hidden] { display: none; }

.row-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.row-actions .btn[hidden] { display: none; }

/* ============================================================ nearby place pills */
.poi-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.poi-chips::-webkit-scrollbar { display: none; }
.poi-option { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: 600 14px var(--font-body); cursor: pointer; white-space: nowrap; }
.poi-option.is-active { background: var(--lagoon-strong); color: #fff; }
.poi-option-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; }
.poi-option:active { transform: scale(.97); }
.map-chips { flex-wrap: wrap; max-width: calc(100vw - 24px); }
.poi-status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: 600 13px var(--font-body); cursor: pointer; }
.poi-status[hidden] { display: none; }
.poi-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.poi { background: none; border: 0; }
.poi-wrap { position: relative; width: 30px; height: 30px; }
.poi-pin { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); }
.poi-name { position: absolute; left: 50%; top: 33px; transform: translateX(-50%); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font: 700 12px/1.2 var(--font-body); text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 4px #000; pointer-events: none; }
.leaflet-container:not(.poi-names) .poi-name { display: none; }

/* ============================================================ safety: SOS, check-ins, alerts */
.sos-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px 0 11px; border: 0; border-radius: 20px; background: #d63a3a; color: #fff; box-shadow: var(--shadow); font: 800 13px var(--font-body); letter-spacing: .03em; cursor: pointer; }
.sos-chip:active { transform: scale(.97); }
.sos-chip.is-on { background: #b01c1c; animation: sos-chip-pulse 1.4s ease-in-out infinite; }
@keyframes sos-chip-pulse { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(214, 58, 58, .55); } 50% { box-shadow: var(--shadow), 0 0 0 9px rgba(214, 58, 58, 0); } }

.login-invite { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--lagoon-tint); color: var(--lagoon-strong); font-weight: 600; }
.login-invite[hidden] { display: none; }

.alert-dock { position: fixed; z-index: 260; top: 14px; left: calc(var(--panel-w) + 28px); width: min(470px, calc(100vw - var(--panel-w) - 120px)); display: grid; gap: 10px; pointer-events: none; }
.alert-card { pointer-events: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); animation: notice-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.alert-sos { box-shadow: var(--shadow), 0 0 0 2px #d63a3a; }
.alert-calm { box-shadow: var(--shadow), 0 0 0 2px var(--lagoon); }
.alert-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--danger-tint); color: #b01c1c; }
.alert-calm .alert-icon { background: var(--lagoon-tint); color: var(--lagoon-strong); }
.alert-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alert-text strong { font: 700 15px/1.3 var(--font-display); }
.alert-text span { color: var(--muted); font-size: 13.5px; }
.alert-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.alert-actions:empty { display: none; }
.alert-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }
@media (max-width: 899px) { .alert-dock { top: calc(56px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; } }

.sos-marker { background: none; border: 0; }
.sos-pin { position: relative; width: 34px; height: 34px; }
.sos-pulse { position: absolute; inset: -6px; border-radius: 50%; background: rgba(214, 58, 58, .35); animation: sos-pulse 1.6s ease-out infinite; }
.sos-dot { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: #d63a3a; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); font: 800 17px var(--font-body); }
.sos-label { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); padding: 2px 8px; border-radius: 10px; background: #d63a3a; color: #fff; font: 700 12px var(--font-body); white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
@keyframes sos-pulse { from { transform: scale(.7); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sos-pulse, .sos-chip.is-on, .btn.is-armed { animation: none; } }

.safety-dialog { width: min(440px, calc(100vw - 24px)); max-height: 88vh; overflow-y: auto; }
.safety-dialog h3 { margin: 16px 0 6px; font: 700 15px var(--font-display); }
.safety-dialog .dialog-lead { margin: 0 0 4px; color: var(--muted); }
.safety-empty { margin: 0 0 8px; color: var(--muted); }
.contact-list { display: grid; gap: 2px; max-height: 190px; overflow-y: auto; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; cursor: pointer; }
.contact-row:hover { background: var(--lagoon-tint); }
.contact-row input { width: 20px; height: 20px; accent-color: var(--lagoon-strong); }
.safety-card { margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--lagoon-tint); display: grid; gap: 10px; }
.safety-card h3 { margin: 0; }
.safety-card p { margin: 0; color: var(--muted); font-size: 14px; }
.safety-card-on { background: var(--danger-tint); }
.safety-card .btn-large { width: 100%; }
.btn.is-armed { animation: sos-chip-pulse 0.9s ease-in-out infinite; }
.safety-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-choice { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 14px var(--font-body); cursor: pointer; }
.chip-choice[aria-pressed="true"] { background: var(--lagoon-strong); border-color: var(--lagoon-strong); color: #fff; }
.time-choice { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.time-choice input, .safety-card .input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: 500 15px var(--font-body); }
.safety-card .input { width: 100%; box-sizing: border-box; }
.safety-card .input:focus, .time-choice input:focus { outline: none; border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); }

.qr-dialog { text-align: center; }
.qr-box { width: min(260px, 70vw); margin: 0 auto 12px; padding: 8px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-link { margin: 0 0 16px; color: var(--muted); font-size: 12px; word-break: break-all; }
.qr-dialog .dialog-actions { justify-content: center; }
.invite-head { display: grid; place-items: center; margin-bottom: 12px; }
.invite-title, .invite-lead { text-align: center; }

/* ============================================================ minimize the panel into a circle (desktop) */
.panel-fab, .panel-min-btn { display: none; }
.head-actions { display: flex; align-items: center; gap: 6px; }
@media (min-width: 900px) {
  .panel-min-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; }

  /* The panel shrinks to a 56px circle in its top-left corner, then fades as the circle button appears. */
  .panel {
    clip-path: inset(-40px -40px -40px -40px round 62px);          /* wide enough not to cut off the shadow */
    transition: clip-path .34s cubic-bezier(.2, .8, .2, 1), opacity .2s ease, visibility 0s;
  }
  :root.panel-min .panel {
    clip-path: inset(0 calc(100% - 56px) calc(100% - 56px) 0 round 28px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: clip-path .34s cubic-bezier(.2, .8, .2, 1), opacity .2s ease .14s, visibility 0s linear .36s;
  }
  :root.panel-min { --panel-w: 56px; }

  .panel-fab {
    display: grid; place-items: center; position: absolute; z-index: 31; top: 12px; left: 12px; width: 56px; height: 56px;
    border: 0; border-radius: 50%; background: var(--lagoon-strong); color: #fff; box-shadow: var(--shadow); cursor: pointer;
    opacity: 0; transform: scale(.55); pointer-events: none;
    transition: opacity .16s ease, transform .3s cubic-bezier(.2, .9, .3, 1.2), background .15s;
  }
  :root.panel-min .panel-fab { opacity: 1; transform: none; pointer-events: auto; transition-delay: .16s, .16s, 0s; }
  .panel-fab:hover { background: var(--lagoon); }
  .panel-fab:focus-visible { outline: 3px solid var(--ping); outline-offset: 2px; }
  .panel-fab-badge { position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; display: grid; place-items: center; border-radius: 11px; background: var(--ping); color: #2c2000; border: 2px solid #fff; font: 700 12px var(--font-body); }
  .panel-fab-badge[hidden] { display: none; }

  /* everything beside the panel slides over to use the freed-up space */
  .trip-bar, .deck, .map-chips, .alert-dock, .weather-panel { transition: left .34s cubic-bezier(.2, .8, .2, 1), width .34s cubic-bezier(.2, .8, .2, 1); }
  :root.panel-instant .panel, :root.panel-instant .panel-fab, :root.panel-instant .trip-bar, :root.panel-instant .deck,
  :root.panel-instant .map-chips, :root.panel-instant .alert-dock, :root.panel-instant .weather-panel { transition: none !important; }
}
@media (prefers-reduced-motion: reduce) { .panel, .panel-fab, .trip-bar, .deck, .map-chips, .alert-dock, .weather-panel { transition: none !important; } }

/* ===== Inside the Android app (class is added by lib/native.js; the website is unaffected) ===== */
html.is-native, html.is-native body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
html.is-native body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.is-native input, html.is-native textarea, html.is-native .chat-messages, html.is-native [contenteditable] { -webkit-user-select: text; user-select: text; }
html.is-native button, html.is-native .tab, html.is-native a { touch-action: manipulation; }
html.is-native .app, html.is-native .login { padding-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px)); }
html.is-native .gps-chip { top: calc(12px + max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px))); }
