/* 视觉参考 iOS：系统色、大标题、毛玻璃导航、分段控件、内嵌分组列表 */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .2);
  --fill: rgba(118, 118, 128, .12);
  --seg-on: #ffffff;
  --bar: rgba(249, 249, 249, .82);
  --tint: #1f8a4c;
  --orange: #c45d00;
  --orange-bg: rgba(255, 149, 0, .14);
  --warn: #8a5a00;
  --warn-bg: rgba(255, 204, 0, .18);
  --red: #ff3b30;
  --c-trail: #34c759; --c-water: #007aff; --c-bike: #ff9500;
  --c-culture: #af52de; --c-view: #ff2d55; --c-winter: #32ade6;
  --m-land: #e4ecd9; --m-water: #a5cdec; --m-water-text: #2f6f9f;
  --m-road: #ffffff; --m-road-case: #cfd3c4; --m-hwy: #f8c94f; --m-hwy-case: #d9a23a;
  --m-trail: #8b6a45; --m-halo: rgba(255, 255, 255, .85);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .6);
    --fill: rgba(118, 118, 128, .24);
    --seg-on: #636366;
    --bar: rgba(22, 22, 24, .82);
    --tint: #30d158;
    --orange: #ff9f0a;
    --orange-bg: rgba(255, 159, 10, .18);
    --warn: #ffd60a;
    --warn-bg: rgba(255, 214, 10, .14);
    --red: #ff453a;
    --m-land: #1d2620; --m-water: #1b3a52; --m-water-text: #7fb6dd;
    --m-road: #4a4a4e; --m-road-case: #2a2a2c; --m-hwy: #b8892c; --m-hwy-case: #6e5320;
    --m-trail: #b08f68; --m-halo: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1c1c1e; --label: #ffffff;
  --label-2: rgba(235, 235, 245, .6); --label-3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .6); --fill: rgba(118, 118, 128, .24); --seg-on: #636366;
  --bar: rgba(22, 22, 24, .82); --tint: #30d158; --orange: #ff9f0a;
  --orange-bg: rgba(255, 159, 10, .18); --warn: #ffd60a; --warn-bg: rgba(255, 214, 10, .14);
  --red: #ff453a; color-scheme: dark;
  --m-land: #1d2620; --m-water: #1b3a52; --m-water-text: #7fb6dd;
  --m-road: #4a4a4e; --m-road-case: #2a2a2c; --m-hwy: #b8892c; --m-hwy-case: #6e5320;
  --m-trail: #b08f68; --m-halo: rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; letter-spacing: inherit; }

/* ---------- 顶部导航（毛玻璃）---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: transparent;
  transition: background .2s, box-shadow .2s;
}
.nav.scrolled {
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--sep);
}
.nav-inner {
  max-width: 720px; margin: 0 auto; height: 44px; position: relative;
  display: flex; align-items: center; justify-content: flex-end; padding: 0 16px;
}
.nav-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s;
}
.nav.scrolled .nav-title { opacity: 1; }
.net { font-size: 12px; font-weight: 600; color: var(--label-2); }
.net.off {
  color: #000; background: #ffcc00; padding: 2px 8px; border-radius: 999px;
}

/* ---------- 页面 ---------- */
main { max-width: 720px; margin: 0 auto; padding: 0 16px 24px; }
.large-title {
  font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .01em;
  margin: 0 0 10px;
}
.section-h {
  font-size: 13px; color: var(--label-2); text-transform: uppercase;
  margin: 22px 16px 7px; letter-spacing: 0;
}
.footnote { font-size: 13px; color: var(--label-2); margin: 8px 16px 16px; }

/* 搜索框 */
.search {
  display: flex; align-items: center; gap: 6px;
  background: var(--fill); border-radius: 10px; height: 36px; padding: 0 8px;
  margin-bottom: 12px;
}
.search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--label-2); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 17px; color: var(--label);
}
.search input::placeholder { color: var(--label-2); }

