:root {
  --bg: #0b0a10;
  --text: #f4f1fa;
  --muted: #a39cb5;
  --glass: rgba(22, 19, 32, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --pink: #ff5c8a;
  --violet: #9b5cff;
  --gradient: linear-gradient(135deg, var(--pink), var(--violet));
  --glow: 0 0 0 6px color-mix(in srgb, var(--pink) 22%, transparent), 0 8px 24px rgba(255, 92, 138, 0.35);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }

#map { position: fixed; inset: 0; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* --- brand ------------------------------------------------------------------------------- */

.brand-mark, .gate-mark {
  display: inline-block;
  background: var(--gradient);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill-rule='evenodd' d='M12 1.5c-4.4 0-8 3.4-8 7.8 0 5.9 8 13.2 8 13.2s8-7.3 8-13.2c0-4.4-3.6-7.8-8-7.8zm0 4.8a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill-rule='evenodd' d='M12 1.5c-4.4 0-8 3.4-8 7.8 0 5.9 8 13.2 8 13.2s8-7.3 8-13.2c0-4.4-3.6-7.8-8-7.8zm0 4.8a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'/></svg>") center / contain no-repeat;
}

.topbar {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
}
.brand-mark { width: 20px; height: 20px; }
.brand-word { font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }

.avatar {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar img:not([src]) { display: none; }
.avatar span { font-weight: 600; }

.menu {
  position: absolute;
  top: 52px;
  right: 0;
  min-width: 220px;
  padding: 14px;
  border-radius: 18px;
}
.menu-name { font-weight: 600; }
.menu-email { color: var(--muted); font-size: 13px; margin-bottom: 12px; overflow-wrap: anywhere; }
.menu button {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
}
.menu button:hover { background: rgba(255, 255, 255, 0.09); }

/* --- floating controls --------------------------------------------------------------------- */

.fab {
  position: fixed;
  right: 14px;
  bottom: calc(24px + var(--safe-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  z-index: 5;
}

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(30px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 150px);
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  z-index: 4;
}

/* --- map attribution (OpenStreetMap / OpenFreeMap credit is required, keep it visible) ------- */

.maplibregl-ctrl-attrib.maplibregl-compact {
  background: var(--glass);
  color: var(--muted);
}
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-bottom-right { bottom: calc(86px + var(--safe-bottom)); }

/* --- place sheet --------------------------------------------------------------------------- */

.sheet {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 24px));
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  z-index: 20;
  animation: rise 0.22s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px); } }

.sheet-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 20px;
  line-height: 1;
}
.sheet-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sheet-title { margin: 4px 40px 2px 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.sheet-address { color: var(--muted); font-size: 13px; min-height: 1em; }

.cta {
  margin-top: 16px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--gradient);
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 10px 30px rgba(255, 92, 138, 0.3);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.cta:active { transform: scale(0.98); }
.cta:disabled { opacity: 0.5; cursor: default; }

/* --- toast --------------------------------------------------------------------------------- */

.toast {
  position: fixed;
  top: calc(72px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  z-index: 40;
  box-shadow: var(--shadow);
  animation: rise 0.2s ease;
}

/* --- sign-in gate -------------------------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 20% 15%, color-mix(in srgb, var(--pink) 28%, transparent), transparent 70%),
    radial-gradient(55% 45% at 85% 90%, color-mix(in srgb, var(--violet) 30%, transparent), transparent 70%),
    rgba(11, 10, 16, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.gate-card {
  width: min(380px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gate-mark { width: 56px; height: 56px; filter: drop-shadow(0 10px 30px rgba(255, 92, 138, 0.5)); }
.gate h1 {
  margin: 14px 0 6px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.gate-lead { margin: 0 0 28px; color: var(--muted); font-size: 17px; }
#signin { min-height: 44px; }
.gate-fine { margin: 22px 0 0; color: var(--muted); font-size: 12px; opacity: 0.8; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
