/* ============================================================
   覆冰监测系统 · 网页版自适应布局
   ────────────────────────────────────────────────────────────
   app.css 是 build_css.py 的生成物，负责手机端基线；本文件只在
   更宽的屏上叠加断点，不改任何手机端规则：
     ≤767px    单列 430px，底部固定 tabBar  —— 与手机端完全一致
     ≥768px    单列，容器上限放宽到 720px（tabBar 同步对齐）
     ≥1024px   容器上限 1280px；tabBar 移为顶部横向导航；
               首页左列（状态/测量）右列（照片入口等）两列并排
   纯 CSS，不碰 app.js；历史页 canvas 的重画沿用 app.js 里的 resize 监听。
   ============================================================ */

/* ── 平板：单列，容器放宽到 720px ── */
@media (min-width: 768px) {
  .page { max-width: 720px; }
  .tabbar { max-width: 720px; }
}

/* ── 桌面：1280px 两列 + 顶部横向导航 ── */
@media (min-width: 1024px) {

  .page {
    max-width: 1280px;
    padding-top: 64px;      /* 顶部导航占位（下面不再有底部 tabBar） */
    padding-bottom: 40px;
  }

  /* tabBar：底部固定横条 -> 顶部横向导航。
     仍然是同一批 .tabbar-item，app.js 的事件绑定不受影响 */
  .tabbar {
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    justify-content: center;
    border-top: none;
    border-bottom: 1px solid var(--tab-border);
    padding-bottom: 0;
  }
  .tabbar-item {
    flex: 0 0 auto;
    padding: 18px 34px;
    font-size: 14px;
    letter-spacing: 2px;
  }
  /* 顶栏下沿的发光细线，和面板保持同一套冰川语汇 */
  .tabbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg,
      transparent 0%, var(--accent-dim) 30%, var(--accent) 50%,
      var(--accent-dim) 70%, transparent 100%);
    opacity: 0.5;
  }

  /* 首页两列：.idx-col-main = 状态卡 + 仪表 + 气象/力学/评估；
     .idx-col-side = 照片入口、备案信息等其余内容。
     页头与离线横幅横跨整行，不参与分列 */
  #view-index.active {
    display: grid;
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);   /* 黄金分割：主列 61.8% */
    column-gap: 10px;
    align-items: start;
  }
  #view-index .idx-head,
  #view-index .offline-banner {
    grid-column: 1 / -1;
  }
  #view-index .idx-col-main { grid-column: 1 / 2; }
  #view-index .idx-col-side { grid-column: 2 / 3; }

  /* 宽屏下指标行不必再挤成 20px 字号，留一点呼吸 */
  .metric-tile { padding: 14px 4px; }
  .section-header { padding-top: 18px; }
}

/* ── 调试页（#view-debug）的桌面规则已移到文件末尾「调试页 v2」一节 ── */
/*    原来的 mono 两列 .dbg-grid / .db-f-input 宽度 / .dbg-warn 字号随页面重构一并重写 */

/* ── 首页右列补白：快捷入口 #ix-quick + 系统信息 #ix-sysinfo ──
   标记里写死 display:none，保证手机/平板零变化；只在 ≥1024px 打开。
   行内 style 优先级高于本文件，故用 !important 覆盖（全站仅此一处）。 */
@media (min-width: 1024px) {
  #ix-quick,
  #ix-sysinfo { display: block !important; }
}

/* ============================================================
   视觉梯度改造 · 三档圆角 / 浅色按钮去描边 / 状态卡 L 角标 /
   调试页新控件主题 / 调试模式联动 / 排版收敛（子代理 E）
   ────────────────────────────────────────────────────────────
   分层原则（手机端 390px 零回归）：
     · 只定义令牌、只作用于新控件（.db-*、.dbg-on）的规则放全局；
     · 会改动既有元素外形的规则一律进 @media (min-width: 768px)；
     · 唯一例外 .sc::after 的 border-top（评审要求的 L 形角标，
       已确认 390 下 border-top-width 0 -> 1px 属预期）。
   ============================================================ */

/* ── 1. 三档圆角令牌：深色硬朗工业风 / 浅色冰川圆润 ── */
:root {
  --radius-card: 6px;    /* 面板、状态卡、图表卡 */
  --radius-ctrl: 3px;    /* 输入框、小按钮、结果格 */
  --radius-pill: 4px;    /* 胶囊位（深色下锐化） */
  --dev-dot-glow: rgba(46,213,115,0.45);
}
.theme-aurora {
  --radius-card: 14px;
  --radius-ctrl: 9px;
  --radius-pill: 999px;  /* 真胶囊 */
  --dev-dot-glow: rgba(11,122,69,0.35);
}

/* ── 4. 状态卡角标：一条竖线 -> 规整的 L 形拐角括号 ──
   border-color 由 app.css 的 .sc.normal/.warning/.danger::after 提供，
   这里只补上横边，16x16 尺寸与偏移保持不变 */
.sc::after {
  border-top: 1px solid;
}

/* ── 5. 调试页新控件主题（DOM 由 D 提供，此处只按 class 契约写样式） ── */

