/* ============================================================================
   app.css —— 网页端界面样式
   配色与 C++ 端 ui_theme.h 一致（深色科技风 / 高对比 / 浅色办公三档）
   字号由 config.js 写入的 --base-pt 派生（对应 ui_font::basePt，默认 11 磅）
   ============================================================================ */

:root {
  --base-pt: 11pt;
  /* 深色科技风（默认）*/
  --bg: #0A1128;
  --bg-soft: #0E1730;
  --card: rgba(26, 34, 56, 0.92);
  --card-line: rgba(0, 229, 255, 0.24);
  --text: #E8F0FF;
  --text-dim: #8FA3C8;
  --text-second: #5A6B8C;
  --accent: #00E5FF;
  --ok: #00FFAA;
  --warn: #FFB020;
  --alarm: #FF4D4F;
  --purple: #B388FF;
  --radius: 10px;
  --gap: 10px;
}

html[data-theme="contrast"] {
  --bg: #000000;
  --bg-soft: #0A0A0A;
  --card: rgba(18, 18, 18, 0.96);
  --card-line: rgba(0, 229, 255, 0.5);
  --text: #FFFFFF;
  --text-dim: #B9C7DE;
  --text-second: #93A3BD;
  --accent: #29E2FF;
  --ok: #29FF9C;
  --warn: #FFC13D;
  --alarm: #FF6B6D;
}

html[data-theme="light"] {
  --bg: #F2F5FA;
  --bg-soft: #FFFFFF;
  --card: #FFFFFF;
  --card-line: rgba(20, 80, 130, 0.18);
  --text: #16233A;
  --text-dim: #536480;
  --text-second: #7A8AA5;
  --accent: #0A7EA4;
  --ok: #0E9E6A;
  --warn: #B87400;
  --alarm: #C8322F;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 1rem;      /* html 上的 px 由 config.js 按磅值换算写入 */
  line-height: 1.5;
}

a { color: var(--accent); }

/* ---------------------------------------------------------------- 布局 */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.08), transparent 60%);
  border-bottom: 1px solid var(--card-line);
}
.topbar .brand { font-weight: 700; font-size: 1.2rem; }
/* 品牌 Logo（app.js 的 brandLogo()）：assets/logo-256.png 自带白底，
   用白色圆角容器承载，深色/浅色主题下都清晰；尺寸与桌面端顶栏的 34×34 对齐 */
.logo {
  width: 34px; height: 34px; flex: none; padding: 2px;
  border-radius: 8px; background: #FFFFFF;
  box-shadow: 0 0 0 1px var(--card-line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo.lg { width: 84px; height: 84px; padding: 5px; border-radius: 12px; }
/* 图片缺失/加载失败时回退成“伟”字色块（旧版样式，见 brandLogo 的 error 分支） */
.logo.logo-fallback {
  padding: 0; color: #04121F; font-weight: 700; font-size: 1.1rem;
  background: linear-gradient(135deg, #0A7EA4, #00E5FF);
}
.logo.logo-fallback.lg { font-size: 2.4rem; }
.topbar .sub { color: var(--text-second); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-dim); }

.navbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px; background: var(--bg-soft);
  border-bottom: 1px solid var(--card-line);
}
.crumb { color: var(--text-dim); }
.crumb b { color: var(--text); }

.content { flex: 1; padding: 14px 18px 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: var(--gap); }
.split3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 12px;
}
.card-title {
  font-weight: 700; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .dot { color: var(--ok); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 10px 12px; }
.kpi .k { color: var(--text-dim); font-size: 0.9rem; }
.kpi .v { font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.kpi .u { color: var(--text-dim); font-size: 0.85rem; margin-left: 6px; }
.kpi.ok .v { color: var(--ok); }
.kpi.warn .v { color: var(--warn); }
.kpi.alarm .v { color: var(--alarm); }

/* ---------------------------------------------------------------- 地图 */
.wj-map-frame {
  width: 100%; height: 480px; border: 1px solid var(--card-line);
  border-radius: var(--radius); background: #0A1128;
}
.map-wrap { position: relative; }
.map-fallback {
  position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 17, 40, 0.86); border: 1px dashed var(--card-line);
  border-radius: var(--radius); color: var(--text-dim); text-align: center; padding: 12px;
}

/* ---------------------------------------------------------------- 列表/表格 */
.list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.list-item {
  border: 1px solid var(--card-line); border-radius: var(--radius);
  padding: 8px 10px; display: flex; align-items: center; gap: 8px;
}
.list-item:hover { border-color: var(--accent); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; }
.list-item .meta { color: var(--text-dim); font-size: 0.88rem; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--card-line);
  padding: 6px 8px; text-align: left; font-size: 0.95rem;
}
table.grid th { color: var(--text-dim); font-weight: 600; }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--card-line); color: var(--text-dim); font-size: 0.82rem;
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.alarm { color: var(--alarm); border-color: var(--alarm); }


