/* ============================================================
   style.css - v1.6.3 OLED 暖炭黑极简无障碍体系
   - 主底色 #0B0D10 / 卡片 #14171D / 次级 #1C2029 / 极细分割 1px rgba(255,255,255,0.07)
   - 主强调色 #3B82F6（沉稳无障碍蓝）；运行中停止色 #EF4444
   - 风险四色只用 4px 左侧实色竖条 + 柔和低饱和色底 + #F5F5F7 高对比大字
   - 防黑帧硬约束：相机取景关闭或切到记录/设置 Tab 时，.camera-card 保持在视口内
     1x1 opacity:0.01 激活态（严禁对包含 <video> 的祖先容器使用 display: none）
   ============================================================ */

:root {
  --bg: #0B0D10;
  --surface: #14171D;
  --surface-2: #1C2029;
  --border-hairline: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #F5F5F7;
  --text-dim: #C7CCD6;
  --text-mute: #8E95A3;

  --accent: #3B82F6;
  --safe: #34D399;
  --caution: #F59E0B;
  --danger: #EF4444;
  --unknown: #8E95A3;
  --fault: #F43F5E;

  --radius: 16px;
  --space: 14px;
  --font-scale: 1;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  font-size: calc(16px * var(--font-scale));
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  padding: 0 0 36px;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.5;
  font-size: 1rem;
}

body[data-font-scale="1"]    { --font-scale: 1; }
body[data-font-scale="1.25"] { --font-scale: 1.25; }
body[data-font-scale="1.5"]  { --font-scale: 1.5; }

h1, h2 { margin: 0; font-weight: 700; letter-spacing: 0.01em; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #FFFFFF;
  padding: 10px 16px;
  z-index: 100;
  font-weight: 700;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------------- 顶部状态栏 ---------------- */

#app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
  padding: 8px 14px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.header-title {
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--unknown);
}

.dot-ready   { background: var(--unknown); }
.dot-active  { background: var(--safe); animation: pulse 2.2s infinite; }
.dot-loading { background: var(--accent); animation: pulse 1.4s infinite; }
.dot-warning { background: var(--caution); }
.dot-error   { background: var(--danger); }

.status-line {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-error   { color: #FCA5A5; }
.status-warning { color: #FDE68A; }
.status-active  { color: var(--text); }

/* ---------------- 主体与卡片 ---------------- */

#app-main {
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius);
  padding: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 700;
}

.badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-idle    { color: var(--text-mute); }
.badge-active  { color: #6EE7B7; background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.32); }
.badge-warning { color: #FDE68A; background: rgba(245, 158, 11, 0.14); border-color: rgba(251, 191, 36, 0.34); }
.badge-error   { color: #FECACA; background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.38); }
.badge-loading { color: #BFDBFE; background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.34); }

/* ---------------- 按钮体系 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible,
.btn-task:focus-visible,
.nav-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-xl { min-height: 54px; flex: 1 1 140px; }
.btn-lg { min-height: 46px; flex: 1 1 120px; }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: 0.84rem; }

.btn-primary  { background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.55); color: var(--text); }
.btn-warning  { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.45); color: #FEF3C7; }
.btn-danger   { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.52); color: #FEE2E2; }
.btn-secondary{ background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-ghost    { background: transparent; border-color: var(--border-hairline); color: var(--text-dim); }

.btn-toggle-on {
  border-color: rgba(59, 130, 246, 0.65) !important;
  color: var(--text) !important;
  background: rgba(59, 130, 246, 0.16) !important;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-action-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* ---------------- 主圆钮（待机 #38BDF8 / 运行 #EF4444） ---------------- */

.primary-action-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.btn-circle {
  width: 76px;
  height: 76px;
  min-height: 76px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 auto;
}

.btn-circle .btn-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#btn-start.btn-circle {
  background: #1B273B;
  border: 2px solid var(--accent);
  color: var(--accent);
}

#btn-stop.btn-circle {
  background: #2C161A;
  border: 2px solid var(--danger);
  color: var(--danger);
}

/* ---------------- 无框 3 任务分段文字条 ---------------- */

.task-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.btn-task {
  position: relative;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn-task.is-selected {
  color: var(--text);
  font-weight: 800;
}

.btn-task.is-selected::after {
  content: "";
  position: absolute;
  left: 26%;
  right: 26%;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

/* ---------------- 相机取景框 + 四角取景角标 ---------------- */

#camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0B0D10;
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  overflow: hidden;
}

#camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vf-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 3;
  border-color: rgba(248, 250, 252, 0.42);
  border-style: solid;
  border-width: 0;
}
.vf-tl { top: 10px; left: 10px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 4px; }
.vf-tr { top: 10px; right: 10px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 4px; }
.vf-bl { bottom: 10px; left: 10px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 4px; }
.vf-br { bottom: 10px; right: 10px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 4px; }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-bottom: 120px;
  color: var(--text-mute);
  background: radial-gradient(circle at 50% 42%, #171B22 0%, #0B0D10 72%);
  z-index: 2;
}
.placeholder[hidden] { display: none; }
.placeholder p { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--text-dim); letter-spacing: 0.01em; }
.placeholder-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.placeholder-svg { color: rgba(245, 245, 247, 0.78); }

.sampling-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11, 13, 16, 0.82);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--safe);
  font-size: 0.75rem;
  font-weight: 700;
}
.sampling-dot[hidden] { display: none; }
body[data-view-mode="minimal"] #sampling-indicator { display: none; }
body[data-view-mode="minimal"] .vf-corner { display: none; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--safe);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .dot-active, .dot-loading { animation: none; }
}

