/* ============================================
   花粉浓度预报 v4 — 政务风格
   干净 · 专业 · 低干扰
   ============================================ */

:root {
  --primary:   #7B68AE;
  --primary-l:  #E8E0F8;
  --primary-bg: #F7F4FC;
  --bg:        #F5F5F7;
  --card:      #FFFFFF;
  --border:    #E5E5EA;
  --text:      #1C1C1E;
  --text-2:    #636366;
  --text-3:    #AEAEB2;

  --low:    #4A8C5C;
  --mlow:   #7D9B5A;
  --mid:    #C4A040;
  --mhigh:  #C97D3A;
  --high:   #B84C44;
}

* { 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: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

*:focus { outline: none; }
* {-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: var(--card);
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
}

.top-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.top-shield {
  flex-shrink: 0;
}

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

.top-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.5;
}

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

.city-list {
  display: flex;
  gap: 6px;
}

.city-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: #F0F0F5;
  border: none;
  border-radius: 16px;
  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);
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: 12px;
  margin: 0 16px 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(108,92,231,0.10);
}

.card-title-sm {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid 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);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.edu-arrow {
  font-size: 18px;
  color: var(--text-3);
  flex-shrink: 0;
}

.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-highlight {
  color: var(--primary);
  font-weight: 600;
}

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

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

.advice-muted { color: var(--text-3); }

.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;
}

/* ---------- Level Card ---------- */
.level-card { padding: 28px 20px 24px; }

.level-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.level-dot {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15), 0 0 0 4px rgba(255,255,255,0.6);
  position: relative;
}

.level-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
}

.level-dot::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 18px;
  width: 28px;
  height: 12px;
  background: rgba(255,255,255,0.35);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.level-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 3px;
}

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

.level-tag {
  font-size: 14px;
  color: var(--text-3);
  min-height: 20px;
}

.level-info-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.level-date { font-size: 14px; color: var(--text-3); }

.level-date-wrap { display: flex; gap: 6px; }

.date-tab {
  padding: 3px 14px;
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: all 0.2s;
}

.date-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.level-update {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

.mp-jump {
  margin-top: 2px;
  line-height: 1;
}

.mp-jump-text {
  cursor: pointer;
}

/* ---------- Trend ---------- */
.trend-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.trend-row:last-child { margin-bottom: 0; }

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

.trend-bar-wrap {
  flex: 1;
  height: 24px;
  background: var(--primary-bg);
  border-radius: 12px;
  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: #E5E5EA; }

.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 14px;
  padding: 16px 20px;
  text-align: center;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(108,92,231,0.10);
}

.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;
}

/* ---------- States ---------- */
.loading {
  text-align: center;
  padding: 24px 0;
  color: var(--text-3);
  font-size: 14px;
}
.loading::after {
  content: "";
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--primary-l);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: 6px;
  vertical-align: middle;
}

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

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }

@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-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  margin: 0 auto;
}

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

.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%; }

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