/* 自制导航 · 样式层
 * 与 JS 的契约：只依赖 ui.js 输出的类名与 html[data-theme]。改观感只动本文件。
 */

:root {
  color-scheme: light; /* 原生控件跟随主题 */
  --bg: #f2f4f8;
  --fg: #1b1f27;
  --fg-dim: #5c6472;
  --card-bg: rgba(255, 255, 255, .55);
  --card-bg-hover: rgba(255, 255, 255, .78);
  --card-bg-solid: rgba(255, 255, 255, .92);
  --card-border: rgba(255, 255, 255, .65);
  --shadow: 0 4px 18px rgba(20, 25, 40, .10);
  --accent: #4a7cf7;
  --radius: 16px;
  --tm-bg: #d9dde6;
  --tm-ind-bg: rgba(255, 255, 255, .5);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161c;
  --fg: #e8ebf2;
  --fg-dim: #9aa3b4;
  --card-bg: rgba(30, 34, 44, .55);
  --card-bg-hover: rgba(42, 48, 60, .78);
  --card-bg-solid: rgba(26, 29, 37, .94);
  --card-border: rgba(255, 255, 255, .10);
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --accent: #6f96ff;
  --tm-bg: #0d0f14;
  --tm-ind-bg: rgba(255, 255, 255, .07);
}

* { box-sizing: border-box; }

/* tooltip 悬停可能伸出视口，不允许带出横向滚动条 */
html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: background-color .2s ease;
}

/* ---------- 背景层 ---------- */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--bg);
  transition: filter .3s ease;
}

/* 放大一点避免模糊后边缘露白 */
body.bg-blur #bg-layer {
  filter: blur(10px) saturate(115%);
  transform: scale(1.06);
}

/* 背景已整体模糊时，卡片/标签等再各自 backdrop-filter 是对模糊结果的重复采样，纯 GPU 浪费 */
body.bg-blur .site-card,
body.bg-blur .tab,
body.bg-blur .chip,
body.bg-blur .search,
body.bg-blur .wx-now,
body.bg-blur .wx-air,
body.bg-blur .wx-chart {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: flex-start;
  padding: 14px 18px;
}

.chip {
  min-width: 36px;
  padding: 6px 12px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}
.chip:hover { background: var(--card-bg-hover); }

.chip--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

/* ---------- 主体 ---------- */
.stage {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 18px 56px;
}

/* ---------- 搜索框 ---------- */
.search {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 24px auto 28px;
  padding: 6px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.engine-select {
  border: 0;
  background: transparent;
  color: var(--fg-dim);
  font-size: 14px;
  padding: 0 6px;
  outline: none;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 15px;
  outline: none;
}

.search-go {
  width: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 0 0 auto;
  padding: 7px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--fg-dim);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tab[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.grid--pinned {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 18px;
}

.site-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
  color: var(--fg);
  text-decoration: none;
  position: relative;
  transition: transform .15s ease, background-color .15s ease;
}

.site-card:hover {
  transform: translateY(-3px);
  background: var(--card-bg-hover);
}

.site-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.site-card--pinned .site-icon { width: 64px; height: 64px; }

.site-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 字母兜底：按 host 哈希的稳定渐变色 */
.site-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
  border-radius: 12px;
  background: linear-gradient(135deg,
              hsl(var(--tile-hue, 220) 68% 56%),
              hsl(var(--tile-hue2, 250) 72% 44%));
  color: #fff;
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28),
              0 2px 6px rgba(0, 0, 0, .18);
}

.site-tile__char {
  font-size: 17px;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
}

.site-card--pinned .site-tile__char { font-size: 26px; }

