*, *::before, *::after { box-sizing: border-box; }

/* 浏览器给 [hidden] 的 display:none 只是默认样式，会被作者写的 display:flex 盖掉
   （判定卡摘要、搜索框清空按钮都踩过这个坑），这里显式补回来 */
[hidden] { display: none !important; }

:root {
  --bg: #EDF2F9;
  --card: #FFFFFF;
  --card-soft: #F7F9FC;
  --text: #0E1726;
  --text-2: #5C6B80;
  --text-3: #93A1B5;
  --line: rgba(14, 23, 38, .07);
  --line-2: rgba(14, 23, 38, .13);
  --blue: #2B6CD4;
  --blue-deep: #1D4ED8;
  --blue-ink: #1B3A6B;
  --blue-wash: #EAF2FE;
  --green: #0E9F6E;
  --green-wash: #E9F7F1;
  --shadow: 0 1px 1px rgba(14, 23, 38, .03), 0 10px 26px -16px rgba(14, 23, 38, .22);
  --glow: rgba(120, 168, 240, .34);
  /* 降水色阶：越深雨越大（浅色主题下由浅到深） */
  --bar-1: #D3E3F7;
  --bar-2: #AECDEF;
  --bar-3: #7BA6E3;
  --bar-4: #4278CE;
  --bar-5: #1D4ED8;
  --r: 18px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", -apple-system, BlinkMacSystemFont,
          "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html[data-night="true"] {
  --bg: #070C14;
  --card: #121A26;
  --card-soft: #18222F;
  --text: #EAF0F8;
  --text-2: #93A3B8;
  --text-3: #6B7B91;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --blue: #5B95E8;
  --blue-deep: #2E63C8;
  --blue-ink: #BBD4F7;
  --blue-wash: rgba(91, 149, 232, .14);
  --green: #34C08A;
  --green-wash: rgba(52, 192, 138, .12);
  --shadow: 0 1px 1px rgba(0, 0, 0, .35), 0 14px 30px -20px rgba(0, 0, 0, .9);
  --glow: rgba(38, 74, 148, .48);
  /* 深色底上反过来：越亮雨越大 */
  --bar-1: #243349;
  --bar-2: #2F4B76;
  --bar-3: #4A7CC4;
  --bar-4: #6BA3EE;
  --bar-5: #A8CCFA;
}

html[data-wet="true"] { --glow: rgba(88, 138, 224, .46); }
html[data-night="true"][data-wet="true"] { --glow: rgba(30, 62, 136, .58); }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background .6s ease;
}

body.locked { overflow: hidden; }

.sky { position: absolute; inset: 0 0 auto 0; height: 520px; overflow: hidden; pointer-events: none; z-index: 0; }
.sky-glow {
  position: absolute; left: -30%; right: -30%; top: -190px; height: 580px;
  background: radial-gradient(48% 48% at 50% 50%, var(--glow) 0%, rgba(0, 0, 0, 0) 70%);
  transition: background .6s ease;
}

.shell {
  position: relative; z-index: 1;
  max-width: 460px; margin: 0 auto;
  /* 底部留出固定 Tab 栏的高度 */
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(86px + env(safe-area-inset-bottom));
}

/* ---------- 分页 ---------- */

