:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --gold: #d97706;
  --gold-bg: #fef3c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; min-height: 100dvh;
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; background: #111827; color: #f9fafb;
}
.app-title h1 { font-size: 17px; margin: 0; }
.data-meta { margin: 2px 0 0; font-size: 12px; color: #9ca3af; }
.locate-btn {
  flex: none; border: 0; border-radius: 999px; padding: 9px 14px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.locate-btn:disabled { opacity: 0.6; }

.controls {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.controls input[type="search"] {
  flex: 1 1 160px; padding: 9px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
}
.controls select {
  padding: 9px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.gold-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.gold-toggle input { accent-color: var(--gold); }

.layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.map-wrap { height: 46dvh; min-height: 260px; }
#map { width: 100%; height: 100%; }
.list-wrap { flex: 1; overflow-y: auto; padding: 6px 0 24px; }
.list-status { margin: 8px 14px; font-size: 13px; color: var(--muted); }

.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-item {
  padding: 10px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.shop-item.selected { background: #eff6ff; }
.shop-line1 { display: flex; align-items: center; gap: 8px; }
.shop-name { font-weight: 600; font-size: 15px; }
.shop-dist { margin-left: auto; font-weight: 700; color: var(--accent); font-size: 14px; }
.shop-line2 { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.badge-gold {
  flex: none; font-size: 11px; font-weight: 700; color: #92400e;
  background: var(--gold-bg); border: 1px solid #f59e0b;
  padding: 1px 7px; border-radius: 999px;
}

/* markers */
.pin-wrap { background: transparent; border: 0; }
.pin {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  margin: 2px;
}
.pin-normal { background: #2563eb; }
.pin-gold { background: #f59e0b; }
.pin-selected { outline: 3px solid rgba(37,99,235,0.45); }
.pin-user {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: #2563eb; border: 2.5px solid #fff;
  box-shadow: 0 0 0 6px rgba(37,99,235,0.25); margin: 2px;
}

/* detail sheet */
.detail-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,0.18);
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  max-height: 62dvh; overflow-y: auto;
}
.detail-sheet h2 { font-size: 17px; margin: 0 32px 6px 0; }
.detail-close {
  position: absolute; top: 10px; right: 12px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: #f3f4f6; font-size: 18px;
  cursor: pointer;
}
.d-dist { margin: 0 0 8px; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.d-fields { display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; margin: 0 0 14px; font-size: 14px; }
.d-fields dt { color: var(--muted); }
.d-fields dd { margin: 0; }
.d-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-primary, .btn-ghost {
  padding: 11px 16px; border-radius: 10px; font-size: 14.5px;
  font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #f3f4f6; color: var(--text); }

.app-footer { padding: 12px 14px 20px; font-size: 12px; color: var(--muted); }
.app-footer p { margin: 4px 0; }

@media (min-width: 900px) {
  .layout { flex-direction: row; }
  .map-wrap { flex: 1.4; height: auto; }
  .list-wrap { flex: 1; max-width: 460px; border-left: 1px solid var(--border); }
  .detail-sheet { left: auto; width: 440px; border-radius: 16px 0 0 0; }
}
