:root {
  --bg: #0e0e10; --surface: #18181b; --border: #2d2d33;
  --text: #efeff1; --dim: #898991; --accent: #6d5bff;
  --accent2: #9147ff; --green: #00c853; --red: #f44;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
  user-select: none;
}
header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
header h1 { font-size: 16px; font-weight: 600; }
#header-cast-btn { margin-left: auto; }
#status-bar {
  display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 12px; color: var(--dim);
}
#status-bar .val { color: var(--text); font-variant-numeric: tabular-nums; }
#header-stop-btn { margin-left: 8px; padding: 4px 14px; font-size: 12px; }
#status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  align-self: center;
}
#status-dot.ok { background: var(--green); }
.main { display: flex; flex: 1; overflow: hidden; }
.video-pane {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #000; position: relative; min-width: 0;
}
#live-frame {
  max-width: 100%; max-height: 100%; object-fit: contain;
  image-rendering: auto;
}
#crosshair {
  position: absolute; pointer-events: none;
  width: 24px; height: 24px;
  border: 2px solid rgba(255,255,255,0.4); border-radius: 50%;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  display: none;
}
#crosshair::before, #crosshair::after {
  content: ''; position: absolute; background: rgba(255,255,255,0.4);
}
#crosshair::before { width: 1px; height: 8px; top: 50%; left: 50%; transform: translate(-50%,-50%); }
#crosshair::after { width: 8px; height: 1px; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--surface);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto;
}
.panel { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.panel h2 {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); margin-bottom: 6px;
}
button {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 5px 10px; font-size: 11px; cursor: pointer; font-weight: 500;
  transition: opacity .15s;
}
button:hover { opacity: .85; }
button:active { opacity: .7; }
button.secondary { background: var(--border); }
button.danger { background: var(--red); }
.btn-row { display: flex; gap: 4px; }
.speed-row {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 10px; color: var(--dim);
}
.speed-row input {
  width: 44px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px;
  font-size: 10px; text-align: center;
}
.pose-readout {
  font-size: 10px; font-family: monospace; line-height: 1.5; color: var(--dim);
  margin-bottom: 6px;
}
.pose-readout span { display: block; }
.pose-readout .val { color: var(--text); }
.keybind-hint {
  font-size: 10px; color: var(--dim); line-height: 1.6;
}
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 16px; font-size: 13px; opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; }
#drag-overlay {
  position: absolute; inset: 0; cursor: grab; z-index: 2;
}
#drag-overlay:active { cursor: grabbing; }
.video-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.video-placeholder button {
  font-size: 16px; padding: 12px 28px; border-radius: 8px;
}
