:root {
  --bg: #070b16;
  --text: #f5f7fb;
  --muted: #a7b0c3;
  --line: rgba(255, 255, 255, 0.22);
  --glass: rgba(16, 22, 38, 0.55);
  --teal: #7ec8ff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dock: 92px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  touch-action: manipulation;
}
[hidden] { display: none !important; }
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; }
.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--fill { fill: currentColor; stroke: none; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(88, 120, 255, 0.28), transparent 42%),
    radial-gradient(circle at 50% 70%, rgba(255, 94, 168, 0.16), transparent 36%),
    var(--bg);
  transition: opacity 520ms var(--ease), visibility 520ms var(--ease);
}
.splash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash.is-hidden, .splash.is-hidden * { animation: none; }

.location-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(5, 8, 16, 0.62);
}
.location-gate[hidden] { display: none !important; }
.location-gate__card {
  width: min(420px, 100%);
  padding: 28px 22px 22px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(16, 20, 36, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.splash__glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 90, 255, 0.45), transparent 68%);
  filter: blur(8px);
  animation: glowPulse 2.4s var(--ease) infinite;
}
.splash__mark { width: 148px; height: 148px; position: relative; z-index: 1; }
.splash__title, .splash__subtitle {
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 700ms var(--ease) 1.7s forwards;
}
.splash__title { font-size: clamp(28px, 6vw, 40px); font-weight: 700; letter-spacing: -0.03em; }
.splash__subtitle { color: var(--muted); animation-delay: 1.9s; }
@keyframes glowPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes rise { to { opacity: 1; transform: none; } }

.app {
  position: fixed;
  inset: 0;
  opacity: 0;
  transition: opacity 480ms var(--ease);
}
.app.is-visible { opacity: 1; }
.map { position: absolute; inset: 0; z-index: 0; isolation: isolate; background: #0d1524; touch-action: none; }
.map.is-pinning, .map.is-pinning .leaflet-container { cursor: crosshair; }
.saved-pin {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  background: #ff5ea8;
  border: 2px solid #fff;
  transform: rotate(-45deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}
.pin-label {
  background: rgba(12, 16, 28, 0.88);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  box-shadow: none;
}
.pin-label::before { display: none; }
.pin-popup { display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.pin-popup input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  padding: 8px;
}
.pin-popup__actions { display: flex; gap: 8px; }
.pin-popup button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 8px;
  background: rgba(126, 200, 255, 0.2);
}

.leaflet-control-attribution {
  background: rgba(7, 11, 22, 0.72) !important;
  color: #8b97ad !important;
  backdrop-filter: blur(8px);
}
.leaflet-control-attribution a { color: var(--teal) !important; }
.leaflet-routing-container { display: none !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: rgba(14, 20, 34, 0.94);
  color: var(--text);
  border-radius: 14px;
}
.leaflet-popup-content-wrapper { border: 1px solid var(--line); }

.topbar {
  position: absolute;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.brand, .status, .map-tools, .dock, .sheet, .overlay, .toast { pointer-events: auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.brand__mark { width: 22px; height: 22px; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.4);
  color: var(--muted);
  font-size: 13px;
}
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #66758c;
}
.status__dot.is-live {
  background: #3dffb0;
  box-shadow: 0 0 10px #3dffb0;
}

.map-tools {
  position: absolute;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 68px);
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.glass-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.4);
  color: var(--text);
  font-size: 22px;
}
.glass-btn--tiny { width: 36px; height: 36px; border-radius: 50%; }
.glass-btn:active, .dock__btn:active, .liquid:active { transform: scale(0.97); }
.glass-btn.is-on {
  color: #9be7ff;
  border-color: rgba(126, 200, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(126, 200, 255, 0.25) inset;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(var(--dock) + 24px);
  background: rgba(5, 8, 16, 0.42);
  transition: opacity 320ms var(--ease), visibility 320ms var(--ease);
}
.overlay.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.crystal, .sheet, .dock {
  background:
    linear-gradient(160deg, rgba(28, 36, 62, 0.82), rgba(14, 18, 34, 0.74) 46%, rgba(36, 28, 58, 0.78));
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(1.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 24px 60px rgba(0, 0, 0, 0.35);
}
.crystal {
  position: relative;
  width: min(420px, 100%);
  padding: 28px 22px 22px;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.crystal::before, .sheet::before, .dock::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--spin, 0deg), transparent 0 70%, rgba(140, 190, 255, 0.85), rgba(255, 120, 190, 0.7), transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 7s linear infinite;
  pointer-events: none;
}
.crystal__shine {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 70%;
  height: 80%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
  pointer-events: none;
}
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }

.eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #c9d4ff; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field__input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
  transition: border-color 220ms var(--ease), box-shadow 220ms var(--ease), background 220ms var(--ease);
}
.field__input:focus {
  outline: none;
  border-color: rgba(150, 190, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(110, 160, 255, 0.18);
}
.field__input[readonly] { opacity: 0.8; }

.liquid {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 16px;
  padding: 13px 16px;
  font-weight: 600;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.22), rgba(130, 170, 255, 0.16) 45%, rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 24px rgba(80, 120, 255, 0.22);
}
.liquid__label { position: relative; z-index: 1; }
.liquid__blob {
  position: absolute;
  width: 140%;
  height: 180%;
  left: -20%;
  top: -120%;
  background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.75), rgba(150, 200, 255, 0.15) 42%, transparent 62%);
  transition: transform 650ms var(--ease);
}
.liquid:hover .liquid__blob, .liquid:focus-visible .liquid__blob { transform: translateY(46%) scale(1.05); }
.liquid:disabled { opacity: 0.6; }

.google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
  font-weight: 600;
}
.text-link {
  border: 0;
  background: none;
  color: #d5e2ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px;
}

.dock {
  position: absolute;
  z-index: 30;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 6px;
  padding: 8px;
  border-radius: 28px;
}
.dock__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.dock__btn--center {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.dock__btn[aria-pressed="true"] {
  color: #071018;
  background: linear-gradient(160deg, #f3f7ff, #9ec0ff 55%, #f7b7df);
}
.dock__btn.is-tracking { color: #d9fff1; }
.dock__btn.is-tracking[aria-pressed="true"] { color: #04281c; }

.sheet {
  position: absolute;
  z-index: 40;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--dock));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 320ms var(--ease), opacity 320ms var(--ease);
}
.sheet.is-open { transform: none; opacity: 1; pointer-events: auto; }
.sheet__handle {
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}
.sheet__head, .sheet__body {
  display: flex;
  gap: 12px;
  padding: 12px 14px 16px;
}
.sheet__head { align-items: center; justify-content: space-between; padding-bottom: 0; }
.sheet__body { flex-direction: column; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.summary { min-height: 18px; color: #b7d4ff; font-size: 14px; }
.advice {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
}
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
}
.chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
  white-space: pre-wrap;
}
.chat-msg--user { align-self: flex-end; background: rgba(126, 200, 255, 0.18); }
.chat-msg--ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.results { display: flex; flex-direction: column; gap: 8px; }
.results h3 { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.result {
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 10px 12px;
}
.result strong { display: block; }
.result span { color: var(--muted); font-size: 12px; }

.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer .field { flex: 1; }
.sheet__tools { display: flex; gap: 8px; }
.nav-banner {
  position: absolute;
  z-index: 25;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  left: 74px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-radius: 20px;
  background: rgba(14, 18, 32, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.nav-banner[hidden] { display: none !important; }
.nav-banner__copy { flex: 1; min-width: 0; }
.nav-banner strong { display: block; font-size: 20px; }
.nav-banner p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.live-marker { position: relative; width: 28px; height: 28px; }
.live-marker__arrow {
  position: absolute;
  left: 8px;
  top: 1px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid #d7ecff;
  transform-origin: 6px 13px;
}
.live-marker__arrow[hidden] { display: none !important; }
.live-marker__dot {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #7ec8ff;
  box-shadow: 0 0 0 3px #fff;
}
.live-marker__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(126, 200, 255, 0.45);
  animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse {
  from { transform: scale(0.55); opacity: 0.8; }
  to { transform: scale(2.1); opacity: 0; }
}

.toast {
  position: absolute;
  z-index: 70;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 118px);
  transform: translateX(-50%) translateY(8px);
  max-width: min(420px, 92vw);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(12, 16, 28, 0.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%); }

@media (pointer: coarse) {
  .crystal::before, .sheet::before, .dock::before { animation: none; display: none; }
  .splash__glow { animation: none; filter: none; }
  .live-marker__pulse { animation: none; opacity: 0.35; }
  .crystal, .sheet, .dock, .status, .glass-btn, .toast, .nav-banner, .leaflet-control-attribution {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .crystal, .sheet, .dock { background: rgba(14, 18, 32, 0.96); }
  .status, .glass-btn { background: rgba(16, 22, 38, 0.94); }
  .leaflet-zoom-anim .leaflet-zoom-animated { transition: none; }
}

@media (min-width: 760px) {
  .dock, .sheet { width: min(460px, calc(100% - 32px)); left: 50%; right: auto; }
  .dock { transform: translateX(-50%); }
  .sheet { transform: translateX(-50%) translateY(16px); }
  .sheet.is-open { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
button:focus-visible, input:focus-visible { outline: 2px solid #9ec0ff; outline-offset: 2px; }
