/* Reset et plein écran */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  height: 100%;
}

body {
  background: #000;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

#fluid-canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  transform-origin: center center;
}

#webcam-video {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  width: 160px;
  height: 120px;
  top: -200px;
  left: -200px;
}

#status-overlay {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

#status-text {
  font-family: monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

#countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

#countdown-text {
  font-family: monospace;
  font-size: 160px;
  font-weight: bold;
  color: white;
  line-height: 1;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.4);
}

#audio-indicator {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-size: 42px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.8);
}

.hidden { display: none !important; }

/* ── Panel principal ─────────────────────────────────── */
#audio-panel {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  width: 260px;
  padding: 16px;
  background: rgba(5, 4, 18, 0.92);
  border: 1px solid rgba(0, 255, 255, 0.25);
  border-radius: 6px;
  box-shadow:
    0 0 24px rgba(0, 255, 255, 0.08),
    0 0 60px rgba(120, 0, 255, 0.06),
    inset 0 0 30px rgba(0, 0, 40, 0.4);
  backdrop-filter: blur(12px);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100dvh - 24px);
}

/* Scanlines overlay */
#audio-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  border-radius: 6px;
  z-index: 0;
}

/* Tout le contenu au-dessus du scanline */
#audio-panel > * {
  position: relative;
  z-index: 1;
}

/* ── Titre ───────────────────────────────────────────── */
.audio-panel-title {
  font-family: monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 3px;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff, 0 0 20px rgba(0, 255, 255, 0.4);
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.15);
}

/* ── BPM display ─────────────────────────────────────── */
#bpm-display {
  font-family: monospace;
  font-size: 11px;
  color: #ff00ff;
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.6);
  text-align: center;
  min-height: 16px;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

/* ── Harmony select ──────────────────────────────────── */
#ctrl-harmony,
#ctrl-scale {
  font-family: monospace;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #00ffff;
  border: 1px solid rgba(0, 255, 255, 0.25);
  border-radius: 3px;
  padding: 2px 4px;
  cursor: pointer;
  max-width: 110px;
}

/* ── Sections d'effets ───────────────────────────────── */
.effect-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 0, 255, 0.1);
}

.effect-title {
  font-family: monospace;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 2.5px;
  color: #ff00ff;
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.6);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Lignes de contrôle ──────────────────────────────── */
.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ctrl-row label {
  font-family: monospace;
  font-size: 11px;
  color: rgba(180, 210, 255, 0.75);
  white-space: nowrap;
  min-width: 80px;
}

.ctrl-row label span {
  color: #00ffff;
  text-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
}

/* ── Sliders ─────────────────────────────────────────── */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 110px;
  height: 18px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

/* Track — WebKit */
input[type=range]::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(to right, rgba(0,255,255,0.8), rgba(255,0,255,0.8));
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

/* Thumb — WebKit */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px #00ffff, 0 0 18px rgba(0, 255, 255, 0.45);
  transition: box-shadow 0.15s;
}

input[type=range]:active::-webkit-slider-thumb {
  box-shadow: 0 0 12px #ff00ff, 0 0 28px rgba(255, 0, 255, 0.5);
}

/* Track — Firefox */
input[type=range]::-moz-range-track {
  height: 3px;
  background: linear-gradient(to right, rgba(0,255,255,0.8), rgba(255,0,255,0.8));
  border-radius: 2px;
}

input[type=range]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 8px #00ffff;
}

/* ── Toggle switch ───────────────────────────────────── */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: monospace;
  font-size: 11px;
  color: rgba(180, 210, 255, 0.75);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 0, 255, 0.2);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: rgba(200, 180, 255, 0.6);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(0, 255, 200, 0.12);
  border-color: rgba(0, 255, 200, 0.5);
  box-shadow: 0 0 12px rgba(0, 255, 180, 0.25);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #00ffc8;
  box-shadow: 0 0 10px #00ffc8, 0 0 22px rgba(0, 255, 200, 0.4);
}


kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 9px;
  color: #00ffff;
  background: rgba(0, 255, 255, 0.07);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.1);
  line-height: 1.4;
}


/* ── Bouton roue crantée (mobile) ────────────────────── */
#gear-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 25;
  width: 44px;
  height: 44px;
  background: rgba(5, 4, 18, 0.85);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 50%;
  color: #00ffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.15);
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s, background 0.2s;
}

