/* ─── Reset & variables ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #07050f;
  --surface:     #0e0b1a;
  --panel-bg:    rgba(7, 5, 20, 0.88);
  --border:      rgba(180, 77, 255, 0.15);

  --neon-pink:   #ff2d78;
  --neon-cyan:   #00ffe0;
  --neon-violet: #b44dff;
  --neon-yellow: #ffe600;

  --glow-pink:   rgba(255, 45, 120, 0.5);
  --glow-cyan:   rgba(0, 255, 224, 0.45);
  --glow-violet: rgba(180, 77, 255, 0.45);

  /* legacy aliases kept for older rules */
  --accent-violet: #b44dff;
  --accent-cyan:   #00ffe0;
  --accent-glow-v: rgba(180, 77, 255, 0.45);
  --accent-glow-c: rgba(0, 255, 224, 0.45);

  --text-primary:   #e8e0ff;
  --text-secondary: #9b8ec4;
  --text-dim:       #4a3f6b;

  --radius: 12px;
  --panel-height: 180px;
  --header-height: 52px;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ─── Splash screen ─────────────────────────────────────────────────────── */

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%,   rgba(180,77,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(0,255,224,0.08)  0%, transparent 60%),
    #07050f;
  backdrop-filter: blur(4px);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-card {
  max-width: 540px;
  width: calc(100% - 32px);
  padding: 0;
  background: rgba(10, 7, 22, 0.96);
  border: 1px solid transparent;
  border-radius: 4px;
  background-clip: padding-box;
  outline: 1px solid rgba(180,77,255,0.25);
  outline-offset: 0px;
  box-shadow:
    0 0 0 1px rgba(0,255,224,0.08),
    0 0 60px rgba(180,77,255,0.2),
    0 0 120px rgba(0,255,224,0.06),
    inset 0 0 40px rgba(180,77,255,0.04);
  overflow: hidden;
}

/* Ligne décorative haut de carte */
.splash-scanline-top {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--neon-violet) 30%,
    var(--neon-cyan) 60%,
    transparent 100%);
  box-shadow: 0 0 12px var(--glow-cyan);
  margin-bottom: 4px;
}

/* Contenu intro */
#splash-intro {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px 32px 28px;
}

/* Système tag */
.splash-sys {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
  font-family: 'Courier New', monospace;
  text-align: center;
  margin-bottom: -8px;
}

/* Titre */
.splash-card h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: 0.08em;
  text-align: center;
  background: linear-gradient(135deg,
    var(--neon-violet) 0%,
    var(--neon-cyan)   50%,
    var(--neon-pink)   100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0,255,224,0.4));
  font-family: 'Courier New', monospace;
}

.splash-card h1 span {
  font-size: 0.55em;
  letter-spacing: 0.3em;
  display: block;
  opacity: 0.85;
}

.splash-sub {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  letter-spacing: 0.05em;
}

/* Conseil distance */
.splash-distance {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(0,255,224,0.04);
  border: 1px solid rgba(0,255,224,0.2);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(0,255,224,0.06), inset 0 0 8px rgba(0,255,224,0.03);
}

