/* 手机 / 平板简洁版专用样式：不依赖桌面 app.css，避免两套布局互相干扰 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --ok: #16a34a;
  --ok-soft: #e8f5ee;
  --off: #94a3b8;
  --ink: #172033;
  --ink-2: #4a556b;
  --muted: #8492a8;
  --line: #e3e9f2;
  --bg: #f5f7fb;
  --card: #fff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.m-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(12px);
}
.m-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 品牌 logo：白底托住红色标志，镂空处始终显示为白色 */
.m-logo {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #e2e8f5; padding: 3px;
  box-shadow: 0 2px 8px rgba(37,99,235,.10);
}
.m-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.m-brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.m-brand-txt strong { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-brand-txt em { font-style: normal; font-size: 11px; color: var(--muted); }

.m-link {
  border: 0; background: transparent; color: var(--primary);
  font-size: 13px; font-weight: 600; padding: 8px 6px; min-height: 36px;
  text-decoration: none; white-space: nowrap;
}
.m-link:active { opacity: .6; }
.m-muted { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.m-note { color: var(--muted); font-size: 12px; text-align: center; margin: 14px 0 0; line-height: 1.6; }

.m-view { max-width: 760px; margin: 0 auto; padding: 16px 14px 8px; }

/* ------- 登录：红色品牌封面 + 悬浮卡片 ------- */
.m-login-hero {
  position: relative; overflow: hidden;
  margin: 14px auto 0; padding: 26px 18px 48px;
  border-radius: 22px; text-align: center;
  background: linear-gradient(158deg, #1d4ed8 0%, #2563eb 56%, #3b82f6 100%);
  box-shadow: 0 16px 32px -20px rgba(29,78,216,.8);
}
.m-login-glow {
  position: absolute; width: 240px; height: 240px; right: -90px; top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.28), rgba(255,255,255,0) 68%);
}
.m-login-badge {
  position: relative;
  width: 76px; height: 76px; margin: 0 auto 14px;
  padding: 8px; border-radius: 22px; background: #fff;
  box-shadow: 0 10px 22px rgba(13,46,110,.24);
}
.m-login-badge img { width: 100%; height: 100%; object-fit: contain; display: block; }
.m-login-hero strong {
  position: relative; display: block;
  color: #fff; font-size: 21px; font-weight: 700; letter-spacing: .5px;
}
.m-login-hero span {
  position: relative; display: block; margin-top: 7px;
  color: rgba(255,255,255,.84); font-size: 12px;
}
.m-login-card {
  position: relative; z-index: 2;
  margin: -26px auto 0; padding: 26px 20px 20px;
  max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 20px 46px -24px rgba(23,32,51,.45);
}
.m-login-card h2 { font-size: 20px; margin: 0; font-weight: 700; padding-left: 12px; position: relative; }
.m-login-card h2::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 4px; border-radius: 4px; background: var(--primary);
}
.m-field { display: block; margin-top: 18px; }
.m-field span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.m-field input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 11px; background: #fbfcff;
  color: var(--ink); outline: none; font-size: 15px;
}
.m-field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(212,25,29,.12); }
.m-error { min-height: 0; color: #b91c1c; font-size: 12.5px; margin-top: 12px; white-space: pre-line; }
.m-error:empty { display: none; }
.m-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 15px; font-weight: 600;
}
.m-btn.primary {
  width: 100%; margin-top: 6px; height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #2563eb; color: #fff;
  letter-spacing: 3px; border-radius: 12px;
  box-shadow: 0 10px 22px -10px rgba(37,99,235,.55);
}
.m-btn:active { transform: translateY(.5px); }
.m-btn[disabled] { opacity: .55; }