/* 分段控件 */
.segmented {
  display: flex; background: var(--fill); border-radius: 9px; padding: 2px; margin-bottom: 12px;
}
.segmented button {
  flex: 1; border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; padding: 6px 0; border-radius: 7px;
}
.segmented button[aria-pressed="true"] {
  background: var(--seg-on); font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
}

/* 筛选胶囊 */
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px;
  scrollbar-width: none; position: relative;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; cursor: pointer; background: var(--fill);
  font-size: 15px; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--tint); color: #fff; font-weight: 600; }

/* ---------- 内嵌分组列表 ---------- */
.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.group:empty { display: none; }
.empty { font-size: 15px; color: var(--label-2); padding: 12px 16px; margin: 0; background: var(--card); }

.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 44px; padding: 10px 16px; border: 0; background: none;
  text-align: left; cursor: pointer;
}
.row:active { background: var(--fill); }
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px;
  border-top: .5px solid var(--sep);
}
.row.has-tile + .row::before, .row.has-tile + .row.has-tile::before { left: 68px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-size: 17px; }
.row-sub { font-size: 13px; color: var(--label-2); }
.row-desc {
  font-size: 14px; color: var(--label-2);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.chev {
  flex: none; width: 8px; height: 8px; margin-left: 4px;
  border-right: 2px solid var(--label-3); border-top: 2px solid var(--label-3);
  transform: rotate(45deg);
}
.row-danger { color: var(--red); justify-content: center; }

.tile {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 21px;
}
.tile.trail { background: color-mix(in srgb, var(--c-trail) 18%, transparent); }
.tile.water { background: color-mix(in srgb, var(--c-water) 18%, transparent); }
.tile.bike { background: color-mix(in srgb, var(--c-bike) 18%, transparent); }
.tile.culture { background: color-mix(in srgb, var(--c-culture) 18%, transparent); }
.tile.view { background: color-mix(in srgb, var(--c-view) 18%, transparent); }
.tile.winter { background: color-mix(in srgb, var(--c-winter) 18%, transparent); }
.thumb { flex: none; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--fill); display: grid; place-items: center; font-size: 22px; }

.diff-1 { color: var(--c-trail); }
.diff-2 { color: var(--c-water); }
.diff-3 { color: var(--orange); }
.star { color: #ff9f0a; }

/* 本月提示 */
.month-card { padding: 12px 16px; font-size: 15px; display: flex; gap: 12px; align-items: flex-start; }
.month-card .badge-m {
  flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--tint); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; line-height: 1.1; text-align: center;
}
.month-card .mt { font-weight: 600; display: block; }
.month-card .md { color: var(--label-2); }