.splash-distance-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.splash-distance-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.splash-distance-text strong {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.splash-distance-text span {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Instructions */
.splash-instructions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.splash-instructions li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  background: rgba(180,77,255,0.04);
  border: 1px solid rgba(180,77,255,0.15);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.splash-instructions li:hover {
  border-color: rgba(0,255,224,0.3);
  box-shadow: 0 0 10px rgba(0,255,224,0.06);
}

.splash-shortcuts {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0 0;
}

.splash-shortcut {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid rgba(0, 255, 224, 0.3);
  border-radius: 4px;
  background: rgba(0, 255, 224, 0.06);
  color: var(--neon-cyan);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* Tag DROITE / GAUCHE / DOIGTS */
.splash-tag {
  font-size: 8px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.12em;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--glow-pink);
  border: 1px solid rgba(255,45,120,0.4);
  border-radius: 2px;
  padding: 2px 6px;
  flex-shrink: 0;
  width: 52px;
  text-align: center;
  white-space: nowrap;
}

.splash-instructions li strong {
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--glow-cyan);
}

/* Bouton INITIALISER */
.btn-large {
  position: relative;
  padding: 14px 48px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.2em;
  border-radius: 3px;
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--neon-cyan);
  background: transparent;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--glow-cyan);
  box-shadow: 0 0 20px var(--glow-cyan), inset 0 0 20px rgba(0,255,224,0.06);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-large:hover:not(:disabled) {
  background: rgba(0,255,224,0.08);
  box-shadow: 0 0 40px var(--glow-cyan), inset 0 0 20px rgba(0,255,224,0.12);
  letter-spacing: 0.25em;
}

.btn-large:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scanlines animées sur le bouton */
.btn-glow {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,255,224,0.03) 2px,
    rgba(0,255,224,0.03) 4px
  );
  pointer-events: none;
}

.splash-error {
  font-size: 12px;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--glow-pink);
  text-align: center;
  font-family: 'Courier New', monospace;
}

.splash-note {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
  margin-top: -8px;
}

/* ─── Loading screen ─────────────────────────────────────────────────────── */

#splash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 32px;
}

/* Anneaux concentriques rotatifs */
.loader-container {
  position: relative;
  width: 100px;
  height: 100px;
}

.loader-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
}

.loader-ring-1 {
  inset: 0;
  border-top-color:   var(--neon-cyan);
  border-right-color: rgba(0,255,224,0.2);
  animation: spin-cw 1.4s linear infinite;
  box-shadow: 0 0 14px var(--glow-cyan);
}

.loader-ring-2 {
  inset: 14px;
  border-bottom-color: var(--neon-violet);
  border-left-color:   rgba(180,77,255,0.2);
  animation: spin-ccw 1.0s linear infinite;
  box-shadow: inset 0 0 10px var(--glow-violet);
}

.loader-ring-3 {
  inset: 28px;
  border-top-color:  var(--neon-pink);
  border-left-color: rgba(255,45,120,0.2);
  animation: spin-cw 0.7s linear infinite;
}

.loader-core {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(0,255,224,0.6) 0%,
    rgba(180,77,255,0.3) 50%,
    transparent 100%);
  animation: pulse-core 1.4s ease-in-out infinite;
}

@keyframes spin-cw  { to { transform: rotate(360deg);  } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
@keyframes pulse-core {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50%       { opacity: 1.0; transform: scale(1.1); }
}

/* Texte de chargement */
.loader-sys {
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--neon-violet);
  text-shadow: 0 0 8px var(--glow-violet);
  font-family: 'Courier New', monospace;
}

.loader-step {
  font-size: 12px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.06em;
  min-height: 1.4em;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  animation: typewriter 0.4s steps(30) forwards;
}

@keyframes typewriter {
  from { max-width: 0; }
  to   { max-width: 100%; }
}

/* Barre de progression */
.loader-bar-container {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,77,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-violet), var(--neon-cyan));
  box-shadow: 0 0 10px var(--glow-cyan);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Mobile splash */
@media (max-width: 600px) {
  #splash-intro { padding: 24px 20px 20px; gap: 16px; }
  .splash-card h1 { font-size: 2rem; }
  .btn-large { padding: 12px 32px; width: 100%; }
}

body.hide-cursor { cursor: none; }

/* ─── Header ────────────────────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--header-height);
  padding: 12px 20px;
  background: linear-gradient(to bottom, rgba(10,10,20,0.9), transparent);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-btns {
  display: flex;
  gap: 8px;
  pointer-events: all;
}

.btn-header {
  width: 36px;
  height: 36px;
  border: 1px solid var(--neon-violet);
  border-radius: 8px;
  background: rgba(180, 77, 255, 0.06);
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-header:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--glow-cyan);
}

/* Enregistrement */
#btn-rec { position: relative; }

