/* 港深打卡 CityWalk — 手机竖屏，全屏地图 + 悬浮控件 + 底部抽屉
   场景：夜晚街头单手持机边走边看。深色 chrome、金色夜行强调、地图是主角。 */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0f1216;
  --surface: #171d26;
  --surface-2: #202834;
  --line: #2b3441;
  --ink: #f3f5f7;
  --dim: #9aa5b1;
  --faint: #6b7683;
  --accent: #f5a623;
  --accent-ink: #211603;
  --primary: #2f80ed;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;
  --shadow-1: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 10px 32px rgba(0, 0, 0, 0.5);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms;
  --t-med: 260ms;
  /* 悬浮控件几何 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar-h: 44px;
  --chip-h: 38px;
  --top-cluster: calc(var(--safe-top) + 8px + var(--bar-h) + 8px + var(--chip-h));
  /* z 轴语义层级 */
  --z-scrim: 500;
  --z-controls: 900;
  --z-list: 800;
  --z-fab: 950;
  --z-mask: 1200;
  --z-sheet: 1300;
  --z-toast: 1400;
}

html, body { height: 100%; overscroll-behavior: none; }

body {
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }

.icon { width: 18px; height: 18px; flex: none; display: block; }

/* ---------- 全屏地图 ---------- */
#map {
  position: fixed;
  inset: 0;
  background: #ccd3da;
  z-index: 0;
}

/* 顶部渐隐 scrim：保证悬浮控件压在浅色瓦片上也清晰 */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--top-cluster) + 40px);
  background: linear-gradient(to bottom, rgba(10, 13, 17, 0.55), rgba(10, 13, 17, 0));
  pointer-events: none;
  z-index: var(--z-scrim);
}

/* ---------- 悬浮顶栏 ---------- */
.topbar {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 10px;
  right: 10px;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: var(--z-controls);
}

.brand {
  height: var(--bar-h);
  padding: 0 14px 0 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(19, 24, 31, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  white-space: nowrap;
}
.brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.7);
}

