/* 赶海潮汐 · 天气地图 — 手机布局（375px 基准，不用 vw 避免电脑预览炸版） */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #1a1a2e;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  overflow: hidden;
  background: #e8eef3;
}

@media (min-width: 431px) {
  body {
    display: flex;
    justify-content: center;
    background: #1a1a2e;
  }
  .app-shell {
    box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 12px 48px rgba(0,0,0,.5);
  }
}

:root {
  --tabbar-height: calc(50px + env(safe-area-inset-bottom));
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--tabbar-height);
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* ===== 顶栏 ===== */
.float-fav {
  position: absolute;
  left: 12px;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 500;
  background: rgba(255,255,255,.96);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  border: none;
  line-height: 1.2;
}

.loc-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(52px + env(safe-area-inset-top));
  z-index: 600;
  background: #fff7ed;
  color: #c2410c;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  display: none;
}

/* ===== 中心红点 ===== */
.center-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 450;
  pointer-events: none;
  width: 14px;
  height: 14px;
  margin: -18px 0 0 -7px;
  background: #e74c3c;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ===== 坐标气泡（居中、紧凑，对齐参考 App） ===== */
.map-callout {
  position: absolute;
  left: 50%;
  bottom: calc(50% + 20px);
  transform: translateX(-50%);
  z-index: 460;
  width: min(302px, calc(100% - 40px));
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,.14);
}

.map-callout::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-top-color: #fff;
}

.callout-place {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.callout-top {
  display: block;
}

.callout-coord-line {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
}

.callout-coord-text {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  line-height: 1.35;
  word-break: break-all;
  cursor: pointer;
}

.callout-edit {
  flex-shrink: 0;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0 0 0 1px;
  border: none;
  background: none;
  box-shadow: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  vertical-align: middle;
}

.callout-edit:active {
  transform: scale(1.15);
}

.callout-stats {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.callout-stat {
  font-size: 13px;
  line-height: 1.4;
  color: #666;
}

.stat-k {
  display: inline-block;
  min-width: 2.2em;
  color: #888;
}

.stat-src {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
}

/* ===== 搜索/坐标 底部弹层（参考 App） ===== */
.coord-mask {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  align-items: flex-end;
}

.coord-panel {
  position: relative;
  width: 100%;
  background: #f3f4f6;
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 78vh;
  overflow: auto;
}

.coord-close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.coord-search-section {
  margin-bottom: 10px;
}

.coord-search-section input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
}

#searchResults {
  max-height: 140px;
  overflow: auto;
  margin-top: 6px;
  background: #fff;
  border-radius: 10px;
}

.coord-hemi-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 12px;
  padding-top: 8px;
}

.coord-hemi-block {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.coord-hemi-label {
  font-size: 14px;
  color: #64748b;
  min-width: 2em;
}

.coord-swap {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.coord-block {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.coord-block-title {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.coord-input-line {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.coord-input-line:last-child {
  margin-bottom: 0;
}

.coord-input-line span {
  font-size: 14px;
  color: #94a3b8;
  flex-shrink: 0;
}

.coord-in {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 15px;
  text-align: center;
}

.coord-in.wide {
  flex: 1.2;
}

.coord-line {
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 16px;
}

.coord-line:last-of-type {
  margin-bottom: 0;
}

.hemi {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: #e5e7eb;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
}

.hemi.on { background: #33a6ff; color: #fff; }

.coord-ok {
  width: 100%;
  margin-top: 4px;
  border: none;
  padding: 14px;
  border-radius: 24px;
  background: #33a6ff;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.stat-v {
  color: #333;
  font-weight: 500;
}

.callout-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.callout-actions button {
  flex: 1;
  border: none;
  padding: 9px 0;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

.btn-fav { background: #eef6ff; color: #33a6ff; font-weight: 500; }
.btn-detail { flex: 1.35; background: #33a6ff; color: #fff; font-weight: 600; }

/* ===== 底部区域（海况 / 定位） ===== */
.marine-strip {
  position: absolute;
  left: 12px;
  right: 70px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 480;
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  text-align: center;
}

.map-locate {
  position: absolute;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 520;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0284c7 0%, #33a6ff 55%, #38bdf8 100%);
  border: 2px solid #fff;
  box-shadow: 0 4px 16px rgba(51, 166, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

.map-locate-ico {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}

.map-attrib {
  position: absolute;
  left: 8px;
  bottom: calc(4px + env(safe-area-inset-bottom));
  z-index: 400;
  font-size: 10px;
  color: #666;
  background: rgba(255,255,255,.75);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

/* ===== 右侧工具栏 ===== */
.map-tools {
  position: absolute;
  right: 10px;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
}

.user-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #33a6ff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(51,166,255,.35);
}

/* ===== 收藏面板 ===== */
.fav-panel {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(52px + env(safe-area-inset-top));
  z-index: 700;
  max-height: 45vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  padding: 12px;
  overflow: auto;
}

.fav-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }

.fav-item {
  padding: 12px 4px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

/* ===== 定位遮罩 ===== */
.loc-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  background: #f0f4f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.loc-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #dbeafe;
  border-top-color: #33a6ff;
  border-radius: 50%;
  animation: wm-spin .8s linear infinite;
  margin-bottom: 16px;
}

@keyframes wm-spin { to { transform: rotate(360deg); } }

.loc-overlay-title { font-size: 17px; font-weight: 600; color: #222; margin-bottom: 8px; }
.loc-overlay-sub { font-size: 14px; color: #64748b; line-height: 1.5; max-width: 280px; }

.loc-retry-btn {
  margin-top: 20px;
  padding: 11px 28px;
  background: #33a6ff;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  display: none;
}

.loc-retry-btn.show { display: inline-block; }

.loc-skip-btn {
  margin-top: 14px;
  padding: 10px 22px;
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.loc-actions {
  margin-top: 14px;
  display: none;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  max-width: 100%;
}

.loc-actions.show { display: flex; }

.loc-action-btn {
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.loc-action-primary { background: #33a6ff; color: #fff; }
.loc-action-secondary { background: #fff; color: #334155; border: 1px solid #e2e8f0; }

/* ===== 底部 Tab ===== */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 600;
  background: #fff;
  display: flex;
  border-top: 1px solid #ddd;
  padding: 2px 0 env(safe-area-inset-bottom);
  height: var(--tabbar-height);
  box-sizing: border-box;
}

.tab {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: #999;
  cursor: pointer;
  padding: 4px 2px;
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.tab-icon .tab-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.tab-label {
  line-height: 1.2;
}

.tab.on {
  color: #33a6ff;
  font-weight: 500;
}
