/* ============================================
   花粉浓度预报 — 统一设计语言
   ============================================ */

:root {
  /* 品牌色（与健康日历统一） */
  --brand-700: #5A4E78;
  --brand-600: #6B5E8A;
  --brand-500: #8473A8;
  --brand-100: #EFEBF5;
  --brand-50:  #F7F4FB;

  /* 中性色 */
  --ink-900:  #111418;
  --ink-700:  #2C313A;
  --ink-500:  #5C6470;
  --ink-400:  #7A8290;
  --ink-300:  #A8AEB8;
  --ink-200:  #D6D9DF;
  --ink-100:  #EAECEF;
  --ink-50:   #F4F5F7;
  --canvas:   #F8F9FA;

  /* 语义色 */
  --green-700: #2F6F47;
  --green-100: #E2F0E7;
  --amber-700: #A26B14;
  --amber-100: #FAEDD0;
  --red-700:   #B23A3A;
  --red-100:   #FADCDC;

  /* 业务别名（向下兼容花粉原有样式） */
  --primary:   var(--brand-600);
  --primary-l:  var(--brand-100);
  --primary-bg: var(--brand-50);
  --bg:        var(--canvas);
  --card:      #FFFFFF;
  --border:    var(--ink-100);
  --text:      var(--ink-900);
  --text-2:    var(--ink-700);
  --text-3:    var(--ink-500);

  /* 花粉等级色（保持可辨识度） */
  --low:    #4A8C5C;
  --mlow:   #7D9B5A;
  --mid:    #C4A040;
  --mhigh:  #C97D3A;
  --high:   #B84C44;

  /* 设计系统 */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-xs: 0 1px 0 rgba(17,20,24,0.04);
  --shadow-sm: 0 1px 2px rgba(17,20,24,0.06), 0 0 0 1px rgba(17,20,24,0.04);
  --shadow-md: 0 4px 16px rgba(17,20,24,0.06), 0 1px 3px rgba(17,20,24,0.04);
  --shadow-pop: 0 10px 30px -10px rgba(17,20,24,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

*:focus:not(:focus-visible) { outline: none; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
* {-webkit-tap-highlight-color: transparent; }

/* ---------- App ---------- */
.app {
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding: 0 0 32px;
}

/* ---------- Top Bar ---------- */
.top-bar {
  background: linear-gradient(180deg, var(--card) 0%, var(--primary-bg) 100%);
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.top-hero {
  position: absolute;
  right: -5px;
  bottom: 6px;
  height: 80px;
  width: auto;
  aspect-ratio: auto;
  cursor: pointer;
}
@keyframes heroBounce {
  0%   { transform: scale(1) rotate(0deg); }
  15%  { transform: scale(0.82, 1.15) rotate(-3deg); }
  30%  { transform: scale(1.18, 0.85) rotate(2deg); }
  50%  { transform: scale(0.92, 1.06) rotate(0deg); }
  70%  { transform: scale(1.04, 0.97); }
  100% { transform: scale(1); }
}
.hero-bounce {
  animation: heroBounce 0.45s ease;
}

/* D: 长按捏变形 */
.hero-squish {
  transform: scaleX(0.7) scaleY(1.3) !important;
  transition: transform 0.5s ease !important;
}

/* A: 粒子爆炸 */
.burst-dot {
  position: fixed;
  border-radius: 50%;
  background: var(--primary);
  pointer-events: none;
  z-index: 2001;
  opacity: 0;
  transform: translate(0,0);
}
.burst-dot.fly {
  animation: burstFly 0.6s ease-out forwards;
}
@keyframes burstFly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(0); }
}

/* C: 连击数字 */
.combo-num {
  position: fixed;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  pointer-events: none;
  z-index: 2002;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.combo-num.show {
  opacity: 1;
  transform: translateY(-40px);
}

.hero-bubble {
  position: absolute;
  right: 48px;
  bottom: 58px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  max-width: 170px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.hero-bubble::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: -6px;
  width: 12px;
  height: 6px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.hero-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.top-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 2px;
}

.top-sub {
  font-size: 13px;
  color: var(--primary);
  margin: 14px auto 4px;
  line-height: 1.7;
  letter-spacing: 0.3px;
  padding: 10px 16px;
  max-width: 640px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  text-align: left;
}

/* ---------- City ---------- */
.city-wrap {
  padding: 12px 16px 8px;
}
.city-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.city-list::-webkit-scrollbar { display: none; }

.city-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--ink-50);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: all 0.25s ease;
}

.city-tab:active { transform: scale(0.95); }

.city-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(123,104,174,0.25);
}

