/* ========== 火烧云分析预告 · 样式（暗色晚霞主题） ========== */
:root {
  --bg: #0b0e17;
  --bg2: #10152a;
  --panel: rgba(20, 26, 46, 0.86);
  --panel-solid: #141a2e;
  --border: #232c47;
  --text: #e8ecf5;
  --muted: #9aa3b8;
  --dim: #6b7488;
  --accent: #ff6b35;
  --accent2: #ff2d55;
  --gold: #ffa940;
  --blue: #7dd3fc;
  --radius: 14px;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 45, 85, 0.12), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(255, 107, 53, 0.10), transparent 55%),
    var(--bg);
}

/* ---------- 顶栏 ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(11, 14, 23, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 700; letter-spacing: 0.5px;
}
.logo .sun {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd9a0, #ff6b35 55%, #ff2d55);
  box-shadow: 0 0 18px rgba(255, 107, 53, 0.55);
}
.logo small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 2px; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.mode { color: var(--gold); border-color: rgba(255, 169, 64, 0.35); }

.btn {
  font-size: 13px; color: var(--text);
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.18), rgba(255, 45, 85, 0.14));
  border: 1px solid rgba(255, 107, 53, 0.4);
  border-radius: 10px; padding: 7px 14px; cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); box-shadow: 0 0 14px rgba(255, 107, 53, 0.25); }
.btn.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.btn.ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--border); }

/* ---------- 主布局 ---------- */
main {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 22px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------- 侧栏 ---------- */
.sidebar { display: flex; flex-direction: column; gap: 14px; }

.block-title {
  font-size: 13px; color: var(--muted); font-weight: 600;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.block-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent2)); }

select#citySelect {
  width: 100%; padding: 9px 12px; font-size: 14px;
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  outline: none;
}