/* ------- 概览 / 搜索 ------- */
.m-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px;
}
.m-sum {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.m-sum b { display: block; font-size: 21px; font-weight: 700; line-height: 1.2; }
.m-sum b.ok { color: var(--ok); }
.m-sum b.down { color: #dc2626; font-size: 14px; }
.m-sum span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.m-search {
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  color: var(--muted); margin-bottom: 12px;
}
.m-search input { flex: 1; min-width: 0; height: 42px; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 14px; }

/* ------- 设备卡片 ------- */
.m-cards { display: flex; flex-direction: column; gap: 10px; }
.m-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; color: inherit;
}
.m-card:active { background: #f7faff; }
.m-card.off { opacity: .72; }
.m-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--off); }
.m-dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(22,163,74,.14); }
.m-card-main { flex: 1; min-width: 0; }
.m-card-name { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: #f1f3f6; color: var(--muted); flex: 0 0 auto; }
.m-pill.on { background: var(--ok-soft); color: #15803d; }
.m-arrow { color: #c3ccda; font-size: 19px; flex: 0 0 auto; line-height: 1; }
.m-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 46px 12px; }

/* ------- 画面 ------- */
.m-pv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.m-pv-head strong { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-pv-state { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.m-stage {
  position: relative; width: 100%; height: min(58vh, 480px);
  background: #0b1220; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.m-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.m-pv-tip {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  padding: 8px 12px; border-radius: 10px; text-align: center;
  background: rgba(8,15,28,.72); color: #e7edf8; font-size: 12px;
}

/* 画中画小窗：主画面（屏幕 / 摄像头）之外再叠一路，点小窗主副互换 */
.m-pip {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  width: 33%; min-width: 92px; max-width: 150px; aspect-ratio: 4 / 3;
  overflow: hidden; border-radius: 10px; cursor: pointer;
  border: 2px solid rgba(255,255,255,.55); background: #0b1220;
  box-shadow: 0 8px 20px rgba(2,6,23,.55);
}
.m-pip[hidden] { display: none; }
.m-pip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-pip-tag {
  position: absolute; left: 6px; top: 6px; padding: 1px 7px; border-radius: 999px;
  background: rgba(15,23,42,.82); color: #dbeafe; font-size: 10px; font-weight: 600;
  pointer-events: none;
}
.m-pip-tip {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px;
  background: rgba(15,23,42,.7); color: #cbd5e1; font-size: 10px; pointer-events: none;
}
.m-pv-tabs {
  display: flex; gap: 6px; margin: 12px auto 0; padding: 4px;
  background: #e9eef7; border-radius: 12px; max-width: 320px;
}
.m-pv-tabs button {
  flex: 1; min-height: 38px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.m-pv-tabs button.active { background: #fff; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(23,32,51,.09); }

.m-footer {
  max-width: 760px; margin: 0 auto; padding: 18px 14px calc(22px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); font-size: 12px;
}
.m-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ------- 列表页广播入口 ------- */
.m-toolrow { margin-bottom: 12px; }
.m-tool {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.m-tool svg { color: var(--primary); flex: 0 0 auto; }
.m-tool:active { background: #f7faff; }
.m-tool em {
  font-style: normal; font-size: 11px; font-weight: 700; color: #fff;
  background: #dc2626; border-radius: 20px; padding: 2px 8px;
}
.m-btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.m-btn.block { width: 100%; }
.m-btn.ghost { background: #f4f7fc; }

/* ------- 画面页四宫格操作条 ------- */
.m-qrow {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-size: 13px; color: var(--ink-2);
}
.m-qrow span { flex: none; font-weight: 600; }
.m-qrow select {
  flex: 1; height: 38px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); font-size: 13.5px;
}
.m-qrow select:focus { outline: none; border-color: var(--primary); }
.m-qrow select:disabled { opacity: .55; }

.m-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 8px; margin-top: 14px; }
.m-tools button {
  min-height: 52px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.m-tools button:active { background: #f2f6ff; }
.m-tools button.danger { color: #b91c1c; border-color: #f2d5d5; background: #fff7f7; }
.m-tools button.on { background: #dc2626; border-color: #dc2626; color: #fff; }
.m-tools button[disabled] { opacity: .45; }
.m-recbar {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 12px;
  border-radius: 11px; background: #fef2f2; color: #b91c1c; font-size: 12px;
}
.m-recbar i { width: 9px; height: 9px; border-radius: 50%; background: #dc2626; animation: m-blink 1.1s infinite; }
.m-recbar #recTime { font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes m-blink { 50% { opacity: .25; } }

/* ------- 通用底部弹层 ------- */
.m-mask { position: fixed; inset: 0; background: rgba(12,20,36,.45); z-index: 40; }
.m-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 760px; margin: 0 auto; max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 50px -22px rgba(23,32,51,.45);
}
.m-sheet-head {
  position: sticky; top: 0; z-index: 2; background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px; border-bottom: 1px solid var(--line);
}
.m-sheet-head strong { font-size: 16px; }
.m-sheet-body { padding-top: 14px; }
.m-sheet-body p { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.m-sheet-body b { color: var(--ink); }
.m-sheet-acts { display: flex; gap: 10px; margin-top: 14px; }
.m-sheet-acts .m-btn { flex: 1; }

.m-modes { display: flex; gap: 6px; padding: 4px; background: #e9eef7; border-radius: 11px; margin-bottom: 12px; }
.m-modes button {
  flex: 1; min-height: 38px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.m-modes button.active { background: #fff; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(23,32,51,.09); }
.m-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.m-file {
  display: block; width: 100%; padding: 11px 12px; margin-bottom: 12px;
  border: 1px dashed var(--line); border-radius: 11px; background: #fbfcff; font-size: 13px;
}
.m-bc-devs { max-height: 34vh; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.m-bc-dev {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.m-bc-dev:last-child { border-bottom: 0; }
.m-bc-dev input { width: 18px; height: 18px; accent-color: var(--primary); flex: 0 0 18px; }
.m-bc-dev span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-bc-dev small { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.m-bc-dev.off { opacity: .5; }
.m-status {
  margin-top: 12px; padding: 10px 12px; border-radius: 11px;
  background: #f4f7fc; color: var(--ink-2); font-size: 12.5px; line-height: 1.55;
}
.m-status.live { background: #fef2f2; color: #b91c1c; font-weight: 600; }
.m-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 14px; }
.m-presets button {
  min-height: 40px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600;
}
.m-presets button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.m-media-preview {
  display: block; width: 100%; max-height: 56vh; object-fit: contain;
  background: #0b1220; border-radius: 12px; margin-bottom: 12px;
}
.m-warn { color: #b91c1c !important; font-size: 12px !important; }

@media (min-width: 600px) {
  .m-view { padding: 20px 20px 8px; }
  .m-login-card { padding: 30px 28px 26px; }
  .m-card { padding: 16px 18px; }
  .m-stage { height: min(60vh, 540px); }
  .m-tools button { min-height: 58px; }
  .m-sheet { border-radius: 20px 20px 0 0; }
}
