/* 台风平台样式 v1.2 - 大字号舒适阅读 + 中文字体栈 */
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "HarmonyOS Sans",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin-slow { animation: spin-slow 3s linear infinite; }

@keyframes marquee { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }
.marquee { animation: marquee 20s linear infinite; }

/* 工具按钮(四宫格) */
.tool-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 2px 8px; border-radius: 14px; text-align: center;
  background: #f0f9ff; border: 1px solid #e0f2fe; color: #0369a1;
  transition: all .18s; min-width: 0; overflow: hidden;
}
.tool-btn .tool-ico {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  background: #fff; box-shadow: 0 1px 3px rgba(2,132,199,.12);
  transition: all .18s;
}
.tool-btn .tool-ico i { font-size: 15px; line-height: 1; }
.tool-btn .tool-txt {
  display: block; width: 100%; font-size: 12px; font-weight: 600; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .2px;
}
.tool-btn:hover { background: #e0f2fe; border-color: #7dd3fc; transform: translateY(-1px); }
.tool-btn:hover .tool-ico { box-shadow: 0 3px 8px rgba(2,132,199,.22); }
.tool-btn:active { transform: translateY(0); }
.tool-btn.active {
  background: linear-gradient(135deg,#0284c7,#06b6d4); border-color: transparent; color: #fff;
  box-shadow: 0 3px 12px rgba(6,182,212,.35);
}
.tool-btn.active .tool-ico { background: rgba(255,255,255,.2); box-shadow: none; color: #fff; }

/* 台风tab */
.ty-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; line-height: 1;
  background: #f1f5f9; color: #64748b; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; transition: all .15s; flex-shrink: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* 活跃台风呼吸光点: flex对齐消除基线偏移, 双层光环更精致 */
.live-dot {
  position: relative; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: #4ade80; box-shadow: 0 0 0 2px rgba(74,222,128,.3);
}
.ty-tab.active .live-dot { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid currentColor; color: #4ade80; opacity: 0;
  animation: live-ring 2s ease-out infinite;
}
.ty-tab.active .live-dot::after { color: #fff; }
@keyframes live-ring { 0% { transform: scale(.5); opacity: .8; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
#typhoon-tabs { flex-wrap: nowrap; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
#typhoon-tabs::-webkit-scrollbar { height: 4px; }
#typhoon-tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.ty-tab.active { background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; box-shadow: 0 2px 10px rgba(6,182,212,.35); }
.ty-tab.history-tag { background: #fef9c3; color: #a16207; padding-right: 8px; }
.ty-tab.history-tag.active { background: linear-gradient(135deg,#d97706,#f59e0b); color: #fff; box-shadow: 0 2px 10px rgba(245,158,11,.35); }
.tab-close { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; font-size: 11px; opacity: .55; transition: all .15s; vertical-align: -2px; }
.tab-close:hover { opacity: 1; background: rgba(0,0,0,.12); }
.ty-tab.history-tag.active .tab-close:hover { background: rgba(255,255,255,.25); }
.ty-tab.clear-history { background: #f1f5f9; color: #64748b; border: 1px dashed #cbd5e1; }
.ty-tab.clear-history:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.history-super { background: #fef2f2; border-color: #fecaca; }
.history-super:hover { background: #fee2e2; border-color: #fca5a5; }

/* 多台风同屏: 其他台风名称标签 */
.other-ty-label {
  background: rgba(255,255,255,.9); border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600; color: #475569;
  box-shadow: 0 1px 4px rgba(15,23,42,.12); white-space: nowrap;
}
.other-ty-label::before { display: none; }

/* 地图模式切换 */
.layer-btn {
  padding: 8px 15px; font-size: 13px; color: #64748b; background: #fff;
  border-right: 1px solid #e2e8f0; transition: all .15s; white-space: nowrap; font-weight: 500;
}
.layer-btn:last-child { border-right: none; }
.layer-btn:hover { background: #f0f9ff; color: #0284c7; }
.layer-btn.active { background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; }

/* 机构标签 (v1.5: 实心开启态 + 机构全称 + 色点) */
.agency-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1.5px solid; transition: all .15s; font-weight: 600;
}
.agency-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(2,132,199,.15); }
.agency-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* 路径点列表 */
.track-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px;
  font-size: 13.5px; cursor: pointer; transition: background .15s; color: #475569; line-height: 1.6;
}
.track-item:hover { background: #f0f9ff; }
.track-item.current { background: #e0f2fe; border: 1px solid #bae6fd; }

/* 历史台风列表项 */
.history-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  cursor: pointer; transition: all .15s; border: 1px solid #f1f5f9; margin-bottom: 8px;
}
.history-item:hover { background: #f0f9ff; border-color: #bae6fd; }

/* 滚动条 */
.custom-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
#typhoon-tabs::-webkit-scrollbar { height: 3px; }
#typhoon-tabs::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

/* 台风图标 */
.typhoon-marker { pointer-events: none; }
.typhoon-marker svg { animation: spin-slow 1.6s linear infinite; filter: drop-shadow(0 1px 4px rgba(0,0,0,.45)); }

/* Leaflet 弹窗 */
.leaflet-popup-content-wrapper {
  background: #fff !important; color: #334155 !important;
  border-radius: 14px !important; box-shadow: 0 8px 28px rgba(15,23,42,.18) !important;
  font-size: 13.5px;
}
.leaflet-popup-tip { background: #fff !important; }
.leaflet-popup-content { margin: 14px 17px !important; line-height: 1.8; }
.leaflet-container { background: #dbeafe; font-family: inherit; }
.leaflet-control-attribution { background: rgba(255,255,255,.75) !important; color: #94a3b8 !important; font-size: 10px !important; }
.leaflet-control-zoom a { background: #fff !important; color: #475569 !important; border-color: #e2e8f0 !important; }
.leaflet-bar { border-color: #e2e8f0 !important; box-shadow: 0 2px 8px rgba(15,23,42,.1) !important; }
.leaflet-container.dark-bg { background: #0f172a; }

dialog::backdrop { background: rgba(15,23,42,.45); backdrop-filter: blur(2px); }

/* ===== v2.3 顶部统一轮播胶囊 (公告+台风君播报+历史上的今天) ===== */
#top-capsule { animation: capsule-in .4s ease-out; }
@keyframes capsule-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
#capsule-body.capsule-warning { background: rgba(254,243,199,.96); border-color: #fde68a; }
#capsule-body.capsule-warning #capsule-text { color: #92400e; }
#capsule-body.capsule-danger { background: rgba(254,226,226,.97); border-color: #fecaca; animation: pulse-danger 2s infinite; }
#capsule-body.capsule-danger #capsule-text { color: #b91c1c; font-weight: 600; }
@keyframes pulse-danger { 0%,100% { box-shadow: 0 4px 14px rgba(239,68,68,.25); } 50% { box-shadow: 0 4px 22px rgba(239,68,68,.5); } }
.capsule-dot { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; display: inline-block; transition: all .2s; }
.capsule-dot.on { background: #0284c7; width: 12px; border-radius: 3px; }
#capsule-mini { animation: dot-pop .25s ease-out; }
#capsule-mini.flex { display: flex; }

/* ================= AI 台风君聊天 (v1.4) ================= */
#chat-fab { display: flex; }
#chat-fab.hidden { display: none; }
#chat-panel { display: flex; }
#chat-panel.hidden { display: none; }
.chat-fab-icon { animation: fab-breathe 2.6s ease-in-out infinite; }
@keyframes fab-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.chat-msg { display: flex; gap: 8px; margin-bottom: 12px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.chat-msg.ai .chat-avatar { background: linear-gradient(135deg,#e0f2fe,#cffafe); }
.chat-msg.user .chat-avatar { background: #f1f5f9; }
.chat-bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; }
.chat-msg.ai .chat-bubble { background: #fff; color: #334155; border: 1px solid #e2e8f0; border-top-left-radius: 4px; }
.chat-msg.user .chat-bubble { background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; border-top-right-radius: 4px; }
.chat-bubble .ty-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; margin: 0 1px; border-radius: 999px; background: #e0f2fe; color: #0369a1; font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid #bae6fd; transition: all .15s; vertical-align: 1px; }
.chat-bubble .ty-chip:hover { background: #0284c7; color: #fff; }
.chat-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: typing-dot 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes typing-dot { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-quick-btn { padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid #bae6fd; color: #0369a1; font-size: 12.5px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.chat-quick-btn:hover { background: #e0f2fe; }
.chat-quick-more { background: #f0f9ff; border-style: dashed; color: #0891b2; }

/* ===== v1.5 新增 ===== */
/* 聊天系统提示(位置就绪等) */
.chat-sys { text-align: center; font-size: 12px; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: 4px 14px; margin: 8px auto 12px; width: fit-content; max-width: 92%; }
/* AI回答中的可点击定位链接 */
.chat-bubble .loc-link { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; margin: 0 1px; border-radius: 999px; background: #fef3c7; color: #b45309; font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid #fde68a; transition: all .15s; vertical-align: 1px; }
.chat-bubble .loc-link:hover { background: #f59e0b; color: #fff; }
/* 历史台风快捷榜单按钮 */
.history-hot-btn { padding: 6px 13px; border-radius: 999px; background: #fff; border: 1px solid #e2e8f0; color: #475569; font-size: 12.5px; cursor: pointer; transition: all .15s; white-space: nowrap; font-weight: 500; }
.history-hot-btn:hover { border-color: #7dd3fc; color: #0284c7; background: #f0f9ff; }
.history-hot-btn.active { background: linear-gradient(135deg,#0284c7,#06b6d4); border-color: transparent; color: #fff; }
/* 榜单排名 */
.rank-medal { width: 30px; text-align: center; font-size: 17px; }
.rank-num { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #f1f5f9; color: #64748b; font-size: 11.5px; font-weight: 700; text-align: center; }
/* 气泡红点 */
#chat-fab-dot { animation: dot-pop .3s ease-out; }
@keyframes dot-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ===== v1.7 右下角统一控制列 (图例钮 → 缩放 → 台风君气泡, 右缘16px对齐, 间距10px) ===== */
.ctrl-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.96); backdrop-filter: blur(4px);
  border: 1px solid #e2e8f0; color: #475569; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(15,23,42,.12); transition: all .15s;
}
.ctrl-btn:hover { color: #0284c7; border-color: #7dd3fc; transform: scale(1.05); }
.ctrl-btn.active { background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; border-color: transparent; }
#chat-fab { width: 44px; height: 44px; font-size: 19px; }
#legend { right: 70px; bottom: 20px; animation: legend-in .2s ease-out; }
@keyframes legend-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 767px) {
  /* 控制列(仅剩台风君气泡)悬于迷你条上方, 避开右侧工具栏 */
  #ctrl-col { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  /* v3.0: 右缘避开右侧工具栏(rail宽46+右边10+角标4=60) + 限宽防挡工具栏 */
  #legend { left: auto; right: 64px; bottom: auto; top: 156px; max-width: calc(100vw - 150px); }
  /* v3.0: 地图版权署名上移到抽屉迷你条之上(OSM/Protomaps协议要求署名可见) */
  #map .leaflet-bottom { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
/* v3.0: 窄桌面(768~1149px, iPad横屏/分屏/小笔记本)播报胶囊修复:
   原 Tailwind 公式 calc(100vw-780px) 在此区间算出负宽/窄缝, 胶囊直接消失。
   改为靠右布局: 侧栏(402px)右侧居中, 预留图层按钮区域。 */
@media (min-width: 768px) and (max-width: 1149px) {
  #top-capsule { left: calc(402px + (100vw - 402px) / 2) !important; max-width: min(440px, calc(100vw - 520px)) !important; }
  #capsule-mini { left: calc(402px + (100vw - 402px) / 2) !important; }
}

/* ===== v2.3 移动端右侧竖排工具栏 ===== */
.rail-btn {
  position: relative; width: 46px; height: 46px; border-radius: 14px;
  background: rgba(255,255,255,.95); backdrop-filter: blur(6px);
  border: 1px solid #e2e8f0; color: #475569;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 2px 10px rgba(15,23,42,.12); transition: all .15s;
}
.rail-btn i { font-size: 14.5px; }
.rail-btn span { font-size: 9.5px; font-weight: 600; line-height: 1; transform: scale(.95); }
.rail-btn.active { background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; border-color: transparent; box-shadow: 0 3px 12px rgba(6,182,212,.4); }
.rail-btn b { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 3px; border: 1.5px solid #fff; }
.rail-btn b.hidden { display: none; }

/* ===== v3.0 三段式底部抽屉 (mini/half/full) — 整体可滚重构 + dvh回退 =====
   修复: 旧版 track-list 独占 flex-1 滚动, 当上方固定区块(信息卡/工具栏/预报机构/相似路径)
   总高 ≥ 抽屉高时被挤批0高度且 overflow-hidden 直接裁掉 — 历史路径完全看不到。
   新版: 移动端 #drawer-content 整体变为唯一滚动容器, 所有内容自然高度铺开, 永远可达。
   dvh 全部补 vh 回退(夸克/UC/老X5内核不支持 dvh 时整条声明作废导致布局崩坏)。 */
@media (max-width: 767px) {
  #side-panel {
    height: min(88vh, 720px); height: min(88dvh, 720px);
    max-height: none !important; padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 30px rgba(15,23,42,.18); will-change: transform;
  }
  #side-panel.drawer-mini { transform: translateY(calc(100% - 66px - env(safe-area-inset-bottom))); }
  #side-panel.drawer-mini #drawer-content { visibility: hidden; }
  #side-panel.drawer-half { transform: translateY(calc(100% - min(46vh, 420px))); transform: translateY(calc(100% - min(46dvh, 420px))); }
  #side-panel.drawer-full { transform: translateY(0); }
  /* 整体滚动: 内容区不再 flex 挤压, 改为块级流式 + 自身滚动 */
  #drawer-content {
    display: block !important; overflow-y: auto !important; overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  #side-panel.drawer-half #drawer-content { height: calc(min(46vh,420px) - 30px - env(safe-area-inset-bottom)); height: calc(min(46dvh,420px) - 30px - env(safe-area-inset-bottom)); }
  #side-panel.drawer-full #drawer-content { height: calc(min(88vh,720px) - 30px - env(safe-area-inset-bottom)); height: calc(min(88dvh,720px) - 30px - env(safe-area-inset-bottom)); }
  /* 历史路径列表: 取消独立滚动, 自然高度随内容铺开 */
  #track-list { flex: none !important; overflow: visible !important; height: auto !important; }
  /* 迷你条呼吸提示 */
  #side-panel.drawer-mini #drawer-handle > div { animation: handle-hint 2.4s ease-in-out infinite; }
}
@media (min-width: 768px) { #side-panel { transform: none !important; } #drawer-mini { display: none !important; } }

/* ===== v2.3 移动端点位信息卡 (悬于迷你条之上) ===== */
#point-card { bottom: calc(74px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out; }
#point-card dt { font-weight: 500; }

/* ===== v2.3 移动端顶部台风徽章 (仅小屏显示) ===== */
@media (max-width: 767px) { #ty-badge.flex { display: flex; } }
@media (min-width: 768px) { #ty-badge { display: none !important; } }

/* ===== v2.2 移动端体验优化 ===== */
button, .wx-item, .ty-tab, .tool-btn, .agency-chip, .track-item, .history-item { touch-action: manipulation; }
@media (max-width: 767px) {
  /* --- 大把手 (三段式抽屉规则见上方 v2.3 块) --- */
  #drawer-handle { padding: 12px 0 8px; }
  #drawer-handle > div { width: 44px; height: 4.5px; background: #cbd5e1; }
  /* --- 顶栏紧凑 --- */
  #topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  #topbar .fa-hurricane { font-size: 21px !important; }
  #site-title { font-size: 16.5px; }
  #btn-history, #btn-share { padding: 7px 11px; font-size: 12.5px; }
  /* --- 图层面板: 改为底部弹层(拇指可达), vh回退 --- */
  #layer-panel { top: auto !important; right: 0 !important; left: 0 !important; bottom: 0 !important;
    width: auto !important; max-height: min(72vh, 620px) !important; max-height: min(72dvh, 620px) !important; border-radius: 18px 18px 0 0 !important;
    padding: 10px 18px calc(16px + env(safe-area-inset-bottom)) !important;
    animation: sheet-up .22s ease-out; box-shadow: 0 -8px 32px rgba(15,23,42,.25) !important; z-index: 1055 !important; }
  /* --- 距离测算面板: 上移至台风君气泡之上, 不再重叠(旧值120px与气泡顶缘122px叠压) --- */
  #distance-panel { top: auto !important; bottom: calc(136px + env(safe-area-inset-bottom)) !important; right: 12px !important; z-index: 1053 !important; }
  /* --- 聊天面板: dvh 防键盘顶飞(vh回退) + 安全区 + 输入16px防iOS聚焦放大 --- */
  #chat-panel { height: min(82vh, 640px); height: min(82dvh, 640px); padding-bottom: env(safe-area-inset-bottom); }
  #chat-input { font-size: 16px !important; }
  /* --- 触控目标增大 --- */
  .wx-item { padding: 10px 10px; }
  .wx-switch { width: 40px; height: 22px; }
  .wx-switch::after { width: 18px; height: 18px; }
  .wx-switch:checked::after { left: 20px; }
  .precip-btn { padding: 9px 2px; font-size: 12.5px; }
  .tool-btn { padding: 10px 2px 9px; }
  .tool-btn .tool-ico { width: 36px; height: 36px; }
  .layer-btn { padding: 10px 8px; }
  .track-item { padding: 11px 12px; }
  /* --- 弹窗全屏化(vh回退) --- */
  #history-modal article { width: 100vw; max-width: 100vw; height: 92vh; max-height: 92vh; height: 92dvh; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  #history-modal { margin: auto 0 0; max-width: 100vw; }
  #chart-modal article { width: 96vw; padding: 16px; }
  /* --- 页脚归属信息在移动端隐藏(HTML已有max-md:hidden, 双保险) --- */
  .leaflet-control-attribution { font-size: 9px !important; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@keyframes handle-hint { 0%,100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-3px); opacity: .55; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* 图层面板遮罩(仅移动端弹层时显示) */
#sheet-mask { position: fixed; inset: 0; z-index: 1054; background: rgba(15,23,42,.32); animation: mask-in .2s ease-out; }
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 768px) { #sheet-mask { display: none; } }

/* ===== v1.6 路径回放台风君解说气泡 ===== */
.play-nar {
  background: rgba(255,255,255,.96); border: 1.5px solid #7dd3fc; border-radius: 14px;
  padding: 7px 13px; font-size: 13px; color: #0c4a6e; font-weight: 600; line-height: 1.5;
  white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 4px 16px rgba(2,132,199,.25); animation: nar-pop .25s ease-out;
}
@keyframes nar-pop { from { opacity: 0; transform: scale(.7) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ===== v1.8 气象图层面板 ===== */
.wx-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 10px; font-size: 13px; color: #475569; cursor: pointer; transition: background .15s; }
.wx-item:hover { background: #f0f9ff; }
.wx-item > span { display: flex; align-items: center; gap: 8px; }
.wx-ico { width: 18px; text-align: center; font-size: 13px; }
.wx-switch { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: #e2e8f0; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.wx-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.wx-switch:checked { background: linear-gradient(135deg,#0284c7,#06b6d4); }
.wx-switch:checked::after { left: 18px; }
.precip-btn { padding: 6px 2px; border-radius: 9px; font-size: 12px; background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; transition: all .15s; font-weight: 500; }
.precip-btn:hover { border-color: #7dd3fc; color: #0284c7; }
.precip-btn.active { background: linear-gradient(135deg,#0284c7,#06b6d4); border-color: transparent; color: #fff; }
.grat-lbl { font-size: 9.5px; color: #64748b; opacity: .75; white-space: nowrap; text-shadow: 0 0 3px #fff,0 0 3px #fff; }
.measure-lbl { font-size: 11px; color: #0f766e; font-weight: 700; white-space: nowrap; background: rgba(255,255,255,.92); border: 1px solid #99f6e4; border-radius: 8px; padding: 2px 8px; box-shadow: 0 2px 6px rgba(13,148,136,.2); }
#wx-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(16px); z-index: 1200; background: rgba(15,23,42,.88); color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .25s; max-width: 88vw; }
#wx-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* velocity 左下速度提示 */
.leaflet-control-velocity { background: rgba(255,255,255,.85); border-radius: 8px; padding: 3px 9px; font-size: 11px; color: #334155; }

/* ===== v1.9 相似路径 ===== */
.sim-item { display: flex; align-items: center; gap: 7px; width: 100%; padding: 7px 11px; border-radius: 10px; font-size: 12.5px; background: #f8fafc; border: 1px solid #f1f5f9; transition: all .15s; text-align: left; }
.sim-item:hover { background: #f0f9ff; border-color: #bae6fd; }
.sim-item.on { background: #e0f2fe; border-color: #7dd3fc; }
.sim-lbl { font-size: 10.5px; font-weight: 700; white-space: nowrap; background: rgba(255,255,255,.92); border: 1.5px solid; border-radius: 8px; padding: 1px 7px; box-shadow: 0 1px 5px rgba(0,0,0,.15); }

/* ===== v2.1 色标条系统 (纯CSS渐变, 面板迷你条 + 地图浮动色标卡) ===== */
.cb-item { margin-bottom: 10px; }
.cb-item:last-child { margin-bottom: 2px; }
.cb-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #475569; margin-bottom: 4px; }
.cb-title i.fas { width: 14px; text-align: center; font-size: 11px; }
.cb-title em { font-style: normal; font-weight: 500; color: #94a3b8; font-size: 10.5px; }
.cb-bar { position: relative; height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(15,23,42,.08); }
.cb-bar-marked { margin-bottom: 13px; }
.cb-ticks { position: relative; height: 13px; margin-top: 2px; }
.cb-tick { position: absolute; top: 0; font-size: 10px; color: #64748b; line-height: 1.2; white-space: nowrap; }
.cb-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #0f172a; border-radius: 1px; transform: translateX(-50%); box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.cb-marklbl { position: absolute; top: 13px; transform: translateX(-50%); font-size: 9.5px; font-weight: 700; color: #0f172a; white-space: nowrap; background: rgba(255,255,255,.85); border-radius: 4px; padding: 0 3px; }
.cb-note { font-size: 10px; color: #94a3b8; margin-top: 2px; line-height: 1.4; }
/* 降水阶梯色块 */
.cb-steps { display: flex; gap: 2px; }
.cb-step { flex: 1; text-align: center; min-width: 0; }
.cb-step i { display: block; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(15,23,42,.08); }
.cb-step b { display: block; font-size: 9.5px; color: #475569; font-weight: 600; margin-top: 1px; line-height: 1.2; }
.cb-step span { display: block; font-size: 9px; color: #94a3b8; white-space: nowrap; transform: scale(.92); line-height: 1.2; }
/* 浮动色标卡: 桌面右下(控制列左侧) */
#wx-colorbar-card { position: fixed; right: 70px; bottom: 20px; z-index: 997; width: 218px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 4px 18px rgba(15,23,42,.14); animation: legend-in .2s ease-out; }
/* v3.0: 桌面端强度图例与色标卡同锚点(right:70/bottom:20), 同开时色标卡左移避让 */
@media (min-width: 768px) {
  body:has(#legend:not(.hidden)) #wx-colorbar-card { right: 250px; }
}
#wx-colorbar-card .cb-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px; font-size: 12px; font-weight: 700; color: #334155; border-bottom: 1px solid #f1f5f9; }
#wx-colorbar-card .cb-head button { width: 22px; height: 22px; border-radius: 6px; color: #94a3b8; font-size: 11px; }
#wx-colorbar-card .cb-head button:hover { background: #f1f5f9; color: #475569; }
#wx-colorbar-card .cb-body { padding: 8px 12px 9px; max-height: 46vh; overflow-y: auto; }
#wx-colorbar-card.collapsed { width: auto; background: none; border: none; box-shadow: none; backdrop-filter: none; }
.cb-fab { position: relative; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.96); backdrop-filter: blur(4px); border: 1px solid #e2e8f0; color: #0284c7; font-size: 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(15,23,42,.12); transition: all .15s; }
.cb-fab:hover { border-color: #7dd3fc; transform: scale(1.05); }
.cb-fab b { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; border-radius: 999px; background: linear-gradient(135deg,#0284c7,#06b6d4); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
@media (max-width: 767px) {
  /* 移动端: 贴底横向卡, 避开迷你条与右下台风君气泡 */
  #wx-colorbar-card { left: 12px; right: 66px; bottom: calc(84px + env(safe-area-inset-bottom)); width: auto; }
  #wx-colorbar-card .cb-body { max-height: 26vh; max-height: 26dvh; }
  #wx-colorbar-card.collapsed { left: auto; right: 12px; bottom: calc(140px + env(safe-area-inset-bottom)); }
  /* v3.0: 点位卡弹出时自动隐藏色标卡(两者同为贴底浮层, 会叠压) */
  body:has(#point-card:not(.hidden)) #wx-colorbar-card { visibility: hidden; }
}

/* v2.5 MapLibre 作为 Leaflet 底图时始终位于业务覆盖层下方 */
.leaflet-maplibre-gl {
  z-index: 0;
}
.leaflet-maplibre-gl .maplibregl-map,
.leaflet-maplibre-gl .maplibregl-canvas-container,
.leaflet-maplibre-gl canvas {
  width: 100%;
  height: 100%;
}
.maplibregl-canvas {
  outline: none;
}

/* v2.5 定位授权与城市选择 */
.location-dialog {
  width: min(92vw, 480px);
  max-width: 480px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #334155;
  overflow: visible;
}
.location-card {
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.location-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f0f9ff, #ecfeff);
}
.location-header h2 {
  color: #0f172a;
  font-size: 18px;
  font-weight: 750;
}
.location-header h2 i {
  margin-right: 6px;
  color: #0891b2;
}
.location-header p {
  margin-top: 5px;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.55;
}
.location-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #94a3b8;
  transition: background .15s, color .15s;
}
.location-close:hover {
  color: #475569;
  background: rgba(255, 255, 255, .9);
}
.location-body {
  padding: 20px 22px 22px;
}
.location-primary {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: 15px;
  color: #fff;
  text-align: left;
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  box-shadow: 0 8px 22px rgba(6, 182, 212, .22);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.location-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(6, 182, 212, .3);
}
.location-primary:disabled {
  cursor: wait;
  opacity: .65;
}
.location-primary > i {
  width: 24px;
  font-size: 20px;
  text-align: center;
}
.location-primary span,
.location-primary small {
  display: block;
}
.location-primary b {
  display: block;
  font-size: 14.5px;
}
.location-primary small {
  margin-top: 2px;
  color: rgba(255, 255, 255, .82);
  font-size: 11.5px;
}
.location-status {
  min-height: 36px;
  padding: 9px 3px 0;
  color: #64748b;
  font-size: 11.5px;
  line-height: 1.55;
}
.location-status[data-state="error"] { color: #dc2626; }
.location-status[data-state="success"] { color: #059669; }
.location-status[data-state="loading"] { color: #0284c7; }
.location-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 13px 0;
  color: #94a3b8;
  font-size: 11.5px;
}
.location-divider::before,
.location-divider::after {
  height: 1px;
  flex: 1;
  content: '';
  background: #e2e8f0;
}
.location-search-wrap {
  position: relative;
  display: block;
}
.location-search-wrap > i {
  position: absolute;
  top: 50%;
  left: 14px;
  color: #94a3b8;
  transform: translateY(-50%);
}
.location-search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid #dbe4ee;
  border-radius: 13px;
  color: #334155;
  background: #f8fafc;
  font-size: 14px;
  outline: none;
}
.location-search-wrap input:focus {
  border-color: #38bdf8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}
.location-results {
  display: none;
  max-height: 190px;
  margin-top: 7px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .09);
}
.location-results.is-open { display: block; }
.location-city-result {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  color: #475569;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}
.location-city-result:last-child { border-bottom: 0; }
.location-city-result:hover { background: #f0f9ff; }
.location-city-result > i {
  width: 22px;
  color: #0ea5e9;
  text-align: center;
}
.location-city-result span,
.location-city-result small { display: block; }
.location-city-result b { font-size: 13.5px; }
.location-city-result small {
  margin-top: 1px;
  color: #94a3b8;
  font-size: 10.5px;
}
.location-empty {
  padding: 14px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}
.location-popular { margin-top: 16px; }
.location-popular h3 {
  margin-bottom: 9px;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 700;
}
.location-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.location-chip {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  color: #0369a1;
  background: #f0f9ff;
  font-size: 12.5px;
  font-weight: 600;
}
.location-chip:hover {
  border-color: #7dd3fc;
  background: #e0f2fe;
}
@media (max-width: 767px) {
  .location-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: min(88vh, 680px);
    max-height: min(88dvh, 680px);
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }
  .location-card {
    max-height: min(88vh, 680px);
    max-height: min(88dvh, 680px);
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .location-header { padding: 18px 18px 15px; }
  .location-body { padding: 17px 18px 20px; }
  .location-search-wrap input { font-size: 16px; }
  .location-chip { min-height: 38px; padding-inline: 14px; }
}

/* ===== v3.0 手机横屏适配: 高度极小(<480px)时所有底部面板改为可滚不裁剪 ===== */
@media (max-width: 1023px) and (max-height: 480px) {
  #side-panel { height: 100vh; height: 100dvh; }
  #side-panel.drawer-half { transform: translateY(calc(100% - 62vh)); transform: translateY(calc(100% - 62dvh)); }
  #side-panel.drawer-half #drawer-content { height: calc(62vh - 30px); height: calc(62dvh - 30px); }
  #side-panel.drawer-full #drawer-content { height: calc(100vh - 30px); height: calc(100dvh - 30px); }
  #chat-panel { height: 100vh; height: 100dvh; }
  #layer-panel { max-height: 88vh !important; max-height: 88dvh !important; }
  #history-modal article { height: 100vh; max-height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

/* v2.4 无障碍：键盘焦点清晰可见，尊重减少动画偏好 */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #22d3ee !important;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