#btn-rec.recording {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  box-shadow: 0 0 14px var(--glow-pink);
  animation: rec-pulse 1s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 14px var(--glow-pink); }
  50%       { box-shadow: 0 0 26px rgba(255, 45, 120, 0.9); }
}

#btn-rec.recording::after {
  content: attr(data-time);
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--neon-pink);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 0 6px var(--glow-pink);
}

/* Mode performance */
.control-panel {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body.perf-mode header         { opacity: 0; pointer-events: none; }
body.perf-mode .control-panel { transform: translateY(100%); }
body.perf-mode .no-body-msg   { top: 16px; }
body.perf-mode .canvas-container {
  position: fixed;
  inset: 0;
  z-index: 5;
}

/* Bouton de sortie du mode performance */
#btn-exit-perf {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(10, 10, 20, 0.6);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}

body.perf-mode #btn-exit-perf { display: flex; }
body.perf-mode.hide-cursor #btn-exit-perf { opacity: 0; }

header h1 {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--neon-violet), var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px var(--glow-violet));
  font-family: 'Courier New', monospace;
}

/* ─── Main layout ───────────────────────────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-height, 52px));
}

/* ─── Canvas container ──────────────────────────────────────────────────── */
.canvas-container {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
}

#webcam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transform: scaleX(-1);
}

#ascii-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 2px,
    rgba(0, 0, 0, 0.18) 2px, rgba(0, 0, 0, 0.18) 4px
  );
  animation: scanroll 8s linear infinite;
}

@keyframes scanroll {
  from { background-position: 0 0; }
  to   { background-position: 0 100px; }
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at center,
    transparent 40%,
    rgba(0, 0, 20, 0.7) 100%
  );
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: scaleX(-1);
}

/* ─── No-body indicator ─────────────────────────────────────────────────── */
.no-body-msg {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;

  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;

  background: rgba(10, 10, 20, 0.78);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 40px;
  backdrop-filter: blur(10px);

  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;

  animation: pulse-border 2.5s ease-in-out infinite;
}

.no-body-msg[hidden] {
  display: none;
}

.no-body-icon {
  font-size: 16px;
  opacity: 0.7;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(124, 58, 237, 0.4); }
  50%       { border-color: rgba(6, 182, 212, 0.6); }
}

/* ─── Control panel ─────────────────────────────────────────────────────── */
.control-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  height: var(--panel-height);
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 8px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--neon-violet), var(--neon-cyan), var(--neon-pink)) 1;
  box-shadow: 0 -2px 24px rgba(180,77,255,0.12), 0 -1px 8px rgba(0,255,224,0.08);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Séparateurs ───────────────────────────────────────────────────────── */
.cp-sep {
  width: 1px;
  margin: 12px 8px;
  background: linear-gradient(to bottom, transparent, rgba(0,255,224,0.15), transparent);
  flex-shrink: 0;
}

/* ─── Blocs ─────────────────────────────────────────────────────────────── */
.cp-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-width: 0;
}

.cp-block-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--glow-cyan);
  font-family: 'Courier New', monospace;
  margin: 0 0 2px;
  white-space: nowrap;
}

.cp-block--play    { min-width: 180px; }
.cp-block--fx      { flex: 2; min-width: 220px; }
.cp-block--control { flex: 1; min-width: 160px; }
.cp-block--hands   { min-width: 130px; }
.cp-block--status  { flex: 1; min-width: 150px; }

/* ─── BLOC JOUER ────────────────────────────────────────────────────────── */
.cp-instrument-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-autovol-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  cursor: pointer;
}