/* ---------- 动植物卡片 ---------- */
.cards { display: grid; gap: 12px; }
.sp-card {
  display: grid; grid-template-columns: 112px 1fr;
  background: var(--card); border-radius: 14px; overflow: hidden; cursor: pointer;
}
.sp-card:active { opacity: .85; }
.sp-photo { position: relative; min-height: 132px; background: var(--fill); display: grid; place-items: center; }
.sp-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sp-emoji { font-size: 44px; }
.sp-body { padding: 11px 12px 12px; min-width: 0; }
@media (min-width: 560px) {
  .sp-card { grid-template-columns: 200px 1fr; }
  .sp-photo { min-height: 150px; }
  .sp-emoji { font-size: 56px; }
  .sp-body { padding: 12px 14px 14px; }
}
.sp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sp-name { font-size: 17px; font-weight: 600; }
.sp-sub { font-size: 13px; color: var(--label-2); }
.sp-intro {
  font-size: 15px; margin: 6px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.sp-where { font-size: 13px; color: var(--label-2); }

.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--fill); color: var(--label-2); }
.badge.best { background: var(--orange-bg); color: var(--orange); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* App Store 式胶囊按钮 */
.pill {
  flex: none; border: 0; cursor: pointer; background: var(--fill); color: var(--tint);
  font-size: 14px; font-weight: 700; padding: 4px 14px; border-radius: 999px; white-space: nowrap;
}
.pill[aria-pressed="true"] { background: var(--tint); color: #fff; }

/* ---------- 安全须知 ---------- */
.safety .row { align-items: flex-start; cursor: default; }
.safety .row:active { background: none; }
.safety .row-title { font-weight: 600; font-size: 15px; }
.safety .row-sub { font-size: 15px; color: var(--label-2); }

/* ---------- 底部标签栏（毛玻璃）---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; background: none; cursor: pointer; color: var(--label-2);
  padding: 6px 0 4px; font-size: 10px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs button[aria-current="page"] { color: var(--tint); }
.tabs button[aria-current="page"] svg { fill: color-mix(in srgb, currentColor 20%, transparent); }

/* ---------- 详情弹层（iOS sheet）---------- */
.sheet {
  border: 0; padding: 0; width: 100%; max-width: 720px;
  margin: auto auto 0; max-height: 92vh; max-height: 92dvh;
  border-radius: 12px 12px 0 0; background: var(--bg); color: var(--label);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: up .32s cubic-bezier(.32, .72, 0, 1); }
@keyframes up { from { transform: translateY(100%); } }
@media (min-width: 760px) {
  .sheet { margin: auto; border-radius: 14px; max-height: 86vh; }
  .sheet[open] { animation: pop .22s ease-out; }
  @keyframes pop { from { transform: scale(.96); opacity: 0; } }
}
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; height: 44px;
  display: flex; justify-content: flex-end; align-items: center; padding: 0 10px;
}
.grabber {
  position: absolute; left: 50%; top: 5px; transform: translateX(-50%);
  width: 36px; height: 5px; border-radius: 3px; background: var(--label-3);
}
.sheet-done {
  border: 0; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--tint);
  padding: 5px 12px; border-radius: 999px;
  background: var(--bar); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.sheet-body { overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

.hero { margin: 0 -16px; }
.hero img { width: 100%; aspect-ratio: 3 / 2; max-height: 48vh; object-fit: cover; display: block; background: var(--fill); }
.hero figcaption { font-size: 11px; color: var(--label-2); padding: 6px 16px 0; }
.hero figcaption a { color: inherit; }
.sheet-head { padding-top: 52px; display: flex; gap: 14px; align-items: center; }
.sheet-head .tile { width: 60px; height: 60px; border-radius: 14px; font-size: 32px; }
.hero + .sheet-title { margin-top: 14px; }
.sheet-title h2 { font-size: 28px; line-height: 1.15; font-weight: 700; margin: 0; }
.sheet-title .sub { color: var(--label-2); font-size: 15px; margin-top: 2px; }
.sheet-title .latin { font-style: italic; }
.lead { font-size: 17px; margin: 12px 0 0; }

.kv .row { cursor: default; }
.kv .row:active { background: none; }
.kv .k { flex: none; color: var(--label); }
.kv .v { flex: 1; text-align: right; color: var(--label-2); }
.text-card { background: var(--card); border-radius: 12px; padding: 12px 16px; font-size: 16px; }
.callout {
  background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 16px;
  font-size: 15px; margin-top: 16px;
}
.callout b { display: block; margin-bottom: 2px; }
.mbar { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; padding: 12px 12px 10px; }
.mbar i {
  font-style: normal; font-size: 11px; text-align: center; padding: 5px 0; border-radius: 5px;
  background: var(--fill); color: var(--label-3); font-variant-numeric: tabular-nums;
}
.mbar i.on { background: color-mix(in srgb, var(--tint) 22%, transparent); color: var(--label); }
.mbar i.best { background: var(--orange); color: #fff; font-weight: 700; }
.mbar-legend { font-size: 12px; color: var(--label-2); padding: 0 12px 10px; }
.big-btn {
  display: block; width: 100%; margin-top: 20px; border: 0; cursor: pointer;
  background: var(--tint); color: #fff; font-size: 17px; font-weight: 600;
  padding: 14px; border-radius: 12px;
}
.big-btn[aria-pressed="true"] { background: var(--fill); color: var(--tint); }
.sheet-body:focus { outline: none; }

/* ---------- 地图 ---------- */
.map-wrap {
  position: relative; height: clamp(300px, 78vw, 560px);
  border-radius: 14px; overflow: hidden; margin-bottom: 16px;
  background: var(--m-land); touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.map-wrap:active { cursor: grabbing; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m-land { fill: var(--m-land); }
.m-water { fill: var(--m-water); }
.m-river { fill: none; stroke: var(--m-water); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.m-trail { fill: none; stroke: var(--m-trail); stroke-width: 1.4; stroke-dasharray: 3 3; display: none; }
.map.zoomed .m-trail { display: inline; }
.m-road-case, .m-road, .m-hwy-case, .m-hwy { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m-road-case { stroke: var(--m-road-case); stroke-width: 3.6; }
.m-road { stroke: var(--m-road); stroke-width: 2; }
.m-hwy-case { stroke: var(--m-hwy-case); stroke-width: 6.5; }
.m-hwy { stroke: var(--m-hwy); stroke-width: 4.5; }

.map-labels, .map-pins { position: absolute; inset: 0; pointer-events: none; }
.map-label { position: absolute; left: 0; top: 0; }
.map-label > span {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 11px; line-height: 1;
  text-shadow: 0 0 2px var(--m-halo), 0 0 2px var(--m-halo), 0 0 3px var(--m-halo);
}
.map-label.lake > span { color: var(--m-water-text); font-style: italic; }
.map-label.place > span { color: var(--label); font-weight: 700; font-size: 12px; }
.map-label.km > span {
  font-size: 10px; font-weight: 700; color: #7a5a00; background: var(--m-hwy);
  padding: 2px 4px; border-radius: 4px; text-shadow: none; transform: translate(-50%, -150%);
}

.map-pin {
  position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none;
  pointer-events: auto; cursor: pointer;
}
.pin-dot {
  position: absolute; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--pin); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  display: grid; place-items: center; font-size: 15px; line-height: 1;
  transition: width .15s, height .15s, font-size .15s;
}
.map:not(.zoomed) .map-pin:not(.on) .pin-dot { width: 24px; height: 24px; font-size: 12px; border-width: 1.5px; }
.map-pin.on { z-index: 3; }
.map-pin.on .pin-dot { width: 44px; height: 44px; font-size: 23px; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.pin-label {
  position: absolute; top: 17px; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--label); display: none;
  text-shadow: 0 0 2px var(--m-halo), 0 0 2px var(--m-halo), 0 0 3px var(--m-halo);
}
.map.zoomed .pin-label { display: block; }
.map-pin.on .pin-label { display: block; top: 24px; font-size: 12px; }

.map-me {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
}
.map-me::before {
  content: ""; position: absolute; width: 16px; height: 16px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #0a84ff; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(10, 132, 255, .22), 0 1px 3px rgba(0, 0, 0, .3);
}

.map-ctrl {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  display: flex; flex-direction: column; border-radius: 10px; overflow: hidden;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .18);
}
.map-ctrl button {
  width: 36px; height: 36px; border: 0; background: none; cursor: pointer;
  color: var(--tint); font-size: 20px; font-weight: 500; display: grid; place-items: center;
}
.map-ctrl button + button { box-shadow: 0 -.5px 0 var(--sep); }
.map-ctrl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.map-ctrl button.busy svg { animation: blink .8s infinite alternate; }
@keyframes blink { to { opacity: .2; } }
.map-attr {
  position: absolute; left: 8px; bottom: 6px; font-size: 10px; color: var(--label-2);
  text-shadow: 0 0 2px var(--m-halo);
}
.big-btn.plain { margin-top: 10px; background: var(--card); color: var(--tint); }