/* 域名小字仅 64px 大图标有空间显示 */
.site-tile__sub {
  display: none;
  max-width: 100%;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .2px;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-card--pinned .site-tile__sub { display: block; }

.site-name {
  max-width: 100%;
  font-size: 13px;
  color: var(--fg);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 站点说明 tooltip：悬停/聚焦时浮于卡片上方 */
.site-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  /* 必须显式给宽：绝对定位默认收缩，会导致文字竖排成一长条 */
  width: max-content;
  max-width: min(220px, 70vw);
  padding: 6px 10px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg-solid);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
  display: none;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  /* 旧浏览器不认 allow-discrete 会丢弃整条简写，故先写基础过渡再覆盖 */
  transition: opacity .15s ease, transform .15s ease;
  transition: opacity .15s ease, transform .15s ease, display .15s allow-discrete;
  z-index: 5;
}

.site-card:hover .site-tip,
.site-card:focus-within .site-tip {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* display 翻转时的过渡起点；不支持时退化为直接显隐 */
@starting-style {
  .site-card:hover .site-tip,
  .site-card:focus-within .site-tip {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }
}

.empty {
  grid-column: 1 / -1;
  color: var(--fg-dim);
  font-size: 14px;
}

.error {
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid #e05263;
  border-radius: 12px;
  background: rgba(224, 82, 99, .12);
  color: #e05263;
  font-size: 14px;
}

/* ---------- 设置浮窗 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  background: rgba(10, 12, 18, .45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.overlay[hidden] { display: none; }

.panel {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: var(--card-bg-solid);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
}

.panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 16px;
  overflow-y: auto;
}

.field { display: flex; flex-direction: column; gap: 10px; }

.field--row { flex-direction: row; align-items: center; justify-content: space-between; }

.field-label { font-size: 13px; color: var(--fg-dim); }

.bg-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.bg-thumb {
  height: 56px;
  border: 2px solid transparent;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--card-border);
  cursor: pointer;
}

.bg-thumb[aria-current="true"] { border-color: var(--accent); }

.bg-hint { margin: 0; color: var(--fg-dim); font-size: 13px; }

/* 开关 */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--card-border);
  transition: background-color .18s ease;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s ease;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 主题分段控件 */
.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
}

.seg-item {
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 13px;
  cursor: pointer;
}

.seg-item[aria-pressed="true"] { background: var(--accent); color: #fff; }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--card-border);
}

.panel-hint { font-size: 12px; color: var(--fg-dim); }

.btn {
  padding: 8px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}

.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* 自定义控件默认没有 UA 焦点环，玻璃底上几乎看不见，键盘用户需要显式焦点 */
.tab:focus-visible,
.dot:focus-visible,
.chip:focus-visible,
.search-go:focus-visible,
.bg-thumb:focus-visible,
.seg-item:focus-visible,
.btn:focus-visible,
.site-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 分页 deck ----------
 * 基线（手机 / 触屏）：.deck 与 .page 都是普通文档流，行为与单页时代一致。
 * 桌面端的 fixed + transform 布局见文末媒体查询。 */
.deck { display: block; }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page__scroll { flex: 1 1 auto; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 18px;
}

.page-title { margin: 0; font-size: 16px; font-weight: 600; }

.page-meta { font-size: 12px; color: var(--fg-dim); white-space: nowrap; }

/* 提示的是滚轮翻页，触屏上不存在该手势 */
.page-hint { display: none; font-size: 12px; color: var(--fg-dim); }

.dots {
  position: fixed;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 30;
}

.dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 1px solid var(--fg-dim);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.dot[aria-current="true"] { border-color: var(--accent); background: var(--accent); }
.dot:hover { border-color: var(--accent); }

/* ---------- 第 2 页 · 大盘云图 ---------- */
.tabs--dim { margin: 0; padding: 0; }
.tabs--dim .tab { padding: 5px 12px; font-size: 13px; }

.legend {
  display: flex;
  /* 不许压缩：色块一旦被压扁，9 档刻度文字会叠到右侧的时间戳上 */
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.4;
}

.legend-band {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 2px 4px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}

.tm {
  position: relative;
  flex: 1 1 auto;
  min-height: 68vh;
  margin: 0 18px 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--tm-bg);
  overflow: hidden;
}