/* 5.1 预设横排容器 + 胶囊预设按钮 */
.db-preset-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 2px;
}
.db-preset-btn {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 12px; text-align: center; cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--fill-dark);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.db-preset-btn:hover { color: var(--text); background: var(--fill-dark-2); }
.db-preset-btn.active,
.db-preset-btn.db-active,
.db-preset-btn[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: var(--accent);
}

/* 5.2 开关：44x24 轨道 + 18px 圆块 */
.db-switch {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 24px; padding: 0; margin: 0;
  border: 0; background: none;
  flex: 0 0 auto; vertical-align: middle;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.db-switch input[type="checkbox"],
.db-switch input[type="radio"] {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.db-switch-track {
  position: absolute; left: 0; top: 0;
  width: 44px; height: 24px;
  border-radius: var(--radius-pill);
  background: var(--fill-dark-2);
  border: 1px solid var(--border);
  transition: background 0.18s, border-color 0.18s;
}
.theme-aurora .db-switch-track { background: rgba(18,40,63,0.12); }
.db-switch-thumb {
  position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-panel);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.18s;
}
/* 开态：input 在 label 内 / input 与轨道相邻 / JS 直接加 class 三种写法都覆盖 */
.db-switch input:checked + .db-switch-track,
.db-switch input:checked ~ .db-switch-track,
.db-switch.on .db-switch-track,
.db-switch.is-on .db-switch-track,
.db-switch:checked + .db-switch-track,
.db-dev-field.is-on .db-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.db-switch input:checked + .db-switch-track .db-switch-thumb,
.db-switch input:checked ~ .db-switch-track .db-switch-thumb,
.db-switch.on .db-switch-track .db-switch-thumb,
.db-switch.is-on .db-switch-track .db-switch-thumb,
.db-switch:checked + .db-switch-track .db-switch-thumb {
  transform: translateX(20px);
}

/* 5.3 拖放区：1.5px 虚线，悬停转实线 */
.db-drop {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 18px;
  text-align: center; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  color: var(--text-muted);
  background: var(--fill-dark);
  border: 1.5px dashed rgba(0,229,255,0.3);
  border-radius: var(--radius-card);
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.theme-aurora .db-drop { border-color: rgba(10,123,192,0.45); }
.db-drop:hover,
.db-drop.dragover,
.db-drop.is-over,
.db-drop.drag-over {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--text);
}

/* 5.4 缩略图预览 */
.db-preview {
  display: block;
  max-width: 100%; max-height: 160px;
  margin-top: 8px;
  object-fit: contain;
  border-radius: var(--radius-ctrl);
}
.db-preview img {
  display: block;
  max-width: 100%; max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-ctrl);
}

/* 5.5 输入框 + 右侧单位，单位不压数字 */
.db-input-wrap {
  position: relative;
  display: inline-flex; align-items: center;
  flex: 0 0 auto;
}
.db-input-wrap .db-f-input { padding-right: 34px; }
.db-unit {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 12px; line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
  white-space: nowrap;
}

/* 5.6 三段色阶 + 指针 */
.db-scale {
  position: relative;
  margin: 10px 0 4px;
  padding: 4px 0 0;
}
.db-scale-bar {
  position: relative;
  height: 6px;
  border-radius: var(--radius-pill);
  /* 硬分段：按 8mm 线性换算，2mm = 25%、5mm = 62.5%，段间不留过渡带 */
  background: linear-gradient(90deg,
    var(--safe) 0 25%,
    var(--warn) 25% 62.5%,
    var(--danger) 62.5% 100%);
}
.db-scale-needle {
  position: absolute; left: 0; top: -4px;
  width: 2px; height: 14px;
  background: var(--text);
  border-radius: 1px;
}
.db-scale-needle::after {
  content: "";
  position: absolute; left: 50%; bottom: 100%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--text);
}
.db-scale-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.4;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 5.7 小徽章 / 设备在线胶囊 */
/* 结果卡右上角角标：窄屏下不参与 flex 压缩、也不许折行（390 下曾被压成「轻微覆」+「冰」两行） */
.sc-badge {
  flex: 0 0 auto;
  white-space: nowrap;
}
.db-badge-local {
  display: inline-flex; align-items: center;
  padding: 1px 6px; margin-left: 6px;
  font-size: 10px; font-weight: 700; line-height: 1.6; letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-wash);
  border: 1px solid var(--accent-bd);
  border-radius: var(--radius-pill);
  vertical-align: middle;
  white-space: nowrap;
}
.db-dev-status.db-off { color: var(--text-muted); }
.db-dev-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  color: var(--text-dim);
  background: var(--fill-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.db-dev-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  flex: 0 0 auto;
}
.db-dev-status.db-on .db-dev-dot,
.db-dev-status.online .db-dev-dot,
.db-dev-status.on .db-dev-dot,
.db-dev-status.is-on .db-dev-dot {
  background: var(--safe);
  animation: db-dev-pulse 2s ease-out infinite;
}
@keyframes db-dev-pulse {
  0%   { box-shadow: 0 0 0 0 var(--dev-dot-glow); }
  70%  { box-shadow: 0 0 0 6px rgba(0,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* 5.8 输入成功后的一次性闪光 */
.db-flash-ok { animation: db-flash-ok 0.9s ease-out; }
@keyframes db-flash-ok {
  0%   { background-color: var(--accent-wash); border-color: var(--accent); }
  60%  { background-color: var(--accent-wash); border-color: var(--accent); }
  100% { background-color: var(--fill-dark-2); border-color: var(--border); }
}

/* ── 5.8b 行内 style 清空后的兜底：同样的观感完全由本文件给出 ── */
#view-debug .dbg-warn {
  margin: 10px; padding: 10px 12px;
  border: 1px solid var(--danger);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-card);
  background: var(--badge-danger-bg);
  color: var(--danger);
  font-family: var(--font-mono); line-height: 1.6;
}
.dbg-warn { display: block; }
.db-err:empty, .db-ok:empty { display: none; }
.db-drop-hint {
  display: block; text-align: center;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  color: var(--text-muted);
}
.db-scale-current {
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 700; color: var(--text-dim);
}

/* ── 5.9 调试模式联动：警示条与「设备操作」卡点亮 ──
   警示条的边框/底色写在 index.html 的行内 style 上，故只叠发光，
   不动行内属性，本文件声明级的 important 标记仍只有上面那 1 处 */
#view-debug.dbg-on .dbg-warn {
  animation: dbg-warn-pulse 2.4s ease-in-out infinite;
}
@keyframes dbg-warn-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--danger), 0 0 8px var(--danger-glow); }
  50%      { box-shadow: 0 0 0 1px var(--danger), 0 0 20px var(--danger-glow); }
}
/* 「设备操作」卡靠面板内的 #dbx-btn-refresh 认出来，不依赖新增 class */
#view-debug.dbg-on .panel:has(#dbx-btn-refresh),
#view-debug.dbg-on .dbg-devops {
  border-left: 3px solid var(--danger);
  box-shadow: var(--panel-shadow), 0 0 14px var(--danger-glow);
}