/* ---------------------------------------------------------------- 控件 */
.btn {
  background: transparent; color: var(--text);
  border: 1px solid var(--card-line); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; font-size: 0.95rem;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.toggle.on { background: var(--ok); border-color: var(--ok); color: #04121F; }
.btn.danger { border-color: var(--alarm); color: var(--alarm); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.sm { padding: 2px 8px; font-size: 0.85rem; }

.input, select.input, textarea.input {
  background: rgba(0, 0, 0, 0.22); color: var(--text);
  border: 1px solid var(--card-line); border-radius: 8px;
  padding: 5px 8px; font-size: 0.95rem; font-family: inherit;
  width: 100%;
}
html[data-theme="light"] .input { background: #FFFFFF; }
.input:focus { outline: none; border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.field-label { color: var(--text-dim); font-size: 0.9rem; }
.field-hint { color: var(--text-second); font-size: 0.82rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }

/* ---------------------------------------------------------------- 登录页 */
.login-wrap {
  /* 减去页脚高度，保证登录卡片垂直居中 + 页脚在首屏可见（备案信息必须在首页可见） */
  min-height: calc(100vh - 66px); display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(0, 229, 255, 0.10), transparent),
              radial-gradient(900px 500px at 85% 90%, rgba(179, 136, 255, 0.10), transparent),
              var(--bg);
}
.login-card { width: 380px; padding: 22px; }
.login-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 14px; }
.login-err { color: var(--alarm); font-size: 0.9rem; min-height: 1.2em; margin: 6px 0; }

/* ---------------------------------------------------------------- 页脚（备案 / 版权 / 所属单位）
   【2026-10-17 公安网安审核要求】每个页面都要能看到：所属单位 + 版权信息 + ICP 备案号
   （备案号是链接，点开跳工信部备案查询，这也是审核项之一）。文案在 js/app.js 的 siteFooter()。 */
.site-footer {
  flex: 0 0 auto;
  padding: 10px 18px 12px;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.75;
  color: var(--text-second);
  background: var(--bg-soft);
  border-top: 1px solid var(--card-line);
}
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 720px) {
  .site-footer { padding: 8px 10px 10px; font-size: 0.72rem; }
}

/* ---------------------------------------------------------------- 遥控页 */
.rc-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(380px, 1fr); gap: var(--gap); }
.video-frame {
  width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--card-line);
  border-radius: var(--radius); background: #000;
}
.video-placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--text-dim); padding: 16px;
}

.wheel-box { display: flex; align-items: center; gap: 14px; }
.wheel-dial {
  width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid var(--card-line); position: relative; flex: none;
}
.wheel-dial .spoke {
  position: absolute; left: 50%; top: 6px; width: 3px; height: 54px;
  background: var(--accent); transform-origin: 50% 54px; margin-left: -1.5px;
}
.wheel-angle { font-size: 2rem; font-weight: 700; color: var(--accent); }
.wheel-angle small { color: var(--text-dim); font-size: 0.9rem; font-weight: 400; }

