* { box-sizing: border-box; }
:root {
  --bg: #0b0d10; --panel: #12161b; --line: #2a323a;
  --text: #edf1f4; --muted: #8b969f; --accent: #9be8d2;
}
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; }
body { min-width: 320px; }
.app { max-width: 1680px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 48px) 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; letter-spacing: .22em; }
h1 { margin: 0; font-size: clamp(27px, 3vw, 42px); letter-spacing: .1em; font-weight: 600; }
h1 span { color: var(--accent); font-weight: 300; }
.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.status-wrap { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #67717a; }
.status-dot.active { background: var(--accent); box-shadow: 0 0 12px #9be8d288; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; padding-top: 22px; align-items: start; }
.canvas-shell { position: relative; overflow: auto; height: min(76vh, 880px); min-height: 420px; border: 1px solid var(--line); background: #080a0c; scrollbar-color: #37424b #0b0d10; }
#gridCanvas { display: block; width: 2000px; height: 2000px; max-width: none; }
.canvas-label { position: sticky; left: 14px; bottom: 12px; display: inline-flex; gap: 14px; margin: 12px; padding: 8px 10px; background: #101519dd; border: 1px solid #28333a; color: #b9c5cb; font-size: 9px; letter-spacing: .12em; pointer-events: none; }
.canvas-label span { color: var(--accent); }
.side-panel { display: flex; flex-direction: column; gap: 14px; }
.camera-card, .control-card { background: var(--panel); border: 1px solid var(--line); padding: 14px; }
.card-heading { display: flex; justify-content: space-between; color: #d9e0e4; font-size: 10px; letter-spacing: .15em; margin-bottom: 12px; }
.live-mark { color: var(--accent); }
.video-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #080a0c; border: 1px solid #263139; }
#camera, #cameraOverlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#camera { opacity: .82; }
#cameraOverlay { pointer-events: none; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: #69747d; text-align: center; font-size: 11px; }
.camera-placeholder.hidden { display: none; }
.hint { color: var(--muted); font-size: 10px; line-height: 1.7; margin: 10px 0 0; }
.control-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #242b31; font-size: 11px; color: #aab4bb; }
.value { color: var(--accent); text-align: right; }
input[type="range"] { width: 100%; margin: 14px 0 18px; accent-color: var(--accent); }
.buttons { display: flex; gap: 8px; }
button { flex: 1; padding: 11px 8px; border: 1px solid #38434b; background: transparent; color: var(--text); font-size: 11px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b1513; font-weight: 600; }
button:disabled { opacity: .55; cursor: wait; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 2px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 14px; height: 1px; background: #60717b; }
.legend i.legend-face { background: var(--accent); }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); color: #647078; font-size: 9px; letter-spacing: .08em; }
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legend { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .side-panel { display: flex; }
  footer { flex-direction: column; }
}