/* ── 2 + 3. ≥768px：三档圆角落地 + 浅色主按钮去描边 ── */
@media (min-width: 768px) {

  /* 卡片档：面板 / 状态卡 / 指标容器 / 图表卡 / 照片框 */
  .panel,
  .metric-grid,
  .sc,
  .metric-tile,
  .chart-card,
  .ph-img-box,
  .ph-yolo {
    border-radius: var(--radius-card);
  }
  .theme-aurora .panel,
  .theme-aurora .metric-grid,
  .theme-aurora .sc,
  .theme-aurora .metric-tile,
  .theme-aurora .chart-card,
  .theme-aurora .ph-img-box,
  .theme-aurora .ph-yolo {
    border-radius: var(--radius-card);
  }

  /* 控件档：输入框 / 小按钮 / 结果格 / 提示块 */
  .db-f-input,
  .db-btn-reset,
  .db-btn-calc,
  .db-r-item,
  .db-err,
  .db-ok,
  .theme-toggle {
    border-radius: var(--radius-ctrl);
  }
  .theme-aurora .db-f-input,
  .theme-aurora .db-btn-reset,
  .theme-aurora .db-btn-calc,
  .theme-aurora .db-r-item,
  .theme-aurora .db-err,
  .theme-aurora .db-ok {
    border-radius: var(--radius-ctrl);
  }

  /* 胶囊档：分段控件 / 预设选项 / 徽章 */
  .tab-row,
  .tab-item,
  .db-pre,
  .badge {
    border-radius: var(--radius-pill);
  }
  .theme-aurora .tab-row,
  .theme-aurora .tab-item,
  .theme-aurora .db-pre {
    border-radius: var(--radius-pill);
  }

  /* 浅色主按钮：去生硬描边，换同色系柔和阴影 */
  .theme-aurora .idx-refresh-btn,
  .theme-aurora .ph-capture-btn,
  .theme-aurora .db-btn-calc {
    border: 0;
    border-radius: var(--radius-ctrl);
    box-shadow: 0 4px 12px rgba(10,123,192,0.25);
  }
}

/* ── 6. 排版收敛：区块标题独立成行，说明小字退到次级 ──
   同样只在 ≥768px 生效，手机端排版与改造前逐像素一致 */
@media (min-width: 768px) {
  .section-header {
    display: block;
    padding: 20px 10px 8px;
    line-height: 1.35;
  }
  .theme-aurora .section-header {
    padding: 22px 14px 9px;
    line-height: 1.35;
  }
  /* 标题后紧跟的说明小字：更小、更紧、更淡 */
  .panel-title + .db-f-hint,
  .section-header + .db-f-hint,
  .idx-title + .idx-sub {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    letter-spacing: 0.2px;
  }
}

/* ============================================================
   调试页 v2 —— 按 web/design/code_artifact.html 292-778 行重构
   全部使用 theme.css 的中性色变量，切主题自动跟随；
   语义色借 app.css 的 --warn / --danger（浅色主题另有覆盖），
   绿色徽章独占 --dbg-ok 一套。
   ============================================================ */

