:root {
  --bg: #f3f0e8;
  --ink: #1c2430;
  --muted: #5c6570;
  --card: #fffcf7;
  --line: #e2dcd0;
  --teal: #1a5f5a;
  --teal-press: #144e4a;
  --paper: #fffcf7;
  --warn-bg: #f6efe6;
  --warn-ink: #6b3f2a;
  --footer: #e7e1d6;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "PingFang HK", "Noto Sans HK", sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
}

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 8px;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  font-weight: 700;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.primary, .more {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--teal);
  color: var(--paper);
  font-weight: 650;
  font-size: 1.05rem;
}

.primary { width: 100%; }

.primary:active, .more:active { background: var(--teal-press); }

.status {
  flex: none;
  margin: 0;
  padding: 4px 16px 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-wrap {
  flex: none;
  height: 34vh;
  min-height: 200px;
  background: #d9e2dc;
}

#map { height: 100%; width: 100%; }

.map-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.summary {
  flex: none;
  margin: 0;
  padding: 8px 16px 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.list-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  min-height: 72px;
  box-shadow: 0 1px 2px rgba(28, 36, 48, 0.05);
}

.card[aria-pressed="true"] {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.card-closed { background: var(--warn-bg); }

.card-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
}

.rank {
  font-weight: 700;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  min-width: 1.4rem;
}

.name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
}

.dist {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meta, .addr, .hours, .closed {
  display: block;
  margin-top: 4px;
}

.meta { color: var(--muted); font-size: 0.92rem; }

.addr { font-size: 1rem; }

.hours { color: var(--teal); font-weight: 650; }

.closed { color: var(--warn-ink); font-weight: 650; }

.note {
  display: block;
  margin-top: 2px;
  color: var(--warn-ink);
  font-weight: 400;
  font-size: 0.92rem;
}

.more {
  width: 100%;
  margin-top: 10px;
}

.footer {
  flex: none;
  background: var(--footer);
  color: #243038;
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #d5cfc3;
}

.footer a { color: var(--teal); }

.leaflet-div-icon.pin-wrap,
.leaflet-div-icon.you-wrap {
  background: transparent;
  border: 0;
}

.pin {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(28, 36, 48, 0.35);
}

.pin-on {
  background: #143f3c;
  transform: scale(1.08);
}

.you {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #245f9a;
  border: 3px solid white;
  box-shadow: 0 0 0 1px #245f9a, 0 1px 3px rgba(28, 36, 48, 0.35);
}

.empty {
  margin: 12px 4px;
  color: var(--muted);
}

@media (min-width: 880px) {
  .top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .primary { width: auto; min-width: 220px; padding: 0 18px; }

  .workspace { flex-direction: row; }

  .map-wrap {
    height: auto;
    flex: 1.15;
    min-height: 0;
  }

  .panel {
    flex: 0.85;
    border-left: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
