:root {
  --water: #0a3d4d;
  --water-deep: #062830;
  --foam: #eef6f7;
  --lure: #f0a202;
  --lure-dark: #d48900;
  --fish: #1aa6a6;
  --fish-soft: #3ec1c1;
  --ink: #12303a;
  --muted: #5b7780;
  --line: rgba(10, 61, 77, 0.1);
  --card: #fff;
  --danger: #c23b3b;
  --shadow: 0 10px 32px rgba(6, 40, 48, 0.18);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--water-deep);
  overflow: hidden;
}
button, input { font-family: inherit; }
a { color: inherit; text-decoration: none; }

#app { height: 100%; }
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--foam);
}

.page-header {
  flex-shrink: 0;
  z-index: 20;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background:
    linear-gradient(145deg, rgba(26,166,166,.18), transparent 42%),
    linear-gradient(180deg, #062830, #0a3d4d 78%, #0e4e58);
  color: #fff;
  box-shadow: 0 8px 24px rgba(6, 40, 48, 0.28);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
}
.brand-copy { flex: 1; min-width: 0; }
.brand-copy h1 {
  font-size: 18px; font-weight: 750; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.subtitle {
  margin-top: 2px; font-size: 12px; color: rgba(255,255,255,.72);
}
.intro {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255,255,255,.88);
}
.locate-btn {
  width: 42px; height: 42px; border: 0; border-radius: 14px;
  background: rgba(255,255,255,.14); color: #fff;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.locate-btn.locating { animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { color: var(--lure); } }

.search-row { margin-top: 12px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.96);
  border-radius: 14px;
  padding: 0 12px;
  height: 44px;
  box-shadow: var(--shadow);
}
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  border: 0; outline: 0; width: 100%;
  font-size: 15px; background: transparent; color: var(--ink);
}
.search-box input::placeholder { color: #8aa0a8; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.radius-chips { padding-top: 8px; }
.chip {
  flex-shrink: 0;
  border: 0;
  background: rgba(255,255,255,.16);
  color: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active {
  background: var(--lure);
  color: #2a1c00;
  font-weight: 650;
}

.stats-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat-card {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
}
.stat-card strong {
  display: block;
  font-size: 15px;
  font-weight: 750;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255,255,255,.68);
}
.stats-tip {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-tip.muted { color: rgba(255,255,255,.55); }

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 160px;
}
#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #c5d9de;
}
.leaflet-container { font-family: inherit; background: #c5d9de; }

.toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(6,40,48,.88);
  color: #fff;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

.sheet {
  flex-shrink: 0;
  z-index: 15;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 24px rgba(6,40,48,.12);
  display: flex;
  flex-direction: column;
  max-height: 34%;
  transition: max-height .25s ease;
}
.sheet.expanded { max-height: 52%; }
.sheet-handle {
  height: 20px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.sheet-handle b {
  width: 36px; height: 4px; border-radius: 4px; background: #d5e2e6; display: block;
}
.sheet-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 16px 8px;
}
.sheet-head h2 { font-size: 16px; }
.sheet-head span { font-size: 12px; color: var(--muted); }
.shop-list {
  overflow-y: auto;
  padding: 0 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.shop-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
}
.shop-item:active, .shop-item.active { background: var(--foam); }
.shop-cover {
  width: 72px; height: 72px; border-radius: 12px;
  background: linear-gradient(145deg, var(--water), var(--fish));
  color: #fff; display: grid; place-items: center;
  font-size: 26px; overflow: hidden;
}
.shop-cover img { width: 100%; height: 100%; object-fit: cover; }
.shop-meta h3 { font-size: 15px; font-weight: 650; line-height: 1.3; }
.shop-meta p {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tag-row { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  font-size: 11px; color: var(--water); background: #e6f4f4;
  padding: 2px 6px; border-radius: 6px;
}
.dist {
  font-size: 13px; font-weight: 700; color: var(--lure-dark);
  white-space: nowrap;
}
.empty {
  text-align: center; color: var(--muted); padding: 22px 12px; font-size: 14px;
}

.page-footer {
  flex-shrink: 0;
  z-index: 16;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + var(--safe-bottom));
}
.footer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.footer-main b { font-size: 14px; }
.footer-main p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.footer-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}
.footer-stats em {
  font-style: normal;
  font-weight: 750;
  color: var(--water);
}
.footer-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #8aa0a8;
}
.footer-meta a { color: var(--fish); font-weight: 600; }

.detail {
  position: absolute; inset: 0; z-index: 40;
  background: var(--foam);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s ease;
}
.detail.show { transform: none; }
.detail-hero {
  position: relative;
  height: 220px;
  background: linear-gradient(160deg, var(--water-deep), var(--fish));
  flex-shrink: 0;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-ph {
  height: 100%; display: grid; place-items: center; color: #fff; font-size: 48px;
}
.detail-close, .gallery-nav {
  position: absolute; border: 0; background: rgba(6,40,48,.45); color: #fff;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.detail-close { top: calc(10px + var(--safe-top)); left: 12px; }
.gallery-nav { top: 50%; transform: translateY(-50%); }
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }
.dots {
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.45); }
.dots i.on { background: #fff; width: 16px; border-radius: 6px; }

.detail-body {
  flex: 1; overflow-y: auto;
  padding: 16px 16px calc(92px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.detail-title { font-size: 22px; font-weight: 750; }
.detail-sub {
  margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.badge {
  background: #fff3d6; color: var(--lure-dark);
  font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.section { margin-top: 18px; }
.section h4 { font-size: 14px; margin-bottom: 8px; }
.section p, .addr { font-size: 14px; line-height: 1.7; color: #2a4a52; white-space: pre-wrap; }
.addr { display: flex; gap: 8px; align-items: flex-start; }

.detail-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: #fff;
  box-shadow: 0 -6px 20px rgba(6,40,48,.08);
}
.bar-btn {
  height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; font-weight: 650; cursor: pointer;
}
.bar-btn.primary {
  background: var(--lure); border-color: var(--lure); color: #2a1c00;
}
.nav-sheet {
  position: absolute; left: 12px; right: 12px; bottom: calc(70px + var(--safe-bottom));
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; z-index: 5;
}
.nav-sheet button {
  width: 100%; border: 0; background: #fff; padding: 14px;
  text-align: left; font-size: 15px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.nav-sheet button:last-child { border-bottom: 0; }

.yuju-pin { background: none !important; border: 0 !important; }
.yuju-pin-body {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--water);
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(6,40,48,.35);
}
.yuju-pin-body span { transform: rotate(45deg); font-size: 16px; line-height: 1; }
.yuju-pin.is-active .yuju-pin-body { background: var(--lure); }
.yuju-me { background: none !important; border: 0 !important; }
.yuju-me i {
  width: 18px; height: 18px; border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(26,115,232,.22);
  display: block;
}

@media (max-width: 899px) {
  .leaflet-control-zoom { display: none; }
}
@media (max-width: 380px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .app {
    max-width: 1180px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto 1fr auto;
  }
  .page-header {
    grid-column: 1 / -1;
  }
  .map-wrap {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }
  .sheet {
    grid-column: 2;
    grid-row: 2;
    max-height: none !important;
    border-radius: 0;
    height: 100%;
  }
  .sheet-handle { display: none; }
  .page-footer {
    grid-column: 1 / -1;
  }
  .detail {
    left: auto; width: 400px;
  }
}