:root {
  --dbg-ok: #22c55e;
  --dbg-ok-soft: rgba(34, 197, 94, 0.13);
  --dbg-ok-line: rgba(34, 197, 94, 0.38);
  --dbg-danger-soft: rgba(255, 71, 87, 0.1);
  --dbg-warn-soft: rgba(255, 165, 2, 0.12);
}

body.theme-aurora {
  --dbg-ok: #15803d;
  --dbg-ok-soft: rgba(21, 128, 61, 0.09);
  --dbg-ok-line: rgba(21, 128, 61, 0.3);
  --dbg-danger-soft: rgba(179, 38, 30, 0.07);
  --dbg-warn-soft: rgba(179, 99, 0, 0.09);
}

/* ── 应用头（品牌行）── */
.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-logo {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border-radius: var(--radius-ctrl);
  background: var(--accent-soft);
  border: 1px solid var(--border-input);
}

.app-brand-text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.app-brand-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-node-badge {
  flex: 0 0 auto;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--radius-ctrl);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-card);
  white-space: nowrap;
}

.app-conn {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  font-size: 10.5px;
  color: var(--text-secondary);
}

.app-conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s ease;
}

.app-conn[data-state="online"] .app-conn-dot {
  background: var(--dbg-ok);
  box-shadow: 0 0 5px var(--dbg-ok);
}

.app-conn[data-state="offline"] .app-conn-dot { background: var(--danger); }
.app-conn-text { white-space: nowrap; }

/* ── 导航项里的图标（tabbar-item 内部新增，class/data-view 未动）── */
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.tb-ico {
  width: 18px;
  height: 18px;
  display: block;
}

.tb-label {
  font-size: 10.5px;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

/* ── 页面容器与列 ── */
#view-debug { padding: 10px 10px 4px; }

.dbg-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dbg-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ── 卡片头 ── */
#view-debug .dbg-card { padding: 12px; }

.dbg-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dbg-head-text { min-width: 0; }

.dbg-head-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dbg-head-title,
.dbg-card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-head-sub,
.dbg-card-hint {
  margin: 2px 0 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-muted);
}

.dbg-card-note {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dbg-tag {
  flex: 0 0 auto;
  font-size: 9.5px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-ctrl);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-card);
  white-space: nowrap;
}

.dbg-ico {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  vertical-align: middle;
}

/* ── 调试模式开关 ── */
.dbg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.dbg-toggle-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.dbg-toggle-name {
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
}

.dbg-toggle-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── 快速预设档位 ── */
.dbg-presets {
  margin-top: 10px;
  padding: 9px;
}

.dbg-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.dbg-preset-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dbg-preset-hint {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dbg-preset-hint strong {
  color: var(--accent);
  font-weight: 600;
}

.dbg-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.dbg-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 3px;
  font-family: inherit;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dbg-preset-btn:hover { border-color: var(--border-focus); }

.dbg-preset-btn.db-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dbg-preset-label {
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.dbg-preset-delta {
  font-size: 9.5px;
  line-height: 1.1;
  color: var(--text-muted);
}

.dbg-preset-btn.db-active .dbg-preset-delta { color: var(--accent); }

.dbg-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.dbg-dot-safe { background: var(--dbg-ok); }
.dbg-dot-warn { background: var(--warn); }
.dbg-dot-danger { background: var(--danger); }
.dbg-dot-dark { background: #0c1426; border: 1px solid var(--border-input); }
.dbg-dot-light { background: #eef4f9; border: 1px solid var(--border-input); }

/* ── 六个参数：两列小卡片 ── */
.dbg-params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.dbg-param {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.dbg-param-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dbg-param-label {
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-param-sub {
  font-size: 9.5px;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-param-input {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 2px;
  overflow: hidden;
}

.dbg-step {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: calc(var(--radius-ctrl) - 1px);
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dbg-step:hover { background: var(--accent-soft); color: var(--accent); }
.dbg-step:active { transform: scale(0.94); }

.dbg-param-field {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.dbg-param-field::-webkit-outer-spin-button,
.dbg-param-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dbg-param-unit {
  flex: 0 0 auto;
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── 主按钮行 ── */
.dbg-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}

.dbg-btn-reset {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.dbg-btn-calc {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.dbg-btn-calc:disabled {
  opacity: 0.6;
  cursor: default;
}

#view-debug .db-err,
#view-debug .db-ok { margin-top: 8px; }

/* ── 计算结果卡 ── */
.dbg-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dbg-result-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.dbg-result-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.dbg-badge-local {
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--dbg-ok-soft);
  color: var(--dbg-ok);
  border: 1px solid var(--dbg-ok-line);
  white-space: nowrap;
}

.dbg-risk {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 7px;
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  white-space: nowrap;
}

.dbg-risk-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.dbg-risk[data-level="warning"] { color: var(--warn); border-color: var(--warn); }
.dbg-risk[data-level="danger"] { color: var(--danger); border-color: var(--danger); }

.dbg-result-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
}

.dbg-result-value {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.dbg-result-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--accent);
  transition: color 0.2s ease;
}

#dbx-result[data-level="warning"] .dbg-result-num { color: var(--warn); }
#dbx-result[data-level="danger"] .dbg-result-num { color: var(--danger); }

.dbg-result-unit {
  font-size: 11px;
  color: var(--text-secondary);
}

.dbg-scale-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.dbg-scale-ruler {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  margin-bottom: 4px;
  font-size: 8.5px;
  color: var(--text-muted);
}

.dbg-scale-ruler span { white-space: nowrap; }

#dbx-scale-bar {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  box-sizing: border-box;
}

.dbg-scale-seg {
  flex-grow: 1;
  flex-basis: 0;
  height: 100%;
}

.dbg-seg-safe {
  flex-grow: 13.333;
  background: var(--dbg-ok);
  border-radius: 999px 0 0 999px;
}

.dbg-seg-warn {
  flex-grow: 20;
  background: var(--warn);
}

.dbg-seg-danger {
  flex-grow: 66.667;
  background: var(--danger);
  border-radius: 0 999px 999px 0;
}

#dbx-res-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  transition: width 0.35s ease;
}

#dbx-scale-needle {
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 0;
  margin-left: -5px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid var(--text-primary);
  background: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  transition: left 0.35s ease;
  z-index: 2;
}

#dbx-scale-needle::after { display: none; }

.dbg-scale-current-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 3px;
}

#view-debug .db-scale-current {
  font-size: 9.5px;
  color: var(--text-muted);
}

/* ── 2×2 数据网格 ── */
.dbg-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.dbg-metric {
  padding: 6px 8px;
  min-width: 0;
}

.dbg-metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 9.5px;
  color: var(--text-muted);
}

.dbg-metric-label > span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-metric-sym {
  flex: 0 0 auto;
  font-size: 9.5px;
  color: var(--accent);
}

.dbg-metric-value {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-primary);
}

.dbg-metric-unit {
  font-size: 9px;
  color: var(--text-muted);
}

.dbg-result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  font-size: 9.5px;
  color: var(--text-muted);
}