/* ---------------- 风险提示卡（4px 左侧实色竖条 + 柔和低饱和色底） ---------------- */

.risk-panel {
  border: 1px solid var(--border-hairline);
  border-left: 4px solid var(--unknown);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.risk-unknown {
  border-left-color: var(--unknown);
  background: var(--surface);
}
.risk-low {
  border-left-color: var(--safe);
  background: #111C19;
}
.risk-medium {
  border-left-color: var(--caution);
  background: #211B11;
}
.risk-high {
  border-left-color: var(--danger);
  background: #271316;
}
.risk-fault {
  border-left-color: var(--fault);
  background: #241219;
}

.risk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.risk-badge {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.risk-low .risk-badge     { color: var(--safe); }
.risk-medium .risk-badge  { color: var(--caution); }
.risk-high .risk-badge    { color: #FCA5A5; }
.risk-unknown .risk-badge { color: var(--text-mute); }
.risk-fault .risk-badge   { color: #FDA4AF; }

.risk-countdown {
  font-size: 0.76rem;
  color: var(--text-mute);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 显示与 TTS 同用 short_prompt：纯白高对比 */
.short-prompt {
  margin: 8px 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.32;
  color: var(--text);
}

.gesture-hint {
  display: none;
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  color: var(--text-mute);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.result-detail {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  word-break: break-word;
}

.obstacle-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.obstacle-list li {
  border: 1px solid var(--border-hairline);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.result-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ---------------- 权限与偏好设置样式 ---------------- */

.perm-list, .pref-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perm-item {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.perm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.perm-name, .pref-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.pref-sub {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-mute);
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
}

.pref-row .btn-sm {
  flex-shrink: 0;
}

.debug-accordion { padding: 0; overflow: hidden; }
.accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary::after {
  content: "▾";
  color: var(--text-mute);
  transition: transform 0.15s ease;
}
.debug-accordion[open] .accordion-summary::after { transform: rotate(180deg); }
.accordion-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-hairline);
  padding-top: 12px;
}

.voice-card {
  padding-top: 10px;
  border-top: 1px solid var(--border-hairline);
}

/* ---------------- 文本与统计 ---------------- */

.hint-text, .meta-text {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--text-mute);
}

.asr-text {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  min-height: 1.4em;
}

.fault-text {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  color: var(--text-dim);
  font-size: 0.86rem;
}

.fault-text.is-fault {
  border-color: rgba(244, 63, 94, 0.45);
  color: #FECDD3;
  background: rgba(244, 63, 94, 0.12);
  font-weight: 700;
}

.exception-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow: auto;
}

.exception-list li {
  font-size: 0.8rem;
  color: var(--text-dim);
  border-left: 2px solid var(--fault);
  padding-left: 8px;
  word-break: break-word;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 0;
}

.stat-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
}

.stats-grid dt {
  font-size: 0.72rem;
  color: var(--text-mute);
}

.stats-grid dd {
  margin: 3px 0 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}

#app-footer {
  padding: 4px 2px 12px;
  color: var(--text-mute);
  font-size: 0.78rem;
}

/* ---------------- 底部三 Tab 导航栏 ---------------- */

.bottom-nav {
  flex: 0 0 60px;
  height: 60px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(11, 13, 16, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-hairline);
  z-index: 30;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 54px;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  padding: 6px 0;
  transition: color 0.15s ease;
}

.nav-tab.is-active {
  color: var(--accent);
  font-weight: 700;
}

/* ============================================================
   极简三 Tab 单页架构（默认 viewMode = minimal）
   ============================================================ */

body[data-view-mode="minimal"] {
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-view-mode="minimal"] #app-header {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
}