.tm-layer { position: absolute; inset: 0; }

.tm-ind,
.tm-grp,
.tm-leaf {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.tm-ind { border-radius: 10px; background: var(--tm-ind-bg); }

.tm-ind__bar,
.tm-grp__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0 7px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-ind__bar { font-size: 12px; font-weight: 600; }
.tm-grp__bar { font-size: 11px; color: var(--fg-dim); }

.tm-leaf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .45);
  cursor: default;
}

.tm-leaf__n, .tm-leaf__v {
  max-width: 100%;
  padding: 0 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tm-leaf__n { font-size: 11px; line-height: 1.2; }
.tm-leaf__v { font-size: 10px; line-height: 1.2; opacity: .92; }

/* 文字按格子尺寸分级显隐：小格子只上色不排字，避免整页糊成噪点 */
.tm-leaf__n, .tm-leaf__v { display: none; }
.tm-leaf--named .tm-leaf__n { display: block; }
.tm-leaf--named.tm-leaf--valued .tm-leaf__n { font-size: 12px; }
.tm-leaf--valued .tm-leaf__v { display: block; }

.tm-leaf:hover { outline: 2px solid #fff; outline-offset: -2px; }

.tm-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--fg-dim);
  font-size: 14px;
}

.tm-tip {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg-solid);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 6;
}

.tm-tip[hidden] { display: none; }
.tm-tip__title { font-weight: 700; }

/* ---------- 第 3 页 · 天气 ---------- */
/* 城市标签：名称 + 当前温度角标，一眼并览三城（复用 .tab 体系） */
.tabs--city { margin: 0; padding: 0; }
.tabs--city .tab {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  font-size: 13px;
}

.tab__wx {
  font-size: 11px;
  opacity: .75;
  font-variant-numeric: tabular-nums;
}
.tab[aria-current="true"] .tab__wx { opacity: .9; }

.wx {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  margin: 0 18px 18px;
}

.wx-status { margin: 0; padding: 20px 4px; color: var(--fg-dim); font-size: 14px; }

.wx-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1.1fr) minmax(190px, .9fr);
  gap: 14px;
  align-content: start;
}