/* ── 右栏：两列小按钮 ── */
.dbg-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.dbg-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 4px;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.dbg-theme-btn.db-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dbg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 8px 4px;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.dbg-btn-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 9px 6px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.dbg-sect { min-width: 0; }

.dbg-divider {
  height: 1px;
  margin: 10px -12px;
  background: var(--border-card);
}

.dbg-title-help {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.dbg-help {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
}

.dbg-help.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.dbg-help-panel {
  display: none;
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-ctrl);
}

.dbg-help-panel.is-open { display: block; }
.dbg-help-panel code { font-size: 9.5px; color: var(--accent); }

#dbx-baseline {
  flex: 0 0 auto;
  max-width: 58%;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--radius-ctrl);
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dbx-baseline.is-ok {
  color: var(--dbg-ok);
  border-color: var(--dbg-ok-line);
  background: var(--dbg-ok-soft);
}

#dbx-baseline.is-warn {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--dbg-warn-soft);
}

/* ── 设备状态胶囊 ── */
#view-debug .db-dev-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}

#view-debug .db-dev-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

#view-debug .db-dev-status.online .db-dev-dot {
  background: var(--dbg-ok);
  box-shadow: 0 0 5px var(--dbg-ok);
}

#view-debug .db-dev-status.offline .db-dev-dot { background: var(--danger); }

/* ── 上传图片卡 ── */
.dbg-drop {
  display: block;
  position: relative;
  margin-top: 8px;
  padding: 10px;
  cursor: pointer;
  border: 1px dashed var(--border-input);
  border-radius: var(--radius-ctrl);
  background: var(--bg-input);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dbg-drop:hover { border-color: var(--border-focus); }

.dbg-drop.dragover,
.dbg-drop.drag-over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
}

.dbg-drop input[type="file"] { display: none; }

.dbg-drop-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
}

.dbg-preview {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  border-radius: var(--radius-ctrl);
}

