:root {
  color-scheme: light;
  --paper: oklch(97% 0.02 86);
  --ink: oklch(22% 0.05 258);
  --muted: oklch(47% 0.05 250);
  --line: oklch(88% 0.03 86);
  --blue: oklch(55% 0.2 255);
  --purple: oklch(45% 0.16 285);
  --sun: oklch(79% 0.16 82);
  --orange: oklch(64% 0.19 45);
  --green: oklch(66% 0.18 145);
  --sheet: oklch(98% 0.018 90 / 0.96);
  --shadow: 0 -18px 50px oklch(18% 0.05 260 / 0.22);
  font-family: Avenir Next, PingFang SC, Hiragino Sans GB, Helvetica Neue, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(340px, 48dvh) minmax(0, 1fr);
  background: linear-gradient(180deg, oklch(96% 0.03 90), oklch(92% 0.04 240));
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.top-bar {
  position: absolute;
  z-index: 20;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.kicker,
.sheet-head p,
.event-meta,
.detail-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 1px 0 0;
  max-width: 62vw;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

.locate-button,
.ghost-button,
.date-chip,
.venue-chip {
  min-height: 36px;
  border-radius: 999px;
  background: oklch(98% 0.018 90 / 0.92);
  color: var(--ink);
  box-shadow: 0 7px 22px oklch(25% 0.07 250 / 0.14);
  backdrop-filter: blur(12px);
}

.locate-button,
.ghost-button {
  padding: 0 14px;
  font-weight: 800;
}

.date-strip {
  position: absolute;
  z-index: 21;
  top: max(72px, calc(env(safe-area-inset-top) + 68px));
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.date-strip::-webkit-scrollbar,
.venue-strip::-webkit-scrollbar {
  display: none;
}

.date-chip {
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
}

.date-chip.active {
  background: var(--ink);
  color: var(--paper);
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.map-viewport:active {
  cursor: grabbing;
}

.map-content {
  position: absolute;
  left: 0;
  top: 0;
  width: min(150vh, 1180px);
  aspect-ratio: 2573 / 1418;
  overflow: hidden;
  transform-origin: 0 0;
  will-change: transform;
}

.map-content img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
}

.map-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  min-width: 42px;
  height: 42px;
  padding: 0 9px;
  transform: translate(-50%, -50%);
  border: 2px solid oklch(99% 0.01 90);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: oklch(98% 0.02 90);
  background: var(--blue);
  box-shadow: 0 9px 26px oklch(18% 0.08 260 / 0.24);
  font-size: 13px;
  font-weight: 900;
}

.map-marker[data-kind="outdoor"] {
  background: var(--orange);
}

.map-marker[data-kind="building"] {
  background: var(--purple);
}

.map-marker[data-kind="other"] {
  background: var(--muted);
}

.map-marker[data-kind="venue"] {
  min-width: 34px;
  height: 34px;
  padding: 0 7px;
  border-width: 1.5px;
  background: color-mix(in oklch, var(--sun), var(--orange) 16%);
  color: var(--ink);
  box-shadow: 0 8px 20px oklch(20% 0.06 250 / 0.16);
  font-size: 11px;
}

.map-marker[data-kind="venue"] .count {
  min-width: 17px;
  height: 17px;
  right: -4px;
  top: -5px;
  font-size: 10px;
}

.map-marker.active {
  background: var(--sun);
  color: var(--ink);
  transform: translate(-50%, -50%) scale(1.12);
}

.map-marker .count {
  position: absolute;
  right: -6px;
  top: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: oklch(98% 0.02 90);
  color: var(--ink);
  font-size: 11px;
  box-shadow: 0 3px 12px oklch(20% 0.05 250 / 0.18);
}

.sheet {
  position: relative;
  z-index: 30;
  min-height: 0;
  padding: 9px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--sheet);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: grid;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 8px;
  transform: translateY(var(--sheet-y, 0));
  transition: transform 180ms ease-out;
}

.sheet.compact {
  --sheet-y: 0;
}

.sheet-handle {
  justify-self: center;
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: oklch(72% 0.04 250);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-head h2 {
  margin: 1px 0 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: oklch(100% 0 0 / 0.72);
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.tag-filter-panel {
  display: grid;
  gap: 7px;
}

.filter-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tag-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tag-strip::-webkit-scrollbar {
  display: none;
}

.tag-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: oklch(100% 0 0 / 0.66);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px var(--line);
}

.tag-chip.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.tag-chip strong {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: oklch(96% 0.02 90);
  color: var(--ink);
  font-size: 10px;
}

.more-filters {
  min-width: 0;
}

.more-filters summary {
  width: max-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display: grid;
  align-items: center;
  background: color-mix(in oklch, var(--blue), white 86%);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}

.more-filters summary::-webkit-details-marker {
  display: none;
}

.more-filter-body {
  display: grid;
  gap: 7px;
  padding-top: 7px;
}

.venue-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.venue-chip {
  flex: 0 0 auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.venue-chip.active {
  background: color-mix(in oklch, var(--blue), white 80%);
  color: var(--ink);
}

.venue-chip strong {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: oklch(99% 0.01 90);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.activity-list {
  min-height: 0;
  overflow: auto;
  padding: 0 1px 10px;
}

.event-row {
  width: 100%;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.event-time {
  color: var(--purple);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.event-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.23;
  letter-spacing: 0;
}

.event-place {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 7px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--sun), white 72%);
  color: oklch(31% 0.08 80);
  font-size: 11px;
  font-weight: 800;
}

.empty {
  padding: 26px 4px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.55;
}

.detail-panel {
  position: absolute;
  z-index: 50;
  inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px;
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 16px;
  border-radius: 22px;
  background: oklch(99% 0.018 90);
  box-shadow: 0 18px 60px oklch(18% 0.05 260 / 0.28);
}

.close-detail {
  float: right;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
}

.detail-panel h3 {
  margin: 6px 58px 8px 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-panel p {
  margin: 10px 0 0;
  line-height: 1.6;
}

.detail-meta {
  margin-top: 8px;
}

@media (min-width: 760px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: 1fr;
  }

  .sheet {
    height: 100dvh;
    border-radius: 0;
    box-shadow: -14px 0 46px oklch(18% 0.05 260 / 0.14);
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .sheet-handle {
    display: none;
  }

  .detail-panel {
    left: auto;
    width: 410px;
    right: 400px;
  }
}

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