body[data-view-mode="minimal"] .header-inner {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body[data-view-mode="minimal"] .status-bar {
  width: 100%;
}

body[data-view-mode="minimal"] #app-main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 14px 10px;
  overflow: hidden;
}

/* 辅助 Tab 全屏无死角一屏无滚动 */
body[data-view-mode="minimal"][data-active-tab="assist"] #app-main {
  padding: 0;
}

body[data-view-mode="minimal"][data-active-tab="assist"] #panel-assist {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

body[data-view-mode="minimal"][data-active-tab="assist"] #panel-dash,
body[data-view-mode="minimal"][data-active-tab="assist"] #panel-setup {
  display: none;
}

body[data-view-mode="minimal"] .assist-hotzone {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  border-radius: 0;
}

body[data-view-mode="minimal"] #assist-hotzone * {
  pointer-events: none;
}

body[data-view-mode="minimal"] .assist-hotzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* 辅助页极简化裁剪，保留所有 DOM 节点供合同读取 */
body[data-view-mode="minimal"] #panel-assist .camera-card .section-header,
body[data-view-mode="minimal"] #panel-assist #camera-meta,
body[data-view-mode="minimal"] #panel-assist .result-card .section-header,
body[data-view-mode="minimal"] #panel-setup .controls-card .section-header {
  /* #panel-assist 标题裁剪；#panel-setup 手动区保留标题 */
}

body[data-view-mode="minimal"] #panel-assist .camera-card .section-header,
body[data-view-mode="minimal"] #panel-assist #camera-meta,
body[data-view-mode="minimal"] #panel-assist .result-card .section-header {
  display: none !important;
}

body[data-view-mode="minimal"] #panel-assist .camera-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  z-index: 1;
  background: #0B0D10;
}

body[data-view-mode="minimal"] #panel-assist #camera-container {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: #0B0D10;
}

body[data-view-mode="minimal"] #panel-assist #camera-container::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(11, 13, 16, 0.44) 0%,
    rgba(11, 13, 16, 0.04) 24%,
    rgba(11, 13, 16, 0.12) 54%,
    rgba(11, 13, 16, 0.82) 100%
  );
}

body[data-view-mode="minimal"] #panel-assist .result-card {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  margin: auto 12px 14px;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: transparent;
}

body[data-view-mode="minimal"] #panel-assist #risk-panel {
  min-height: 144px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 12px;
  background-color: rgba(20, 23, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left-width: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

body[data-view-mode="minimal"] #panel-assist #risk-panel.risk-low    { background-color: rgba(17, 28, 25, 0.94); }
body[data-view-mode="minimal"] #panel-assist #risk-panel.risk-medium { background-color: rgba(33, 27, 17, 0.94); }
body[data-view-mode="minimal"] #panel-assist #risk-panel.risk-high   { background-color: rgba(39, 19, 22, 0.95); }
body[data-view-mode="minimal"] #panel-assist #risk-panel.risk-fault  { background-color: rgba(36, 18, 25, 0.95); }

body[data-view-mode="minimal"] #panel-assist #risk-panel.is-listening {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

body[data-view-mode="minimal"] #panel-assist .short-prompt {
  margin: auto 0;
  font-size: clamp(1.32rem, 1.55rem, 1.85rem);
  line-height: 1.28;
}

