/*
  styles.css —— 全站样式
  ============================================================
  这里只写“长什么样”，不写“怎么动”（行为在 js 里）。
  包含：地图铺满、分析按钮、天气面板、加载动画、AI 对话框、提示条、标记图标。
  给新手的小知识：
    - 我们用“绝对定位（position: absolute）”把浮层 UI 叠在地图之上。
    - .hidden 这个类用来实现“显示/隐藏”的切换（display:none）。
*/

/* 1) 基础重置：去掉浏览器默认外边距，并让盒模型更好算尺寸 */
* {
  box-sizing: border-box; /* width 包含 padding 和 border，布局更直观 */
  margin: 0;
  padding: 0;
}

/* 2) html / body / #app 都铺满整个屏幕，这样地图才能占满视口 */
html,
body,
#app {
  width: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    sans-serif; /* 用系统默认字体，中文也更顺眼 */
  overflow: hidden; /* 不出现整页滚动条，地图应该占满 */
  color: #1f2933;
}

/* 3) 地图容器：绝对定位铺满 #app */
#map {
  position: absolute;
  inset: 0; /* 等价于 top/right/bottom/left 都为 0 */
  z-index: 0; /* 地图在最底层，浮层在它之上 */
  background: #1a2433; /* 地图加载前的底色：中性深色，避免瓦片间隙露出刺眼蓝色 */
}

/* Leaflet 初始化后会把 .leaflet-container 类加到地图容器上，
   这里同步设为中性深色，覆盖 Leaflet 默认的浅蓝/白底。 */
.leaflet-container {
  background: #1a2433;
}

/* ============================================================
   4) 右上角「AI 分析此处」按钮
   ============================================================ */
.map-control-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000; /* 比地图控件高，确保可点 */
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); /* 蓝色渐变，醒目 */
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.map-control-btn:hover {
  transform: translateY(-1px); /* 悬停时轻微上浮 */
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}
.map-control-btn:active {
  transform: translateY(0); /* 按下时回弹 */
}

/* 右上角「📍 附近钓点」按钮：放在「AI 分析此处」下方，蓝色系区分 */
.locate-btn {
  top: 64px; /* 避开上方的「AI 分析此处」按钮 */
  background: linear-gradient(135deg, #0ea5e9, #0284c7); /* 蓝青色系，区别于分析按钮 */
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}
.locate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
}

/* 弹窗里的来源标注 badge（规则库 / 默认兜底） */
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.src-rule {
  background: #e0f2fe;
  color: #0369a1;
}
.src-default {
  background: #fef3c7;
  color: #92400e;
}
/* 科学依据出处 badge（弹窗增强：标注 FishBase + 路亚实战语料的来源） */
.src-source {
  background: #ede9fe;
  color: #5b21b6;
  font-size: 11px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ============================================================
   5) 通用浮层面板（天气面板、AI 对话框共用）
   ============================================================ */
.panel {
  position: absolute;
  z-index: 1100;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden; /* 圆角 + 内部滚动更干净 */
  display: flex;
  flex-direction: column;
}

/* 面板头部：标题 + 右侧小按钮 */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* 头部里的小图标按钮（刷新 / 关闭） */
.icon-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.icon-btn:hover {
  color: #fff;
}

.panel-body {
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}

/* 左上角天气面板的具体尺寸与位置 */
#weather-panel {
  top: 16px;
  left: 16px;
  width: 240px;
}

/* 天气卡（面板 / 钓点弹窗内联共用）文本样式
   注意：weather.js 生成的是 .wc-temp / .wc-desc / .wc-row / .wc-loc 类名，
   与 v1 的 .weather-temp 等不同，这里统一按新类名写样式。 */