.cp-autovol-label {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── BLOC EFFETS ───────────────────────────────────────────────────────── */
.fx-grid {
  display: grid;
  grid-template-columns: 48px 1fr 46px;
  align-items: center;
  gap: 4px 8px;
}

.fx-label {
  font-size: 9px;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fx-val {
  font-size: 10px;
  color: var(--neon-cyan);
  font-family: 'Courier New', monospace;
  text-align: right;
  text-shadow: 0 0 6px var(--glow-cyan);
  white-space: nowrap;
}

.effect-row {
  display: grid;
  grid-template-columns: 48px 1fr 46px;
  align-items: center;
  gap: 4px 8px;
  margin-top: 4px;
}

/* ─── BLOC CONTRÔLE ─────────────────────────────────────────────────────── */
.cp-row-label {
  font-size: 9px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.cp-sub-label {
  font-size: 9px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 2px 0 0;
}

/* ─── BLOC MAINS ────────────────────────────────────────────────────────── */
.hands-indicator {
  display: flex;
  gap: 8px;
}

.hand-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(180,77,255,0.2);
  background: var(--surface);
  transition: all 0.15s ease;
  opacity: 0.25;
  position: relative;
  min-width: 48px;
}

.hand-dot::before,
.hand-dot::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.hand-dot::before { top: -1px; left: -1px;  border-top: 2px solid var(--neon-cyan); border-left: 2px solid var(--neon-cyan); }
.hand-dot::after  { bottom: -1px; right: -1px; border-bottom: 2px solid var(--neon-pink); border-right: 2px solid var(--neon-pink); }

.hand-dot.detected {
  opacity: 1;
  border-color: rgba(0,255,224,0.35);
  box-shadow: 0 0 10px rgba(0,255,224,0.15);
}
.hand-dot.detected::before,
.hand-dot.detected::after { opacity: 1; }

.hand-dot-icon  { font-size: 18px; }
.hand-dot-label { font-size: 8px; font-family: 'Courier New', monospace; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }

/* ─── BLOC STATUS ───────────────────────────────────────────────────────── */
.status-grid {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 3px 8px;
  align-items: center;
}

.status-key {
  font-size: 9px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neon-pink);
  text-shadow: 0 0 4px var(--glow-pink);
}

.status-val {
  font-size: 12px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
}

.status-val--note {
  font-size: 16px;
  color: var(--neon-violet);
  text-shadow: 0 0 12px var(--glow-violet);
}

/* ─── Kbd hint ──────────────────────────────────────────────────────────── */
.kbd-hint {
  color: var(--neon-cyan);
  opacity: 0.4;
  font-size: 9px;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid rgba(0,255,224,0.3);
  border-radius: 4px;
  background: rgba(0,255,224,0.06);
  color: var(--neon-cyan);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* ─── Toggle switch ─────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(0,255,224,0.2);
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 12px; height: 12px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-track {
  background: rgba(0,255,224,0.12);
  border-color: var(--neon-cyan);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--glow-cyan);
}

/* ─── Mute button ───────────────────────────────────────────────────────── */
.btn-mute {
  width: 44px;
  height: 44px;
  border: 1px solid var(--neon-violet);
  border-radius: 8px;
  background: rgba(180,77,255,0.07);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  line-height: 1;
  box-shadow: 0 0 8px rgba(180,77,255,0.2);
  flex-shrink: 0;
}

.btn-mute:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px var(--glow-cyan);
  background: rgba(0,255,224,0.07);
}

.btn-mute.muted {
  background: rgba(255,45,120,0.1);
  border-color: var(--neon-pink);
  box-shadow: 0 0 14px var(--glow-pink);
}

.btn-mute:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── Button (splash) ───────────────────────────────────────────────────── */
.btn-primary {
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow-v);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 28px var(--accent-glow-v), 0 0 12px var(--accent-glow-c);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Select ────────────────────────────────────────────────────────────── */
select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--neon-violet);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 8px 32px 8px 12px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b44dff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 0 8px rgba(180,77,255,0.08);
  flex: 1;
}