#gear-btn:active,
#gear-btn.open {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 22px rgba(0, 255, 255, 0.3);
}

/* ── Responsive mobile ───────────────────────────────── */
body.touch-mode #audio-panel {
  left: 8px;
  top: 64px;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  width: calc(100vw - 16px);
  max-width: 380px;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.touch-mode .ctrl-row label {
  min-width: 90px;
  font-size: 12px;
}

body.touch-mode input[type=range] {
  max-width: none;
  flex: 1;
  height: 28px;
}

body.touch-mode input[type=range]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8.5px;
}

body.touch-mode input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
}

body.touch-mode .toggle-switch {
  width: 50px;
  height: 28px;
}

body.touch-mode .toggle-slider::before {
  width: 20px;
  height: 20px;
  top: 3px;
}

body.touch-mode .toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

body.touch-mode .toggle-row,
body.touch-mode .ctrl-row label {
  font-size: 13px;
}

/* Sections desktop uniquement */
.desktop-only-section {
  display: block;
}

body.touch-mode .desktop-only-section {
  display: none;
}

/* Selects adaptés au touch */
body.touch-mode #ctrl-harmony,
body.touch-mode #ctrl-scale {
  max-width: none;
  flex: 1;
  font-size: 12px;
  padding: 6px 4px;
  height: 36px;
}

/* Boutons tactiles aux dimensions recommandées (44px min) */
body.touch-mode .sym-btn,
body.touch-mode .preset-btn {
  padding: 14px 4px;
  font-size: 12px;
}

/* Scrollbar synthwave dans le panel (WebKit) */
#audio-panel::-webkit-scrollbar {
  width: 4px;
}
#audio-panel::-webkit-scrollbar-track {
  background: transparent;
}
#audio-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.25);
  border-radius: 2px;
}

/* ── Mode présentation ───────────────────────────────── */
body.presentation-mode {
  cursor: none !important;
}

body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

body.presentation-mode #audio-panel,
body.presentation-mode #shortcuts-panel,
body.presentation-mode #status-overlay,
body.presentation-mode #audio-indicator,
body.presentation-mode #gear-btn,
body.presentation-mode #countdown-overlay {
  display: none !important;
}

/* Supprime le focus ring natif dans les panels */
#audio-panel *:focus,
#gear-btn:focus {
  outline: none;
}

#audio-panel select:focus {
  border-color: rgba(0, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 255, 255, 0.2);
}

/* ── Sections touch-only ─────────────────────────────── */
.touch-only-section {
  display: none;
}

body.touch-mode .touch-only-section {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 0, 255, 0.1);
}

.btn-group {
  display: flex;
  gap: 6px;
}

.sym-btn,
.preset-btn {
  flex: 1;
  font-family: monospace;
  font-size: 11px;
  padding: 10px 4px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 255, 255, 0.18);
  border-radius: 4px;
  color: rgba(180, 210, 255, 0.65);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.sym-btn.active,
.preset-btn.active {
  background: rgba(0, 255, 255, 0.1);
  border-color: rgba(0, 255, 255, 0.5);
  color: #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.preset-btn.recording {
  color: #ff4444;
  border-color: rgba(255, 68, 68, 0.6);
  animation: rec-pulse 1s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(255, 68, 68, 0.3); }
  50%       { box-shadow: 0 0 14px rgba(255, 68, 68, 0.9), 0 0 28px rgba(255, 68, 68, 0.4); }
}

.sym-btn:active,
.preset-btn:active {
  background: rgba(0, 255, 255, 0.15);
}

/* ── Panel raccourcis clavier ────────────────────────── */
#shortcuts-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  padding: 12px 14px;
  background: rgba(5, 4, 18, 0.88);
  border: 1px solid rgba(0, 255, 255, 0.18);
  border-radius: 6px;
  box-shadow:
    0 0 18px rgba(0, 255, 255, 0.06),
    0 0 40px rgba(120, 0, 255, 0.05);
  backdrop-filter: blur(10px);
}

body.touch-mode #shortcuts-panel {
  display: none;
}

.shortcuts-title {
  font-family: monospace;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 2.5px;
  color: #00ffff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
  text-align: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.12);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  align-items: center;
}

.shortcuts-grid kbd {
  justify-self: end;
}

.shortcuts-grid span {
  font-family: monospace;
  font-size: 9px;
  color: rgba(100, 130, 180, 0.55);
  letter-spacing: 0.3px;
}