/* 天气分组只驱动一条侧栏强调色，卡片本体仍是统一玻璃底 */
.wx--clear { --wx-accent: #e8a33d; }
.wx--cloud { --wx-accent: #8f9bb0; }
.wx--fog, .wx--drizzle { --wx-accent: #7fa8c9; }
.wx--rain, .wx--showers { --wx-accent: var(--accent); }
.wx--snow { --wx-accent: #9fd8ef; }
.wx--thunder { --wx-accent: #7d4ea8; }

.wx-now, .wx-air {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px 18px 24px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wx-now::before, .wx-air::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--wx-accent, var(--accent));
}
.wx-air::before { background: var(--aqi, var(--wx-accent, var(--accent))); }

.wx-now__temp { font-size: 54px; line-height: 1.05; font-weight: 700; }
.wx-now__cond { font-size: 16px; color: var(--fg-dim); }

.wx-facts {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 10px;
  margin: 10px 0 0;
  font-size: 13px;
}
.wx-facts__k { color: var(--fg-dim); }
.wx-facts__v { text-align: right; font-variant-numeric: tabular-nums; }

.wx-air { justify-content: center; }
.wx-air__num { font-size: 42px; line-height: 1.05; font-weight: 700; color: var(--aqi); }
.wx-air__band { font-size: 15px; color: var(--aqi); }
.wx-air__sub { margin-top: 6px; font-size: 12px; color: var(--fg-dim); }

.aqi--good { --aqi: #2e9e5b; }
.aqi--moderate { --aqi: #c08a1e; }
.aqi--usg { --aqi: #d9772a; }
.aqi--unhealthy { --aqi: #c8403f; }
.aqi--very { --aqi: #7d4ea8; }
.aqi--hazardous { --aqi: #8c3a4a; }

/* ---------- 七日温度柱状图 ---------- */
.wx-chart {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.wx-chart__bars {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 120px;
  position: relative;
}

.wx-chart__col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  height: 100%;
  position: relative;
}

.wx-chart__max,
.wx-chart__min {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wx-chart__max { margin-bottom: 3px; }
.wx-chart__min { margin-top: 3px; color: var(--fg-dim); }

.wx-chart__bar {
  width: 70%;
  max-width: 36px;
  min-height: 8px;
  border-radius: 6px;
  background: var(--wx-accent, var(--accent));
  transition: height .3s ease, bottom .3s ease;
}

.wx-chart__labels {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.wx-chart__label {
  flex: 1 1 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wx-chart__day { font-size: 12px; font-weight: 600; }
.wx-chart__cond { font-size: 11px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-chart__rain { font-size: 10px; color: var(--wx-accent, var(--accent)); opacity: .85; }

/* ---------- 第 4 页 · 台风嵌入 ---------- */
.embed {
  flex: 1 1 auto;
  min-height: 78vh;
  margin: 0 18px 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg-solid);
  overflow: hidden;
}

.embed-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .stage { padding: 16px 12px 48px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .grid--pinned { grid-template-columns: repeat(3, 1fr); }
  .site-card { padding: 12px 8px; }
  .site-card--pinned .site-icon { width: 52px; height: 52px; }
  .overlay { padding: 4vh 12px 12px; }
  .panel { max-height: 88vh; }
  .wx { margin: 0 12px 12px; }
  .wx-grid { grid-template-columns: 1fr; }
  .wx-now, .wx-air { grid-column: 1; }
  .wx-now__temp { font-size: 44px; }
  .wx-chart__bars { height: 90px; }
  .wx-chart__max, .wx-chart__min { font-size: 10px; }
  .wx-chart__day { font-size: 11px; }
  .wx-chart__cond { font-size: 10px; }
}

/* 桌面端才启用整页翻页。该条件与 js/deck.js 的 DESKTOP 字符串是同一份契约，改一处必须改两处；
 * 用 hover/pointer 特性而不是纯宽度，是为了把「窄窗口桌面浏览器」与「横屏平板」区分开。 */
@media (min-width: 861px) and (hover: hover) and (pointer: fine) {
  html, body { height: 100%; }
  body { overflow: hidden; }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    /* 齿轮以外的区域不吃滚轮，否则那条横带会挡住整页翻页 */
    pointer-events: none;
  }
  .topbar .chip { pointer-events: auto; }

  .deck {
    position: fixed;
    inset: 0;
    transition: transform .52s cubic-bezier(.4, 0, .2, 1);
  }
  .deck--instant { transition: none; }

  .page { height: 100vh; min-height: 0; overflow: hidden; }

  /* 内容超高时页内自滚，滚到底才由 deck 翻页 */
  .page__scroll { overflow-y: auto; overscroll-behavior: contain; }

  .page-head { padding-left: 62px; }  /* 让开左上角齿轮 */
  .page-meta { margin-left: auto; }    /* 桌面端行内有空间，更新时间靠右；窄屏靠换行自然排布 */
  .page-hint { display: inline; }
  .dots { display: flex; }

  .tm, .embed { min-height: 0; }

  /* 天气卡较多时页内自滚，滚到底才翻页（FR-11.5） */
  .wx { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

  /* 右侧留一条给翻页圆点的通道：否则圆点会压在云图右缘和台风网自带的工具条上 */
  .page--market .tm,
  .page--weather .wx,
  .page--typhoon .embed { margin-right: 34px; }
}

/* 不支持 backdrop-filter 时降级为半透明纯色，保证可读性 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-card, .tab, .chip, .search,
  .wx-now, .wx-air, .wx-chart { background: var(--card-bg-hover); }
  .panel { background: var(--card-bg-solid); }
}