select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px var(--glow-cyan), inset 0 0 8px rgba(0,255,224,0.08);
}

/* ─── Slider label value ────────────────────────────────────────────────── */
.slider-value {
  font-size: 10px;
  font-weight: 400;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
  text-transform: none;
  letter-spacing: 0;
}

/* ─── Range slider ──────────────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--glow-cyan);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 14px var(--glow-cyan);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
}

/* ─── Filter type buttons ───────────────────────────────────────────────── */
.filter-type-btns {
  display: flex;
  gap: 4px;
}

.btn-ftype {
  flex: 1;
  padding: 3px 6px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  background: transparent;
  border: 1px solid rgba(0,255,224,0.2);
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.btn-ftype.active,
.btn-ftype:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0,255,224,0.08);
  text-shadow: 0 0 6px var(--glow-cyan);
}

/* ─── Volume bar ────────────────────────────────────────────────────────── */
.volume-bar-container {
  height: 5px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.volume-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-violet), var(--neon-cyan), var(--neon-pink));
  border-radius: 2px;
  transition: width 0.08s linear;
  box-shadow: 0 0 6px var(--glow-cyan);
}

/* ─── Effect value (auto-vol label) ────────────────────────────────────── */
.effect-value {
  font-size: 10px;
  color: var(--neon-cyan);
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 6px var(--glow-cyan);
}

/* ─── Burger button ─────────────────────────────────────────────────────── */
.btn-fab-menu {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid var(--neon-violet);
  color: var(--neon-violet);
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(180,77,255,0.4);
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .btn-fab-menu { display: flex; }
  body.perf-mode .btn-fab-menu { display: none; }
}

/* ─── Backdrop mobile ───────────────────────────────────────────────────── */
.mobile-overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.mobile-overlay-backdrop.open { display: block; }

/* ─── Bouton fermer (mobile uniquement) ─────────────────────────────────── */
.btn-close-panel-mobile {
  display: none;
}

