:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel2: #223050;
  --text: #e8edf7;
  --muted: #8a97b0;
  --accent: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  min-height: 100vh;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid #2a3652;
}
header h1 { font-size: 17px; font-weight: 600; }
header .status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.dot.on { background: var(--green); }

/* 顶部警示条（非安全上下文 / 常见错误提示） */
.warn {
  display: none;
  margin: 14px 22px 0;
  padding: 11px 15px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .5);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
}
.warn.show { display: block; }
.warn code {
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.warn .warn-tip { color: var(--muted); }

main { display: flex; gap: 18px; padding: 18px 22px; max-width: 1400px; margin: 0 auto; flex-wrap: wrap; }

.sidebar {
  flex: 0 0 280px;
  background: var(--panel);
  border-radius: 10px;
  padding: 16px;
  min-height: 300px;
}
.sidebar h2 { font-size: 14px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel2);
  margin-bottom: 8px;
  font-size: 14px;
}
.device-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-item button {
  background: var(--accent);
  border: none; color: #fff;
  padding: 5px 12px; border-radius: 6px;
  cursor: pointer; font-size: 13px; flex-shrink: 0;
}
.device-item button:hover { filter: brightness(1.15); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 0; }

.stage { flex: 1 1 500px; min-width: 320px; }
.video-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
video { width: 100%; height: 100%; object-fit: contain; display: block; }
.placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; flex-direction: column; gap: 8px;
  cursor: pointer;
}
.video-toolbar {
  display: flex; gap: 10px; margin-top: 12px; align-items: center;
  font-size: 13px; color: var(--muted);
}
.video-toolbar button {
  background: var(--panel2); color: var(--text);
  border: 1px solid #2a3652; padding: 7px 16px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.video-toolbar button:hover { border-color: var(--accent); }
.video-toolbar button.danger { border-color: var(--red); color: #fca5a5; }
.conn-state { margin-left: auto; }
.conn-state .ok { color: var(--green); }
.conn-state .bad { color: var(--red); }

/* camera.html */
.cam-form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.cam-form label { font-size: 13px; color: var(--muted); }
.cam-form input {
  background: var(--panel2); border: 1px solid #2a3652; color: var(--text);
  padding: 9px 12px; border-radius: 6px; font-size: 14px; outline: none;
}
.cam-form input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 18px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.log {
  margin-top: 14px; font-size: 12px; color: var(--muted);
  background: var(--panel); border-radius: 8px; padding: 10px 12px;
  max-height: 150px; overflow-y: auto; line-height: 1.7;
}
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel2); color: var(--muted);
}
.badge.green { color: var(--green); }
/* 版本号：用于确认浏览器加载的是不是最新页面（排查缓存问题） */
.ver {
  font-size: 11px; color: var(--muted); font-weight: 400;
  background: var(--panel2); padding: 2px 7px; border-radius: 4px;
  vertical-align: middle; margin-left: 6px;
}
