:root {
  --blue: #2563eb;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --t1: #dc2626;
  --t2: #ea580c;
  --t3: #2563eb;
  --t4: #6b7280;
  --t5: #9ca3af;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top {
  flex: 0 0 auto;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
}
.tabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.sub { margin: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.base { display: flex; gap: 4px; flex: 0 0 auto; }
.base button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}
.base button.on { background: #111827; color: #fff; border-color: #111827; }

#map { flex: 0 0 46vh; z-index: 1; }
.list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 10px calc(24px + env(safe-area-inset-bottom));
  background: #f3f4f6;
}

.pin-wrap { background: none; border: none; }
.pin {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.pin.on { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(17, 24, 39, .25), 0 1px 4px rgba(0, 0, 0, .35); }
.pin.t1 { background: var(--t1); }
.pin.t2 { background: var(--t2); }
.pin.t3 { background: var(--t3); }
.pin.t4 { background: var(--t4); }
.pin.t5 { background: var(--t5); }

.row {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.row h3 { margin: 0 0 2px; font-size: 15px; line-height: 1.35; }
.row .meta { margin: 0 0 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.row .btns { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 6px;
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: 1px;
}
.chip.t1 { background: var(--t1); }
.chip.t2 { background: var(--t2); }
.chip.t3 { background: var(--t3); }
.chip.t4 { background: var(--t4); }
.chip.t5 { background: var(--t5); }

a.bd, button.bd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  text-decoration: none;
  border: none;
  border-radius: 9px;
  background: #1a73e8;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
a.bd.ghost, button.bd.ghost {
  background: #fff;
  color: #1f2937;
  border: 1px solid var(--line);
}

.panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1500;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform .25s ease;
  max-height: 72vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.panel.show { transform: translateY(0); }
.close {
  position: absolute;
  top: 10px; right: 12px;
  border: none;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.kicker { margin: 0 0 2px; font-size: 12px; font-weight: 700; color: var(--blue); letter-spacing: .02em; }
#p-name { margin: 0 0 4px; font-size: 20px; line-height: 1.3; padding-right: 60px; }
.addr { margin: 0 0 10px; font-size: 13px; color: #4b5563; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.note { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #374151; white-space: pre-wrap; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photos img { width: 100%; border-radius: 10px; display: block; cursor: zoom-in; }
.photos img.big { grid-column: 1 / -1; cursor: zoom-out; }
.photos figcaption { font-size: 11px; color: var(--muted); margin-top: 3px; }
.photos figure { margin: 0; }

@media (min-width: 760px) {
  body { display: grid; grid-template-columns: 55% 1fr; grid-template-rows: auto 1fr; }
  .top { grid-column: 1 / -1; }
  #map { height: auto; }
  .panel { left: auto; right: 20px; bottom: 20px; width: 420px; border-radius: 16px; transform: translateY(0); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .panel.show { opacity: 1; pointer-events: auto; }
}
