/* 哈旅天气 — Material 风格移动端样式 */
:root {
  --md-primary: #0b57d0;
  --md-on-primary: #fff;
  --md-primary-container: #d3e3fd;
  --md-surface: #f7f9fc;
  --md-surface-1: #ffffff;
  --md-surface-2: #eef2f8;
  --md-outline: #dde3ec;
  --md-text: #1b1c1e;
  --md-text-2: #5f6368;
  --md-rain: #0b57d0;
  --md-warn: #b3261e;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(20, 40, 80, .10);
  --nav-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--md-surface); color: var(--md-text);
  overscroll-behavior: none; user-select: none;
}
#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 顶部状态条（窄） ---------- */
.statusbar {
  height: calc(22px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #e8ebf0; color: var(--md-text-2);
  font-size: 11px; flex: none; z-index: 30;
  border-bottom: 1px solid var(--md-outline);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; transition: background .3s; }
.conn-dot.on { background: #22c55e; box-shadow: 0 0 5px #22c55e; }

/* ---------- 预警横幅 ---------- */
.warning-banner {
  flex: none; background: #fdecea; color: #99221b;
  padding: 8px 14px; font-size: 13px; line-height: 1.4;
  border-bottom: 1px solid #f6c7c3; cursor: pointer;
  animation: slideDown .35s ease;
  max-height: 72px; overflow: hidden;
}
.warning-banner b { margin-right: 6px; }
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- 页面切换 ---------- */
#pages { flex: 1; position: relative; overflow: hidden; }
.page {
  position: absolute; inset: 0; display: none;
  opacity: 0; transform: translateX(24px);
}
.page.active { display: block; animation: pageIn .28s cubic-bezier(.2,.7,.3,1) forwards; }
.page.active.from-left { animation-name: pageInL; }
@keyframes pageIn  { to { opacity: 1; transform: none } }
@keyframes pageInL { from { opacity: 0; transform: translateX(-24px) } to { opacity: 1; transform: none } }

.scroll-area { height: 100%; overflow-y: auto; padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }

/* ---------- 底部导航（微信式） ---------- */
.bottom-nav {
  flex: none; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--md-surface-1);
  border-top: 1px solid var(--md-outline); z-index: 40;
}
.nav-item {
  flex: 1; border: 0; background: none; color: var(--md-text-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; cursor: pointer; transition: color .2s;
}
.nav-item i { font-size: 26px; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.nav-item.active { color: var(--md-primary); font-weight: 600; }
.nav-item.active i { transform: translateY(-2px) scale(1.12); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--md-surface-1); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.loading { text-align: center; color: var(--md-text-2); padding: 48px 0; font-size: 14px; }
.md-btn {
  border: 0; border-radius: 20px; padding: 10px 18px; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: filter .15s, transform .1s;
}
.md-btn:active { transform: scale(.96); }
.md-btn.tonal { background: var(--md-primary-container); color: var(--md-primary); font-weight: 600; }
.md-btn.text { background: none; color: var(--md-primary); font-weight: 600; }
.icon-btn {
  border: 0; background: var(--md-surface-2); color: var(--md-text-2);
  width: 36px; height: 36px; border-radius: 50%; font-size: 17px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .3s;
}
.icon-btn:active { transform: rotate(180deg); }
.hidden { display: none !important; }

/* ---------- 大盘预报 ---------- */
#page-map { background: #eaf1fb; }
#harbin-map { position: absolute; inset: 0; background: #eaf1fb; z-index: 1; }
.leaflet-container { background: #eaf1fb; font: inherit; }

.district-label { background: none; border: 0; box-shadow: none; }
.district-label .dl {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11px; color: #123; text-shadow: 0 1px 2px #fff; white-space: nowrap;
  transform: translate(-50%, -50%);
}
.district-label .dl i { font-size: 17px; }
.district-label .dl .t { font-weight: 700; font-size: 11px; }
.district-label .dl .rain-tag {
  background: var(--md-rain); color: #fff; font-size: 9px; border-radius: 8px;
  padding: 0 5px; line-height: 14px;
}

.map-legend {
  position: absolute; left: 12px; bottom: 14px; z-index: 20;
  padding: 10px 12px; width: 150px; font-size: 11px;
}
.legend-title { color: var(--md-text-2); margin-bottom: 6px; }
.legend-scale { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.legend-scale .lg { flex: 1; }
.legend-labels { display: flex; justify-content: space-between; color: var(--md-text-2); margin-top: 3px; }
.legend-updated { color: #98a1ad; margin-top: 6px; font-size: 10px; }

.fab {
  position: absolute; right: 14px; bottom: 18px; z-index: 20;
  width: 52px; height: 52px; border-radius: 16px; border: 0;
  background: var(--md-primary); color: #fff; font-size: 22px;
  box-shadow: 0 4px 14px rgba(11, 87, 208, .4); cursor: pointer;
  transition: transform .2s;
}
.fab:active { transform: scale(.92) rotate(180deg); }
.fab.spin i { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- 底部抽屉 ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
  background: var(--md-surface-1); border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 30px rgba(10, 30, 70, .25);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.8,.3,1);
  max-height: 76%; display: flex; flex-direction: column;
}
.sheet.open { transform: none; }
.sheet-handle { flex: none; width: 40px; height: 4px; border-radius: 2px; background: #cfd6e0; margin: 10px auto 4px; }
.sheet-body { overflow-y: auto; padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); }
.sheet-mask { position: absolute; inset: 0; z-index: 24; background: rgba(10,20,40,.25); }

.point-title { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 2px; }
.point-title h3 { margin: 0; font-size: 18px; }
.point-title .coords { font-size: 12px; color: var(--md-text-2); }

/* ---------- 实况区块 ---------- */
.now-block { display: flex; align-items: center; gap: 14px; padding: 10px 2px; cursor: pointer; }
.now-block .big-icon { font-size: 54px; color: var(--md-primary); }
.now-block .big-temp { font-size: 44px; font-weight: 300; }
.now-block .big-temp sup { font-size: 20px; }
.now-block .now-desc { flex: 1; }
.now-block .now-desc .t1 { font-size: 17px; font-weight: 600; }
.now-block .now-desc .t2 { font-size: 13px; color: var(--md-text-2); margin-top: 2px; }
.now-block .more-dots { color: var(--md-text-2); font-size: 20px; padding: 4px 8px; }

/* ---------- 分钟级降水 ---------- */
.minutely-card { margin-top: 10px; }
.minutely-summary { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.minutely-summary i { color: var(--md-rain); font-size: 22px; }
.minutely-summary .dry { color: #16a34a; }
.minutely-chart {
  margin-top: 10px; display: flex; align-items: flex-end; gap: 3px;
  overflow-x: auto; padding-bottom: 4px; height: 104px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.minutely-chart::-webkit-scrollbar { height: 3px; }
.minutely-chart::-webkit-scrollbar-thumb { background: #c6d2e4; border-radius: 2px; }
.mbar {
  flex: none; width: 24px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
  scroll-snap-align: start; position: relative;
}
.mbar .bar {
  width: 13px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #4c8df6, #0b57d0);
  min-height: 3px; transition: height .5s cubic-bezier(.2,.8,.3,1);
}
.mbar .bar.zero { background: #e3e9f2; }
/* 固定高度：无论有无文字，时间行都占同样空间，保证所有柱子底部在同一水平线 */
.mbar .tm {
  height: 14px; line-height: 14px; font-size: 10px; color: #97a2b0;
  margin-top: 3px; white-space: nowrap;
}
.mbar .val {
  position: absolute; top: 0; font-size: 10px; color: var(--md-rain);
  opacity: 0; transition: opacity .2s;
}
.mbar:active .val, .mbar.peak .val { opacity: 1; }
.minutely-updated { font-size: 11px; color: #98a1ad; margin-top: 4px; }

/* ---------- 逐小时 ---------- */
.hourly-card { margin-top: 10px; }
.hourly-title, .minutely-title, .warn-title {
  font-size: 14px; color: var(--md-text-2); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.hourly-strip { display: flex; overflow-x: auto; gap: 6px; padding: 2px; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.hourly-strip::-webkit-scrollbar { height: 3px; }
.hourly-strip::-webkit-scrollbar-thumb { background: #c6d2e4; border-radius: 2px; }
.hcell {
  flex: none; width: 66px; text-align: center; padding: 10px 0;
  border: 1px solid var(--md-outline); border-radius: 14px;
  background: var(--md-surface-1);
  transition: background .2s, border-color .2s; cursor: pointer;
}
.hcell:active { background: var(--md-surface-2); border-color: var(--md-primary); }
.hcell .h-time { font-size: 12px; color: var(--md-text-2); }
.hcell .h-icon { font-size: 28px; margin: 6px 0; color: var(--md-primary); display: block; }
.hcell .h-temp { font-size: 15px; font-weight: 600; }
.hcell .h-pop { font-size: 11px; color: var(--md-rain); min-height: 14px; }

/* ---------- 预警卡片 ---------- */
.warn-card { margin-top: 10px; border-left: 4px solid var(--md-warn); }
.warn-item { padding: 4px 0; cursor: pointer; }
.warn-item + .warn-item { border-top: 1px dashed var(--md-outline); margin-top: 6px; padding-top: 10px; }
.warn-item .w-title { font-size: 14px; font-weight: 600; }
.warn-item .w-meta { font-size: 12px; color: var(--md-text-2); margin-top: 2px; }
.warn-badge {
  display: inline-block; font-size: 11px; border-radius: 8px; padding: 1px 7px;
  color: #fff; margin-right: 6px; vertical-align: 1px;
}

/* ---------- 精准预报 ---------- */
.here-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.here-loc { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.here-loc i { color: var(--md-primary); font-size: 20px; }
.here-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--md-text-2); }
.hero-card {
  background: linear-gradient(135deg, #0b57d0, #3f7de8 60%, #6fa2f2);
  color: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.hero-card .now-block .big-icon, .hero-card .now-block .more-dots { color: #fff; }
.hero-card .now-desc .t2 { color: #d9e5ff; }
.hero-card.rainy { background: linear-gradient(135deg, #062e6f, #0b57d0 65%, #2a6de0); }

/* ---------- 清单预报 ---------- */
.list-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.place-card {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; cursor: pointer;
  animation: cardIn .3s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
.place-card .p-icon { font-size: 40px; color: var(--md-primary); flex: none; }
.place-card .p-main { flex: 1; min-width: 0; }
.place-card .p-name { font-size: 16px; font-weight: 600; }
.place-card .p-sub { font-size: 13px; color: var(--md-text-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-card .p-sub.rain { color: var(--md-rain); font-weight: 600; }
.place-card .p-temp { font-size: 30px; font-weight: 300; flex: none; }
.place-card .p-spark { flex: none; display: flex; align-items: flex-end; gap: 1.5px; height: 30px; width: 74px; }
.place-card .p-spark span { flex: 1; background: #4c8df6; border-radius: 1.5px; min-height: 2px; }
.place-card .p-spark span.z { background: #e3e9f2; }
.empty-hint { text-align: center; color: var(--md-text-2); padding: 60px 20px; font-size: 14px; line-height: 1.8; }
.empty-hint i { font-size: 42px; color: #c3cede; display: block; margin-bottom: 8px; }

/* ---------- 对话框 ---------- */
.dialog-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 40, .4);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0 } }
.dialog {
  background: var(--md-surface-1); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 82dvh; display: flex; flex-direction: column;
  animation: sheetUp .3s cubic-bezier(.2,.8,.3,1);
}
@keyframes sheetUp { from { transform: translateY(40%) } }
.dialog-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.search-box { position: relative; }
.search-box input {
  width: 100%; border: 1.5px solid var(--md-outline); border-radius: 14px;
  padding: 11px 14px; font-size: 14px; outline: none; background: var(--md-surface-2);
}
.search-box input:focus { border-color: var(--md-primary); background: #fff; }
.search-results { margin-top: 6px; max-height: 200px; overflow-y: auto; }
.sr-item {
  padding: 11px 10px; border-radius: 12px; cursor: pointer; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.sr-item:active { background: var(--md-surface-2); }
.sr-item .sr-d { font-size: 12px; color: var(--md-text-2); }
.sr-item .sr-add { color: var(--md-primary); font-size: 18px; }
.dialog-list { overflow-y: auto; margin-top: 10px; flex: 1; }
.dl-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 6px;
  border-bottom: 1px solid var(--md-surface-2); font-size: 15px;
}
.dl-item .dl-name { flex: 1; }
.dl-item .dl-name input {
  border: 0; border-bottom: 1px dashed transparent; font-size: 14px; width: 100%;
  outline: none; background: none;
}
.dl-item .dl-name input:focus { border-color: var(--md-primary); }
.dl-item .dl-coord { font-size: 12px; color: var(--md-text-2); }
.dl-del { border: 0; background: none; color: var(--md-warn); font-size: 17px; cursor: pointer; padding: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- 详情弹层 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.detail-cell { background: var(--md-surface-2); border-radius: 14px; padding: 12px; }
.detail-cell .dc-k { font-size: 12px; color: var(--md-text-2); }
.detail-cell .dc-v { font-size: 19px; font-weight: 600; margin-top: 3px; }
.detail-text { font-size: 14px; line-height: 1.7; color: var(--md-text); margin-top: 8px; user-select: text; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); z-index: 80;
  transform: translateX(-50%); background: rgba(30, 34, 40, .92); color: #fff;
  font-size: 13px; padding: 10px 18px; border-radius: 20px;
  animation: toastIn .25s ease; max-width: 84%; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px) } }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center; height: 100dvh;
  background: linear-gradient(150deg, #0b57d0, #3f7de8 55%, #8db4f5);
}
.login-card {
  background: #fff; border-radius: 26px; padding: 36px 30px; width: min(86%, 340px);
  text-align: center; box-shadow: 0 12px 40px rgba(4, 30, 80, .35);
  animation: cardIn .4s ease;
}
.login-logo { font-size: 52px; color: var(--md-primary); }
.login-card h1 { margin: 8px 0 4px; font-size: 24px; }
.login-sub { color: var(--md-text-2); font-size: 13px; margin: 0 0 22px; }
.login-input {
  width: 100%; border: 1.5px solid var(--md-outline); border-radius: 14px;
  padding: 13px 16px; font-size: 16px; text-align: center; letter-spacing: 4px; outline: none;
}
.login-input:focus { border-color: var(--md-primary); }
.login-error { color: var(--md-warn); font-size: 13px; margin-top: 10px; }
.login-btn {
  width: 100%; margin-top: 18px; border: 0; border-radius: 14px; padding: 13px;
  background: var(--md-primary); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform .1s;
}
.login-btn:active { transform: scale(.97); }
