/* 小榄三角梅 · 天气养护台 —— 设计系统：夜色玻璃 + 天气自适应画面 */

:root {
  --glass-bg: rgba(13, 17, 26, 0.46);
  --glass-bd: rgba(255, 255, 255, 0.14);
  --glass-blur: 20px;
  --txt: #eef3f8;
  --txt-dim: rgba(238, 243, 248, 0.68);
  --txt-faint: rgba(238, 243, 248, 0.42);
  --pri-high: #ff5d6c;
  --pri-mid: #ff8c1a;
  --pri-low: #3ecf8e;
  --gold: #ffd166;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--txt);
  background: #0a0e18;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(5, 8, 14, 0.55) 100%);
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 16px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.hidden { display: none !important; }

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; }
.brand-sub { font-size: 12px; font-weight: 400; color: var(--txt-dim); margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.meta { font-size: 12px; color: var(--txt-dim); }
.badge {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-bd);
  background: rgba(255, 255, 255, 0.08);
}
.icon-btn {
  border: 1px solid var(--glass-bd);
  background: rgba(255, 255, 255, 0.08);
  color: var(--txt);
  border-radius: 12px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); transform: scale(1.06); }

/* ── 预警横幅 ── */
.alert-banner {
  padding: 12px 16px;
  background: rgba(255, 77, 94, 0.18);
  border-color: rgba(255, 93, 108, 0.55);
}
.alert-title { font-weight: 600; color: #ff8d99; font-size: 14px; }
.alert-desc { font-size: 13px; color: var(--txt-dim); margin-top: 2px; }

/* ── 主卡 ── */
.hero { padding: 22px 22px 18px; }
.hero-main { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.temp {
  font-size: clamp(64px, 15vw, 118px);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
}
.hero-side { padding-bottom: 8px; display: flex; flex-direction: column; gap: 5px; }
.hero-date { font-size: 13px; color: var(--txt-dim); letter-spacing: 0.03em; }
.cond-text { font-size: 24px; font-weight: 600; }
.cond-sub { font-size: 15px; font-weight: 500; color: var(--txt); max-width: 520px; line-height: 1.55; }
.cond-range { font-size: 14px; color: var(--txt-dim); font-variant-numeric: tabular-nums; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.chip {
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-bd);
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.chip .k { color: var(--txt-faint); font-size: 11px; }
.chip .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.bad .v { color: var(--gold); }

/* ── 逐时降雨 ── */
.hourly-wrap { margin-top: 18px; }
.section-title { font-size: 12px; color: var(--txt-faint); letter-spacing: 0.08em; margin-bottom: 8px; }
.hourly { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-bottom: 16px; }
.hbar {
  flex: 1;
  min-width: 3px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(to top, rgba(90, 140, 255, 0.28), rgba(120, 170, 255, 0.55));
  position: relative;
  transition: height 0.6s ease;
}
.hbar.now { background: linear-gradient(to top, rgba(90, 140, 255, 0.55), rgba(190, 220, 255, 0.95)); }
.hbar.warn { background: linear-gradient(to top, rgba(190, 90, 255, 0.5), rgba(220, 170, 255, 0.9)); }
.hbar .hl {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--txt-faint);
  white-space: nowrap;
}
.hourly-note { margin-top: 6px; font-size: 13px; color: var(--txt-dim); min-height: 18px; }

/* ── 未来几天 ── */
.future-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 8px;
  scrollbar-width: thin;
}
.fday {
  flex: 1;
  min-width: 132px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 1px solid var(--glass-bd);
}
.fday:first-child { border-left: none; }
.fday .fd-name { font-size: 12px; color: var(--txt-dim); }
.fday .fd-icon { font-size: 22px; }
.fday .fd-temp { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fday .fd-sub { font-size: 11px; color: var(--txt-faint); }

/* ── 养护卡片 ── */
.advice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.advice-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.advice-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--pc, var(--pri-low));
  border-radius: 0 4px 4px 0;
}
.ac-head { display: flex; align-items: center; gap: 10px; }
.ac-icon { font-size: 20px; }
.ac-title { font-size: 16px; font-weight: 600; }
.ac-pill {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--pc, var(--pri-low));
  color: var(--pc, var(--pri-low));
  background: color-mix(in srgb, var(--pc, var(--pri-low)) 14%, transparent);
  font-weight: 600;
}
.ac-phase { font-size: 11px; color: var(--txt-faint); }
.ac-stars { color: var(--gold); font-size: 13px; letter-spacing: 2px; }
.ac-op { font-size: 14px; line-height: 1.65; }
.ac-detail { font-size: 12px; color: var(--txt-dim); line-height: 1.65; }
.advice-card { animation: rise 0.45s both; animation-delay: calc(var(--i, 0) * 50ms); }
.advice-card.skel {
  min-height: 110px;
  background: rgba(255, 255, 255, 0.05);
  animation: skelpulse 1.6s ease-in-out infinite;
}
@keyframes skelpulse {
  0%, 100% { background: rgba(255, 255, 255, 0.05); }
  50% { background: rgba(255, 255, 255, 0.11); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 页脚 ── */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--txt-faint);
  flex-wrap: wrap;
}
.foot-right { display: flex; align-items: center; gap: 10px; }
.demo-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-dim); }
select {
  background: rgba(255, 255, 255, 0.08);
  color: var(--txt);
  border: 1px solid var(--glass-bd);
  border-radius: 12px;
  padding: 5px 8px;
  font-size: 12px;
}
select option { color: #111; }

/* ── 演示模式横幅 ── */
.demo-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(255, 176, 32, 0.2);
  border: 1px solid rgba(255, 176, 32, 0.6);
  color: #ffd58a;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .hbar { transition: none; }
}

@media (max-width: 560px) {
  .shell { padding: 10px 10px calc(20px + env(safe-area-inset-bottom)); gap: 10px; }
  .advice-grid { grid-template-columns: 1fr; }
  .hero { padding: 18px 16px 14px; }
  .hourly { gap: 2px; }
  .hbar .hl { display: block; font-size: 8px; }
  .future-strip { gap: 2px; }
}