.pedal-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pedal-row .label { width: 56px; color: var(--text-dim); font-size: 0.9rem; }
.bar { flex: 1; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 60ms linear; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.alarm > i { background: var(--alarm); }
.pedal-row .val { width: 64px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.tele-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tele-cell {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 6px 8px;
}
.tele-cell .k { color: var(--text-dim); font-size: 0.82rem; }
.tele-cell .v { font-size: 1.1rem; font-weight: 600; }
.tele-cell .v small { color: var(--text-dim); font-size: 0.75rem; }
.v-volt { color: #00E5FF; } .v-amp { color: #5BF0FF; } .v-mode { color: #FFB020; }
.v-prog { color: #00FFAA; } .v-imu { color: #B388FF; } .v-us { color: #FFA726; }
.v-laser { color: #FF7043; } .v-kpa { color: #4DD0C4; } .v-ok { color: #00FFAA; }
.v-bad { color: #FF4D4F; }

.key-hint { color: var(--text-dim); font-size: 0.88rem; line-height: 1.7; }
.key-hint kbd {
  border: 1px solid var(--card-line); border-radius: 5px;
  padding: 0 5px; margin-right: 3px; color: var(--text);
}

/* ---------------------------------------------------------------- 弹窗 */
.modal-back {
  position: fixed; inset: 0; background: rgba(2, 6, 18, 0.62);
  display: flex; align-items: center; justify-content: center; z-index: 60;
}
.modal {
  background: var(--bg-soft); border: 1px solid var(--card-line);
  border-radius: 12px; padding: 16px; min-width: 340px; max-width: min(760px, 94vw);
  max-height: 88vh; overflow: auto;
}
.modal-title { font-weight: 700; margin-bottom: 10px; }
.modal-body { margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

#wj-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--bg-soft); border: 1px solid var(--card-line);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 8px 12px; max-width: 380px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.alarm { border-left-color: var(--alarm); }
.toast.out { opacity: 0; transform: translateY(6px); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--card-line); border-radius: 999px;
  padding: 3px 12px; cursor: pointer; color: var(--text-dim);
}
.tab.on { border-color: var(--accent); color: var(--accent); }

.status-line { color: var(--text-dim); font-size: 0.9rem; }
.status-line .on { color: var(--ok); }
.status-line .off { color: var(--alarm); }

/* ============================================================================
   数据看板（顶栏 KPI 卡 + 底部图表区）—— 对应 kpi_card.cpp / chartwidgets.cpp
   ============================================================================ */

/* KPI 分组（资产规模 / 经济效益 / 双碳环保 / 设备健康度与预警）*/
.kpi-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi-group {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 8px 10px 10px;
}
.kpi-group-title {
  color: var(--text-dim); font-size: 0.85rem; font-weight: 600;
  margin-bottom: 6px; letter-spacing: 0.5px;
}
.kpi-cards { display: grid; grid-template-columns: 1fr; gap: 8px; }

/* 指标卡：玻璃拟态 + 左侧一道强调色微光 */
.kpi-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  border: 1px solid var(--card-line); border-radius: 10px;
  padding: 8px 10px;
}
.kpi-card::before {
  content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: var(--kpi-accent, var(--accent)); opacity: 0.85;
}
.kpi-card .col { min-width: 0; flex: 1; }
.kpi-card .k {
  color: var(--text-dim); font-size: 0.82rem;
  display: flex; align-items: center; gap: 6px;
}
.kpi-card .k::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--kpi-accent, var(--accent));
  box-shadow: 0 0 6px var(--kpi-accent, var(--accent));
  flex: none;
}
.kpi-card .v-row { display: flex; align-items: baseline; gap: 5px; }
.kpi-card .v {
  font-size: 1.5rem; font-weight: 700; color: var(--kpi-accent, var(--accent));
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.kpi-card .u { color: var(--text-dim); font-size: 0.82rem; }
.kpi-card .sub { color: var(--text-second); font-size: 0.78rem; margin-top: 2px; }
.kpi-card.has-ring .v-row { display: none; }
.kpi-card .ring-gauge { flex: none; }

/* 底部图表区：三张图并排 */
.chart-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.chart {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 6px 8px 4px;
  display: flex; flex-direction: column; min-width: 0;
}
.chart-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.chart-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.chart-sub { color: var(--text-second); font-size: 0.76rem; margin-left: auto; }
.chart-canvas { width: 100%; height: 148px; display: block; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1280px) {
  .kpi-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .split, .rc-grid, .split3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tele-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .kpi-groups { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================================
   机器姿态球 —— 对应 attitude_ball.cpp 的软件渲染卡片
   卡片底色固定深色（与桌面端一致：该控件在浅色主题下也保持深底 + 青蓝模型，
   否则青色网格线在浅色卡片上看不清）
   ============================================================================ */
.attitude-ball {
  position: relative; width: 100%; height: 330px;
  background: rgba(26, 34, 56, 0.94);
  border: 1px solid rgba(46, 110, 142, 0.63);
  border-radius: 10px; overflow: hidden;
  cursor: grab; touch-action: none; user-select: none;
}
.attitude-ball.dragging { cursor: grabbing; }
.attitude-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.attitude-title {
  position: absolute; left: 6px; top: 3px;
  font-size: 0.82rem; font-weight: 700; color: #E8F0FF;
  pointer-events: none;
}
.attitude-meta {
  position: absolute; left: 6px; right: 6px; bottom: 3px;
  font-size: 0.78rem; line-height: 1.35; pointer-events: none;
}
.attitude-rpy { color: #8FA3C8; }
.attitude-src {
  color: #5A6B8C; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================================
   现场作业实况 · 浮层小窗 —— 对应 live_window.cpp + live_placeholder.cpp
   宿主是 .map-wrap（position:relative），小窗绝对定位浮在地图上
   ============================================================================ */
.live-window {
  position: absolute; z-index: 30; display: flex; flex-direction: column;
  padding: 4px; gap: 4px;
  background: rgba(12, 19, 36, 0.94);
  border: 1px solid rgba(0, 229, 255, 0.55);
  border-radius: 10px; color: #E8F0FF;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}
.live-head {
  display: flex; align-items: center; gap: 6px; height: 24px;
  cursor: move; flex: none;
}
.live-head.dragging { cursor: grabbing; }
.live-title {
  flex: 1; min-width: 0; font-size: 0.82rem; font-weight: 700;
  color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-badge { font-size: 0.78rem; color: #8FA3C8; flex: none; }
.live-badge.on { color: var(--ok); }
.live-btn {
  flex: none; width: 26px; padding: 0; height: 20px;
  background: transparent; border: none; color: #8FA3C8;
  font-weight: 700; font-size: 0.82rem; font-family: inherit; cursor: pointer;
}
.live-btn:hover { color: var(--accent); }
.live-body {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  border-radius: 6px; background: #060C1C;
}
.live-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; background: #000; display: block;
}

/* —— 占位取景框（深色底 + 淡网格 + 扫描线 + 四角直角线 + 机位标签）—— */
.live-placeholder { position: absolute; inset: 0; overflow: hidden; }
.live-grid {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to bottom,
    rgba(0, 229, 255, 0.06) 0, rgba(0, 229, 255, 0.06) 1px, transparent 1px, transparent 24px);
}
.live-scan {
  position: absolute; left: 1px; right: 1px; height: 68px; top: -15%;
  background: linear-gradient(to bottom, rgba(0, 229, 255, 0) 0%,
    rgba(0, 229, 255, 0.18) 50%, rgba(0, 229, 255, 0) 100%);
  animation: live-scan 8s linear infinite;
}
.live-scan::after {
  content: ''; position: absolute; left: 5px; right: 5px; top: 50%;
  height: 1px; background: rgba(0, 229, 255, 0.59);
}
@keyframes live-scan {
  0%   { top: -15%; }   /* sy = -0.15h + phase · 1.30h（phase 0→1）*/
  100% { top: 115%; }
}
.live-corner {
  position: absolute; width: 8px; height: 8px;
  border-color: rgba(0, 229, 255, 0.82);
}
.live-corner.tl { left: 8px; top: 8px; border-left: 2px solid; border-top: 2px solid; }
.live-corner.tr { right: 8px; top: 8px; border-right: 2px solid; border-top: 2px solid; }
.live-corner.bl { left: 8px; bottom: 8px; border-left: 2px solid; border-bottom: 2px solid; }
.live-corner.br { right: 8px; bottom: 8px; border-right: 2px solid; border-bottom: 2px solid; }
.live-cam {
  position: absolute; left: 18px; top: 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: 0.74rem; color: var(--text-second);
}
.live-cam .rec {
  width: 8px; height: 8px; border-radius: 50%; background: var(--alarm);
  animation: live-blink 1.4s ease-in-out infinite;
}
@keyframes live-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.live-name {
  position: absolute; left: 20px; right: 20px; top: 42%;
  text-align: center; font-size: 1.4rem; font-weight: 700;
  letter-spacing: 2px; color: #E8F0FF;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-status {
  position: absolute; left: 20px; right: 20px; top: calc(42% + 2.1rem);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.88rem; color: var(--ok);
}
.live-status .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  animation: live-blink 1.4s ease-in-out infinite;
}
.live-foot {
  position: absolute; left: 12px; right: 12px; bottom: 6px;
  text-align: center; font-size: 0.72rem; color: var(--text-second);
}

/* ============================================================================
   遥控页右列 —— 结构对齐 mainwindow.cpp：
   机器姿态球 → 拉流控制 → 设备监控 → 方向盘/换挡器 → 踏板/手刹（竖条）
   ============================================================================ */
.rc-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.rc-cap {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.rc-hint { color: var(--text-second); font-size: 0.8rem; }
.rc-line { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.rc-line .k { color: var(--text-dim); font-size: 0.88rem; width: 76px; flex: none; }
.rc-line .v { font-size: 0.88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rc-url { display: flex; gap: 6px; }
.rc-url .input { flex: 1; min-width: 0; }

/* 方向盘 + 大号角度（对应 mainwindow.cpp 的 dash 行：左盘右数） */
.dash-row { display: flex; align-items: center; gap: 10px; }
.dash-row .wheel-box { flex: 1; }
.dash-angle { flex: 1; text-align: center; }
.dash-angle .num {
  font-size: 2.6rem; font-weight: 700; color: var(--accent); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.dash-angle .unit { color: var(--text-second); font-size: 0.82rem; }

.shift-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.shift-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* —— 竖条踏板（对应 pedal_bar.cpp：名称在上、竖条居中、百分比在条下、状态在底）—— */
.pedal-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pedal-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pedal-col .pname { font-size: 0.82rem; font-weight: 700; color: var(--text-dim); }
.pedal-col .slot {
  position: relative; width: 20px; height: 108px;
  border-radius: 10px; background: #1a2238; border: 1px solid #2a3654;
  overflow: hidden;
}
.pedal-col .slot > i {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  border-radius: 10px; background: var(--pedal, var(--accent));
  transition: height 60ms linear;
}
.pedal-col .pval {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pedal-col .pstate { font-size: 0.72rem; color: var(--text-second); }
/* 未连接：整条置灰 + 显示 --（与桌面端 setConnected(false) 一致） */
.pedal-col.off .slot > i { background: #5a5c64; }
.pedal-col.off .pname,
.pedal-col.off .pval { color: var(--text-second); }



/* ============================================================================
   屏幕方向键 —— 网页端增强（手机 / 平板没有实体键盘，按住屏幕按钮即可遥控）
   与键盘遥控共用同一套按键状态：按住 = 持续（20Hz 循环），松开 = 立即归零
   ============================================================================ */
.touch-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  max-width: 420px;
}
.touch-btn {
  min-height: 62px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius);
  touch-action: none;                       /* 长按不滚动页面、不触发双击缩放 */
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn.up { grid-area: 1 / 2 / 2 / 3; }
.touch-btn.left { grid-area: 2 / 1 / 3 / 2; }
.touch-btn.stop { grid-area: 2 / 2 / 3 / 3; }
.touch-btn.right { grid-area: 2 / 3 / 3 / 4; }
.touch-btn.down { grid-area: 3 / 2 / 4 / 3; }
.touch-btn.stop {
  border-color: var(--alarm); color: var(--alarm); font-weight: 700;
  background: rgba(255, 77, 79, 0.14);
}
.touch-btn.active,
.touch-btn.active:hover {
  background: var(--accent); border-color: var(--accent); color: #06121F;
}
.touch-btn.stop.active,
.touch-btn.stop.active:hover {
  background: var(--alarm); border-color: var(--alarm); color: #FFFFFF;
}
/* 触屏设备把按钮做大一些（手指比鼠标指针粗） */
@media (pointer: coarse) {
  .touch-btn { min-height: 78px; font-size: 1.15rem; }
}
@media (max-width: 1080px) {
  /* 手机上把触屏按钮提到右列最前：打开遥控页就能按，不用先滚到底 */
  .rc-col > .touch-card { order: -1; }
  .touch-pad { max-width: none; }
}


/* ---------------------------------------------------------------- 视频 OSD 叠加层
   对应桌面端 VideoOsd：视频画面上叠一层「转向指示线 + 右上状态板 + 左上小地图」。
   颜色全部走主题变量 → 深色 / 高对比 / 浅色三档自动适配。
   关键：叠加层本身 pointer-events:none（不吃鼠标），只有小地图卡片与放大面板
   恢复 auto —— 等价于桌面端的 WA_TransparentForMouseEvents + 事件过滤器，
   视频播放页自己的按钮照旧可点。 */
.hidden { display: none !important; }
.video-stage { position: relative; }

.osd {
  position: absolute; inset: 0; z-index: 60; overflow: hidden;
  pointer-events: none; font-size: 0.82rem; line-height: 1.45;
}

/* —— 中央：随转向角倾斜的指示横线（+ 贯穿画面的虚线参照 + 读数条）—— */
.osd-steer { position: absolute; inset: 0; }
.osd-steer-ref {
  position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px dashed rgba(255, 255, 255, 0.26);
}
.osd-steer-line {
  position: absolute; left: 50%; top: 50%; height: 3px; border-radius: 2px;
  background: var(--accent); width: 200px; /* 宽度由 JS 按画面尺寸算出 */
}
.osd-steer-readout {
  position: absolute; transform: translate(-50%, -50%);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--card-line);
  color: var(--accent); font-variant-numeric: tabular-nums; font-size: 0.78rem;
}

/* —— 右上角：机器状态板 —— */
.osd-status {
  position: absolute; right: 10px; top: 10px; min-width: 178px; max-width: 48%;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: 8px; padding: 6px 8px;
}
.osd-status-head {
  display: flex; justify-content: space-between; gap: 10px;
  color: var(--accent); font-weight: 600;
  border-bottom: 1px solid var(--card-line);
  padding-bottom: 4px; margin-bottom: 4px;
}
.osd-status-id { color: var(--text-dim); font-weight: 400; font-size: 0.78rem; }
.osd-status-row { display: flex; justify-content: space-between; gap: 12px; }
.osd-status-row .k { color: var(--text-dim); }
.osd-status-row .v { font-variant-numeric: tabular-nums; }

/* —— 左上角：小地图卡片（点一下放大）—— */
.osd-map {
  position: absolute; left: 10px; top: 10px; width: 232px; cursor: pointer;
  pointer-events: auto;                                  /* 只有它能吃点击 */
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: 8px; overflow: hidden;
}
.osd-map:hover { border-color: var(--accent); }
.osd-map-head {
  display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px;
  border-bottom: 1px solid var(--card-line); color: var(--text-second);
  font-size: 0.78rem;
}
.osd-map-stat { color: var(--accent); }
.osd-map-stat.bad { color: var(--warn); }
.osd-map-body {
  position: relative; height: 146px;
  /* 瓦片没到之前（或断网）显示网格底，位置与轨迹依然可读 */
  background: rgba(10, 17, 40, 0.55);
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.10) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
}
.osd-leaflet, .osd-leaflet-big { position: absolute; inset: 0; }
/* leaflet.css 默认给容器铺了 #ddd 底，会盖住上面的网格底 */
.osd-leaflet.leaflet-container, .osd-leaflet-big.leaflet-container { background: transparent; }

/* 【小地图要跟地图页一个观感】高德瓦片本身是**浅色**的，地图页靠 assets/map-tiles.css 里
 * 那条 `.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) … }` 把整层转成暗黑底图。
 * 遥控页的叠加层是懒加载 Leaflet 的（见 js/osd.js ensureLeaflet），**没有**加载 map-tiles.css
 * → 小地图会露出浅色瓦片，看着像一块白底卡片（现场反馈过）。
 * 这里只把那条滤镜规则按 OSD 作用域补上：
 *   · 不整体引入 map-tiles.css —— 它还有 html/body 的布局与字体规则，后加载会覆盖 app.css；
 *   · 浅色办公主题下照旧用原色瓦片（与地图页 body.map-light 的行为一致）。 */
.osd-leaflet .leaflet-tile-pane,
.osd-leaflet-big .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.90) saturate(0.72);
}
/* 【对齐客户端】没定位时不显示瓦片：只留占位网格 + 「等待定位」
 *   （客户端的 video_minimap.cpp 就是 if (hasFix_) 才画瓦片；否则画占位网格）
 *   否则网页端会先露出一张"中国全景 + 超大号地名"，看着像"地图位置不对"。 */
.osd-map.no-fix .leaflet-tile-pane,
.osd-map-body.offline .leaflet-tile-pane {
    display: none;
}
html[data-theme="light"] .osd-leaflet .leaflet-tile-pane,
html[data-theme="light"] .osd-leaflet-big .leaflet-tile-pane {
    filter: none;
}
.osd-map-wait {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.78rem;
}
.osd-map-zoom { position: absolute; right: 6px; top: 3px; color: var(--text-dim); font-size: 0.72rem; }
.osd-map-magnifier {
  position: absolute; right: 6px; bottom: 4px; font-size: 0.78rem; opacity: 0.85;
}
.osd-map-foot {
  display: flex; justify-content: space-between; gap: 8px; padding: 2px 8px;
  color: var(--text-dim); font-size: 0.72rem; font-variant-numeric: tabular-nums;
}
.osd-map-addr {
  padding: 0 8px 5px; color: var(--text-second); font-size: 0.72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* —— 机器位置点：青色箭头（航向），与桌面端同一观感 —— */
.osd-robot { background: none; border: none; }
.osd-robot i {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  margin: -6px 0 0 -6px; transform-origin: 50% 50%;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 12px solid var(--accent);
  filter: drop-shadow(0 0 3px var(--accent));
}

/* —— 放大查看面板（盖在画面上，四周留边）—— */
.osd-big {
  position: absolute; inset: 3%; pointer-events: auto;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--accent); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.osd-big-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 8px; border-bottom: 1px solid var(--card-line); color: var(--accent);
}
.osd-big-btns { display: flex; gap: 6px; }
.osd-btn {
  width: 26px; height: 22px; line-height: 1; cursor: pointer;
  background: transparent; border: 1px solid var(--card-line);
  color: var(--text-second); border-radius: 6px; pointer-events: auto;
}
.osd-btn:hover { border-color: var(--accent); color: var(--accent); }
.osd-big-body { position: relative; flex: 1; min-height: 120px; }
.osd-big-hint {
  padding: 2px 8px; border-top: 1px solid var(--card-line);
  color: var(--text-dim); font-size: 0.74rem;
}

/* 窄屏（手机 / 平板竖屏）：小地图卡片收窄，别把画面挡太多 */
@media (max-width: 560px) {
  .osd-map { width: 168px; }
  .osd-map-body { height: 112px; }
  .osd-status { min-width: 0; max-width: 62%; font-size: 0.76rem; }
}