.dbg-drop-hint {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

.dbg-file-pill {
  max-width: 100%;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-file-clear {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 9px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: var(--radius-ctrl);
  border: 1px solid var(--border-input);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.dbg-file-clear:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.dbg-drop-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 9.5px;
  color: var(--text-muted);
}

.dbg-drop-browse {
  color: var(--accent);
  text-decoration: underline;
}

.dbg-upload-box {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.dbg-upload-label { color: var(--text-muted); }
.dbg-upload-info { color: var(--accent); }

/* ── 高风险警示条 ── */
#view-debug .dbg-warn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--danger);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-ctrl);
  background: var(--dbg-danger-soft);
  color: var(--danger);
  font-family: inherit;
  font-size: 12px;
}

.dbg-warn-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dbg-warn-tag {
  flex: 0 0 auto;
  font-size: 9.5px;
  line-height: 1;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: 0.85;
}

.dbg-warn-text {
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbg-mode-pill {
  flex: 0 0 auto;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  opacity: 0.9;
  white-space: nowrap;
}

/* ── ≥768px：参数两列（照原型），数字与刻度条并排，留白放宽 ── */
@media (min-width: 768px) {
  .app-head { padding: 10px 14px; }
  .app-brand-title { font-size: 13.5px; }
  #view-debug { padding: 12px 14px 4px; }
  #view-debug .dbg-card { padding: 14px; }
  .dbg-param-label { font-size: 12px; }
  .dbg-param-sub { font-size: 10px; }
  .dbg-result-main { flex-direction: row; align-items: center; gap: 12px; }
  .dbg-divider { margin: 10px -14px; }
  .dbg-result-num { font-size: 36px; }
}

/* ── ≥1024px：左列（参数 + 结果）与右列（主题 / 基线 / 校准 / 设备 / 上传）并排 ── */
@media (min-width: 1024px) {
  .app-head { padding: 10px 18px; }
  .tabbar-item {
    flex-direction: row;
    gap: 6px;
    padding: 14px 26px;
  }
  .tb-ico { width: 16px; height: 16px; }
  .tb-label { font-size: 11.5px; }
  #view-debug { padding: 14px 18px 0; }
  #view-debug .dbg-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);  /* 黄金分割：主列 61.8% */
    gap: 12px;
    align-items: start;
  }
  #view-debug .dbg-col { gap: 12px; }
  #view-debug .dbg-card { padding: 16px; }
  #view-debug .dbg-divider { margin: 12px -16px; }
  #view-debug .dbg-warn { font-size: 12.5px; }
  .dbg-result-num { font-size: 38px; }
}

/* ── 应用头连接状态 + 照片页大图（2026-10-24 原型照抄的验收补丁） ───────────── */

/* 手机上空出一句话的宽度，品牌标题就会被挤成两行，所以小屏只留色点，
   完整语义由 title 与颜色承担；≥480px 显示「设备在线 / 设备离线」四个字 */
@media (max-width: 479px) {
  .app-conn-text { display: none; }
}

/* 桌面端一张巡检图能把整屏顶满，按 65vh 封顶并居中，剩下的视线留给下面的分析结果
   （app.css:628 的 .ph-img 是 width:100% + min-height:250px，这条是断点内覆盖） */
@media (min-width: 768px) {
  .ph-img { width: auto; max-width: 100%; max-height: 65vh; margin: 0 auto; display: block; }
}

/* ============================================================
   三页设计语言统一 · 首页 / 历史 / 照片（第三波返工，2026-10-24）
   ────────────────────────────────────────────────────────────
   设计源：web/design/code_artifact.html 的令牌与组件类（1-198 行）
           与调试页结构（292-778 行，已上线，作为参照物）。
   原则：本节只在文件尾部追加，不改上方任何既有规则。
        被 app.js 重写 className 的元素（#ix-sc / #ix-sc-badge /
        #ix-temperature / #ix-weatherRisk / #ix-credibility /
        #ph-thickness / #ph-badge / #ix-dot）不能挂 .theme-* 类，
        只能按 id 或父级选择器覆盖。
   ============================================================ */

/* ── 1. 三页统一内边距 ──────────────────────────────────────
   旧版靠 .panel/.metric-grid/.sc/.tab-row 各自的 margin:10px 撑缩进；
   卡片换成 .theme-card 后自身无外边距，缩进统一交给 section。 */
#view-index,
#view-history,
#view-photo {
  padding: 8px 10px 0;
}

/* 卡片之间的纵向节奏交给 flex gap，避免 margin 折叠 */
#view-index .idx-col,
#view-photo .ph-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
/* 页头与离线横幅之后的第一块、以及手机上堆叠的第二列 */
#view-index .idx-col { margin-top: 10px; }
#view-photo .ph-col-side { margin-top: 10px; }

/* ── 2. 首页顶部设备条 ──────────────────────────────────────
   .idx-head 原是渐变带 + 半透明下边框（app.css:493），改成与其它卡
   同款的卡面；类名保留，供 ≥1024px 的 grid-column:1/-1 跨列规则复用。 */
#view-index .idx-head {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
#view-index .idx-head .idx-logo { font-size: 16px; line-height: 1; }

/* 设备条右侧的状态胶囊（#ix-dot 的 class 由 app.js:646 重写，只改容器） */
#view-index .idx-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
#view-index .idx-pill .status-dot { margin: 0; }
#view-index .idx-pill-accent {
  color: var(--accent);
  background: var(--accent-soft);
  letter-spacing: 0.5px;
}

/* 离线横幅：原 margin:0 10px 10px（app.css:528）会叠在 section padding 上
   再多缩进一圈，改为紧跟页头的卡间距 */
#view-index .offline-banner {
  margin: 8px 0 0;
  padding: 7px 10px;
  border-radius: var(--radius-ctrl);
}

/* ── 3. 覆冰状态卡 #ix-sc ────────────────────────────────────
   class 被 app.js:211 整段重写为「sc + 等级」，等级底色、脉冲与
   .sc::after 角标全部由 app.css 提供，这里只收敛外边距与字号。 */
#view-index #ix-sc {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
#view-index #ix-sc .sc-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent);
}
#view-index #ix-sc .sc-value {
  font-size: 34px;
  letter-spacing: 0;
}
#view-index #ix-sc .sc-body { margin: 2px 0 8px; }
#view-index #ix-sc .sc-unit { font-size: 14px; }