/* ─── Responsive — tablette portrait (601–768px) ────────────────────────── */
@media (max-width: 768px) and (orientation: portrait) {
  .canvas-container {
    flex: 1;
    height: auto;
  }

  main {
    height: calc(100dvh - var(--header-height, 52px));
    flex-direction: column;
  }

  .control-panel {
    position: relative;
    height: auto;
    flex-wrap: wrap;
    padding: 10px 12px 16px;
    gap: 0;
    align-items: flex-start;
  }

  .cp-sep { display: none; }

  .cp-block {
    padding: 8px 10px;
    min-width: calc(50% - 20px);
    flex: 1 1 calc(50% - 20px);
  }

  .cp-block--fx     { flex: 1 1 100%; }
  .cp-block--status { flex: 1 1 100%; }

  .fx-grid { grid-template-columns: 50px 1fr 46px; }

  .status-grid {
    grid-template-columns: repeat(3, auto 1fr);
    gap: 4px 12px;
  }

  /* Touch targets */
  input[type="range"] { height: 6px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
  input[type="range"]::-moz-range-thumb     { width: 22px; height: 22px; }
  select { padding: 10px 32px 10px 12px; font-size: 13px; }
  .btn-mute { width: 48px; height: 48px; }
  .btn-ftype { padding: 8px 6px; font-size: 11px; }

  body.perf-mode .control-panel    { display: none; }
  body.perf-mode .canvas-container { position: fixed; inset: 0; height: 100dvh; z-index: 5; }
}

/* ─── Responsive — mobile portrait (≤ 600px) ───────────────────────────── */
@media (max-width: 600px) and (orientation: portrait) {
  :root { --panel-height: auto; }

  html, body { overflow: hidden; }

  .canvas-container {
    flex: 1;
    height: auto;
  }

  main {
    height: calc(100dvh - var(--header-height, 52px));
    flex-direction: column;
  }

  .control-panel {
    position: relative;
    height: auto;
    flex-direction: column;
    padding: 8px 12px 20px;
    gap: 0;
    align-items: stretch;
    overflow-y: auto;
    max-height: 52dvh;
  }

  .cp-sep {
    width: 100%;
    height: 1px;
    margin: 5px 0;
    background: linear-gradient(to right, transparent, rgba(0,255,224,0.15), transparent);
  }

  .cp-block         { padding: 5px 0; }
  .cp-block-label   { font-size: 8px; margin-bottom: 4px; }
  .fx-grid          { grid-template-columns: 42px 1fr 40px; gap: 3px 6px; }
  .fx-label         { font-size: 8px; }
  .fx-val           { font-size: 9px; }
  .cp-autovol-label { font-size: 9px; }

  /* Touch targets élargis */
  input[type="range"]                       { height: 6px; }
  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  input[type="range"]::-moz-range-thumb     { width: 24px; height: 24px; }
  select { padding: 10px 28px 10px 10px; font-size: 12px; width: 100%; }
  .btn-mute { width: 48px; height: 48px; font-size: 20px; }
  .btn-ftype { padding: 8px 4px; font-size: 10px; }

  .cp-instrument-row { gap: 8px; }

  .hands-indicator { gap: 10px; justify-content: center; }
  .hand-dot        { flex: 1; max-width: 120px; padding: 6px 8px; }
  .hand-dot-icon   { font-size: 20px; }
  .hand-dot-label  { font-size: 7px; }

  .status-grid {
    display: grid;
    grid-template-columns: repeat(3, auto 1fr);
    gap: 4px 8px;
    align-items: center;
  }
  .status-key  { font-size: 8px; }
  .status-val  { font-size: 11px; }
  .status-val--note { font-size: 14px; }

  header { padding: 8px 12px; }
  header h1 { font-size: clamp(0.8rem, 3vw, 1rem); }
  .btn-header { width: 34px; height: 34px; font-size: 14px; }
  .no-body-msg { font-size: 10px; padding: 6px 12px; top: 50px; }

  /* Splash */
  .splash-card { padding: 20px 14px 16px; gap: 12px; max-height: 92dvh; overflow-y: auto; }
  .splash-instructions li { font-size: 11px; padding: 7px 8px; }
  .splash-distance { padding: 10px 12px; gap: 10px; }
  .splash-shortcuts { gap: 10px; }
  .btn-large { padding: 12px 24px; font-size: 13px; width: 100%; }

  body.perf-mode .control-panel    { display: none; }
  body.perf-mode .canvas-container { position: fixed; inset: 0; height: 100dvh; z-index: 5; }
}

/* ─── Responsive — mobile landscape (≤ 768px) ──────────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  main {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
  }

  .canvas-container {
    flex: 1;
    height: 100dvh;
  }

  .control-panel {
    position: relative;
    width: 200px;
    min-width: 200px;
    height: 100dvh;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: nowrap;
    padding: 44px 0 8px;
    gap: 0;
    align-items: stretch;
    border-top: none;
    border-left: 1px solid var(--border);
    /* Scrollbar discrète */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,255,224,0.2) transparent;
  }

  .control-panel::-webkit-scrollbar       { width: 3px; }
  .control-panel::-webkit-scrollbar-track { background: transparent; }
  .control-panel::-webkit-scrollbar-thumb { background: rgba(0,255,224,0.2); border-radius: 2px; }

  .cp-sep   { width: 100%; height: 1px; margin: 4px 0; background: linear-gradient(to right, transparent, rgba(0,255,224,0.15), transparent); }
  .cp-block { padding: 6px 12px; }
  .cp-block-label { font-size: 8px; }
  .fx-grid  { grid-template-columns: 38px 1fr 36px; gap: 3px 6px; }
  .fx-label { font-size: 8px; }
  .fx-val   { font-size: 8px; }

  /* Touch targets */
  input[type="range"]                       { height: 5px; }
  input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; }
  input[type="range"]::-moz-range-thumb     { width: 20px; height: 20px; }
  select    { padding: 8px 24px 8px 8px; font-size: 11px; }
  .btn-mute { width: 40px; height: 40px; font-size: 18px; }
  .btn-ftype { padding: 6px 4px; font-size: 9px; }

  .hand-dot-icon  { font-size: 16px; }
  .hand-dot-label { font-size: 7px; }
  .status-val--note { font-size: 14px; }

  body.perf-mode .control-panel    { display: none; }
  body.perf-mode .canvas-container { position: fixed; inset: 0; height: 100dvh; z-index: 5; }
}