.seg {
  margin-left: auto;
  height: var(--bar-h);
  padding: 4px;
  gap: 2px;
  background: rgba(19, 24, 31, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  display: flex;
  align-items: center;
}
.seg button {
  height: 100%;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button.active { background: var(--primary); color: #fff; font-weight: 600; }
.seg button.current { color: var(--accent); }
.seg button:active { transform: scale(0.96); }

.view-toggle {
  height: var(--bar-h);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(19, 24, 31, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  white-space: nowrap;
  transition: background var(--t-fast);
}
.view-toggle:active { background: var(--surface-2); }

/* ---------- 悬浮筛选 chips ---------- */
.chips {
  position: fixed;
  top: calc(var(--safe-top) + 8px + var(--bar-h) + 8px);
  left: 0;
  right: 0;
  height: var(--chip-h);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: var(--z-controls);
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  height: 34px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: rgba(19, 24, 31, 0.92);
  color: var(--ink);
  font-size: 13px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip .n { font-size: 11px; color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.active .n { color: rgba(33, 22, 3, 0.65); }
.chip:disabled { opacity: 0.35; }
.chip:active:not(:disabled) { transform: scale(0.96); }

/* ---------- marker 标签 ---------- */
.poi-label {
  background: rgba(255, 255, 255, 0.95);
  border: 0;
  border-radius: 7px;
  box-shadow: 0 1px 5px rgba(15, 23, 32, 0.3);
  color: #1f2933;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  white-space: nowrap;
}
.poi-label::before { display: none; }
.poi-label-night { background: rgba(255, 246, 224, 0.97); color: #6b4e00; }
.labels-off .poi-label { display: none; }

/* 用户蓝点 */
.user-dot {
  width: 16px;
  height: 16px;
  background: #4285f4;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.4), 0 1px 6px rgba(0, 0, 0, 0.4);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.45), 0 1px 6px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(66, 133, 244, 0.1), 0 1px 6px rgba(0, 0, 0, 0.4); }
}

/* ---------- 回到我 FAB ---------- */
.fab {
  position: fixed;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 22px);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(19, 24, 31, 0.95);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-2);
  z-index: var(--z-fab);
  transition: transform var(--t-fast), background var(--t-fast);
}
.fab:active { transform: scale(0.92); background: var(--surface-2); }
.fab .icon { width: 22px; height: 22px; }

/* ---------- 列表面板 ---------- */
.list {
  position: fixed;
  inset: 0;
  z-index: var(--z-list);
  background: var(--bg);
  overflow-y: auto;
  padding: calc(var(--top-cluster) + 14px) 12px calc(var(--safe-bottom) + 24px);
}
.list-empty { color: var(--faint); text-align: center; padding: 48px 0; }

.list-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r-m);
  padding: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.list-item:active { background: var(--surface-2); }

.thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--r-s);
  object-fit: cover;
  flex: none;
  background: var(--surface-2);
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  background: linear-gradient(150deg, var(--surface-2), #232f3d);
}
.thumb-empty .icon { width: 24px; height: 24px; opacity: 0.7; }
.thumb.broken { visibility: hidden; }

.li-main { flex: 1; min-width: 0; }
.li-title {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-sub {
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.li-sub b { color: var(--accent); font-weight: 700; }
.li-tags {
  margin-top: 4px;
  font-size: 11px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-hot {
  flex: none;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
  margin-top: 2px;
}
.night-badge { font-size: 12px; flex: none; }

/* ---------- 底部详情抽屉 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.5);
  z-index: var(--z-mask);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: var(--r-l) var(--r-l) 0 0;
  border-top: 1px solid var(--line);
  z-index: var(--z-sheet);
  padding: 8px 16px calc(var(--safe-bottom) + 18px);
  box-shadow: var(--shadow-2);
  transform: translateY(104%);
  visibility: hidden;
  transition: transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med);
}
.sheet.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform var(--t-med) var(--ease-out);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 6px auto 12px;
}

.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: var(--r-m);
  margin-bottom: 14px;
  scrollbar-width: none;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip img {
  height: 216px;
  min-width: 80%;
  object-fit: cover;
  border-radius: var(--r-m);
  scroll-snap-align: center;
  background: var(--surface-2);
}
.photo-placeholder {
  height: 150px;
  min-width: 100%;
  border-radius: var(--r-m);
  background: linear-gradient(150deg, var(--surface-2), #232f3d);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--dim);
  font-size: 13px;
}
.photo-placeholder .icon { width: 26px; height: 26px; color: var(--faint); }
.ph-sub { font-size: 11px; color: var(--faint); }

.sheet-title h2 { font-size: 20px; font-weight: 700; display: inline; letter-spacing: 0.005em; }
.title-en { color: var(--faint); font-size: 12px; margin-top: 3px; }
.sheet-meta { color: var(--dim); font-size: 13px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.sheet-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sheet-tags span {
  font-size: 11px;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 9px;
  color: var(--dim);
}
.sheet-hours {
  font-size: 13px;
  color: var(--accent);
  margin-top: 12px;
  font-weight: 500;
}
.sheet-intro { font-size: 14.5px; line-height: 1.7; margin-top: 10px; max-width: 68ch; }
.sheet-tips { list-style: none; margin-top: 10px; }
.sheet-tips li {
  font-size: 13px;
  line-height: 1.75;
  color: #ccd4dc;
  padding-left: 14px;
  position: relative;
}
.sheet-tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.sheet-links { display: flex; gap: 8px; margin-top: 16px; }
.btn {
  flex: 1;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.btn:active { filter: brightness(1.15); transform: scale(0.98); }
.btn-primary { flex: 1.6; background: var(--primary); color: #fff; font-weight: 600; }
.sheet-source { font-size: 11px; color: var(--faint); margin-top: 14px; }

/* ---------- toast（底部 snackbar） ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 88px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 48px);
  background: rgba(24, 30, 38, 0.97);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: var(--z-toast);
  box-shadow: var(--shadow-2);
  white-space: nowrap;
  animation: toast-in 240ms var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast button {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 13px;
  margin-left: 10px;
}

/* ---------- Leaflet 控件 ---------- */
.leaflet-control-attribution {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 6px 0 0 0;
  color: #4b5763;
}
.leaflet-bottom.leaflet-right .leaflet-control-attribution { margin-right: 0; }

/* ---------- 窄屏（≤400px）：收紧顶栏，保三组控件一行 ---------- */
@media (max-width: 400px) {
  .view-toggle span { display: none; }
  .view-toggle { padding: 0 12px; }
  .brand { padding: 0 11px 0 10px; font-size: 13px; }
  .seg button { padding: 0 10px; font-size: 12.5px; }
}

/* ---------- 动效可及性 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .user-dot { animation: none; }
}
