/* ============ 基础 ============ */
:root {
  --bg: #14101f;
  --bg-soft: #1c1729;
  --card-radius: 20px;
  --text: #f3eee7;
  --text-dim: rgba(243, 238, 231, 0.62);
  --text-faint: rgba(243, 238, 231, 0.4);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(255, 122, 89, 0.16), transparent),
    radial-gradient(ellipse 60% 40% at 10% 110%, rgba(94, 96, 206, 0.14), transparent);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* ============ 头部 ============ */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}

.brand h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #ffb88c, #ff7e5f 45%, #d76d9e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 3px;
  margin-top: 2px;
}

.loc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 12px;
}

.loc-chip::before {
  content: "📍";
  font-size: 12px;
}

.loc-chip-btn { cursor: pointer; transition: all 0.2s; }

.loc-chip-btn::after {
  content: "▾";
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.7;
}

.loc-chip-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }

/* ============ 城市搜索面板 ============ */
.city-search {
  position: fixed;
  width: min(320px, calc(100vw - 28px));
  background: rgba(28, 23, 41, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  z-index: 50;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.city-search-box {
  display: flex;
  gap: 8px;
}

.city-search-box input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.city-search-box input:focus { border-color: #ff8a5c; }

.city-search-box button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  background: linear-gradient(120deg, #ff9a56, #ff5e62);
  color: #fff;
}

.city-results { margin-top: 10px; max-height: 300px; overflow-y: auto; }

.city-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}

.city-item:hover { background: rgba(255, 154, 86, 0.14); }

.city-item .ci-name { font-size: 14px; color: var(--text); }

.city-item .ci-region { font-size: 11.5px; color: var(--text-faint); }

.city-status { padding: 14px 6px 6px; font-size: 12.5px; color: var(--text-faint); text-align: center; }

.refresh-btn {
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }

/* ============ 状态卡片 ============ */
.status-card {
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--card-radius);
  padding: 48px 24px;
  text-align: center;
}

.status-card p { color: var(--text-dim); }
.status-hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #ff8a5c;
  animation: spin 0.9s linear infinite;
}

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

