/*!
 * 天气卡片模块 weather.css v1.0.0
 * ------------------------------------------------------------------
 * 与 weather.js 配套。所有样式都收在 .wx-weather 作用域内，
 * 颜色/圆角/阴影走 --wx-* 变量：宿主不定义也能正常显示（默认暗色）；
 * 需要浅色时给根节点加 .wx-light（或让 <html data-theme="light"> 让模块自动跟随）。
 *
 * 想和宿主配色统一，只要覆盖变量即可：
 *   .wx-weather { --wx-panel: #1b2233; --wx-accent: #4e6ef2; }
 * ------------------------------------------------------------------ */

/* ---------------- 主题变量（默认暗色） ---------------- */
.wx-weather {
  --wx-bg: #0b1020;
  --wx-bg-soft: #0d1424;
  --wx-panel: #131a2e;
  --wx-panel-2: #0f1526;
  --wx-line: rgba(255, 255, 255, .12);
  --wx-text: #e8eefc;
  --wx-muted: #8fa0c4;
  --wx-accent: #4e6ef2;
  --wx-accent-2: #7c4dff;
  --wx-pending: #cf8a2e;
  --wx-radius: 14px;
  --wx-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  color: var(--wx-text);
  font-size: 13px;
  line-height: 1.4;
}
.wx-weather.wx-light,
[data-theme="light"] .wx-weather:not(.wx-dark) {
  --wx-bg: #eef2f9;
  --wx-bg-soft: #e6ecf6;
  --wx-panel: #ffffff;
  --wx-panel-2: #e8eef8;
  --wx-line: #d8e0ee;
  --wx-text: #1f2a44;
  --wx-muted: #5d6b8c;
  --wx-pending: #cf8a2e;
  --wx-shadow: 0 10px 28px rgba(30, 45, 90, .10);
}

/* ---------------- 卡片外壳 ---------------- */
.wx-card {
  background: linear-gradient(180deg, var(--wx-panel), var(--wx-bg-soft));
  border: 1px solid var(--wx-line); border-radius: var(--wx-radius);
  padding: 10px 12px 8px; box-shadow: var(--wx-shadow);
  display: flex; flex-direction: column; gap: 7px; min-width: 0;
}
/* 头部：标题 + 城市 chips + 默认显示 + 刷新/关闭，同一行，窄屏自动换行 */
.wx-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wx-head .wx-chips { flex: 1; min-width: 0; }
.wx-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wx-refresh {
  background: transparent; border: 1px solid var(--wx-line); color: var(--wx-muted);
  border-radius: 8px; padding: 3px 9px; font-size: 12px; cursor: pointer; transition: .15s;
}
.wx-refresh:hover { color: var(--wx-text); border-color: var(--wx-accent); }

.wx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wx-chip {
  background: var(--wx-panel-2); color: var(--wx-muted); border: 1px solid var(--wx-line);
  border-radius: 999px; padding: 2px 8px; font-size: 11.5px; cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: .15s;
}
.wx-chip:hover { color: var(--wx-text); }
.wx-chip.active {
  color: #fff; background: linear-gradient(180deg, var(--wx-accent), var(--wx-accent-2));
  border-color: transparent;
}
.wx-chip-add { border-style: dashed; }
.wx-chip-del { border-left: 1px dashed var(--wx-line); }

.wx-add { display: none; gap: 6px; }
.wx-add.open { display: flex; }
.wx-add input {
  flex: 1; min-width: 0; background: var(--wx-panel-2); border: 1px solid var(--wx-line);
  color: var(--wx-text); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; outline: none;
}
.wx-add input:focus { border-color: var(--wx-accent); }