/* ---------- Weather ---------- */
.weather-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 16px 6px;
  padding: 4px 2px;
  font-size: 13px;
  color: var(--text-2);
  min-height: 24px;
}
.weather-icon { font-size: 13px; flex-shrink: 0; }
.weather-temp {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.weather-item { flex-shrink: 0; }
.weather-item span {
  font-weight: 500;
  color: var(--text);
}
.weather-aqi { margin-left: auto; font-size: 13px; flex-shrink: 0; }
.weather-aqi .aqi-num { font-weight: 600; }
.aqi-you { color: #4A8C5C; }
.aqi-liang { color: #C4A040; }
.aqi-qingdu { color: #C97D3A; }
.aqi-zhongdu { color: #B84C44; }
.aqi-zhongdu2 { color: #9B2D5C; }
.aqi-yanzhong { color: #7E0023; }

/* 生活指数 */
.life-strip {
  display: flex;
  gap: 12px;
  margin: 0 16px 8px;
  padding: 2px 2px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
  min-height: 20px;
}
.life-strip .life-item { flex-shrink: 0; }
.life-strip .life-label { color: var(--text-2); }
.life-strip .life-val { color: var(--text); font-weight: 500; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin: 0 16px 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card.card-hero {
  background: linear-gradient(180deg, var(--primary-bg) 0%, #FFFFFF 60%);
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title-row .card-title-sm {
  margin-bottom: 0;
}
.card-title-sm {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.card-title-link {
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.card-title-link:active { color: var(--primary); }

/* ---------- Skeleton ---------- */
.panel-hint {
  text-align: center;
  padding: 28px 0 16px;
  color: var(--text-3);
  line-height: 1.8;
}

.panel-hint p { font-size: 14px; }

/* ---------- Edu Items ---------- */
.edu-list { padding: 0 2px 8px; }

.edu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  text-decoration: none;
  margin-bottom: 8px;
  transition: background 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.edu-item:active { background: var(--primary-bg); }

.edu-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.edu-icon svg { display: block; }

.edu-item-body {
  flex: 1;
  min-width: 0;
}

.edu-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

.edu-item-source {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.edu-pinned {
  color: var(--primary);
  font-weight: 500;
}

.edu-more {
  text-align: center;
  padding: 4px 0 0;
}
.edu-more-btn {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-bg);
  border: none;
  border-radius: var(--radius);
  padding: 8px 0;
  width: 100%;
  cursor: pointer;
}
.edu-more-btn:active { background: var(--primary-l); }

.card-text {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.8;
  padding: 0 2px;
}

.advice-line {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 4px;
  padding-left: 2px;
}

.advice-block {
  margin-bottom: 4px;
}

.advice-block:last-of-type {
  margin-bottom: 0;
}

.advice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  transition: background 0.2s;
}
.advice-head:active { background: var(--bg); }

.advice-arrow {
  font-size: 11px;
  color: var(--text-3);
  transition: transform 0.2s;
}
.advice-block.open .advice-arrow {
  transform: rotate(90deg);
}

.advice-body {
  display: none;
  padding: 0 16px 8px;
}
.advice-block.open .advice-body {
  display: block;
}

.advice-block.hl {
  background: linear-gradient(135deg, var(--primary-bg), #FFFFFF);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--primary-l);
  transition: background 0.3s;
}
.advice-block.hl .advice-head {
  background: transparent;
}

.advice-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  white-space: nowrap;
}

.tag-low         { color: #4A8C5C; background: #E8F5EC; }
.tag-mid         { color: #C4A040; background: #FBF6E5; }
.tag-fairly-high { color: #C97D3A; background: #FFF3E8; }
.tag-high        { color: #B84C44; background: #FBECEB; }

.advice-highlight {
  color: var(--primary);
  font-weight: 600;
}

.advice-important {
  color: var(--mhigh);
  font-weight: 600;
}

.advice-danger {
  color: var(--high);
  font-weight: 700;
}

/* ---------- Advices ---------- */
.advice-general {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ---------- Trend ---------- */
.trend-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.trend-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.trend-row:last-child { margin-bottom: 0; }

.trend-date {
  width: 50px;
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  text-align: right;
  padding-right: 10px;
  white-space: nowrap;
}

.trend-row.today .trend-date {
  color: var(--primary);
  font-weight: 600;
}
.trend-row.today .trend-bar-wrap {
  box-shadow: 0 0 0 2px rgba(123,104,174,0.25);
  border-radius: 12px;
}

.trend-bar-wrap {
  flex: 1;
  height: 24px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.trend-bar {
  height: 100%;
  border-radius: 12px;
  transition: width 0.6s ease;
  min-width: 0;
}

.trend-bar.bar-low        { background: var(--low); }
.trend-bar.bar-fairly-low { background: var(--mlow); }
.trend-bar.bar-mid        { background: var(--mid); }
.trend-bar.bar-fairly-high{ background: var(--mhigh); }
.trend-bar.bar-high       { background: var(--high); }
.trend-bar.bar-none       { background: transparent; border: 1.5px dashed #D1D1D6; border-radius: 12px; width: 12% !important; }

.trend-label {
  width: 32px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
  padding-left: 6px;
}

.label-low        { color: var(--low); }
.label-fairly-low { color: var(--mlow); }
.label-mid        { color: var(--mid); }
.label-fairly-high{ color: var(--mhigh); }
.label-high       { color: var(--high); }
.label-none       { color: var(--text-3); }

/* ---------- 鸣谢 ---------- */
.ack-section {
  margin: 0 16px;
  padding: 18px 20px 8px;
  text-align: center;
  background: linear-gradient(180deg, var(--card) 0%, var(--primary-bg) 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.ack-section-title {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
  font-weight: 600;
}

.ack-unit {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
}

/* ---------- 小程序入口（卡片内底部） ---------- */
.dual-cards-meta {
  padding: 8px 20px 4px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.meta-toggle-text {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  display: block;
  transition: opacity 0.2s;
}

.meta-toggle-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
  margin-top: 8px;
  padding: 0;
  display: none;
  text-align: left;
}

.dual-cards-meta.open .meta-toggle-body,
.mp-card-meta.open .meta-toggle-body {
  display: block;
}

.dual-cards-meta.open .meta-toggle-text,
.mp-card-meta.open .meta-toggle-text {
  display: none;
}

.mp-entry-link {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

/* 小程序卡片内入口 */
.mp-card-entry {
  margin-top: 4px;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.mp-card-entry:active .mp-entry-link {
  opacity: 0.7;
}

/* 小程序卡片内入口 */
.mp-card-meta {
  margin-top: 8px;
  padding: 8px 20px 4px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

/* ---------- 小程序二维码弹窗 ---------- */
.mp-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.mp-modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.mp-modal-card {
  background: #fff;
  border-radius: var(--radius-lg, var(--radius));
  padding: 28px 24px;
  width: 280px;
  text-align: center;
  box-shadow: var(--shadow-pop);
  transform: translateY(12px);
  transition: transform 0.25s;
}

.mp-modal-overlay.show .mp-modal-card {
  transform: translateY(0);
}

.mp-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.mp-modal-qr {
  width: 180px;
  height: 180px;
  margin: 0 auto 12px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-modal-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mp-modal-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
}

.mp-modal-close {
  display: inline-block;
  padding: 8px 28px;
  font-size: 13px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}

.mp-modal-close:active {
  background: var(--primary-bg);
}

/* ---------- Dual Cards ---------- */
.dual-cards {
  display: block;
  padding: 12px 12px;
}

/* ---------- 等级图例 ---------- */
.level-legend {
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
}
.level-legend-title {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
  font-weight: 500;
}
.level-legend-bars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.level-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  padding: 2px 0;
}
.level-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.level-legend-name { font-weight: 600; color: var(--text); }
.level-legend-range { color: var(--text-2); }
.level-legend-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
  line-height: 1.5;
}
.dot-low         { background: var(--low); }
.dot-fairly-low  { background: var(--mlow); }
.dot-mid         { background: var(--mid); }
.dot-fairly-high { background: var(--mhigh); }
.dot-high        { background: var(--high); }

.dual-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

/* 今日主卡片：视觉权重最高 */
.dual-card-main {
  flex: 1.4;
  padding: 8px 6px;
  border-radius: 14px;
}
.dual-card-main .dual-card-label {
  color: var(--primary);
}

/* 明日子卡片：弱化 */
.dual-card-sub {
  opacity: 0.92;
}
.dual-card-sub .dual-card-dot { width: 52px; height: 52px; }
.dual-card-sub .dual-card-num { font-size: 22px; }
.dual-card-sub .dual-card-label { font-size: 13px; color: var(--text-2); }

.dual-divider {
  width: 1px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
  align-self: stretch;
}

.dual-card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.dual-card-dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.dual-card-dot::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 10px;
  width: 12px;
  height: 6px;
  background: rgba(255,255,255,0.32);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.dual-card-dot.level-low        { background: linear-gradient(135deg, #4A8C5C, #5DAF73); }
.dual-card-dot.level-fairly-low { background: linear-gradient(135deg, #7D9B5A, #9BB875); }
.dual-card-dot.level-mid        { background: linear-gradient(135deg, #C4A040, #D9B85A); color: #2C2410; }
.dual-card-dot.level-fairly-high{ background: linear-gradient(135deg, #C97D3A, #E0994F); }
.dual-card-dot.level-high       { background: linear-gradient(135deg, #B84C44, #D1655C); }
.dual-card-dot.level-none       { background: #A8A8AD; }

/* ---------- 花粉浓度红绿灯（今日行动建议） ---------- */
/* 今日应对 · 顶部色点行（红绿灯四档色 + 防护建议融合） */
.today-action-card .ta-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 12px;
}
.ta-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink-300);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.5);
}
.ta-dot.level-low         { background: linear-gradient(135deg, #4A8C5C, #5DAF73); }
.ta-dot.level-mid         { background: linear-gradient(135deg, #C4A040, #D9B85A); }
.ta-dot.level-fairly-high { background: linear-gradient(135deg, #C97D3A, #E0994F); }
.ta-dot.level-high        { background: linear-gradient(135deg, #B84C44, #D1655C); }
.ta-head-text { display: flex; flex-direction: column; }
.ta-level { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.ta-action { font-size: 13px; color: var(--text-2); margin-top: 2px; }

#todayDot { width: 72px; height: 72px; }

.dual-card-num {
  display: inline-block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: color 0.4s ease;
}

.dual-card-trend {
  min-height: 20px;
}

.trend-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.trend-up { color: #C97D3A; background: #FFF3E8; }
.trend-down { color: #4A8C5C; background: #E8F5EC; }
.trend-flat { color: var(--text-3); background: var(--ink-50); }

.dual-card-tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 10px;
  border-radius: 10px;
  min-height: 20px;
  display: flex;
  align-items: center;
}

.dual-card-update {
  font-size: 11px;
  color: var(--text-3);
  min-height: 16px;
}

/* 今日卡片：非今日录入（显示为昨存预报）的提示 */
.forecast-flag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #C97D3A;
  background: #FFF3E8;
  padding: 1px 7px;
  border-radius: 10px;
  vertical-align: middle;
}

/* ---------- States ---------- */
.no-data {
  text-align: center;
  padding: 16px 0;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.fade-in { animation: fadeIn .35s ease forwards; }
.fade-out { animation: fadeOut .2s ease forwards; }

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ---------- Skeleton ---------- */
.skel {
  background: linear-gradient(90deg, #E8E8ED 25%, #F0F0F5 50%, #E8E8ED 75%);
  background-size: 200% 100%;
  animation: pulse 1.5s ease infinite;
  border-radius: 6px;
}

.skel-line { height: 14px; margin: 0 auto; }
.skel-line.w40 { width: 40%; }
.skel-line.w60 { width: 60%; }

.skel-bar {
  height: 24px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.skel-bar:nth-child(1) { width: 75%; }
.skel-bar:nth-child(2) { width: 55%; }
.skel-bar:nth-child(3) { width: 65%; }
.skel-bar:nth-child(4) { width: 45%; }
.skel-bar:nth-child(5) { width: 70%; }
.skel-bar:nth-child(6) { width: 60%; }
.skel-bar:nth-child(7) { width: 50%; }

/* ---------- Skeleton 应用 ---------- */
.dual-skel {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 18px 0 22px;
  min-height: 260px;
}
.dual-skel[hidden] {
  display: none !important;
}

.dual-cards-content {
  display: flex;
  align-items: stretch;
  padding: 16px 8px;
  min-height: 260px;
}

.dual-cards-content[hidden],
.trend-skel[hidden],
.trend-content {
  min-height: 120px;
}
.trend-content[hidden] {
  display: none !important;
}

/* 极窄屏：双卡片上下堆叠 */
@media (max-width: 340px) {
  .dual-cards-content {
    flex-direction: column;
    gap: 4px;
  }
  .dual-divider {
    width: 80%;
    height: 1px;
    margin: 4px auto;
    align-self: center;
  }
  .dual-card-main { flex: none; }
}
.dual-skel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.dual-skel-card .skel-line:first-child {
  width: 60px;
  height: 12px;
  margin-bottom: 6px;
}
.dual-skel-card .skel-line:last-child {
  width: 100px;
  height: 10px;
}
.dual-skel .skel-circle-sm {
  width: 72px;
  height: 72px;
}

.dual-skel-card:last-child .skel-circle-sm {
  width: 56px;
  height: 56px;
}

.trend-skel {
  padding: 18px 0 22px;
  min-height: 160px;
}
.trend-skel-dots {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  margin-bottom: 24px;
}
.skel-circle-xs {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.trend-skel-bars {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
  gap: 8px;
}

/* ---------- 错误态 ---------- */
.data-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 12px;
  text-align: center;
  border-radius: 12px;
  margin: 0 0 8px;
  flex-basis: 100%;
  transition: background 0.3s;
}
.data-error[hidden] { display: none; }
.data-error-icon {
  font-size: 40px;
  margin-bottom: 8px;
  line-height: 1;
}
.data-error-msg {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
}
.data-error-retry {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.data-error-retry:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(123,104,174,0.15);
}

/* 错误类型配色 */
.err-network { background: #FFF5F5; }
.err-network .data-error-icon { color: #E56060; }
.err-network .data-error-msg { color: #C94A4A; }

.err-server  { background: #FFF8EC; }
.err-server  .data-error-icon { color: #C97D3A; }
.err-server  .data-error-msg { color: #A85F2A; }

.err-empty   { background: #F4F6FA; }
.err-empty   .data-error-icon { color: var(--text-3); }
.err-empty   .data-error-msg { color: var(--text-2); }

/* safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

/* 小屏适配 */
@media (max-width: 360px) {
  .top-title { font-size: 24px; }
  .top-sub { font-size: 13px; padding: 10px 14px; }
  .dual-card-dot { width: 48px; height: 48px; }
  #todayDot { width: 56px; height: 56px; }
  .dual-card-num { font-size: 22px; }
  .city-tab { font-size: 13px; padding: 6px 12px; }
}

/* 减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Trend More Link ---------- */
.trend-more-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  padding: 10px 0 0;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  transition: opacity 0.2s;
}
.trend-more-link:active { opacity: 0.7; }

/* ---------- Pollen Calendar ---------- */
.cal-fusion { padding: 0 2px; }

.cal-timeline { padding: 0 0 4px; }
.cal-timeline-row { margin-bottom: 14px; }
.cal-timeline-row.current {
  background: var(--primary-bg);
  border-radius: 8px;
  padding: 8px 10px;
}
.cal-tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cal-tl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-tl-name { font-size: 14px; font-weight: 600; color: var(--text); }
.cal-timeline-row:not(.current) .cal-tl-name { color: var(--text-3); }
.cal-tl-months { font-size: 12px; color: var(--text-3); margin-left: auto; }
.cal-tl-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  position: relative;
  margin-bottom: 6px;
  overflow: hidden;
}
.cal-tl-bar { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.cal-timeline-row.current .cal-tl-bar { opacity: 1; }
.cal-timeline-row:not(.current) .cal-tl-bar { opacity: 0.3; }
.cal-tl-items { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-tl-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: var(--bg); color: var(--text); }
.cal-timeline-row.current .cal-tl-tag { background: #fff; font-weight: 500; }
.cal-tl-empty { font-size: 12px; color: var(--text-3); }

.cal-tl-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.cal-tl-axis span { font-size: 10px; color: var(--text-3); text-align: center; flex: 1; }
.cal-tl-axis span.cur { color: var(--primary); font-weight: 700; }



/* 连续点击 IP 形象的飘落 GIF */
.float-gif {
  position: fixed;
  width: 90px;
  height: auto;
  z-index: 2000;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.3) translateY(20px) rotate(-10deg);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.float-gif.show {
  opacity: 1;
  transform: scale(1) translateY(0) rotate(0deg);
}

/* ---------- 呼吸放松球 ---------- */
.breathe-card { text-align: center; }
.breathe-body {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.breathe-ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--primary-l), var(--primary));
  box-shadow: 0 4px 20px rgba(123,104,174,0.2);
  transform: scale(1);
}
.breathe-ball.inhale {
  transform: scale(1.6);
  box-shadow: 0 6px 32px rgba(123,104,174,0.35);
}
.breathe-ball.hold {
  transform: scale(1.6);
  box-shadow: 0 6px 32px rgba(123,104,174,0.35);
}
.breathe-ball.exhale {
  transform: scale(0.8);
  box-shadow: 0 2px 12px rgba(123,104,174,0.12);
}
.breathe-label {
  font-size: 13px;
  color: var(--text-2);
  transition: color 0.3s;
}
.breathe-btn {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-bg);
  border: none;
  border-radius: var(--radius);
  padding: 10px 0;
  width: 100%;
  cursor: pointer;
  margin-top: 4px;
}
.breathe-btn:active { background: var(--primary-l); }
.breathe-btn.stop { background: var(--primary-l); color: var(--text-2); }

/* ---------- 背景花瓣飘落 ---------- */
.petal {
  position: fixed;
  top: -40px;
  width: 18px;
  height: 18px;
  border-radius: 50% 0 50% 50%;
  background: rgba(180,150,210,0.25);
  pointer-events: none;
  z-index: 0;
  animation: petalFall linear infinite;
}
@keyframes petalFall {
  0%   { transform: translateX(0) translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.45; }
  25%  { transform: translateX(30px) translateY(25vh) rotate(90deg); }
  50%  { transform: translateX(-20px) translateY(50vh) rotate(180deg); }
  75%  { transform: translateX(20px) translateY(75vh) rotate(270deg); }
  90%  { opacity: 0.35; }
  100% { transform: translateX(0) translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ---------- Footer ---------- */

/* 花粉粒子 */
.pollen-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  transition: transform 0.6s ease, opacity 0.5s ease;
  box-shadow: 0 0 4px rgba(190,160,40,0.3);
}
.pollen-dot.cleared { transform: scale(0) translateY(-20px); opacity: 0; }

/* 喷嚏文字 */
.sneeze-text {
  position: fixed;
  font-size: 18px;
  font-weight: 700;
  color: #7B68AE;
  pointer-events: none;
  z-index: 2003;
  opacity: 0;
  transform: translateY(0) scale(0.5);
  animation: sneezeFly 1.2s ease-out forwards;
}
@keyframes sneezeFly {
  0%  { opacity: 1; transform: translateY(0) scale(0.5); }
  30% { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100%{ opacity: 0; transform: translateY(-70px) scale(0.8); }
}

/* 长按呼吸圈 */
.breath-ring {
  position: fixed;
  border-radius: 50%;
  border: 2px solid rgba(123,104,174,0.4);
  pointer-events: none;
  z-index: 999;
  transform: scale(0);
  opacity: 0;
}
.breath-ring.inhale { animation: breathIn 3s ease-in-out forwards; }
.breath-ring.exhale { animation: breathOut 4s ease-in-out forwards; }
.breath-hint {
  position: fixed;
  font-size: 12px;
  color: rgba(123,104,174,0.6);
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}
.breath-hint.show { opacity: 1; }
@keyframes breathIn {
  0%   { transform: scale(0.3); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0.2; }
}
@keyframes breathOut {
  0%   { transform: scale(2); opacity: 0.2; }
  100% { transform: scale(0.3); opacity: 0; }
}
