/* ===== iOS 风格 · 浅色液态玻璃 ===== */
:root {
  --bg: #eef1f7;
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, .62);
  --label-3: rgba(60, 60, 67, .38);
  --sep: rgba(60, 60, 67, .12);
  --fill: rgba(118, 118, 128, .12);
  --blue: #007aff;
  --orange: #ff9500;
  --green: #34c759;
  --red: #ff3b30;
  --yellow: #ffcc00;
  --r-xl: 26px;
  --r-lg: 18px;
  --r-md: 12px;
  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .5));
  --glass-border: rgba(255, 255, 255, .75);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 1px rgba(255, 255, 255, .35), 0 10px 30px -8px rgba(30, 41, 70, .18), 0 2px 6px rgba(30, 41, 70, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--label);
  background: var(--bg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
/* 柔和的「壁纸」，给玻璃一点可以折射的颜色 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45vmax 45vmax at 8% 0%, rgba(120, 180, 255, .45), transparent 60%),
    radial-gradient(40vmax 40vmax at 100% 20%, rgba(255, 190, 150, .38), transparent 60%),
    radial-gradient(45vmax 45vmax at 30% 100%, rgba(170, 230, 210, .40), transparent 60%),
    radial-gradient(35vmax 35vmax at 90% 95%, rgba(210, 180, 255, .35), transparent 60%),
    var(--bg);
}
h1, h2 { margin: 0; }
a { color: var(--blue); text-decoration: none; }

/* 液态玻璃 */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* ===== 导航栏 ===== */
.navbar {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 12px;
  margin: 0; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  border-width: 0 0 1px; border-radius: 0;
  border-bottom-color: rgba(255, 255, 255, .6);
}
.nav-title { flex: 1; min-width: 0; }
.navbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.status { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .18); }
.dot-warn { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 149, 0, .18); }
.dot-bad { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 59, 48, .18); }
.dot-wait { background: var(--label-3); }