/* 两天卡片 */
.day-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.day-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
  transition: all 0.15s;
}
.day-card:hover { border-color: rgba(255, 107, 53, 0.5); }
.day-card.active { border-color: var(--accent); background: rgba(255, 107, 53, 0.08); }
.dc-date { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.dc-sun { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.dc-sun b { color: var(--text); }
.dc-scores { display: flex; gap: 8px; }
.dc-score {
  flex: 1; text-align: center; border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 2px;
}
.dc-score b { display: block; font-size: 22px; line-height: 1.1; }
.dc-score span { font-size: 11px; color: var(--muted); }
.dc-score.sm b { font-size: 17px; }

/* 日出日落下方的晚霞/朝霞切换按钮 */
.dc-type-btn {
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.dc-type-btn:hover { border-color: rgba(255, 107, 53, 0.55); }
.dc-type-btn.active { background: rgba(255, 107, 53, 0.10); }
/* 未选中：分数数字置灰，选中态的彩色由 inline style 驱动 */
.dc-type-btn:not(.active) b { color: var(--muted); }

/* 详情头部 */
.detail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.detail-city { font-size: 19px; font-weight: 700; }
.detail-city .region {
  font-size: 11px; color: var(--gold); margin-left: 8px;
  border: 1px solid rgba(255, 169, 64, 0.35); border-radius: 6px; padding: 2px 7px;
  vertical-align: middle;
}
.detail-coord { font-size: 11.5px; color: var(--dim); }

.empty { padding: 18px 8px; text-align: center; color: var(--dim); font-size: 13px; }

/* 仪表盘 */
.gauge-wrap { display: flex; align-items: center; gap: 6px; margin: 6px 0 12px; }
.gauge { width: 190px; flex-shrink: 0; }
.g-num { fill: #fff; font-size: 34px; font-weight: 700; }
.g-label { fill: var(--muted); font-size: 12px; }
.gauge-side { flex: 1; min-width: 0; }
.g-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.g-weather, .g-window { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.g-window b { color: var(--gold); }
.g-advice { font-size: 12.5px; color: var(--text); margin-top: 6px; line-height: 1.5; }
.g-proverb {
  margin-top: 8px; font-size: 12px; color: var(--gold);
  background: rgba(255, 169, 64, 0.08); border: 1px dashed rgba(255, 169, 64, 0.35);
  border-radius: 8px; padding: 6px 8px;
}

/* 指标分解 */
.metrics { margin-top: 6px; }
.metrics-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.m-row {
  display: grid; grid-template-columns: 58px 76px 1fr 52px;
  align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px;
}
.m-name { color: var(--muted); }
.m-val { color: var(--text); font-size: 11.5px; }
.m-bar { height: 7px; background: rgba(255, 255, 255, 0.07); border-radius: 4px; overflow: hidden; }
.m-bar i { display: block; height: 100%; border-radius: 4px; }
.m-pts { color: var(--dim); text-align: right; font-size: 11px; }

/* 曲线 */
.curve-wrap { margin-top: 12px; }
#curveCanvas { width: 100%; height: 90px; display: block; }

/* 排行榜 */
.rank-item {
  display: grid; grid-template-columns: 24px 52px 1fr 34px;
  align-items: center; gap: 8px; padding: 7px 6px;
  border-radius: 9px; cursor: pointer; font-size: 13px;
}
.rank-item:hover { background: rgba(255, 255, 255, 0.05); }
.rank-no {
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, 0.08); color: var(--muted);
}
.rank-no.r1 { background: linear-gradient(135deg, #ff2d55, #ff6b35); color: #fff; }
.rank-no.r2 { background: rgba(255, 107, 53, 0.35); color: #ffd9c2; }
.rank-no.r3 { background: rgba(255, 169, 64, 0.25); color: var(--gold); }
.rank-name { font-weight: 600; }
.rank-bar { height: 6px; background: rgba(255, 255, 255, 0.07); border-radius: 3px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; }
.rank-score { font-weight: 700; text-align: right; }

/* 覆盖统计 */
.coverage-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 10px; text-align: center;
}
.stat b { display: block; font-size: 17px; margin-bottom: 2px; }
.stat span { font-size: 11px; color: var(--muted); }

/* ---------- 右侧列：今日朝霞晚霞看板 + 地图 ---------- */
.mapcol {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
  height: calc(100vh - 130px);
  min-height: 620px;
}
.mapwrap { position: relative; flex: 1; min-height: 0; }
.map-box {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1220;
  height: 100%;
  min-height: 460px;
}

/* 今日朝霞/晚霞看板 */
.today-panel { flex-shrink: 0; padding: 12px 16px; }
.tp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tp-title { font-size: 14px; font-weight: 700; }
.tp-city {
  font-size: 12px; color: var(--gold);
  border: 1px solid rgba(255, 169, 64, 0.35); border-radius: 6px; padding: 2px 8px;
}
.tp-clock { font-size: 12.5px; color: var(--muted); }
.tp-clock b { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.tp-date { font-size: 12.5px; color: var(--muted); }
.tp-rule { margin-left: auto; font-size: 11.5px; color: var(--blue); }
.tp-body { display: flex; gap: 16px; align-items: stretch; }
.tp-tabs { display: flex; gap: 10px; flex-shrink: 0; }
.tp-btn {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 14px; cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.tp-btn:hover { border-color: rgba(255, 107, 53, 0.55); }
.tp-btn.active { background: rgba(255, 107, 53, 0.10); }
.tp-emoji { font-size: 20px; line-height: 1; }
.tp-name { font-size: 13px; color: var(--text); font-weight: 600; }
.tp-score { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.tp-grade { font-size: 11.5px; font-style: normal; }
.tp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.tp-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.tp-line b { color: var(--text); }
.tp-k { color: var(--muted); }
.tp-sub { color: var(--dim); font-size: 11.5px; }
.tp-advice { color: var(--muted); }
.tp-best { font-weight: 600; }
.tp-empty { color: var(--dim); font-size: 12.5px; }
#mapContainer { position: absolute; inset: 0; }
/* 火烧云覆盖层：盖在腾讯地图之上、地图控件之下，不拦截鼠标 */
/* canvas 是替换元素：仅 inset:0 会用固有尺寸 300x150（贴在左上角一小块），
   必须显式 width/height:100% 才能铺满地图容器 */
#mapCoverage { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
#fallbackMap { position: absolute; inset: 0; display: none; padding: 10px; }
#fallbackCanvas { width: 100%; display: block; border-radius: 10px; }
#fallbackNote {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--gold); background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 169, 64, 0.4); border-radius: 8px; padding: 6px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56%;
  z-index: 5; /* 低于地图控件，避免遮挡按钮 */
}

/* 地图控件必须压过腾讯地图内部图层：后者大量使用 z-index 数百~上千的浮层，
   控件若只给 10 就会被盖住、按钮点不动 → 这里给一个足够高的值。
   （不能改成给 #mapContainer 加 z-index 来隔离，那样会把地图内部的信息窗
   也封进低层，导致信息窗被火烧云覆盖层遮住） */
.map-controls {
  position: absolute; top: 12px; right: 12px; z-index: 20000;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.seg {
  display: flex; background: rgba(13, 18, 32, 0.88);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  backdrop-filter: blur(8px);
}
.seg-btn {
  font-size: 12.5px; color: var(--muted); background: transparent;
  border: none; padding: 7px 13px; cursor: pointer; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 600;
}
.map-tools { display: flex; gap: 8px; }
.map-tools .btn { font-size: 12px; padding: 6px 11px; backdrop-filter: blur(8px); }
/* 「切换内置覆盖图」：地图/覆盖图底图是浅色，原本 4% 白的半透明底会让浅色文字糊在底图上看不清
   → 改成与 .seg 一致的深色实心底，保证任何底图上都可读 */
.map-tools .btn.ghost {
  background: rgba(13, 18, 32, 0.92);
  border-color: var(--border);
  color: var(--text);
}
.map-tools .btn.ghost:hover {
  background: rgba(30, 38, 62, 0.95);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(255, 107, 53, 0.25);
}

.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 20000;
  background: rgba(13, 18, 32, 0.85); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; backdrop-filter: blur(8px);
  font-size: 11.5px; color: var(--muted);
}
.legend-bar {
  width: 200px; height: 10px; border-radius: 5px; margin: 6px 0 4px;
  background: linear-gradient(90deg, #fffacd, #ffec96, #ffd15c, #faa43e, #f25e34, #c41a1a);
}
.legend-labels { display: flex; justify-content: space-between; }

/* 加载条 */
.loading-bar {
  position: absolute; inset: 0; z-index: 20001;   /* 高于地图控件，加载时仍盖住按钮 */
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
  background: rgba(11, 14, 23, 0.72); backdrop-filter: blur(4px);
  font-size: 14px; color: var(--text);
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255, 107, 53, 0.2); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  margin: 12px 22px; padding: 14px 18px; font-size: 13.5px;
  background: rgba(255, 45, 85, 0.1); border: 1px solid rgba(255, 45, 85, 0.4);
  border-radius: 12px; color: #ffb3c2;
}

/* ---------- 原理区 ---------- */
section.method { padding: 8px 22px 26px; max-width: 1720px; margin: 0 auto; }
.method-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 14px; }
.method p, .method li { font-size: 13px; color: var(--muted); line-height: 1.75; }
.method b { color: var(--text); }
.method ul { padding-left: 18px; }
.weight-row { display: grid; grid-template-columns: 76px 1fr 34px; gap: 8px; align-items: center; font-size: 12.5px; margin-bottom: 8px; }
.weight-row .w-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.weight-row .w-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent2)); }
.formula {
  font-size: 12.5px; color: var(--gold); background: rgba(255, 169, 64, 0.07);
  border: 1px dashed rgba(255, 169, 64, 0.3); border-radius: 10px;
  padding: 10px 12px; margin-top: 10px; line-height: 1.7;
}

footer {
  padding: 18px 22px 30px; text-align: center;
  font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--border);
}

/* ---------- 覆盖图弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(5, 7, 12, 0.8); backdrop-filter: blur(6px);
  padding: 24px;
}
.modal-body {
  background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px; max-width: 960px; width: 100%;
  max-height: 92vh; overflow: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head b { font-size: 16px; }
.modal-close {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
#coverageCanvas { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.modal-foot { margin-top: 12px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  main { grid-template-columns: 1fr; }
  .mapcol { height: auto; min-height: 0; }
  .map-box { height: 62vh; }
  .tp-body { flex-direction: column; gap: 10px; }
  .method-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  header.topbar { padding: 10px 14px; }
  main { padding: 12px 14px; }
  .logo { font-size: 17px; }
  .map-box { height: 56vh; min-height: 420px; }
  .tp-tabs { width: 100%; }
  .tp-btn { flex: 1; justify-content: center; }
}
