:root {
  --page: #efede8;
  --land: #f5f3ee;
  --street: #e3e0d8;
  --road: #ffffff;
  --road-edge: #dcd7cc;
  --park: #dfe7d3;
  --park-edge: #cfdcc0;
  --water: #d3e2ea;
  --water-edge: #bfd3de;
  --ink: #17181c;
  --soft: #6d6a64;
  --faint: #a29e95;
  --line: rgba(23, 24, 28, 0.09);
  --accent: #c8553d;
  --open: #2f7a4a;
  --shadow: 0 40px 70px -34px rgba(40, 30, 20, 0.38), 0 3px 10px rgba(40, 30, 20, 0.06);
  --card: 0 18px 36px -16px rgba(23, 24, 28, 0.38), 0 2px 6px rgba(23, 24, 28, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: radial-gradient(120% 90% at 50% 0%, #f6f4f0 0%, var(--page) 60%);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
}

/* the app window */
.app {
  position: relative;
  width: min(94vw, 720px);
  height: min(86vh, 470px);
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--land);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* a thin light edge on top of the window */
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 20;
}

.map { position: absolute; inset: 0; cursor: grab; }
.map.is-dragging { cursor: grabbing; }

.map__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.w-land { fill: var(--land); }
.w-street { stroke: var(--street); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.w-street.w-street--fine { stroke: #ebe8e1; }
.w-park { fill: var(--park); stroke: var(--park-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.w-path { stroke: #c9d8b8; stroke-width: 1.2; fill: none; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.w-water { fill: none; stroke: var(--water); stroke-linecap: round; }
.w-water-edge { fill: none; stroke: var(--water-edge); stroke-linecap: round; }
.w-sea { fill: var(--water); stroke: var(--water-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.w-casing { fill: none; stroke: var(--road-edge); stroke-linecap: round; }
.w-road { fill: none; stroke: var(--road); stroke-linecap: round; }

/* district and street names, placed by the script */
.labels, .markers { position: absolute; inset: 0; pointer-events: none; }

.label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.label__in {
  display: block;
  transform: translate(-50%, -50%);
}

.label--district .label__in {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.label--street .label__in {
  font-size: 10px;
  font-weight: 500;
  color: #9a958b;
  font-style: italic;
  font-stretch: 92%;
}

/* a single store pin; the script moves the button, CSS draws the drop on a child */
.pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border: 0;
  background: none;
  pointer-events: none;
}

.pin__hit {
  position: absolute;
  left: -17px;
  top: -44px;
  width: 34px;
  height: 46px;
  border-radius: 12px;
  pointer-events: auto;
  cursor: pointer;
}

.pin__shadow {
  position: absolute;
  left: -9px;
  top: -3px;
  width: 18px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(23, 24, 28, 0.32), rgba(23, 24, 28, 0));
  pointer-events: none;
}

.pin__lift {
  position: absolute;
  left: -15px;
  top: -40px;
  width: 30px;
  height: 30px;
  transform-origin: 50% 133%;
  pointer-events: none;
}

.pin__drop {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(160deg, #2a2c33 0%, var(--ink) 60%);
  box-shadow: 0 6px 12px -6px rgba(23, 24, 28, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: background 0.25s ease;
}

.pin.is-hot .pin__drop,
.pin.is-picked .pin__drop {
  background: linear-gradient(160deg, #d9684f 0%, var(--accent) 65%);
}

.pin__icon {
  position: absolute;
  left: 8px;
  top: 7px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* a cluster: a white disc with the number of stores inside */
.cluster {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cluster__body {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--d, 40px);
  height: var(--d, 40px);
  margin: calc(var(--d, 40px) / -2) 0 0 calc(var(--d, 40px) / -2);
  pointer-events: auto;
  cursor: pointer;
}

.cluster__ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(200, 85, 61, 0.35);
  background: rgba(200, 85, 61, 0.07);
  transition: inset 0.35s cubic-bezier(0.3, 1.5, 0.5, 1), border-color 0.3s ease, background 0.3s ease;
}

.cluster.is-hot .cluster__ring {
  inset: -12px;
  border-color: rgba(200, 85, 61, 0.6);
  background: rgba(200, 85, 61, 0.1);
}

.cluster__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #f6f4ef 100%);
  border: 1px solid rgba(23, 24, 28, 0.1);
  box-shadow: var(--card), inset 0 1px 0 #fff;
  display: grid;
  place-items: center;
}

.cluster__num {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cluster.is-big .cluster__num { font-size: 15px; }

/* the store card above a pin */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 8;
  pointer-events: none;
  visibility: hidden;
}

.tip__card {
  position: absolute;
  left: 0;
  bottom: 52px;
  width: 196px;
  margin-left: -98px;
  padding: 11px 13px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(23, 24, 28, 0.08);
  box-shadow: var(--card);
  transform-origin: 50% 100%;
}

.tip__arrow {
  position: absolute;
  left: calc(-6px + var(--nudge, 0px));
  bottom: 46px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid rgba(23, 24, 28, 0.08);
  border-bottom: 1px solid rgba(23, 24, 28, 0.08);
  transform: rotate(45deg);
}

.tip.is-below .tip__card { bottom: auto; top: 14px; transform-origin: 50% 0; }
.tip.is-below .tip__arrow { bottom: auto; top: 8px; transform: rotate(225deg); }

.tip__name { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.tip__addr { margin-top: 2px; font-size: 11px; color: var(--soft); }

.tip__row {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 24, 28, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tip__hours { white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--open); }
.tip__hours.is-shut { color: var(--soft); }
.tip__hours.is-soon { color: #b0661c; }

.tip__go {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.tip__go svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* the search bar and the count of stores in view */
.bar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(300px, 62%);
  height: 38px;
  padding: 0 12px 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 24, 28, 0.08);
  box-shadow: 0 10px 24px -14px rgba(23, 24, 28, 0.35), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  pointer-events: auto;
}

.search__mark { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.search__glass { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--soft); stroke-width: 1.5; stroke-linecap: round; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

.search input::placeholder { color: var(--soft); }

.count {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 24, 28, 0.08);
  box-shadow: 0 8px 20px -14px rgba(23, 24, 28, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.count__word, .count__short { margin-left: 0.32em; }
.count__num { display: inline-block; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.count__short { display: none; }

/* the scale bar */
.scale {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  pointer-events: none;
}

.scale__bar {
  display: block;
  width: 60px;
  height: 6px;
  border: 1.5px solid var(--ink);
  border-top: 0;
  opacity: 0.55;
}

.scale__text { font-size: 10.5px; font-weight: 600; color: var(--soft); line-height: 1; font-variant-numeric: tabular-nums; }

/* zoom buttons */
.zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(23, 24, 28, 0.08);
  box-shadow: 0 12px 26px -14px rgba(23, 24, 28, 0.4), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.zoom__btn {
  width: 38px;
  height: 36px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
}

.zoom__btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
.zoom__btn:active svg, .zoom__btn.is-pressed svg { transform: scale(0.8); }
.zoom__btn:disabled { color: var(--faint); cursor: default; }
.zoom__rule { width: 20px; height: 1px; background: rgba(23, 24, 28, 0.1); }

@media (hover: hover) {
  .zoom__btn:hover:not(:disabled) { background: rgba(23, 24, 28, 0.04); }
}

/* the drawn pointer of the autopilot */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 4px rgba(23, 24, 28, 0.28));
  transform-origin: 20% 15%;
}

/* small windows: the count keeps only the number */
.app.is-small .count__word { display: none; }
.app.is-small .count__short { display: inline; }
.app.is-small .search { width: 64%; height: 34px; }
.app.is-small .search input { font-size: 11.5px; }
.app.is-small .tip__card { width: 188px; margin-left: -94px; padding: 9px 11px 10px; }
.app.is-small .bar { left: 10px; right: 10px; top: 10px; }
.app.is-small .zoom { right: 10px; bottom: 10px; }
.app.is-small .scale { left: 12px; bottom: 12px; }