body[data-view-mode="minimal"] #panel-assist .gesture-hint {
  display: block;
  margin: 4px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: transparent;
  color: var(--text-mute);
  opacity: 0.62;
  font-size: 0.76rem;
}

body[data-view-mode="minimal"] #panel-assist #risk-panel.is-listening .gesture-hint {
  background: transparent;
  border-top-color: rgba(59, 130, 246, 0.45);
  color: var(--text);
  opacity: 1;
}

body[data-view-mode="minimal"] #btn-lens-override {
  position: relative;
  z-index: 12;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  min-height: 46px;
  padding: 8px 12px;
  font-size: 0.88rem;
  flex-shrink: 0;
}

body[data-view-mode="minimal"] #lens-hint {
  position: relative;
  z-index: 12;
  margin: 0 14px 10px;
  font-size: 0.72rem;
  line-height: 1.3;
  flex-shrink: 0;
}

body[data-view-mode="minimal"] #panel-setup .primary-action-row {
  justify-content: flex-start;
  gap: 10px;
}

/* 记录与设置 Tab 可内部滚动 */
body[data-view-mode="minimal"][data-active-tab="dash"] #app-main,
body[data-view-mode="minimal"][data-active-tab="setup"] #app-main {
  overflow-y: auto;
}

body[data-view-mode="minimal"][data-active-tab="dash"] #panel-setup,
body[data-view-mode="minimal"][data-active-tab="setup"] #panel-dash {
  display: none;
}

/* 防黑帧核心约束：
   1) 切到记录/设置 Tab 时，不能对 #panel-assist 用 display:none，否则 <video> 暂停解码；
   2) 取景框关(data-viewfinder="off") 时同样保持 1x1 opacity:0.01 在视口内激活解码。 */
body[data-view-mode="minimal"][data-active-tab="dash"] #panel-assist,
body[data-view-mode="minimal"][data-active-tab="setup"] #panel-assist {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

body[data-view-mode="minimal"][data-active-tab="dash"] #panel-assist > *:not(#assist-hotzone),
body[data-view-mode="minimal"][data-active-tab="setup"] #panel-assist > *:not(#assist-hotzone),
body[data-view-mode="minimal"][data-active-tab="dash"] #panel-assist .result-card,
body[data-view-mode="minimal"][data-active-tab="setup"] #panel-assist .result-card {
  display: none !important;
}

body[data-view-mode="minimal"][data-active-tab="dash"] .camera-card,
body[data-view-mode="minimal"][data-active-tab="setup"] .camera-card,
body[data-view-mode="minimal"][data-viewfinder="off"] .camera-card {
  position: fixed !important;
  inset: auto !important;
  left: 0 !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  flex: 0 0 1px !important;
  overflow: hidden;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
  padding: 0;
  border: 0;
  margin: 0;
}

body[data-view-mode="minimal"][data-active-tab="dash"] #camera-container,
body[data-view-mode="minimal"][data-active-tab="setup"] #camera-container,
body[data-view-mode="minimal"][data-viewfinder="off"] #camera-container,
body[data-view-mode="minimal"][data-active-tab="dash"] #camera-preview,
body[data-view-mode="minimal"][data-active-tab="setup"] #camera-preview,
body[data-view-mode="minimal"][data-viewfinder="off"] #camera-preview {
  width: 1px !important;
  height: 1px !important;
}

/* ============================================================
   完整调试模式（?mode=debug 或在设置页切换）
   ============================================================ */

body[data-view-mode="debug"] {
  padding-bottom: 36px;
}

body[data-view-mode="debug"] .tab-panel {
  display: flex !important;
}

body[data-view-mode="debug"] .bottom-nav {
  display: none;
}

body[data-view-mode="debug"] .btn-circle {
  width: auto;
  height: auto;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 12px;
  flex: 1 1 140px;
}

body[data-view-mode="debug"] .btn-circle .btn-label {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
}

body[data-view-mode="debug"] .btn-circle .circle-icon {
  width: 18px;
  height: 18px;
}

@media (prefers-contrast: more) {
  :root {
    --text-dim: #FFFFFF;
    --text-mute: #E2E8F0;
    --border-hairline: rgba(255, 255, 255, 0.35);
    --border-strong: rgba(255, 255, 255, 0.65);
  }
}