#weather-content {
  font-size: 13px;
  line-height: 1.6;
}
#weather-content .wc-temp {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
#weather-content .wc-desc {
  font-size: 15px;
  font-weight: 600;
  color: #2563eb;
  margin: 2px 0 6px;
}
#weather-content .wc-row {
  color: #475569;
  margin-top: 3px;
}
#weather-content .wc-loc {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
  color: #94a3b8;
  font-size: 12px;
}
#weather-content .weather-loading,
#weather-content .weather-error {
  color: #64748b;
  font-size: 13px;
  padding: 4px 0;
}
#weather-content .weather-error {
  color: #dc2626;
}

/* ============================================================
   6) 加载动画遮罩（分析期间盖住地图）
   ============================================================ */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000; /* 盖住一切，包括按钮 */
  background: rgba(15, 23, 42, 0.55); /* 半透明深色 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

/* 转圈圈的小动画：用 border 做出“圆环缺一角”，再让整个元素旋转 */
.spinner {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff; /* 顶部那一笔是实心的，形成“旋转感” */
  border-radius: 50%;
  animation: spin 0.9s linear infinite; /* 无限旋转 */
}

/* @keyframes 定义“从 0 度转到 360 度” */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   7) 右下角 AI 对话框
   ============================================================ */
.chat-fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 1100;
  width: 54px;
  height: 54px;
  border-radius: 50%; /* 圆形悬浮按钮 */
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
}

#chat-panel {
  right: 16px;
  bottom: 82px; /* 浮在 chat-fab 上方，避免重叠 */
  width: 320px;
  max-height: 60vh; /* 最高占屏幕 60%，避免遮太多 */
}

/* 消息区：可纵向滚动 */
.chat-messages {
  flex: 1; /* 占满面板中间剩余空间 */
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 单条消息气泡 */
.msg {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word; /* 长单词/链接自动换行 */
}
.msg.user {
  align-self: flex-end; /* 用户消息靠右 */
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 2px;
}
.msg.bot {
  align-self: flex-start; /* AI 消息靠左 */
  background: #fff;
  color: #1f2933;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
}
/* 系统提示气泡（如“已加载上下文”） */
.msg.system {
  align-self: center;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  text-align: center;
}

/* 输入区 */
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
#chat-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
#chat-input:focus {
  border-color: #2563eb; /* 聚焦时高亮边框 */
}
.primary-btn {
  padding: 8px 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.primary-btn:hover {
  background: #1d4ed8;
}

/* ============================================================
   8) 提示条 toast（临时出现在底部中央）
   ============================================================ */
.toast-container {
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%); /* 水平居中 */
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none; /* 不挡住下面的点击 */
}

.toast {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
/* 出现动画的结束态 */
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success {
  background: #16a34a; /* 绿色=成功 */
}
.toast.error {
  background: #dc2626; /* 红色=错误 */
}
.toast.info {
  background: #475569; /* 灰色=普通提示 */
}

/* ============================================================
   9) 钓点结构标记（自定义图标 + 弹窗内容）
   ============================================================ */
/* 用 divIcon 做的“鱼竿 pin”：一个圆底 + emoji */
.struct-pin {
  width: 34px;
  height: 34px;
  background: #f59e0b;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0; /* 做成水滴/图钉形状 */
  transform: rotate(-45deg); /* 图钉尖朝左下，需要再转回文字 */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  font-size: 16px;
}
.struct-pin span {
  transform: rotate(45deg); /* 把 emoji 再转回来，保持正向 */
}

/* Leaflet 弹窗（InfoWindow）里的内容样式 */
.struct-popup {
  font-size: 13px;
  line-height: 1.5;
  min-width: 200px;
}
.struct-popup h4 {
  margin-bottom: 6px;
  color: #b45309;
  font-size: 14px;
}
.struct-popup .field {
  margin: 4px 0;
}
.struct-popup .label {
  font-weight: 700;
  color: #475569;
}
.struct-popup .novice {
  margin-top: 6px;
  padding: 6px 8px;
  background: #fef3c7;
  border-radius: 6px;
  color: #92400e;
}
/* 弹窗增强：做钓思路块（高亮显示，区别于普通字段行） */
.struct-popup .fishing-plan {
  margin: 8px 0;
  padding: 8px 10px;
  background: #ecfeff;
  border-left: 3px solid #0891b2;
  border-radius: 6px;
  color: #155e75;
  line-height: 1.6;
}

/* ============================================================
   9.5) 右下角图层切换控件（高德 / Esri / 天地图预留）
   ============================================================ */
.layer-control {
  position: absolute;
  right: 16px;
  bottom: 80px; /* 悬在 AI 对话框悬浮按钮(chat-fab)上方，避免重叠 */
  z-index: 1000;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.layer-btn {
  border: none;
  background: #e2e8f0;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.layer-btn.active {
  background: #2563eb;
  color: #fff;
}
.layer-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   9.6) 左下角「📑 我的收藏」开关按钮
   ============================================================ */
.fav-toggle {
  top: auto; /* 覆盖 .map-control-btn 的 top:16 */
  right: auto; /* 覆盖 .map-control-btn 的 right:16 */
  bottom: 16px;
  left: 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706); /* 橙色系，区别于分析/定位 */
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}
.fav-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.5);
}