.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--blue); cursor: pointer; padding: 0;
  transition: transform .2s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { cursor: default; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 布局 ===== */
.layout { display: grid; gap: 16px; padding: 14px 16px 8px; grid-template-columns: minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.panel { border-radius: var(--r-xl); padding: 16px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.caption { margin: 0; font-size: 13px; color: var(--label-2); }

.alert {
  margin-bottom: 12px; padding: 10px 14px; border-radius: var(--r-md);
  font-size: 14px; color: #c4271d; background: rgba(255, 59, 48, .1);
}

/* ===== 地图 ===== */
.map-card { min-width: 0; }
.map-wrap {
  position: relative; border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 0 18px 40px -14px rgba(30, 41, 70, .35), 0 2px 8px rgba(30, 41, 70, .08);
  isolation: isolate;
}
.map { height: 62vh; min-height: 340px; background: #1d2433; }
.map-card .caption { padding: 8px 6px 0; }
.map-fallback { display: flex; align-items: center; justify-content: center; height: 100%; padding: 24px; text-align: center; color: rgba(255, 255, 255, .8); font-size: 14px; }

.map-overlay { position: absolute; z-index: 800; }
.top-left { top: 12px; left: 12px; }
.top-right { top: 12px; right: 12px; }
.bottom-left { bottom: 26px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); left: 12px; }

.legend { padding: 8px 12px; border-radius: 16px; font-size: 13px; color: var(--label); }
.lg-row { display: flex; gap: 12px; }
.lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.alt-bar { margin-top: 6px; }
.alt-grad { display: block; height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgb(52,199,89), rgb(0,199,190), rgb(0,122,255), rgb(88,86,214), rgb(175,82,222)); }
.alt-ticks { display: flex; justify-content: space-between; margin-top: 2px; font-size: 10px; color: var(--label-2); }
.alt-ticks i { font-style: normal; }
.lg-note { margin-top: 4px; font-size: 11px; color: #b25e00; }
.lg b { font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-dot.mil { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 149, 0, .25); }
.lg-dot.civ { background: #fff; border: 1.5px solid #5b6474; }

/* iOS 分段控件 */
.segmented { display: flex; padding: 3px; border-radius: 999px; gap: 2px; }
.seg {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--label);
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease;
}
.seg[aria-selected="true"] { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* iOS 开关 */
.toggles { display: grid; gap: 2px; padding: 6px 8px 6px 14px; border-radius: 18px; }
.toggle-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.toggle-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: rgba(120, 120, 128, .32); transition: background .25s ease; }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s cubic-bezier(.3, .7, .4, 1.2);
}
.toggle-row input:checked + .switch { background: var(--green); }
.toggle-row input:checked + .switch::after { transform: translateX(18px); }
.toggle-row input:focus-visible + .switch { outline: 2px solid var(--blue); outline-offset: 2px; }

.map-alert {
  left: 12px; right: 12px; top: 58px; padding: 9px 14px; border-radius: 14px;
  font-size: 13px; color: #fff; background: rgba(255, 59, 48, .82);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}

/* 飞机图标 */
.ac-icon { background: none; border: 0; }
.ac-icon svg { display: block; transform-origin: 50% 50%; transition: transform .3s ease; }
.ac-civ svg path { fill: #fff; stroke: rgba(20, 24, 33, .75); stroke-width: 1; }
.ac-mil svg { filter: drop-shadow(0 0 4px rgba(255, 149, 0, .9)) drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.ac-mil svg path { fill: var(--orange); stroke: #fff; stroke-width: 1.2; }
.ac-ground { opacity: .55; }
.map:not(.is-sat) .ac-civ svg path { fill: #5b6474; stroke: #fff; }

/* Leaflet 主题 */
.leaflet-container { font: inherit; }
.leaflet-control-zoom { border: 0 !important; border-radius: 14px !important; overflow: hidden; box-shadow: var(--glass-shadow) !important; margin-bottom: 26px !important; margin-bottom: calc(26px + env(safe-area-inset-bottom, 0px)) !important; margin-right: 12px !important; }
.leaflet-control-zoom a {
  width: 36px !important; height: 36px !important; line-height: 36px !important; font-size: 20px !important;
  color: var(--label) !important; border-bottom-color: var(--sep) !important;
  background: rgba(255, 255, 255, .72) !important; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .6) !important; border-top-left-radius: 8px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.leaflet-popup-content-wrapper {
  border-radius: 18px; color: var(--label);
  background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}
.leaflet-popup-tip { background: rgba(255, 255, 255, .82); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; min-width: 210px; }
.popup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.popup-title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.popup-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.popup-tag.mil { color: #b25e00; background: rgba(255, 149, 0, .16); }
.popup-tag.civ { color: var(--label-2); background: var(--fill); }
.popup-row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border-top: .5px solid var(--sep); }
.popup-row span:first-child { color: var(--label-2); }
.popup-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 时间线 ===== */
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--label);
  background: var(--fill); border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.chip[aria-selected="true"] { color: #fff; background: var(--blue); box-shadow: 0 4px 12px rgba(0, 122, 255, .3); }
.chip .n { margin-left: 4px; font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tl-item {
  background: rgba(255, 255, 255, .72); border-radius: var(--r-lg); padding: 14px;
  box-shadow: 0 1px 2px rgba(30, 41, 70, .05), 0 0 0 .5px rgba(30, 41, 70, .05);
}
.tl-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--label-2); }
.tl-time { font-variant-numeric: tabular-nums; margin-right: 2px; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--label-2); }
.badge-cat { color: var(--blue); background: rgba(0, 122, 255, .1); }
.conf-已证实 { color: #1f8a3c; background: rgba(52, 199, 89, .14); }
.conf-媒体报道 { color: #b25e00; background: rgba(255, 149, 0, .14); }
.conf-推测 { color: var(--label-2); background: var(--fill); }
.tl-title { margin: 8px 0 4px; font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
.tl-summary { margin: 0; color: var(--label-2); font-size: 14px; line-height: 1.5; }
.tl-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--label-2); }
.tag { color: var(--label-2); background: var(--fill); border-radius: 6px; padding: 1px 7px; }
.empty { color: var(--label-2); font-size: 14px; padding: 16px 0; text-align: center; }

/* ===== 问 AI（iMessage 气泡） ===== */
.chat-log { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; min-height: 150px; overflow-y: auto; padding: 4px 2px 12px; }
.bubble { max-width: 82%; padding: 9px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.42; }
.bubble.user { align-self: flex-end; color: #fff; background: linear-gradient(180deg, #2b8cff, #007aff); border-bottom-right-radius: 6px; }
.bubble.ai { align-self: flex-start; background: rgba(233, 233, 235, .9); border-bottom-left-radius: 6px; }
.bubble.err { color: #c4271d; background: rgba(255, 59, 48, .1); }
.bubble.pending { color: var(--label-2); animation: pulse 1.2s ease-in-out infinite; }
.bubble.ai .chat-p { margin: 0 0 6px; }
.bubble.ai .chat-p:last-child { margin-bottom: 0; }
.bubble.ai .chat-h { margin: 2px 0 6px; font-weight: 700; }
.bubble.ai .chat-list { display: grid; gap: 3px; margin: 2px 0 6px; }
.bubble.ai .chat-li { display: flex; gap: 6px; }
.bubble.ai .chat-bullet { flex: none; opacity: .7; }
.bubble.ai strong { font-weight: 700; }
.bubble.ai code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; padding: 0 4px; border-radius: 5px; background: rgba(0, 0, 0, .07); }
@keyframes pulse { 50% { opacity: .5; } }
.chat-form {
  display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 .5px rgba(60, 60, 67, .2);
}
.chat-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; /* 16px 防 iOS 自动缩放 */
  color: var(--label); background: transparent; border: 0; padding: 7px 0; outline: none;
}
.chat-form input::placeholder { color: var(--label-3); }
.send-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: #fff; background: var(--blue); cursor: pointer;
  transition: transform .15s ease, opacity .2s ease;
}
.send-btn:active { transform: scale(.9); }
.send-btn:disabled { opacity: .4; cursor: default; }
.mic-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: var(--blue); background: var(--fill); cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
.mic-btn:active { transform: scale(.9); }
.mic-btn.recording { color: #fff; background: var(--red); animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 59, 48, .16); } }

.footer { max-width: 900px; margin: 0 auto; padding: 8px 20px 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); font-size: 12px; line-height: 1.6; color: var(--label-3); text-align: center; }

/* ===== 航迹页新增 ===== */
.view-seg { flex: none; }
.view-seg .seg { padding: 6px 12px; }
.navbar .icon-btn { margin-left: 2px; }

.map-search {
  top: 108px; left: 12px; width: min(300px, calc(100% - 24px));
  display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 38px; border-radius: 999px; color: var(--label-2);
}
.map-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font: inherit; font-size: 16px; color: var(--label); }
.map-search input::placeholder { color: var(--label-3); font-size: 14px; }
.map-search input::-webkit-search-cancel-button { display: none; }

.apt-label {
  background: rgba(255, 255, 255, .78); border: 0; border-radius: 6px; box-shadow: none;
  padding: 1px 6px; font-size: 11px; font-weight: 600; color: var(--label);
}
.apt-label::before { display: none; }

.ac-icon { cursor: pointer; }
.ac-selected svg { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 6px rgba(255, 204, 0, 1)) drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.ac-selected svg path { fill: var(--yellow) !important; stroke: #1c1c1e !important; }

/* 详情面板：手机底部抽屉，电脑右侧卡片 */
.detail {
  left: 8px; right: 8px; bottom: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 900; max-height: 58%; overflow-y: auto;
  border-radius: 24px; padding: 6px 16px 14px; overscroll-behavior: contain;
  background: linear-gradient(160deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .78));
}
.detail-grip { display: block; width: 100%; height: 18px; border: 0; padding: 0; margin: 0 0 4px; background: transparent; cursor: pointer; position: relative; }
.detail-grip::after { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: rgba(60, 60, 67, .28); }
.detail-head { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.head-btns { display: flex; gap: 6px; flex: none; }
.whole-btn { color: var(--blue); background: rgba(0, 122, 255, .1); }
.detail-quick { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; color: var(--label); font-variant-numeric: tabular-nums; }
.detail-quick b { font-weight: 600; }
.detail-quick span { color: var(--label-2); }
.peek-hint { display: none; margin-top: 4px; font-size: 11px; color: var(--label-3); }
@media (max-width: 899px) {
  .detail.peek { overflow: hidden; }
  .detail.peek .detail-photo, .detail.peek .detail-grid, .detail.peek .detail-actions, .detail.peek .detail-note { display: none !important; }
  .detail.peek .peek-hint { display: block; }
}
.detail-id { flex: 1; min-width: 0; }
.detail-call { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.detail-sub { margin-top: 2px; font-size: 13px; color: var(--label-2); }
.close-btn { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--label-2); background: var(--fill); cursor: pointer; }
.detail-alert { margin-top: 10px; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; color: #c4271d; background: rgba(255, 59, 48, .12); }
.detail-photo { position: relative; margin-top: 12px; border-radius: 14px; overflow: hidden; background: var(--fill); aspect-ratio: 3 / 2; }
.detail-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-credit { position: absolute; left: 8px; bottom: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: #fff; background: rgba(0, 0, 0, .45); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 12px; border-radius: 14px; overflow: hidden; background: var(--sep); }
.dg-cell { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; background: rgba(255, 255, 255, .85); min-width: 0; }
.dg-k { font-size: 11px; color: var(--label-2); }
.dg-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-word; }
.detail-actions { display: flex; gap: 8px; margin-top: 12px; }
.pill-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--blue); background: rgba(0, 122, 255, .1);
  border: 0; border-radius: 999px; cursor: pointer;
}
.pill-btn[aria-pressed="true"] { color: #fff; background: var(--blue); }
.detail-note { margin: 10px 2px 0; font-size: 11px; color: var(--label-3); }

/* 提示条 */
.toasts { position: fixed; z-index: 2000; top: calc(var(--nav-h, 64px) + 8px); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); display: grid; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 10px 14px; border-radius: 18px; font: inherit; font-size: 14px; line-height: 1.4; color: var(--label);
  opacity: 0; transform: translateY(-8px) scale(.98); transition: opacity .25s ease, transform .25s ease; cursor: default;
}
button.toast { cursor: pointer; }
.toast.show { opacity: 1; transform: none; }
.toast-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--blue); }
.toast-mil .toast-icon { background: var(--orange); }
.toast-warn .toast-icon { background: var(--red); }

.badge-auto { color: #6e3cc4; background: rgba(175, 82, 222, .12); }
.tl-auto { box-shadow: inset 3px 0 0 rgba(255, 149, 0, .7), 0 1px 2px rgba(30, 41, 70, .05); }

/* 时间线卡片可点开查看完整详情 */
.tl-item { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.tl-item:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -14px rgba(30, 41, 70, .32), 0 0 0 .5px rgba(30, 41, 70, .06); }
.tl-item:active { transform: scale(.995); }
.tl-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tl-more { margin-left: auto; color: var(--blue); font-weight: 600; white-space: nowrap; }

/* 条目详情：手机底部抽屉 / 桌面居中卡片 */
.item-modal { position: fixed; inset: 0; z-index: 2400; display: flex; align-items: flex-end; justify-content: center; }
.item-modal[hidden] { display: none; }
.item-modal-backdrop {
  position: absolute; inset: 0; background: rgba(20, 24, 33, .38);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.item-sheet {
  position: relative; width: 100%; max-height: 84vh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 24px 24px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
}
.item-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.item-title { margin: 10px 0 8px; font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.item-summary { margin: 0; font-size: 15px; line-height: 1.6; color: var(--label); white-space: pre-wrap; }
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 14px; border-radius: 14px; overflow: hidden; background: var(--sep); }
.item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.item-tags:empty { display: none; }
.item-link { display: inline-flex; width: 100%; margin-top: 14px; text-decoration: none; }
.item-link[hidden] { display: none; }
.item-note { margin: 10px 2px 0; font-size: 11px; line-height: 1.55; color: var(--label-3); }
body.modal-open { overflow: hidden; }

@media (min-width: 700px) {
  .item-modal { align-items: center; padding: 24px; }
  .item-sheet { max-width: 600px; max-height: 80vh; border-radius: 26px; padding: 22px; }
}

/* 航迹模式：地图全屏 */
body[data-view="track"] { overflow: hidden; }
body[data-view="track"] .timeline-card,
body[data-view="track"] .chat-card,
body[data-view="track"] .footer,
body[data-view="track"] .map-card .caption { display: none; }
body[data-view="track"] .layout { display: block; padding: 0; max-width: none; }
body[data-view="track"] .map-wrap { position: fixed; top: var(--nav-h, 64px); left: 0; right: 0; bottom: 0; border-radius: 0; box-shadow: none; }
body[data-view="track"] .map { height: 100%; min-height: 0; }

@media (max-width: 520px) {
  .navbar h1 { font-size: 18px; }
  .view-seg .seg { padding: 6px 10px; }
  .map-wrap.has-detail .toggles, .map-wrap.has-detail .leaflet-control-zoom { visibility: hidden; }
}

/* 窄屏（iPhone SE / 360px 级）：压缩导航栏，避免标题与分段控件挤出屏幕 */
@media (max-width: 380px) {
  .navbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .navbar h1 { font-size: 16px; }
  .view-seg .seg { padding: 6px 8px; font-size: 12px; }
  .icon-btn { width: 36px; height: 36px; }
}

@media (min-width: 900px) {
  .detail { left: auto; right: 12px; top: 12px; bottom: auto; width: 360px; max-height: calc(100% - 24px); }
  .map-wrap.has-detail .top-right { right: 384px; }
}

/* 不支持 backdrop-filter 的浏览器：用更实的白底 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, .94); }
}

/* ≥900px：左地图 + 问 AI，右时间线 */
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); align-items: start; gap: 20px; padding: 20px 24px 8px; }
  .navbar { padding-left: 24px; padding-right: 24px; }
  .map-card { grid-column: 1; grid-row: 1; }
  .chat-card { grid-column: 1; grid-row: 2; }
  .timeline-card { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 84px; }
  .map { height: 64vh; }
  .timeline { max-height: calc(100vh - 230px); overflow-y: auto; margin-right: -6px; padding-right: 6px; }
}
