/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #f5f6fa;
  color: #1f2d3d;
  overflow: hidden;
}

.app { position: relative; height: 100%; overflow: hidden; }

/* ========== 开屏 ========== */
.splash {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #eaf6fd 0%, #f7fbff 55%, #ffffff 100%);
  transition: opacity .5s ease, transform .5s ease;
}
.splash.hide { opacity: 0; transform: scale(1.06); pointer-events: none; }

.splash-logo {
  width: 132px; height: 132px;
  animation: logoIn .8s cubic-bezier(.22, .61, .36, 1) both;
}
.splash-ring {
  position: absolute;
  width: 210px; height: 210px;
  border-radius: 50%;
  border: 2px solid rgba(18, 150, 219, .18);
  animation: ringPulse 2.2s ease-out infinite;
}
@keyframes ringPulse {
  0%   { transform: scale(.82); opacity: .9; }
  70%  { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
@keyframes logoIn {
  from { opacity: 0; transform: scale(.72); }
  to   { opacity: 1; transform: scale(1); }
}
.splash-title {
  margin-top: 26px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #1f2d3d;
  animation: fadeUp .7s ease .18s both;
}
.splash-bar {
  margin-top: 34px;
  width: 96px; height: 3px;
  border-radius: 2px;
  background: rgba(18, 150, 219, .15);
  overflow: hidden;
  animation: fadeUp .7s ease .42s both;
}
.splash-bar i {
  display: block;
  width: 40%; height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #55c3f0, #1296db);
  animation: barRun 1.5s ease-in-out infinite;
}
@keyframes barRun {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== 视图切换 ========== */
.view {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f5f6fa;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform .34s cubic-bezier(.22, .61, .36, 1), opacity .28s ease, visibility .34s;
  will-change: transform, opacity;
}
.view.active {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}
.view.pushed {
  transform: translateX(-22%);
  opacity: .55;
  visibility: visible;
}
.view-home { transform: none; opacity: 1; visibility: visible; }

/* ========== 首页 ========== */
.view-home {
  padding: calc(28px + env(safe-area-inset-top)) 16px calc(30px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #eaf6fd 0%, #f5f6fa 180px);
}
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 30px;
  animation: fadeUp .6s cubic-bezier(.22, .61, .36, 1) both;
}
.home-logo { width: 104px; height: 104px; }
.menu { display: flex; flex-direction: column; gap: 14px; }

.card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: 0 6px 20px rgba(20, 90, 140, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:active { transform: scale(.972); box-shadow: 0 2px 10px rgba(20, 90, 140, .1); }
.card-forecast { animation: fadeUp .45s ease .08s backwards; }
.card-spot { animation: fadeUp .45s ease .18s backwards; }

.badge {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  flex-shrink: 0;
}
.badge-1 { background: linear-gradient(135deg, #55c3f0, #1296db); }
.badge-2 { background: linear-gradient(135deg, #4ed2b1, #0fa47f); }

.info { flex: 1; margin-left: 14px; min-width: 0; }
.title { font-size: 17px; font-weight: 600; color: #1f2d3d; }
.arrow {
  width: 8px; height: 8px;
  border-top: 2px solid #c6d0dd;
  border-right: 2px solid #c6d0dd;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-left: 8px;
}
.home-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: #b3bcc9;
  animation: fadeUp .5s ease .3s both;
}
.home-footer p { margin: 3px 0; }

/* ========== 导航栏 ========== */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 6px;
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}
.nav-back {
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.nav-back::before {
  content: '';
  width: 10px; height: 10px;
  border-left: 2px solid #1f2d3d;
  border-bottom: 2px solid #1f2d3d;
  transform: rotate(45deg);
}
.nav-back:active { opacity: .45; }
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}
.nav-right { width: 46px; flex-shrink: 0; }

/* ========== 日历 ========== */
.cal-wrap { padding: 10px 14px calc(24px + env(safe-area-inset-bottom)); }

.cal-tip {
  text-align: center;
  font-size: 12px;
  color: #8a96a8;
  padding: 6px 0 12px;
  letter-spacing: .3px;
}

.cal-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 4px 0 14px;
}
.m-label { font-size: 16px; font-weight: 600; min-width: 120px; text-align: center; }
.m-btn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #1296db;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(20, 90, 140, .1);
  transition: transform .15s ease;
}
.m-btn:active { transform: scale(.9); }
.m-btn:disabled { color: #cfd6e0; box-shadow: none; background: #f2f4f8; }

.week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 2px 8px;
  font-size: 11.5px;
  color: #9aa5b5;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cell {
  position: relative;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  color: #1f2d3d;
  transition: transform .16s ease, background .16s ease;
  box-shadow: 0 1px 4px rgba(20, 90, 140, .05);
}
.cell.blank { background: transparent; box-shadow: none; }
.cell.has { color: #1296db; font-weight: 600; }
.cell.spot.has { color: #0fa47f; }
.cell:active.has { transform: scale(.92); }
.cell.dim { color: #c3cad6; background: #fafbfd; box-shadow: none; }
.cell .dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #1296db;
  position: absolute;
  bottom: 8px;
}
.cell.spot .dot { background: #0fa47f; }
.cell.dim .dot { display: none; }
.cell.today::after {
  content: '';
  position: absolute;
  top: 5px; right: 5px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #ff9f2e;
}

.legend {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #9aa5b5;
}
.legend .dot { width: 5px; height: 5px; border-radius: 50%; }
.dot-f { background: #1296db; }
.dot-s { background: #0fa47f; }

/* ========== 详情 ========== */
.detail-body { padding: 12px 14px calc(26px + env(safe-area-inset-bottom)); }

.detail-head {
  border-radius: 16px;
  padding: 18px 18px 16px;
  color: #fff;
  background: linear-gradient(135deg, #4fb3e4, #1296db);
  transition: background .3s ease;
}
.detail-head.spot { background: linear-gradient(135deg, #4ed2b1, #0fa47f); }
.d-date { font-size: 21px; font-weight: 600; letter-spacing: .5px; }
.d-sub { margin-top: 6px; font-size: 12.5px; opacity: .9; }

.stats {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  margin-top: 12px;
  padding: 16px 4px;
  box-shadow: 0 4px 16px rgba(20, 90, 140, .06);
}
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.stat + .stat { border-left: 1px solid #f1f3f7; }
.s-label { font-size: 11.5px; color: #9aa5b5; }
.s-value { font-size: 17px; font-weight: 700; color: #1f2d3d; }
.s-value.up { color: #e6432d; }
.s-value.down { color: #09bb07; }
.s-time { font-size: 11px; color: #b3bcc9; }

.card-box {
  background: #fff;
  border-radius: 16px;
  margin-top: 12px;
  padding: 12px 8px;
  box-shadow: 0 4px 16px rgba(20, 90, 140, .06);
}
#chart { width: 100%; height: 210px; display: block; }

.list-box { padding: 0; overflow: hidden; }
.detail-note {
  margin: 14px 6px 0;
  font-size: 11px;
  line-height: 1.7;
  color: #b3bcc9;
  text-align: center;
}
.list-header {
  display: flex;
  position: sticky;
  top: 46px;
  background: #fff;
  z-index: 5;
  padding: 12px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #7c889b;
  border-bottom: 1px solid #f2f4f8;
}
.list-header span { flex: 1; text-align: center; }

.row {
  display: flex;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #f7f8fa;
  font-size: 14px;
}
.row span { flex: 1; text-align: center; }
.row.lv-low { background: #eafaf1; }
.row.lv-low span { color: #09bb07; font-weight: 600; }
.row.lv-mid { background: #fff; }
.row.lv-mid span { color: #333; }
.row.lv-high { background: #fdeceb; }
.row.lv-high span { color: #e6432d; font-weight: 600; }

/* ========== 提示 ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 12px);
  background: rgba(31, 45, 61, .88);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 1000;
  max-width: 78vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 加载中 */
.loading {
  text-align: center;
  color: #9aa5b5;
  font-size: 13px;
  padding: 40px 0;
}