.page { display: block; }
.page.in-r { animation: pageInR .26s cubic-bezier(.2, .8, .3, 1); }
.page.in-l { animation: pageInL .26s cubic-bezier(.2, .8, .3, 1); }
@keyframes pageInR { from { opacity: 0; transform: translateX(15px); } to { opacity: 1; transform: none; } }
@keyframes pageInL { from { opacity: 0; transform: translateX(-15px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .page.in-r, .page.in-l { animation: none; }
}

/* ---------- top bar ---------- */

.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

.place {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 0; padding: 6px 4px 6px 2px;
  color: var(--text); font-family: inherit; font-size: 16px; font-weight: 500;
  cursor: pointer; border-radius: 10px; text-align: left;
}
.place-pin { color: var(--blue); display: flex; flex: none; }
.place-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-sub { font-size: 12px; font-weight: 400; color: var(--text-3); white-space: nowrap; flex: none; }
.place-sub:empty { display: none; }
.place-chev { color: var(--text-3); display: flex; flex: none; margin-left: 1px; }
.place:active { opacity: .55; }

.iconbtn {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .2s, color .2s;
}
.iconbtn:active { background: var(--line); }
.iconbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stamp { margin: 0 0 2px 2px; font-size: 12px; color: var(--text-3); }

/* ---------- current ---------- */

.now { padding: 10px 2px 18px; }
.now-row { display: flex; align-items: center; gap: 12px; }
.now-icon { width: 56px; height: 56px; flex: none; color: var(--text-2); }
.now-icon svg { width: 100%; height: 100%; display: block; }
.now-temp {
  font-size: 54px; font-weight: 300; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums; display: flex; align-items: flex-start;
}
.now-temp i { font-style: normal; font-size: 26px; font-weight: 300; margin-top: 5px; color: var(--text-3); }
.now-desc { margin: 8px 0 0; font-size: 15px; color: var(--text-2); }

.now-meta {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; gap: 20px; flex-wrap: wrap;
}
.now-meta li { display: flex; align-items: baseline; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.now-meta b { font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- verdict ---------- */

.verdict {
  border-radius: 20px; padding: 18px 18px 16px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: background .45s ease, color .45s ease, border-color .45s ease;
}
.verdict-inner { display: flex; align-items: flex-start; gap: 14px; }
.verdict-badge { width: 42px; height: 42px; flex: none; }
.verdict-badge svg { width: 100%; height: 100%; display: block; }
.verdict-text { min-width: 0; padding-top: 1px; }
.verdict-title {
  margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25;
}
.verdict-reason { margin: 5px 0 0; font-size: 13.5px; line-height: 1.55; opacity: .82; }

.verdict-chip {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 16%, transparent);
  font-size: 12.5px; display: flex; align-items: center; gap: 7px; opacity: .85;
}
.verdict-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}

.verdict[data-level="strong"] {
  background: linear-gradient(158deg, #2563EB 0%, #1D4ED8 62%, #1A3FAE 100%);
  border-color: transparent; color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(29, 78, 216, .18), 0 16px 34px -18px rgba(29, 78, 216, .7);
}
.verdict[data-level="strong"] .verdict-reason { opacity: .88; }
.verdict[data-level="strong"] .verdict-chip { color: #D9E6FF; }

.verdict[data-level="mid"] {
  background: var(--blue-wash); border-color: color-mix(in srgb, var(--blue) 22%, transparent);
  color: var(--blue-ink); box-shadow: none;
}
.verdict[data-level="mid"] .verdict-chip { color: var(--blue-ink); }

.verdict[data-level="soft"] { background: var(--card-soft); color: var(--text); box-shadow: none; }
.verdict[data-level="soft"] .verdict-reason { color: var(--text-2); opacity: 1; }
.verdict[data-level="soft"] .verdict-badge { color: var(--text-3); }
.verdict[data-level="soft"] .verdict-chip { color: var(--text-3); }

.verdict[data-level="none"] {
  background: var(--green-wash); border-color: color-mix(in srgb, var(--green) 20%, transparent);
  color: var(--text); box-shadow: none;
}
.verdict[data-level="none"] .verdict-badge { color: var(--green); }
.verdict[data-level="none"] .verdict-reason { color: var(--text-2); opacity: 1; }
.verdict[data-level="none"] .verdict-chip { color: var(--text-3); }

.verdict[data-level="idle"] { background: var(--card-soft); box-shadow: none; }
.verdict[data-level="idle"] .verdict-badge { color: var(--text-3); }
.verdict[data-level="idle"] .verdict-reason { color: var(--text-3); opacity: 1; }

/* ---------- cards ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 15px 13px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-2); letter-spacing: .01em; }
.card-hint { font-size: 11.5px; color: var(--text-3); flex: none; }

/* ---------- 出门时段 ---------- */

.go-chips { display: flex; gap: 7px; margin-bottom: 12px; }
.go-chip {
  flex: 1 1 0; min-width: 0;
  padding: 8px 6px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--card-soft);
  font-family: inherit; font-size: 12.5px; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.go-chip:active { transform: scale(.97); }
.go-chip[aria-pressed="true"] {
  background: var(--blue-wash); border-color: color-mix(in srgb, var(--blue) 42%, transparent);
  color: var(--blue); font-weight: 500;
}
html[data-night="true"] .go-chip[aria-pressed="true"] { color: var(--blue-ink); }

.plan {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 13px; border-radius: 14px;
  background: var(--card-soft); border: 1px solid var(--line);
  transition: background .35s ease, border-color .35s ease;
}
.plan-badge { width: 21px; height: 21px; flex: none; margin-top: 2px; color: var(--text-3); }
.plan-badge svg { width: 100%; height: 100%; display: block; }
.plan-body { min-width: 0; flex: 1; }
.plan-line { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-line b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.plan-win { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.plan-note { margin: 4px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }

.plan[data-level="strong"] {
  background: var(--blue-wash); border-color: color-mix(in srgb, var(--blue) 24%, transparent);
}
.plan[data-level="strong"] .plan-badge { color: var(--blue); }
.plan[data-level="strong"] .plan-line b { color: var(--blue-deep); }
html[data-night="true"] .plan[data-level="strong"] .plan-line b { color: var(--blue-ink); }

.plan[data-level="mid"] .plan-badge { color: var(--blue); }

.plan[data-level="none"] {
  background: var(--green-wash); border-color: color-mix(in srgb, var(--green) 20%, transparent);
}
.plan[data-level="none"] .plan-badge { color: var(--green); }

/* ---------- 24h chart ---------- */

.chart { position: relative; height: 108px; margin-top: 2px; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid span { height: 0; border-top: 1px dashed var(--line-2); }
.chart-bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; }
.bar { height: 100%; display: flex; align-items: flex-end; cursor: pointer; }
.bar i {
  display: block; width: 100%; border-radius: 3px 3px 2px 2px;
  background: var(--blue); transition: height .5s cubic-bezier(.3, .8, .3, 1), opacity .2s;
  min-height: 3px;
}
.bar.p0 i { background: var(--line-2); }
.bar.active i { opacity: 1; }
.bar:not(.active) i { opacity: .92; }

.chart-axis { display: flex; justify-content: space-between; margin-top: 7px; }
.chart-axis span { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-note { margin: 9px 0 0; font-size: 12px; color: var(--text-3); min-height: 18px; }
.chart-note b { color: var(--blue); font-weight: 500; }

/* ---------- daily ---------- */

.daily { list-style: none; margin: 0; padding: 0; }
.daily li {
  display: grid; grid-template-columns: 44px 22px 28px 1fr 28px 56px;
  align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line);
}
.daily li:first-child { border-top: 0; padding-top: 2px; }
.daily .d-name { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.daily li.today .d-name { color: var(--text); font-weight: 500; }
.daily .d-icon { width: 22px; height: 22px; color: var(--text-2); }
.daily .d-icon svg { width: 100%; height: 100%; display: block; }
.daily .d-lo, .daily .d-hi { font-size: 13px; font-variant-numeric: tabular-nums; }
.daily .d-lo { color: var(--text-3); text-align: right; }
.daily .d-hi { color: var(--text); text-align: right; font-weight: 500; }
.daily .d-track { position: relative; height: 5px; border-radius: 3px; background: var(--line); }
.daily .d-span { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, #7FB2EC, #E0A34A); }
html[data-night="true"] .daily .d-span { background: linear-gradient(90deg, #4D7FC4, #C08A38); }
.daily .d-pop {
  font-size: 12px; text-align: right; color: var(--text-3);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.daily .d-pop i { display: block; font-style: normal; font-size: 10.5px; color: var(--text-3); }
.daily .d-pop.wet { color: var(--blue); font-weight: 500; }
.daily .d-pop.wet i { font-weight: 400; opacity: .82; }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--line);
}
.tabbar-inner { max-width: 460px; margin: 0 auto; display: flex; gap: 6px; }

.tab {
  flex: 1; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px 6px; border: 0; border-radius: 13px;
  background: transparent; color: var(--text-3);
  font-family: inherit; cursor: pointer;
  transition: color .22s ease, background .22s ease;
}
.tab:active { transform: scale(.97); }
.tab-ico { display: flex; }
.tab-ico svg { width: 21px; height: 21px; display: block; }
.tab-txt { font-size: 11px; line-height: 1.2; }
.tab[aria-current="page"] { color: var(--blue); background: var(--blue-wash); }
.tab[aria-current="page"] .tab-txt { font-weight: 500; }
html[data-night="true"] .tab[aria-current="page"] { color: var(--blue-ink); }

/* ---------- footer ---------- */

.foot { padding: 8px 4px 0; }
.foot p { margin: 0; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.foot-tip { margin-top: 3px; }

/* ---------- sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 50; visibility: hidden; opacity: 0; transition: opacity .26s ease, visibility .26s; }
.sheet.open { visibility: visible; opacity: 1; }
.sheet-mask { position: absolute; inset: 0; background: rgba(8, 14, 26, .42); backdrop-filter: blur(2px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 460px; margin: 0 auto;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(14px); transition: transform .3s cubic-bezier(.2, .8, .3, 1);
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 -12px 40px -20px rgba(8, 14, 26, .5);
}
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px auto 12px; }

.sheet-search {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: var(--card-soft); border: 1px solid var(--line); border-radius: 12px; color: var(--text-3);
}
.sheet-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: 15px; color: var(--text);
}
.sheet-search input::placeholder { color: var(--text-3); }
.sheet-clear { border: 0; background: transparent; color: var(--text-3); display: flex; padding: 2px; cursor: pointer; }

.sheet-body { overflow-y: auto; overscroll-behavior: contain; margin-top: 6px; flex: 1; }
.sheet-block h3 {
  margin: 14px 0 6px; font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: .02em;
}
.place-list { list-style: none; margin: 0; padding: 0; }
.place-list li {
  display: flex; align-items: center; gap: 10px; padding: 11px 4px;
  border-top: 1px solid var(--line); cursor: pointer; font-size: 15px;
}
.place-list li:first-child { border-top: 0; }
.place-list li:active { opacity: .55; }
.place-list .p-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-list .p-region { font-size: 12.5px; color: var(--text-3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-list .p-cur { font-size: 11.5px; color: var(--blue); flex: none; }
.place-list .p-star {
  flex: none; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  padding: 4px; display: flex; border-radius: 6px;
  transition: color .18s ease, transform .18s ease;
}
.place-list .p-star.on { color: #E9A23B; }
.place-list .p-star.on svg { fill: currentColor; }
.place-list .p-star:active { background: var(--line); transform: scale(.88); }
html[data-night="true"] .place-list .p-star.on { color: #F0B75A; }
.place-empty { padding: 14px 4px; font-size: 13.5px; line-height: 1.5; color: var(--text-3); }
.sheet-credit { margin: 16px 0 2px; font-size: 11px; line-height: 1.5; text-align: center; color: var(--text-3); }

.locate {
  flex: none; margin-top: 12px; width: 100%; padding: 12px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); border-radius: 12px; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.locate:active { background: var(--card-soft); }

@media (min-width: 520px) {
  .shell { padding-top: 28px; padding-bottom: 96px; }
  .sheet-panel { border-radius: 22px; bottom: 24px; }
}