/* ---------------- 当前天气块 ---------------- */
.wx-now { display: flex; align-items: center; gap: 12px; }
.wx-now-main { min-width: 0; }
.wx-ico { font-size: 34px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.wx-weather.wx-light .wx-ico,
[data-theme="light"] .wx-weather .wx-ico { filter: none; }
.wx-temp {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.wx-temp small { font-size: 14px; font-weight: 600; color: var(--wx-muted); }
.wx-cond {
  font-size: 12.5px; color: var(--wx-muted); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-cond b { color: var(--wx-text); font-weight: 700; }
.wx-nowdesc { font-size: 11.5px; color: var(--wx-muted); line-height: 1.5; }
.wx-nowdesc b { color: var(--wx-text); font-weight: 600; }

/* 默认显示城市下拉 */
.wx-defsel {
  flex: none; max-width: 130px; background: var(--wx-panel-2); color: var(--wx-muted);
  border: 1px solid var(--wx-line); border-radius: 8px; padding: 3px 6px;
  font-size: 11.5px; outline: none; cursor: pointer;
}
.wx-defsel:focus { border-color: var(--wx-accent); }
.wx-star { color: var(--wx-pending); font-size: 11px; }
.wx-chip.active .wx-star { color: #fff; }

/* 夜晚：真实月相 SVG（亮面随 illuminations 变化），有云/降水时叠一朵云 */
.wx-moon { position: relative; display: inline-block; line-height: 0; }
.wx-moon svg { filter: drop-shadow(0 4px 12px rgba(242, 230, 192, .18)); }
.wx-moon .wx-cloud {
  position: absolute; right: -7px; bottom: -3px; font-size: 19px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3));
}
/* 月亮信息行：月相 · 星座 · 月升/月上中天/月落（并入当前天气块，单行） */
.wx-moonline {
  margin-top: 2px; font-size: 11px; color: var(--wx-muted);
  font-variant-numeric: tabular-nums; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 头部按钮组：刷新 + 关闭 */
.wx-head-btns { display: flex; gap: 6px; align-items: center; }
.wx-close {
  background: transparent; border: 1px solid var(--wx-line); color: var(--wx-muted);
  border-radius: 8px; width: 26px; height: 26px; font-size: 13px; cursor: pointer;
  line-height: 1; transition: .15s;
}
.wx-close:hover { color: #ff6b6b; border-color: #ff6b6b; }
/* 刷新中保留旧内容：整体轻微降透明提示在更新（不清空闪烁） */
.wx-updating .wx-card-body { opacity: .72; transition: opacity .2s; }
/* 关闭后的恢复条 */
.wx-reopen {
  width: 100%; padding: 10px 12px; border-radius: var(--wx-radius);
  background: var(--wx-panel); border: 1px dashed var(--wx-line); color: var(--wx-muted);
  font-size: 12px; cursor: pointer; text-align: left; transition: .15s;
}
.wx-reopen:hover { color: var(--wx-text); border-color: var(--wx-accent); }

/* ---------------- 面板（10 天 / 当天逐时） ---------------- */
.wx-panel {
  background: var(--wx-panel-2); border: 1px solid var(--wx-line); border-radius: 12px;
  padding: 7px 10px 5px; min-width: 0;   /* 宽度随卡片走，两块面板自然左右对齐 */
}
.wx-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--wx-text); margin-bottom: 2px; flex-wrap: wrap;
}
.wx-panel-head .wx-hint { font-size: 10.5px; color: var(--wx-muted); }
.wx-legend {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--wx-muted);
}
.wx-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.wx-legend .lg-hi { background: #ff9a5d; }
.wx-legend .lg-lo { background: #5da9ff; margin-left: 8px; }
.wx-legend .lg-today { background: #34d399; margin-left: 8px; }

/* ---------------- 未来 10 天折线 ---------------- */
.wx-chart-flex { display: flex; gap: 14px; align-items: stretch; min-width: 0; }
.wx-chart-wrap { flex: 1 1 auto; min-width: 0; position: relative; }
/* 绘图区：SVG / Y 轴刻度 / 现在气温气泡 / 小时刻度同一个定位上下文，
   高度由 .wx-chart 撑开（190px），各处百分比坐标因此与 SVG 的 viewBox 严格对应 */
.wx-plot { position: relative; }
/* 悬浮对齐线（吸附到当天折线点/日期列的 X 坐标）+ 高低温浮层 */
.wx-chart-cursor {
  position: absolute; top: 0; bottom: 0; width: 1px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 154, 93, .75), rgba(93, 169, 255, .55));
  box-shadow: 0 0 6px rgba(255, 154, 93, .35);
}
.wx-chart-cursor::before {
  content: ""; position: absolute; top: -2px; left: -2.5px; width: 6px; height: 6px;
  border-radius: 50%; background: #ff9a5d;
}
.wx-chart-tip {
  position: absolute; top: -2px; z-index: 3; pointer-events: none;
  padding: 3px 8px; border-radius: 7px; white-space: nowrap;
  background: rgba(16, 22, 40, .95); border: 1px solid var(--wx-line);
  box-shadow: var(--wx-shadow); font-size: 11.5px; color: var(--wx-text);
  font-variant-numeric: tabular-nums;
}
.wx-chart-tip b { font-weight: 700; }
.wx-chart-tip .t-ico { color: var(--wx-muted); }
.wx-chart-tip .t-hi { color: #ffb079; font-weight: 700; margin-left: 4px; }
.wx-chart-tip .t-lo { color: #8cc4ff; font-weight: 700; margin-left: 4px; }
.wx-chart-tip .t-today { color: #34d399; font-weight: 700; margin-left: 4px; }
.wx-chart-tip .t-pp { color: var(--wx-accent); margin-left: 4px; }
.wx-weather.wx-light .wx-chart-tip,
[data-theme="light"] .wx-weather .wx-chart-tip { background: #fff; }
.wx-cday.active { background: rgba(255, 255, 255, .07); }
.wx-weather.wx-light .wx-cday.active,
[data-theme="light"] .wx-weather .wx-cday.active { background: rgba(0, 0, 0, .05); }

/* Y 轴刻度：叠在折线左侧空白里，跟随数据 */
.wx-chart-axis {
  position: absolute; left: 0; top: 0; height: 190px; width: 4.4%;
  pointer-events: none; z-index: 1;
}
.wx-chart-axis span {
  position: absolute; right: 3px; transform: translateY(-50%);
  font-size: 10px; color: var(--wx-muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 右侧小结：极值/温差/雨日 */
.wx-ten-stats {
  flex: none; width: 128px; display: flex; flex-direction: column; justify-content: center;
  gap: 4px; border-left: 1px dashed var(--wx-line); padding-left: 12px;
}
.wx-ten-stats .ts-title {
  font-size: 11px; color: var(--wx-muted); letter-spacing: .5px; margin-bottom: 1px;
}
.wx-ten-stats span {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--wx-muted);
}
.wx-ten-stats b { font-size: 13px; color: var(--wx-text); font-variant-numeric: tabular-nums; }
.wx-ten-stats .s-hi { color: #ffb079; }
.wx-ten-stats .s-lo { color: #8cc4ff; }
/* 折线固定高度（preserveAspectRatio=none），高度与 viewBox 160 成比例，圆点才不会被拉扁 */
.wx-chart { display: block; width: 100%; height: 190px; }
/* 网格/分隔虚线用 currentColor，浅色主题下才看得见（RGB 写死在 SVG 里会隐没在白底上） */
.wx-chart { color: #fff; }
.wx-weather.wx-light .wx-chart,
[data-theme="light"] .wx-weather .wx-chart { color: #1f2a44; }

.wx-cdays {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0; margin-top: 1px;
  /* 列数与左右留白由 JS 写入（与折线绘图区同一套几何），保证日期列中心正对折线点位 */
  padding-left: 4.6%; padding-right: 1.2%;
}
/* 全天小时刻度：定位基准是绘图区（.wx-plot），left/width/top 由 JS 按折线几何写入 */
.wx-taxis { position: absolute; top: 0; pointer-events: none; }
.wx-taxis .ta-line {
  position: relative; display: block; width: 100%; height: 12px;
  border-top: 1px dashed var(--wx-line);
}
.wx-taxis .ta-line i {
  position: absolute; top: 0; transform: translateX(-50%); font-style: normal;
  font-size: 8.5px; line-height: 12px; color: var(--wx-muted); font-variant-numeric: tabular-nums;
}
.wx-taxis .ta-line i.now { color: #34d399; font-weight: 700; }

/* 「现在 09:00 · 27°」气泡 + 倒三角指针（尖端对准当前小时的点；HTML 层做，避免 SVG 缩放拉变形）
   JS 会按点位位置追加 .at-l / .at-r（贴住左右边缘）和 .below（点位靠上时翻到点下方） */
.wx-nowmark {
  position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center;
  pointer-events: none; transform: translate(-50%, calc(-100% - 2px));
}
.wx-nowmark.at-l { transform: translate(-5px, calc(-100% - 2px)); align-items: flex-start; }
.wx-nowmark.at-r { transform: translate(calc(-100% + 5px), calc(-100% - 2px)); align-items: flex-end; }
.wx-nowmark.below { transform: translate(-50%, 2px); flex-direction: column-reverse; }
.wx-nowmark.below.at-l { transform: translate(-5px, 2px); align-items: flex-start; }
.wx-nowmark.below.at-r { transform: translate(calc(-100% + 5px), 2px); align-items: flex-end; }
.wx-nowpin {
  width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 10px solid #34d399;
}
.wx-nowmark.below .wx-nowpin { border-top: 0; border-bottom: 10px solid #34d399; }
.wx-nowtag {
  pointer-events: none; white-space: nowrap; margin-bottom: 2px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #34d399; background: rgba(16, 22, 40, .92);
  border: 1px solid rgba(52, 211, 153, .45); font-variant-numeric: tabular-nums;
}
.wx-nowmark.below .wx-nowtag { margin-bottom: 0; margin-top: 2px; }
.wx-weather.wx-light .wx-nowtag,
[data-theme="light"] .wx-weather .wx-nowtag { background: #fff; }

/* 日期行：星期+日期 / 图标 + 高低温 + 降水 */
.wx-cday {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 1px; border-radius: 6px; text-align: center; min-width: 0;
}
.wx-cday:hover { background: rgba(255, 255, 255, .04); }
.wx-weather.wx-light .wx-cday:hover,
[data-theme="light"] .wx-weather .wx-cday:hover { background: rgba(0, 0, 0, .04); }
.wx-cday .c-name { font-size: 10.5px; color: var(--wx-text); white-space: nowrap; line-height: 1.35; }
.wx-cday .c-name em { font-style: normal; font-size: 9px; color: var(--wx-muted); }
.wx-cday .c-row {
  display: flex; align-items: center; gap: 2px; font-size: 11px;
  white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.35;
}
.wx-cday .c-hi { color: #ffb079; font-weight: 700; }
.wx-cday .c-lo { color: #8cc4ff; font-style: normal; }
.wx-cday .c-pp { font-style: normal; font-size: 9px; color: var(--wx-accent); }

/* ---------------- 当天逐时条（横向滚动单元格） ---------------- */
.wx-hours-wrap { display: flex; gap: 6px; align-items: flex-start; min-width: 0; }
.wx-hours-scroll { flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.wx-hours-inner { position: relative; display: flex; flex-direction: column; gap: 1px; }
/* 逐时悬浮：绿色竖直对齐线 + 浮层（与上面 10 天图同一套观感） */
.wx-hcursor {
  position: absolute; top: 0; bottom: 0; width: 1px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(52, 211, 153, .85), rgba(52, 211, 153, .2));
  box-shadow: 0 0 6px rgba(52, 211, 153, .3);
}
.wx-hcursor::before {
  content: ""; position: absolute; top: -2px; left: -2.5px; width: 6px; height: 6px;
  border-radius: 50%; background: #34d399;
}
.wx-htip {
  position: absolute; top: -2px; z-index: 3; pointer-events: none;
  padding: 3px 8px; border-radius: 7px; white-space: nowrap;
  background: rgba(16, 22, 40, .95); border: 1px solid var(--wx-line);
  box-shadow: var(--wx-shadow); font-size: 11.5px; color: var(--wx-text);
  font-variant-numeric: tabular-nums;
}
.wx-htip b { font-weight: 700; }
.wx-htip .t-ico { color: var(--wx-muted); }
.wx-htip .t-today { color: #34d399; font-weight: 700; margin-left: 4px; }
.wx-htip .t-pp { color: var(--wx-accent); margin-left: 4px; }
.wx-weather.wx-light .wx-htip,
[data-theme="light"] .wx-weather .wx-htip { background: #fff; }
.wx-hc.active { background: rgba(255, 255, 255, .07); }
.wx-weather.wx-light .wx-hc.active,
[data-theme="light"] .wx-weather .wx-hc.active { background: rgba(0, 0, 0, .05); }
.wx-hours-h { display: flex; gap: 4px; padding: 0; }
.wx-hc {
  flex: 1 1 0; min-width: 50px; display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: 2px 1px; border-radius: 8px; border: 1px solid transparent;
  line-height: 1.25;
}
.wx-hc:hover { background: rgba(255, 255, 255, .04); }
.wx-weather.wx-light .wx-hc:hover,
[data-theme="light"] .wx-weather .wx-hc:hover { background: rgba(0, 0, 0, .04); }
.wx-hc .hc-time { font-size: 9.5px; color: var(--wx-muted); font-variant-numeric: tabular-nums; }
.wx-hc .hc-mid { display: flex; align-items: center; gap: 3px; }
.wx-hc .hc-ico { font-size: 14px; }
.wx-hc .hc-pp { font-size: 9px; color: var(--wx-accent); }
.wx-hc .hc-t { font-size: 12px; font-weight: 700; color: var(--wx-text); font-variant-numeric: tabular-nums; }
.wx-hc.past { opacity: .55; }
.wx-hc.now { background: var(--wx-panel); border-color: var(--wx-accent); }
.wx-hc.now .hc-time { color: var(--wx-accent); font-weight: 700; }

/* ---------------- 状态文案 ---------------- */
.wx-err { font-size: 12.5px; color: var(--wx-pending); line-height: 1.6; }
.wx-err a { color: var(--wx-accent); }
.wx-loading { color: var(--wx-muted); font-size: 12.5px; padding: 6px 0; }

/* ---------------- 响应式 ---------------- */
/* 中窄屏 10 天列变窄，先收起降水概率，避免压字（悬浮提示与 title 里仍有） */
@media (max-width: 1100px) {
  .wx-weather .wx-cday .c-pp { display: none; }
}
@media (max-width: 980px) {
  .wx-weather .wx-panel { padding: 8px 8px 6px; }
  .wx-weather .wx-ten-stats { display: none; }      /* 窄屏隐藏右侧小结，图占满宽 */
  .wx-weather .wx-chart-wrap { max-width: none; }
  .wx-weather .wx-chart-axis { font-size: 8.5px; width: 4.6%; }
  .wx-weather .wx-chart-axis span { right: 1px; font-size: 8.5px; }
}
/* 手机窄屏：10 天列只有 ~29px，图标/日期/高低温横排必然互相压字 → 改为「周六 / 29° / 23°」三行 */
@media (max-width: 620px) {
  .wx-weather .wx-cday .c-name { font-size: 9.5px; white-space: nowrap; }
  .wx-weather .wx-cday .c-name em { display: none; }
  .wx-weather .wx-cday .c-row { flex-direction: column; gap: 0; line-height: 1.2; }
  .wx-weather .wx-cday .c-ico, .wx-weather .wx-cday .c-pp { display: none; }
  .wx-weather .wx-cday .c-hi, .wx-weather .wx-cday .c-lo { font-size: 10px; }
  /* 全天刻度每 3 小时一格，窄屏约 36px 间距仍可读 */
  .wx-weather .wx-taxis .ta-line i { font-size: 8px; }
  .wx-weather .wx-nowtag { font-size: 10px; padding: 1px 6px; }
}

/* ---------------- lulu 宿主适配 ---------------- */
.wx-host { width: 100%; margin: 0 0 16px; }
.wx-host .wx-weather { margin: 0; }
@media (max-width: 760px) {
  .wx-host { margin-bottom: 12px; }
}

/* 近三天角标（明天 / 后天 / 大后天） */
.wx-daymark{position:absolute;transform:translate(-50%,-100%);
  background:rgba(255,209,102,.95);color:#0a0f18;font-size:10px;font-weight:800;
  line-height:1.4;padding:2px 7px;border-radius:5px;white-space:nowrap;
  pointer-events:none;z-index:5;box-shadow:0 2px 8px rgba(0,0,0,.5)}
.wx-daymark::after{content:"";position:absolute;left:50%;top:100%;
  transform:translateX(-50%);border:4px solid transparent;
  border-top-color:rgba(255,209,102,.95)}

/* 「今天」角标：绿色，区别于明/后/大后天的亮黄 */
.wx-daymark.today{background:rgba(67,214,138,.95);color:#06251a}
.wx-daymark.today::after{border-top-color:rgba(67,214,138,.95)}
