:root {
  --cyan:    #00ffcc;
  --magenta: #dd00ff;
  --yellow:  #ffdd00;
  --orange:  #ff8800;
  --red:     #ff2255;
  --bg:      #09090f;
  --panel:   #0d0d1a;
  --border:  #1e1e3a;
  --text:    #c0c8e8;
  --dim:     #5060a0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  width: 1160px;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0,255,200,0.07), 0 0 100px rgba(0,0,0,0.8);
}

#canvas-container { flex: 0 0 860px; background: #09090f; }
#canvas-container canvas { display: block; }

/* ── Panneau latéral ── */
#ui-panel {
  flex: 1;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Titre ── */
.title { text-align: center; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.title h1 {
  font-size: 20px; letter-spacing: 5px; line-height: 1;
  color: var(--cyan); text-shadow: 0 0 14px var(--cyan);
}
.title h1 span { color: var(--red); text-shadow: 0 0 14px var(--red); }
.title p { font-size: 8px; letter-spacing: 3px; color: var(--dim); margin-top: 3px; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.stat-box {
  background: #12122a; border: 1px solid var(--border); border-radius: 4px; padding: 5px 8px;
}
.stat-box .lbl { font-size: 8px; color: var(--dim); letter-spacing: 1px; display: block; }
.stat-box .val { font-size: 15px; font-weight: bold; color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.stat-box.wide  { grid-column: 1 / -1; }
.stat-box.green .val  { color: #44ff88; text-shadow: 0 0 8px #44ff88; }
.stat-box.yellow .val { color: var(--yellow); text-shadow: 0 0 8px var(--yellow); }
.stat-box.orange .val { color: var(--orange); text-shadow: 0 0 8px var(--orange); }

/* ── Sections ── */
.sec { font-size: 8px; letter-spacing: 2px; color: var(--dim); border-top: 1px solid var(--border); padding-top: 7px; }

/* ── Légende contrôles ── */
.ctrl-legend { display: flex; flex-direction: column; gap: 4px; }
.ctrl-row { display: flex; align-items: center; gap: 7px; font-size: 9px; }
.ctrl-icon { font-size: 14px; width: 20px; text-align: center; }
.ctrl-label { color: var(--text); }
.ctrl-key { font-size: 8px; color: var(--dim); margin-left: auto; }

/* ── Boutons ── */
.btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
button {
  font-family: 'Courier New', monospace; font-size: 9px;
  letter-spacing: 1.5px; padding: 7px 4px; border-radius: 4px;
  cursor: pointer; border: 1px solid var(--border); transition: all 0.15s;
}
.btn-primary  { background: rgba(0,255,200,0.12); color: var(--cyan);  border-color: var(--cyan); }
.btn-primary:hover  { background: rgba(0,255,200,0.22); box-shadow: 0 0 10px rgba(0,255,200,0.3); }
.btn-secondary { background: rgba(200,200,255,0.06); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(200,200,255,0.12); }
.btn-active { background: rgba(220,0,255,0.14) !important; color: var(--magenta) !important; border-color: var(--magenta) !important; }

/* ── Webcam ── */
#webcam-wrapper { position: relative; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); background: #000; display: none; max-width: 270px; }
#webcam-wrapper.visible { display: block; }
#webcam { width: 100%; height: auto; display: block; transform: scaleX(-1); }
#pose-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: scaleX(-1); }
#btn-stop-cam {
  position: absolute; top: 4px; right: 4px; z-index: 10;
  width: 22px; height: 22px; padding: 0;
  background: rgba(200,0,40,0.75); border: 1px solid rgba(255,50,80,0.9);
  color: #fff; font-size: 11px; border-radius: 3px; cursor: pointer;
  letter-spacing: 0; font-family: monospace;
}

#face-status { font-size: 9px; color: var(--dim); text-align: center; min-height: 13px; }

.bright-ctrl {
  display: flex; align-items: center; gap: 6px;
  font-size: 8px; color: var(--dim); padding: 2px 4px;
}
.bright-lbl { letter-spacing: 1px; }
#brightness-slider {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right, #1e1e3a, #00ffcc); border-radius: 2px; outline: none;
}
#brightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 6px rgba(0,255,200,0.8);
}
#brightness-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); border: none; cursor: pointer;
}
#brightness-value { color: var(--cyan); min-width: 26px; text-align: right; }