/* ─── Panel mobile : slide-up depuis le bas ─────────────────────────────── */
@media (max-width: 768px) {
  .btn-fab-menu {
    display: flex;
  }

  .btn-close-panel-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0,255,224,0.1);
    color: var(--text-dim);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 4px;
  }

  .btn-close-panel-mobile:hover { color: var(--neon-cyan); }

  .control-panel {
    /* Caché par défaut sur mobile */
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    height: auto !important;
    max-height: 75dvh;
    flex-direction: column !important;
    overflow-x: clip !important;
    overflow-y: auto !important;
    z-index: 40;
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px 16px 0 0;
    border-top: 1px solid var(--neon-cyan) !important;
    border-image: none !important;
    padding: 0 16px 24px !important;
    gap: 0 !important;
    align-items: stretch !important;
  }

  .control-panel.mobile-open {
    transform: translateY(0);
  }

  .cp-sep {
    width: 100% !important;
    height: 1px !important;
    margin: 6px 0 !important;
    background: linear-gradient(to right, transparent, rgba(0,255,224,0.15), transparent) !important;
  }

  .cp-block { padding: 8px 0; }
  .cp-block--play, .cp-block--fx, .cp-block--control,
  .cp-block--hands, .cp-block--status {
    min-width: 0 !important;
    flex: none !important;
    width: 100%;
  }

  .fx-grid { grid-template-columns: 50px 1fr 44px; }

  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  input[type="range"]::-moz-range-thumb     { width: 24px; height: 24px; }
  input[type="range"] { height: 6px; }
  select { width: 100%; padding: 10px 32px 10px 12px; }
  .btn-mute  { width: 48px; height: 48px; }
  .btn-ftype { padding: 10px 6px; font-size: 11px; }

  .canvas-container {
    flex: 1;
    min-height: 0;
    height: 100%;
  }
  main {
    height: 100dvh;
    padding-top: var(--header-height, 52px);
    flex-direction: column;
    overflow: hidden;
  }

  body.perf-mode .control-panel    { display: none !important; }
  body.perf-mode .canvas-container { position: fixed; inset: 0; height: 100dvh; z-index: 5; }

  /* Masquer "En cours" et "Mains" sur mobile — inutiles dans le menu */
  .cp-block--status {
    display: none !important;
    visibility: hidden;
    width: 0;
    overflow: hidden;
  }

  .cp-block--hands { display: none !important; }

  /* Espacement généreux entre blocs pour éviter le chevauchement des sliders */
  .cp-block { padding: 12px 0; }

  .effect-row {
    margin-top: 10px;
  }

  /* Slider thumb plus petit pour ne pas déborder */
  input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; }
  input[type="range"]::-moz-range-thumb     { width: 20px; height: 20px; }

  /* Séparateur visible entre chaque bloc */
  .cp-sep {
    width: 100% !important;
    height: 1px !important;
    margin: 8px 0 !important;
    background: linear-gradient(to right, transparent, rgba(0,255,224,0.15), transparent) !important;
  }

  /* Espace sous le dernier bloc pour ne pas chevaucher le FAB */
  .control-panel { padding-bottom: 80px !important; }
}