/* ============================================================
   9.7) 收藏列表面板（从右侧滑入）
   ============================================================ */
.fav-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 86vw;
  background: #fff;
  z-index: 1200; /* 高于普通面板，低于加载遮罩 */
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.fav-panel.open {
  transform: translateX(0);
}
.fav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #0f172a;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.fav-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fav-empty {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
}
.fav-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}
.fav-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fav-name {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.fav-del {
  flex: 0 0 auto;
}
.fav-meta {
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
}
.fav-lure {
  font-size: 12px;
  color: #0ea5e9;
  margin-top: 2px;
}
.fav-coords {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fav-fly {
  margin-left: auto;
  border: 1px solid #2563eb;
  background: #fff;
  color: #2563eb;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.fav-fly:hover {
  background: #eff6ff;
}
.fav-note {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 38px;
}
.fav-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.fav-share {
  border: none;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.fav-share:hover {
  background: #15803d;
}

/* 收藏标记（地图⭐图钉） */
.fav-pin {
  width: 32px;
  height: 32px;
  background: #f59e0b;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  font-size: 15px;
}
.fav-pin span {
  transform: rotate(45deg);
}

/* 收藏标记弹窗 */
.fav-popup {
  font-size: 13px;
  line-height: 1.5;
  min-width: 200px;
}
.fav-popup h4 {
  margin-bottom: 6px;
  color: #b45309;
  font-size: 14px;
}
.fav-popup .field {
  margin: 4px 0;
}
/* 收藏标记弹窗里的「分享」按钮（class 由 favorites.js 生成，分享逻辑由 share.js 事件委托） */
.fav-popup .js-share-fav {
  margin-top: 10px;
  width: 100%;
  border: none;
  background: #16a34a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.fav-popup .js-share-fav:hover {
  background: #15803d;
}

/* ============================================================
   9.8) 钓点结构弹窗里的「收藏」按钮 + 内联天气卡
   ============================================================ */
.struct-popup .fav-add-btn {
  margin-top: 10px;
  width: 100%;
  border: none;
  background: #f59e0b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.struct-popup .fav-add-btn:hover {
  background: #d97706;
}

/* 内联天气卡（在结构弹窗内，区别于左侧大面板） */
.struct-popup .weather-card {
  margin: 8px 0;
  padding: 8px 10px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #334155;
}
.struct-popup .weather-card .wc-temp {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
.struct-popup .weather-card .wc-desc {
  font-size: 14px;
  font-weight: 600;
  color: #2563eb;
  margin: 0 0 4px;
}
.struct-popup .weather-card .wc-row {
  color: #475569;
  margin-top: 2px;
}
.struct-popup .weather-card .wc-loc {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-size: 11px;
}

/* ============================================================
   9.9) 分享弹窗（canvas 信息卡 + 文案 + 下载/复制）
   ============================================================ */
.share-modal {
  position: absolute;
  inset: 0;
  z-index: 2500; /* 盖住一切浮层，仅次于 toast */
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.share-box {
  width: 640px;
  max-width: 92vw;
  max-height: 92vh;
  background: #fff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #0f172a;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.share-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.share-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  background: #0f172a; /* canvas 未绘制时的底色 */
}
.share-text {
  width: 100%;
  min-height: 160px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
}
.share-actions {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  justify-content: flex-end;
}
.primary-btn.ghost {
  background: #fff;
  color: #2563eb;
  border: 1px solid #2563eb;
}
.primary-btn.ghost:hover {
  background: #eff6ff;
}

/* ============================================================
   9.9.5) 【FEATURE #3】附近钓点浮层面板（地图右侧）
   ============================================================ */
.nearby-panel {
  position: absolute;
  top: 116px;                 /* 避开右上角的「AI 分析此处 / 附近钓点」按钮 */
  right: 16px;
  z-index: 1150;
  width: 268px;
  max-height: calc(100vh - 260px); /* 不压住底部的图层控件与 AI 对话框悬浮钮 */
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nearby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.nearby-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nearby-item {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nearby-item:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}
.nearby-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2933;
  line-height: 1.4;
}
.nearby-meta {
  margin-top: 3px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* ============================================================
   9.9.6) 【FEATURE #5】弹窗内的「外部因素」小卡片（紧凑排版）
   位于做钓思路与科学依据之间，分行显示气温/水温/气压/湿度/风向/风力/天气
   ============================================================ */
.struct-popup .ext-factors {
  margin: 8px 0;
  padding: 8px 10px;
  background: #f1f5f9;
  border-left: 3px solid #64748b;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: #334155;
}
.struct-popup .ext-factors-head {
  font-weight: 700;
  color: #475569;
  margin-bottom: 2px;
}
.struct-popup .ext-factors .ext-row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   9.10) 响应式：手机端（≤768px）适配
   - 触摸目标 ≥44px
   - 弹窗最大宽 90vw，避免溢出
   - 面板 / 弹窗重排
   - 地图内双指缩放由 Leaflet touchZoom 提供（index.html 已 user-scalable=no）
   ============================================================ */
@media (max-width: 768px) {
  /* 触摸友好的最小点击区域 */
  .map-control-btn,
  .layer-btn,
  .fav-toggle,
  .chat-fab,
  .primary-btn,
  .fav-fly,
  .fav-share,
  .fav-add-btn {
    min-height: 44px;
  }
  .map-control-btn {
    font-size: 14px;
    padding: 10px 16px;
  }
  .locate-btn {
    top: 66px;
  }

  /* 天气面板收窄，避免挡太多 */
  #weather-panel {
    width: 180px;
    top: 12px;
    left: 12px;
  }
  #weather-content .wc-temp {
    font-size: 24px;
  }

  /* 图层切换：加大触摸区，放右下角上方 */
  .layer-control {
    bottom: 78px;
    right: 12px;
    padding: 4px;
    gap: 4px;
  }
  .layer-btn {
    padding: 8px 12px;
  }

  /* 收藏开关：左下角 */
  .fav-toggle {
    bottom: 12px;
    left: 12px;
  }

  /* 收藏面板接近全宽 */
  .fav-panel {
    width: 320px;
    max-width: 90vw;
  }

  /* 弹窗最大宽 90vw，防溢出屏幕 */
  .leaflet-popup-content {
    max-width: 90vw !important;
  }
  .struct-popup,
  .fav-popup {
    min-width: 0;
  }

  /* 分享弹窗接近全宽 */
  .share-box {
    max-width: 94vw;
  }

  /* AI 对话框：全宽贴底，避免被小屏挤压 */
  #chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 78px;
  }
}

/* 10) 通用：隐藏元素 */
.hidden {
  display: none !important;
}