/* ── 4. 首页子卡读数 ────────────────────────────────────────
   .metric-value 自带 margin-left:auto（app.css:145 区），在窄格子里会把
   数字顶到右边；这里按父级改回左对齐，并按 3 列 / 2 列两种格子分档定字号。 */
#view-index .theme-subcard .metric-value {
  margin-left: 0;
  line-height: 1.2;
  white-space: nowrap;
}
#view-index .theme-subcard .metric-unit {
  margin-left: 1px;
  font-size: 11px;
  line-height: 1.2;
}
#view-index .idx-grid-3 .metric-value { font-size: 19px; }
#view-index .idx-grid-2 .metric-value { font-size: 22px; }
/* 三环的环下标签：默认 13px + 1px 字距，390 下三个圈并排会挤 */
#view-index .theme-card .g-label {
  font-size: 12px;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ── 5. 历史页 ──────────────────────────────────────────────
   .tab-row 的 margin:10px（app.css:562）在卡内改由卡片 padding 承担。 */
#view-history .tab-row { margin: 0; }
#view-history .tab-item {
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.5px;
}
#view-history .theme-card + .theme-card { margin-top: 8px; }
#view-history #hs-charts { margin-top: 8px; }
#view-history .placeholder-text { margin-top: 0; }
#view-history .placeholder-hint { margin-bottom: 0; }
#view-history .chart-canvas { margin-top: 2px; }

/* ── 6. 照片页 ──────────────────────────────────────────────
   .ph-img-box 的 margin:10px（app.css:619）同理交给卡片 padding；
   圆角 + overflow:hidden 让图片跟着卡面裁切。 */
#view-photo .ph-img-box {
  margin: 0;
  border-radius: var(--radius-ctrl);
  overflow: hidden;
}
#view-photo .ph-noimg { padding: 34px 0; }
/* #ph-thickness 的 class 被 app.js:494 重写为「ph-val + 等级」，
   等宽字体与字号只能按 id 补 */
#view-photo #ph-thickness {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}
#view-photo .theme-subcard .ph-val-sm {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
#view-photo .theme-subcard .metric-unit {
  margin-left: 1px;
  font-size: 11px;
  line-height: 1.2;
}
#view-photo .ph-yolo-icon { margin-bottom: 6px; }

/* ── 7. ≥768px：平板仍是 720 单列，只放宽留白与图表高度 ── */
@media (min-width: 768px) {
  #view-index,
  #view-history,
  #view-photo { padding: 12px 14px 0; }

  #view-index .idx-col,
  #view-photo .ph-col { gap: 12px; }
  #view-index .idx-col,
  #view-photo .ph-col-side { margin-top: 12px; }

  #view-index .idx-grid-3 .metric-value { font-size: 21px; }
  #view-index .idx-grid-2 .metric-value { font-size: 24px; }

  #view-history .theme-card + .theme-card { margin-top: 10px; }
  #view-history #hs-charts { margin-top: 10px; }
  #view-history .chart-canvas { height: 240px; }

  #view-photo #ph-thickness { font-size: 34px; }
}

/* ── 8. ≥1024px：首页保住既有两列，历史页图表并排，照片页图左信息右 ──
   注意 #view-photo 必须写 .active：app.css:868 的 .view{display:none}
   与 .view.active{display:block} 管着显隐，直接给 id 设 grid 会把
   隐藏页也显示出来。 */
@media (min-width: 1024px) {
  /* 首页：responsive.css:66-77 已定义两列与跨列，这里只补纵向节奏 */
  #view-index .idx-col { margin-top: 12px; }
  #view-index .idx-spacer { display: none; }

  /* 历史页：两张图并排，避免单列长条在 1280 宽下显得空 */
  #view-history #hs-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    margin-top: 12px;
  }
  #view-history #hs-charts > .theme-card { margin-top: 0; }
  #view-history .chart-canvas { height: 300px; }

  /* 照片页：左图右信息 */
  #view-photo.active {
    display: grid;
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); /* 黄金分割：图 61.8%，信息 38.2% */
    gap: 12px;
    align-items: start;
  }
  #view-photo .ph-col-side { margin-top: 0; }
  #view-photo .ph-spacer { display: none; }
  #view-photo #ph-thickness { font-size: 36px; }
}

/* ---- 覆冰状态大数字：等宽数字，与 .font-mono-num 一致 ---- */
#ix-sc-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---- 快捷入口按钮：加高到可稳定点击 ---- */
#ix-quick .theme-btn-secondary { padding-top: 9px; padding-bottom: 9px; }

/* ============================================================
   11. 首页信息密度（2026-10-24 · 用户反馈「要往下翻才能看全」）
   ────────────────────────────────────────────────────────────
   实测（改前）：1440 下一页 1299px / 视口 900px，需要滚动；
   同期调试页整页 730px，一屏放得下。差距来自三处：
     ① 主列 5 张卡竖排 1168px
     ② 顶部设备条 .idx-head 108px（内层 flex-wrap 把胶囊挤到第二行）
     ③ 每张卡头两行（标题 16px + 副标 12px）占 66px
   手段全在间距与排布，不改 DOM、不碰 app.js —— 它那 8 处整段重写
   className 会冲掉挂上去的新类，所以这里一律用 id + 后代选择器。
   ============================================================ */