.error-actions { margin-top: 18px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(120deg, #ff9a56, #ff5e62);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-ghost:hover { color: var(--text); }

/* 手动坐标兜底 */
.manual-form {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-form input {
  width: 130px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.manual-form input:focus { border-color: #ff8a5c; }

/* ============ Hero（下一个霞光事件） ============ */
.hero {
  position: relative;
  border-radius: 24px;
  padding: 30px 28px;
  overflow: hidden;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.65);
  transition: background 0.6s;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 90% at 85% 10%, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.hero-tag {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 4px 14px;
}

.hero-when { font-size: 13px; opacity: 0.85; letter-spacing: 1px; }

.hero-body {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.ring-wrap { position: relative; width: 128px; height: 128px; flex-shrink: 0; }

.ring-wrap svg { transform: rotate(-90deg); }

.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 9; }
.ring-val { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.3, 0.7, 0.3, 1); }

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-score { font-size: 34px; font-weight: 700; line-height: 1; }

.ring-unit { font-size: 11px; opacity: 0.75; margin-top: 4px; letter-spacing: 1px; }

.hero-info { flex: 1; min-width: 220px; }

.hero-level { font-size: 30px; font-weight: 700; letter-spacing: 4px; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.25); }

.hero-desc { font-size: 14px; opacity: 0.9; margin-top: 6px; }

.hero-times {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.hero-time-item .t-label { font-size: 11px; opacity: 0.75; letter-spacing: 2px; }
.hero-time-item .t-value { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }

.hero-models {
  margin-top: 18px;
  font-size: 12px;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}

/* ============ 四张事件卡片 ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  border-radius: var(--card-radius);
  padding: 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 34px -16px rgba(0, 0, 0, 0.6);
  transition: background 0.6s, transform 0.2s;
}

.card:hover { transform: translateY(-2px); }

.card.past { opacity: 0.45; filter: saturate(0.6); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.card-title { font-weight: 600; letter-spacing: 2px; }
.card-date { opacity: 0.8; font-size: 12px; }

.card-score { font-size: 38px; font-weight: 700; margin-top: 12px; line-height: 1; }

.card-score small { font-size: 13px; font-weight: 400; opacity: 0.8; margin-left: 4px; }

.card-level { font-size: 14px; margin-top: 4px; font-weight: 600; letter-spacing: 2px; }

.card-bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
  margin-top: 14px;
  overflow: hidden;
}

.card-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  transition: width 0.9s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.card-time { font-size: 12.5px; opacity: 0.85; margin-top: 12px; font-variant-numeric: tabular-nums; }

.card-past-tag {
  position: absolute;
  top: 14px;
  right: -30px;
  transform: rotate(38deg);
  background: rgba(0, 0, 0, 0.4);
  font-size: 11px;
  padding: 3px 36px;
  letter-spacing: 2px;
}

/* ============ 评分 → 渐变色 ============ */
/* 特烧：火烧云 */
.grad-a { background: linear-gradient(140deg, #ff9d6c 0%, #ff5e62 48%, #c73866 100%); }
/* 大烧：橙金 */
.grad-b { background: linear-gradient(140deg, #f7b267 0%, #f4845f 55%, #cd5f6c 100%); }
/* 中烧：紫粉 */
.grad-c { background: linear-gradient(140deg, #8d7ba8 0%, #b78a8c 55%, #d8a26a 100%); }
/* 小烧：平静灰蓝 */
.grad-d { background: linear-gradient(140deg, #43506b 0%, #56617c 55%, #6e7392 100%); }
/* 不烧：深灰蓝 */
.grad-e { background: linear-gradient(140deg, #2c3547 0%, #39445c 55%, #4a5570 100%); }

/* AOD 独立行：徽章 + 数值 + 说明 */
.hero-aod {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 8px 12px;
  background: rgba(0, 0, 0, 0.18); border-radius: 12px;
  backdrop-filter: blur(4px);
}

.aod-badge {
  font-size: 13.5px; font-weight: 700; letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.22); border-radius: 8px;
  padding: 3px 10px; white-space: nowrap;
}

.aod-badge.aod-水晶 { text-shadow: 0 0 10px rgba(255, 255, 255, 0.95); }
.aod-badge.aod-一般 { }
.aod-badge.aod-小污 { background: rgba(160, 140, 120, 0.4); }
.aod-badge.aod-中污 { background: rgba(120, 100, 90, 0.55); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.aod-badge.aod-大污 { background: rgba(90, 70, 60, 0.7); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }

.aod-num { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.aod-desc { font-size: 12px; opacity: 0.85; }

/* AOD 等级强调色（叠在霞色卡片上） */
.aod-value { font-size: 15px !important; }
.aod-水晶 { text-shadow: 0 0 12px rgba(255, 255, 255, 0.9); }
.aod-大污, .aod-中污 { text-shadow: 0 0 10px rgba(0, 0, 0, 0.5); }

/* ============ 筛选行（模式/日期） ============ */
.filters {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.filter-group { display: flex; align-items: center; gap: 8px; }

.filter-label { font-size: 12px; color: var(--text-faint); letter-spacing: 2px; }

.chip-row { display: flex; gap: 6px; }

.chip {
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 15px;
  cursor: pointer;
  transition: all 0.18s;
}

.chip:hover { color: var(--text); }

.chip.active {
  color: #fff;
  background: linear-gradient(120deg, #ff9a56, #ff5e62);
  border-color: transparent;
  font-weight: 600;
}

.model-note {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}

/* ============ 倒计时 / AOD ============ */
.hero-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 4px 14px;
}

.hero-countdown.live { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}

.hero-meta-line { margin-top: 10px; font-size: 12px; opacity: 0.88; }

.card-extra { font-size: 11.5px; opacity: 0.85; margin-top: 6px; }

/* ============ 48 小时云量时间轴 ============ */
.timeline-section {
  margin-top: 22px;
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--card-radius);
  padding: 18px 18px 12px;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-head h2 { font-size: 15px; font-weight: 600; letter-spacing: 1px; }

.timeline-model { font-size: 12px; color: var(--text-faint); }

.timeline-legend {
  display: flex;
  gap: 14px;
  margin: 10px 0 4px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.timeline-legend span { display: inline-flex; align-items: center; gap: 5px; }

.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.timeline-wrap { position: relative; }

.timeline-wrap svg { display: block; width: 100%; height: auto; touch-action: pan-y; }

.tl-axis { fill: rgba(243, 238, 231, 0.4); font-size: 10.5px; font-family: inherit; }

.tl-mark { font-size: 14px; }

.tl-now-text { fill: #fff; font-size: 10.5px; font-weight: 600; }

/* ============ 全国火烧云地图 ============ */
.map-section {
  margin-top: 22px;
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--card-radius);
  padding: 18px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.map-head h2 { font-size: 15px; font-weight: 600; letter-spacing: 1px; }

.map-model { font-size: 12px; color: var(--text-faint); }

.map-body { text-align: center; padding: 18px 0 6px; }

.map-intro {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 480px;
  margin: 0 auto 16px;
}

.map-loading { padding: 30px 0; }

.map-loading .spinner { margin-bottom: 14px; }

.map-loading p { color: var(--text-dim); font-size: 13px; }

.map-error p { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; }

.map-filters {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}

.map-canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; }

/* 悬停/按住时的精准定位准星 */
.map-cross { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 4; }
.map-cross .ch-ring {
  position: absolute; left: -10px; top: -10px; width: 20px; height: 20px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45), inset 0 0 0 1.5px rgba(0, 0, 0, 0.45);
}
.map-cross .ch-h {
  position: absolute; left: -22px; top: -1px; width: 44px; height: 2px;
  background: #fff; box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}
.map-cross .ch-v {
  position: absolute; left: -1px; top: -22px; width: 2px; height: 44px;
  background: #fff; box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

.map-canvas-wrap canvas { display: block; width: 100%; cursor: crosshair; }

.map-tip { position: absolute; font-size: 12px; }

.map-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.legend-bar {
  flex: 1;
  max-width: 340px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgb(45, 58, 88), rgb(86, 86, 140) 20%, rgb(168, 110, 160) 40%,
    rgb(250, 160, 90) 60%, rgb(255, 90, 80) 80%, rgb(200, 40, 100));
}

.map-note { font-size: 11px; color: var(--text-faint); margin-top: 8px; line-height: 1.7; }

.timeline-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(20, 16, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 11.5px;
  line-height: 1.75;
  white-space: nowrap;
  transform: translate(-50%, 0);
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.timeline-tip .tip-time { color: var(--text); font-weight: 600; }
.timeline-tip .tip-row { color: var(--text-dim); }
.timeline-tip .tip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ============ 底部状态栏 ============ */
.footer {
  margin-top: 30px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.9;
}

#statusBar { font-variant-numeric: tabular-nums; }

/* ============ 移动端 ============ */
@media (max-width: 560px) {
  .page { padding: 20px 14px 32px; }
  .hero { padding: 24px 20px; }
  .hero-body { gap: 18px; }
  .hero-level { font-size: 24px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-score { font-size: 30px; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
}
