:root {
  --paper: #f5f4ef;
  --white: #fffefa;
  --ink: #171714;
  --muted: #696862;
  --line: rgba(23, 23, 20, 0.14);
  --wgw: #fd4f57;
  --plus: #333331;
  --you: #2563eb;
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html,
body,
.app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible { outline: 3px solid var(--you); outline-offset: 2px; }

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  touch-action: none;
  background: #deded9;
}

.leaflet-container { font: inherit; }
.leaflet-control-zoom { display: none; }
.leaflet-control-attribution {
  margin: 0 6px calc(164px + var(--safe-bottom)) 0 !important;
  padding: 2px 5px !important;
  border-radius: 6px;
  font-size: 9px !important;
  opacity: 0.72;
}

.topbar {
  position: fixed;
  z-index: 1000;
  top: var(--safe-top);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.brand,
.filters {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--white) 93%, transparent);
  box-shadow: 0 8px 28px rgba(23, 23, 20, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  min-width: 74px;
  padding: 8px 10px 7px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}

.brand span { font-size: 17px; font-weight: 750; letter-spacing: -0.04em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.filters {
  display: flex;
  min-width: 0;
  padding: 4px;
  border-radius: 14px;
}

.filter {
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.filter span { margin-left: 2px; font-size: 10px; font-weight: 500; opacity: 0.7; }
.filter.is-active { color: var(--white); background: var(--ink); }

.locate {
  position: fixed;
  z-index: 1000;
  right: 14px;
  bottom: calc(176px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  padding: 0 15px 0 12px;
  border: 0;
  border-radius: 23px;
  background: var(--you);
  color: white;
  box-shadow: 0 9px 24px rgba(37, 99, 235, 0.3);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.locate svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.locate.is-loading svg { animation: pulse 0.9s ease-in-out infinite alternate; }

.sheet {
  position: fixed;
  z-index: 1000;
  left: 10px;
  right: 10px;
  bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 146px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--white) 96%, transparent);
  box-shadow: 0 14px 46px rgba(23, 23, 20, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sheet-copy { min-width: 0; align-self: center; }
.meta { margin: 0 0 6px; color: var(--muted); font-size: 11px; line-height: 1.25; }
h1 { margin: 0; font-size: clamp(20px, 5.2vw, 28px); line-height: 1.02; letter-spacing: -0.045em; }
.description { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.28; }

.actions { display: flex; flex-direction: column; justify-content: center; gap: 8px; width: 118px; }
.actions.is-hidden { display: none; }
.button {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}

.button-primary { background: var(--wgw); color: #fff; }
.button-secondary { border: 1px solid var(--line); color: var(--ink); background: var(--paper); }

.status {
  position: fixed;
  z-index: 1100;
  left: 50%;
  top: calc(var(--safe-top) + 64px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.status.is-visible { opacity: 1; }

.venue-pin {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 14%;
  box-shadow: 0 2px 8px rgba(23, 23, 20, 0.32);
  transform: rotate(-45deg);
  transition: transform 130ms ease;
}

.venue-pin::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: white;
}

.venue-pin.wgw { background: var(--wgw); }
.venue-pin.wgw_plus { background: var(--plus); }
.venue-pin.selected { transform: rotate(-45deg) scale(1.28); }

.you-pin {
  width: 20px;
  height: 20px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--you);
  box-shadow: 0 0 0 7px rgba(37, 99, 235, 0.18), 0 4px 14px rgba(37, 99, 235, 0.45);
}

@keyframes pulse { from { opacity: 0.45; transform: scale(0.9); } to { opacity: 1; transform: scale(1.08); } }

@media (max-width: 370px) {
  .brand { display: none; }
  .topbar { justify-content: flex-end; }
  .filter { padding-inline: 8px; }
  .sheet { grid-template-columns: 1fr; gap: 10px; min-height: 162px; }
  .actions { width: 100%; flex-direction: row; }
  .button { flex: 1; }
  .locate { bottom: calc(192px + var(--safe-bottom)); }
  .leaflet-control-attribution { margin-bottom: calc(180px + var(--safe-bottom)) !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