/* 11.1 卡头：下留白 12 → 6（全断点，纯收高，不改变排布） */
#view-index .theme-card > .border-b.pb-3 {
  padding-bottom: 6px;
}

/* 11.2 卡片内边距 16 → 12、子卡 12 → 10、网格缝 8 → 6（全断点） */
#view-index .idx-col > .theme-card { padding: 12px; }
#view-index .theme-subcard { padding: 10px; }
#view-index .idx-grid-2,
#view-index .idx-grid-3 { gap: 6px; }

/* 11.3 卡内纵向节奏 12 → 8（.space-y-3 原规则特异性 0,3,0） */
#view-index .theme-card.space-y-3 > * + * { margin-top: 8px; }

/* 11.4 仪表环 80 → 72，标签行距收 2px（.g-ring 是 app.css:441 的环体） */
#view-index .g-ring { width: 72px; height: 72px; }
#view-index .g-label { margin-top: 3px; font-size: 12px; }

/* 11.5 ≥768：标题与副标同基线（手机端不这么做 —— 390px 下副标会折成
   两行，反而比竖排更高，得不偿失） */
@media (min-width: 768px) {
  #view-index .theme-card > .border-b.pb-3 > .flex-1 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 8px;
  }
  #view-index .theme-card > .border-b.pb-3 > .flex-1 > p { margin-top: 0; }
}

/* 11.6 ≥1024：主列内部改两栏，状态卡横跨整行 —— 5 张卡竖排变 3 行 */
@media (min-width: 1024px) {
  #view-index .idx-col-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
    column-gap: 12px;
    row-gap: 12px;
  }
  #view-index .idx-col-main > #ix-sc { grid-column: 1 / -1; }
}

/* 11.7 ≥1024：顶部设备条压成一行（副标「设备 · ICEBOX_001」与上方应用头
   重复；隐藏后 #ix-device 仍在 DOM 里，右列系统信息照常镜像） */
@media (min-width: 1024px) {
  #view-index .idx-head { padding: 10px 12px; }
  #view-index .idx-head > .flex { flex-wrap: nowrap; }
  #view-index .idx-head p { display: none; }
}

/* 11.8 ≥1024：右列也收 —— 快捷入口三个按钮横排（省两行），
   系统信息四行行距 8 → 6 */
@media (min-width: 1024px) {
  #ix-quick .grid-cols-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #ix-sysinfo .space-y-2 > * + * { margin-top: 6px; }
  #ix-sysinfo .border-b { padding-bottom: 6px; }
}

/* 11.9 再收一档（手机端主要靠这几处省高）
   状态卡默认 margin:10px（app.css:339），在 flex 列里与 gap 叠成 20px 且
   比别的卡窄 20px；归零后与其它卡对齐。 */
#view-index #ix-sc { margin: 0; padding: 13px 13px 11px; }
#view-index .sc-value { font-size: 38px; }
#view-index .theme-subcard { padding: 8px 10px; }
#view-index .theme-subcard .metric-value { font-size: 18px; line-height: 1.3; }

/* 11.10 ≥768：副标 12 → 11px。卡头收成一行后标题与说明容易黏成一句话，
   把说明再降一档就能拉回层次（手机端不动，11px 在 390 上偏小） */
@media (min-width: 768px) {
  #view-index .theme-card > .border-b.pb-3 > .flex-1 > p {
    font-size: 11px;
    letter-spacing: 0.2px;
  }
}



/* ═══════════════════════════════════════════════════════════════
   12 · 首页「现场照片」卡 · 最新抓拍预览
   标注图优先；object-fit: cover 让预览铺满整条（contain 时两侧会留大片空白）。
   代价是原始 16:9 的上下被裁约 40% —— 想看完整标注请点开照片页，卡头已写明。
   高度按右列空位定：1440 下右列 506 → 加 150 后约 670，与主列 617
   相仿，整页仍收在 900 一屏内。
   ═══════════════════════════════════════════════════════════════ */
.ix-photo-preview {
  position: relative;
  margin-top: 10px;
  height: 160px;
  border-radius: var(--radius-ctrl);
  border: 1px solid var(--border-card);
  background: var(--bg-input);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ix-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ix-photo-preview-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.ix-photo-preview-empty-icon {
  font-size: 15px;
  color: var(--text-secondary);
}
.ix-photo-preview-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .3px;
  border-radius: var(--radius-pill);
  background: rgba(4, 16, 28, .74);
  color: #e6f1ff;
}
body.theme-aurora .ix-photo-preview-tag {
  background: rgba(255, 255, 255, .88);
  color: #0b3d5c;
  border: 1px solid var(--border-card);
}
@media (min-width: 1024px) {
  .ix-photo-preview {
    height: 150px;
  }
}
