/* Root Colors and Design Tokens */
:root {
  --bg-main: #080710;
  --bg-panel: rgba(14, 12, 28, 0.80);
  --bg-panel-solid: #0e0c1c;
  --border-glow: rgba(168, 85, 247, 0.45);
  --border-light: rgba(255, 255, 255, 0.15);
  --text-main: #f1f5f9;
  --text-muted: #c0cfe0;
  --accent-glow: #c084fc;
  --accent-blue: #60a5fa;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-cyan: #38bdf8;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --glass-blur: 15px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.6);
}

/* Glassmorphism Panels */
.glass {
  background: var(--bg-panel);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-premium);
}

/* App Grid Layout */
.app-container {
  display: grid;
  grid-template-columns: var(--left-width, 280px) 5px 1fr 5px var(--right-width, 300px);
  grid-template-rows: 52px 1fr;
  height: 100vh;
  width: 100vw;
}

/* Explicit grid placement for row-2 items */
.left-sidebar  { grid-column: 1; grid-row: 2; }
.workspace     { grid-column: 3; grid-row: 2; }
.right-sidebar { grid-column: 5; grid-row: 2; }
#resize-handle-left  { grid-column: 2; grid-row: 2; }
#resize-handle-right { grid-column: 4; grid-row: 2; }

/* Resize handles */
.resize-handle {
  cursor: col-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: background 0.15s ease;
}
.resize-handle::after {
  content: '';
  width: 2px;
  height: 36px;
  border-radius: 2px;
  background: rgba(168, 85, 247, 0.25);
  transition: background 0.15s ease, height 0.15s ease;
}
.resize-handle:hover::after,
.resize-handle.dragging::after {
  background: rgba(168, 85, 247, 0.85);
  height: 60px;
}
.resize-handle.dragging {
  background: rgba(168, 85, 247, 0.06);
}

/* Header */
.app-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  z-index: 10;
  border-bottom: 1px solid var(--border-light);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-logo {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.logo {
  gap: 8px;
}
.logo h1 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
}

.logo h1 .subtitle {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-left: 8px;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.mode-toggle-container .btn {
  padding: 5px 10px;
  font-size: 0.72rem;
}
.btn-mode {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 84px;
}
.btn-mode.active {
  background: rgba(96,165,250,0.30);
  border-color: rgba(96,165,250,0.7);
  color: #fff;
  box-shadow: 0 0 10px rgba(96,165,250,0.35);
}
#btn-global-mode-edit.active {
  background: rgba(168,85,247,0.30);
  border-color: rgba(168,85,247,0.7);
  box-shadow: 0 0 10px rgba(168,85,247,0.35);
}

.status-bar {
  display: none;
}

/* Status Indicators */
.status-bar {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.red {
  background-color: var(--accent-red);
  color: var(--accent-red);
}

.status-dot.green {
  background-color: var(--accent-green);
  color: var(--accent-green);
}

/* Sidebar Panels */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  z-index: 5;
  border-top: none;
}

.left-sidebar {
  border-right: 1px solid var(--border-light);
}

.right-sidebar {
  border-left: 1px solid var(--border-light);
}

/* Control Sections */
.control-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.control-section h3 {
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-glow);
  border-left: 2px solid var(--accent-glow);
  padding-left: 8px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* Interactive Canvas Workspace */
.workspace {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #040307;
  overflow: hidden;
}

#score-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#score-canvas:active {
  cursor: grabbing;
}

/* Canvas Overlays */
.canvas-overlay {
  position: absolute;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.75rem;
  pointer-events: auto;
  z-index: 4;
}

.navigation-help {
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-muted);
}

.active-mode-indicator {
  top: 20px;
  left: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  border-left: 3px solid var(--accent-blue);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Form Controls & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.border-top-glow {
  border-top: 1px solid var(--border-glow);
  padding-top: 12px;
  margin-top: 6px;
}

label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spacing-top {
  margin-top: 8px;
}

.value-display {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--accent-glow);
  background: rgba(168, 85, 247, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.info-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-text.highlight {
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.05);
  padding: 8px;
  border-radius: 6px;
  border: 1px dashed rgba(34, 211, 238, 0.2);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--accent-glow);
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.btn-primary {
  background: var(--accent-glow);
  border-color: var(--accent-glow);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
  background: #b86bfc;
  border-color: #b86bfc;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.5);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: #93c5fd;
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-glow);
  color: var(--accent-glow);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.btn-block {
  width: 100%;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-grid button:last-child {
  grid-column: span 2;
}

.btn-preset {
  font-size: 0.75rem;
  padding: 8px 12px;
}

.btn-mini {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-speakers {
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #c084fc;
}
.btn-speakers.active {
  background: rgba(168, 85, 247, 0.55);
  color: #fff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}
/* ── Mode scène publiée (utilisateur) : interface épurée ── */
.published-mode { --left-width: 0px; --right-width: 0px; }
.published-mode .left-sidebar,
.published-mode .right-sidebar,
.published-mode #resize-handle-left,
.published-mode #resize-handle-right,
.published-mode .mode-toggle-container,
.published-mode #profile-badge { display: none !important; }

/* ── Page « Play » (accès public, sans option d'édition) ── */
/* L'édition et le menu de configuration ne sont accessibles qu'après authentification admin (setup/). */
/* Les deux colonnes latérales sont masquées : la soundmap occupe toute la largeur. */
.play-only { --left-width: 0px; --right-width: 0px; }
.play-only .left-sidebar,
.play-only .right-sidebar,
.play-only #resize-handle-left,
.play-only #resize-handle-right,
.play-only .edit-only,
.play-only #btn-global-mode-play,
.play-only #btn-global-mode-edit,
.play-only #btn-toggle-3d,
.play-only #btn-hide-hp,
.play-only #btn-open-library,
.play-only #btn-open-sources,
.play-only #btn-open-cameras,
.play-only #profile-badge,
.play-only .active-mode-indicator,
.play-only #camera-status,
.play-only #btn-start-audio,
.play-only #fps-display { display: none !important; }

/* ── Palette rapide de couleurs contrastées (inspecteur) ── */
.color-swatches {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  gap: 5px;
  margin-top: 8px;
}
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.color-swatch:hover { transform: scale(1.18); }
.color-swatch.selected {
  box-shadow: 0 0 0 2px var(--bg-main, #080710), 0 0 0 4px #fff;
}
@media (max-width: 1100px) {
  .color-swatches { grid-template-columns: repeat(5, 20px); }
}

/* ── Mode Multiple : playlist déclenchée (inspecteur) ── */
.playlist-dropzone {
  margin-top: 8px;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 6px;
  min-height: 56px;
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.playlist-dropzone.pl-dragover {
  border-color: var(--accent-cyan, #22d3ee);
  background: rgba(34, 211, 238, 0.08);
}
.playlist-empty {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 6px;
  line-height: 1.4;
}
.playlist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  margin: 3px 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  cursor: default;
}
.playlist-row.pl-dragging { opacity: 0.45; }
.pl-handle { cursor: grab; color: var(--text-muted); font-size: 0.85rem; user-select: none; }
.pl-num {
  flex: none; min-width: 18px; height: 18px; line-height: 18px; text-align: center;
  font-size: 0.62rem; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--text-muted);
}
.pl-name {
  flex: 1; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-del {
  flex: none; border: none; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.8rem; padding: 2px 4px; border-radius: 4px;
}
.pl-del:hover { color: #f87171; background: rgba(248, 113, 113, 0.12); }

/* ── Popup de répartition multi-fichiers ── */
.multidrop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.multidrop-grid .btn {
  justify-content: flex-start;
  padding: 12px 14px;
  font-size: 0.82rem;
  text-align: left;
}
.multidrop-grid .btn[data-dist="multiple"] { grid-column: span 2; }

/* ── Librairie audio ── */
#library-modal {
  width: min(560px, 96vw);
  height: 70vh;
  resize: both;
  overflow: auto;
  min-width: 360px;
  min-height: 280px;
  max-width: 96vw;
  max-height: 92vh;
}
.lib-toolbar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.lib-dropzone {
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.lib-dropzone.lib-dragover { border-color: var(--accent-cyan, #22d3ee); background: rgba(34, 211, 238, 0.08); }
.lib-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.lib-table th {
  text-align: left; padding: 5px 8px; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border-light); position: sticky; top: 0;
  background: rgba(10, 8, 22, 0.97);
}
.lib-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.lib-row { cursor: grab; }
.lib-row:hover { background: rgba(255, 255, 255, 0.04); }
.lib-row.lib-dragging { opacity: 0.5; }
.lib-name { display: flex; align-items: center; gap: 7px; max-width: 240px; }
.lib-name .lib-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid rgba(255,255,255,0.25); }
.lib-name .lib-fn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-uses { text-align: center; }
.lib-uses .badge0 { color: var(--text-muted); }
.lib-group-sel { width: 100%; font-size: 0.68rem; padding: 3px 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light); border-radius: 5px; color: var(--text-main); }
.lib-section-title { font-family: var(--font-title); font-size: 0.72rem; color: var(--accent-cyan); margin: 14px 0 8px; letter-spacing: 0.08em; }
.lib-groups { display: flex; flex-direction: column; gap: 6px; }
.lib-group-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); border-radius: 7px; }
.lib-group-row input[type="color"] { width: 26px; height: 22px; padding: 0; border: 1px solid var(--border-light); border-radius: 5px; background: none; cursor: pointer; flex: none; }
.lib-group-row .lib-group-name { flex: 1; background: none; border: none; color: var(--text-main); font-size: 0.76rem; outline: none; }
.lib-group-row .btn { padding: 3px 8px; font-size: 0.66rem; }
/* Colonne BPM : visible uniquement en mode Beat-sync */
#library-modal:not(.beatsync-on) .lib-bpm-col { display: none; }
.lib-bpm-col { white-space: nowrap; }
.lib-bpm { width: 52px; font-size: 0.68rem; padding: 2px 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light); border-radius: 5px; color: var(--text-main); }
.lib-bpm-auto { margin-left: 4px; font-size: 0.6rem; padding: 2px 5px; border: 1px solid var(--border-light); border-radius: 5px; background: rgba(255,255,255,0.06); color: var(--text-muted); cursor: pointer; }
.lib-bpm-auto:hover { color: var(--accent-cyan); }

/* ── Liste des sources (popup comparatif éditable) ── */
#sources-list-modal {
  width: min(780px, 96vw);
  height: 66vh;
  resize: both;
  overflow: auto;
  min-width: 420px;
  min-height: 260px;
  max-width: 96vw;
  max-height: 92vh;
}
.srclist-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.srclist-table th {
  text-align: left; padding: 5px 7px; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border-light); position: sticky; top: 0;
  background: rgba(10, 8, 22, 0.97); white-space: nowrap;
}
.srclist-table td { padding: 3px 7px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.srclist-row { cursor: pointer; }
.srclist-row:hover { background: rgba(255,255,255,0.04); }
/* is-selected = dans la multi-sélection ; is-active = source active dans l'inspecteur */
.srclist-row.is-selected { background: rgba(168,85,247,0.16); }
.srclist-row.is-active { background: rgba(168,85,247,0.28); box-shadow: inset 2px 0 0 var(--accent-purple, #a855f7); }
.srclist-row.is-selected.is-active { background: rgba(168,85,247,0.35); }
/* Indicateur de sélection multiple */
.srclist-multisel-indicator {
  font-size: 0.72rem; color: var(--accent-purple, #a855f7);
  background: rgba(168,85,247,0.10); border: 1px solid rgba(168,85,247,0.28);
  border-radius: 6px; padding: 4px 10px; margin-bottom: 7px;
  text-align: center; display: none;
}
.srclist-table input[type="text"], .srclist-table input[type="number"], .srclist-table select {
  width: 100%; min-width: 48px; font-size: 0.7rem; padding: 3px 5px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-light);
  border-radius: 5px; color: var(--text-main); outline: none;
}
.srclist-table input.sl-name { min-width: 90px; }
.srclist-table input.sl-vol, .srclist-table input.sl-radius { width: 60px; }
.srclist-table input[type="color"] { width: 30px; height: 22px; padding: 0; border: 1px solid var(--border-light); border-radius: 5px; background: none; cursor: pointer; }
.srclist-table .sl-del { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); color: var(--accent-red); border-radius: 5px; cursor: pointer; padding: 2px 7px; font-size: 0.75rem; }

/* ── Comptes administrateurs (popup Config, superadmin) ── */
.cfg-admins-list { display: flex; flex-direction: column; gap: 5px; }
.cfg-admin-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); border-radius: 7px; }
.cfg-admin-row .cfg-admin-email { flex: 1; font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfg-admin-row .cfg-admin-tag { font-size: 0.62rem; padding: 2px 7px; border-radius: 10px; background: rgba(168,85,247,0.2); border: 1px solid rgba(168,85,247,0.4); color: #d8b4fe; }
.cfg-admin-row .btn { padding: 3px 9px; font-size: 0.68rem; }

/* ── Gestionnaire de sources audio (popup) ── */
#audio-manager-modal {
  width: min(640px, 96vw);
  height: 68vh;
  resize: both;
  overflow: auto;
  min-width: 420px;
  min-height: 300px;
  max-width: 96vw;
  max-height: 92vh;
}
.audiomgr-list { display: flex; flex-direction: column; gap: 8px; }
.am-row { border: 1px solid var(--border-light); border-radius: 9px; padding: 9px 11px; background: rgba(255,255,255,0.03); }
.am-head { display: flex; align-items: center; gap: 9px; }
.am-name { font-weight: 600; font-size: 0.82rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-uses { font-size: 0.66rem; color: var(--text-muted); white-space: nowrap; }
.am-uses .am-used { color: var(--accent-cyan); }
.am-meta { font-size: 0.68rem; color: var(--text-muted); font-family: monospace; margin: 5px 0 7px; }
.am-meta .am-chip { display: inline-block; padding: 1px 6px; margin-right: 5px; border-radius: 6px; background: rgba(255,255,255,0.06); border: 1px solid var(--border-light); }
.am-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.am-actions .btn { padding: 4px 9px; font-size: 0.7rem; }
.am-btn-play { background: rgba(96,165,250,0.18); border: 1px solid rgba(96,165,250,0.4); color: #eaf3ff; border-radius: 6px; cursor: pointer; padding: 4px 9px; font-size: 0.7rem; }
.am-btn-trim { background: rgba(168,85,247,0.18); border: 1px solid rgba(168,85,247,0.4); color: #f1e9ff; border-radius: 6px; cursor: pointer; padding: 4px 9px; font-size: 0.7rem; }
.am-btn-replace { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.4); color: #e6fff0; border-radius: 6px; cursor: pointer; padding: 4px 9px; font-size: 0.7rem; }
.am-btn-del { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); color: var(--accent-red); border-radius: 6px; cursor: pointer; padding: 4px 9px; font-size: 0.7rem; }
.am-trim { margin-top: 8px; padding: 8px; border: 1px dashed var(--border-light); border-radius: 7px; }
.am-trim.hidden { display: none; }
.am-trim-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.am-trim-row label { font-size: 0.68rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.am-trim-row input[type="number"] { width: 80px; font-size: 0.72rem; padding: 3px 5px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light); border-radius: 5px; color: var(--text-main); }
.am-trim-row .checkbox-container { margin: 0; }
.am-progress { font-size: 0.66rem; color: var(--accent-cyan); margin-top: 5px; font-family: monospace; }

/* ── Waveform trim UI ── */
.am-wave-wrap { position: relative; width: 100%; margin-bottom: 7px; touch-action: none; }
.am-wave { display: block; width: 100%; height: 90px; background: #0b0918; border: 1px solid rgba(168,85,247,0.35); border-radius: 6px; cursor: crosshair; }
.am-wave-handles { position: absolute; inset: 0; pointer-events: none; }
.am-wave-selection { position: absolute; top: 0; bottom: 0; background: rgba(192,132,252,0.18); border-left: 2px solid #a855f7; border-right: 2px solid #a855f7; pointer-events: none; }
.am-wave-handle { position: absolute; top: 0; bottom: 0; width: 18px; transform: translateX(-50%); cursor: ew-resize; pointer-events: auto; display: flex; align-items: center; justify-content: center; }
.am-wave-handle::before { content: ''; display: block; width: 4px; height: 70%; border-radius: 3px; background: #c084fc; box-shadow: 0 0 6px rgba(192,132,252,0.7); }
.am-wave-info { display: flex; justify-content: space-between; font-size: 0.64rem; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }
.am-wave-dur { color: var(--accent-glow); font-weight: 600; }
.am-wave-listen { background: rgba(96,165,250,0.18); border: 1px solid rgba(96,165,250,0.4); color: #eaf3ff; border-radius: 6px; cursor: pointer; padding: 3px 8px; font-size: 0.68rem; }

/* ── Mapping caméras (popup) ── */
#camera-map-modal {
  width: min(420px, 96vw);
  height: 64vh;
  resize: both;
  overflow: auto;
  min-width: 320px;
  min-height: 300px;
  max-width: 96vw;
  max-height: 92vh;
}
.cammap-overview { width: 100%; height: auto; background: #0a0813; border: 1px solid var(--border-light); border-radius: 8px; display: block; margin-bottom: 10px; }
.cammap-cam { border: 1px solid var(--border-light); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; background: rgba(255,255,255,0.03); }
.cammap-cam-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.cammap-cam-head .cammap-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cammap-cam-head .cammap-label { font-weight: 600; font-size: 0.78rem; flex: 1; }
.cammap-corners { display: grid; grid-template-columns: auto 1fr 1fr; gap: 4px 6px; align-items: center; }
.cammap-corners .cammap-corner-lbl { font-size: 0.66rem; color: var(--text-muted); }
.cammap-corners input { width: 100%; font-size: 0.68rem; padding: 2px 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light); border-radius: 5px; color: var(--text-main); }

/* ── Contrôle audio + volume dans la barre du haut ── */
.header-audio {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-audio-hd {
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.header-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 3px 10px;
}
.header-vol .slider {
  width: 84px;
  margin: 0;
}

.pb-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 4, 12, 0.82); backdrop-filter: blur(8px);
  padding: 20px;
}
.pb-card {
  max-width: 460px; text-align: center;
  padding: 36px 32px; border-radius: 18px;
  border: 1px solid var(--border-glow);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}
.pb-kicker { font-size: 0.7rem; letter-spacing: 0.25em; color: var(--accent-cyan); margin-bottom: 10px; }
.pb-card h2 { font-family: var(--font-title); font-size: 1.5rem; color: #fff; margin-bottom: 12px; }
.pb-card p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; margin-bottom: 22px; }
.pb-card .btn-primary { font-size: 1rem; padding: 12px 28px; display: inline-flex; align-items: center; justify-content: center; margin: 0 auto; }
.pb-hint { margin-top: 16px; font-size: 0.72rem; color: var(--text-muted); }
.pb-finish-btn {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 1100; padding: 9px 20px;
}

.btn-session {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-weight: 600;
}
.btn-session.rec-active {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  animation: recPulse 1.4s ease-in-out infinite;
}
@keyframes recPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

.btn-3d {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.btn-3d.active {
  background: rgba(56, 189, 248, 0.45);
  color: #fff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
}
.canvas-overlay-3d {
  top: 20px;
  right: 20px;
  padding: 6px 12px;
  border-left: none;
  border-right: 3px solid rgba(56,189,248,0.5);
}
.btn-3d-inline {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(56,189,248,0.75);
  padding: 0;
}
.btn-3d-inline:hover { color: #38bdf8; }
.btn-3d-inline.active { color: #fff; text-shadow: 0 0 10px rgba(56,189,248,0.8); }

/* Éditeur de source : compact, largeur ajustée au contenu (pas d'espace vide) */
#source-editor-modal {
  width: 320px;
  max-width: 94vw;
}

/* ── Speaker floating panel ── */
.sp-float-panel {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, 96vw);
  max-height: 82vh;
  background: rgba(10, 8, 22, 0.97);
  border: 1px solid rgba(168, 85, 247, 0.55);
  border-radius: 14px;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(168,85,247,0.1);
  z-index: 500;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.sp-float-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: move;
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent-glow);
  flex-shrink: 0;
}
.sp-float-header:active { cursor: grabbing; }
.sp-float-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

/* Config bar */
.sp-config-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 8px;
}
.sp-config-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.sp-config-input {
  width: 72px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  color: var(--text-main);
  font-size: 0.77rem;
  padding: 3px 6px;
  outline: none;
}
.sp-config-input:focus { border-color: var(--accent-glow); }
.sp-config-unit { font-size: 0.65rem; color: var(--text-muted); opacity: 0.7; }
.sp-config-hint { font-size: 0.65rem; color: var(--accent-cyan); margin-left: auto; }

.sp-calib-info {
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 4px 2px;
  line-height: 1.5;
  opacity: 0.8;
}

/* Table */
.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.sp-table th {
  text-align: left;
  padding: 5px 8px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.sp-th-calc {
  color: var(--accent-cyan) !important;
  font-style: italic;
}
.sp-unit { font-size: 0.6rem; opacity: 0.55; margin-left: 2px; }
.sp-table td {
  padding: 3px 5px;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  vertical-align: middle;
}
.sp-table input[type=text],
.sp-table input[type=number] {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 0.74rem;
  padding: 3px 6px;
  outline: none;
}
.sp-table input:focus { border-color: var(--accent-glow); }
.sp-table tr:hover td { background: rgba(255,255,255,0.02); }
.sp-td-calc {
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
  font-size: 0.73rem;
  padding: 3px 8px !important;
}
.sp-td-gain-pos { color: var(--accent-green) !important; }
.sp-td-gain-neg { color: #f87171 !important; }
.sp-del-btn {
  background: none; border: none; color: var(--accent-red);
  cursor: pointer; font-size: 0.85rem; padding: 2px 5px;
  border-radius: 4px; opacity: 0.6;
}
.sp-del-btn:hover { opacity: 1; background: rgba(248,113,113,0.1); }

/* Range Sliders */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: background 0.3s;
}
.color-input-full {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: rgba(255,255,255,0.05);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-glow);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
  transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Form inputs */
.input-text, .select {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: #fff;
  outline: none;
  transition: all 0.2s;
}

.input-text:focus, .select:focus {
  border-color: var(--accent-glow);
  background: rgba(255, 255, 255, 0.08);
}

.select option {
  background-color: var(--bg-panel-solid);
  color: #fff;
}

/* Inspector styles */
.inspector-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 30px 10px;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

/* Cameras dynamic container */
#cameras-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.camera-feed {
  margin-bottom: 12px;
}
.cam-viewmode-select {
  width: 100%;
  margin-top: 6px;
  font-size: 0.72rem;
  padding: 5px 8px;
}
.cam-bgreset-btn {
  width: 100%;
  margin-top: 5px;
  font-size: 0.7rem;
}
.cam-stats {
  margin-top: 6px; padding: 4px 8px; border-radius: 6px;
  font-size: 0.72rem; font-family: monospace; text-align: center;
  background: rgba(255,255,255,0.05); color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.cam-stats.cam-stats-hot { color: #34d399; border-color: rgba(52,211,153,0.45); background: rgba(52,211,153,0.10); }
.cam-param {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px; font-size: 0.72rem; color: var(--text-muted);
}
.cam-param input[type="range"] { flex: 1; }
.cam-param-label { min-width: 5em; }
.cam-param-val { font-family: monospace; color: var(--accent-cyan); min-width: 2.8em; text-align: right; }
.sim-audience-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.camera-preview-container {
  position: relative;
  width: 100%;
  height: 150px;
  background-color: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.camera-preview-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  transform: scaleX(-1); /* mirror */
}

.camera-preview-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  mix-blend-mode: screen;
}

.camera-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-cyan);
  z-index: 3;
}

.video-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  color: #fff;
  z-index: 3;
}

/* Checkbox Container */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-glow);
  cursor: pointer;
}

.checkbox-label {
  font-size: 0.75rem;
  cursor: pointer;
}

.highlight-text-cyan {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Loading Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-main);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(168, 85, 247, 0.1);
  border-top-color: var(--accent-glow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-content h2 {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.5rem;
}

.loader-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Modal Popup Window */
/* Conteneur non bloquant : laisse passer les clics vers la page principale */
.modal-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.modal-content {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  max-width: calc(100vw - 24px);
  max-height: 82vh;
  border-radius: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  pointer-events: auto; /* le panneau reste interactif */
  border: 1px solid var(--border-glow);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(168, 85, 247, 0.1);
}

.modal-header {
  cursor: move;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-panel-solid, #0e0c1c);
}
.modal-header:active { cursor: grabbing; }

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close:hover {
  color: var(--accent-red);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Popup Configuration : redimensionnable + colonnes responsives (1/2/3 selon largeur) ── */
#setup-modal .modal-content {
  width: 380px;
  resize: both;
  overflow: auto;
  min-width: 320px;
  min-height: 220px;
  max-height: 92vh;
}
#setup-modal .modal-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
  align-items: start;
}
#setup-modal .setup-section { margin: 0; }
/* Popup ouvert depuis le launcher (hors carte) : masquer les sections propres à une carte */
#setup-modal.config-no-map .cfg-map-only { display: none !important; }
/* …et passer AU-DESSUS de l'overlay launcher (z-index 2000) */
#setup-modal.config-no-map { z-index: 2500; }
/* Modales déclenchées DEPUIS le launcher (z-index 2000) : doivent passer au-dessus,
   sinon elles s'ouvrent derrière et restent invisibles. */
#collab-modal { z-index: 2600; }
/* Couleurs plus compactes, alignées en ligne */
#setup-modal .color-input-full {
  width: 48px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
}
#setup-modal .setup-section .form-group:has(.color-input-full) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* Couleurs du thème regroupées en grille compacte */
.cfg-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cfg-color-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 5px 8px;
  border-radius: 7px;
  margin: 0;
}
.cfg-color-cell input[type="color"] {
  width: 34px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  background: none;
  cursor: pointer;
  flex: none;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.015);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.setup-section h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.cam-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cam-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.cam-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cam-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}

.cam-item-device {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  color: #fff;
  backdrop-filter: blur(12px);
  opacity: 1;
  transition: opacity 0.4s ease;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.info    { background: rgba(59,130,246,0.88);  border: 1px solid rgba(59,130,246,0.4); }
.toast.success { background: rgba(16,185,129,0.88);  border: 1px solid rgba(16,185,129,0.4); }
.toast.error   { background: rgba(239,68,68,0.88);   border: 1px solid rgba(239,68,68,0.4); }
.toast.warning { background: rgba(245,158,11,0.88);  border: 1px solid rgba(245,158,11,0.4); }
.toast.fade-out { opacity: 0; }

/* ── Audio drop zone ── */
.audio-drop-zone {
  border: 2px dashed rgba(168, 85, 247, 0.35);
  border-radius: 10px;
  padding: 18px 10px;
  text-align: center;
  cursor: default;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.audio-drop-zone.drag-over {
  border-color: var(--accent-glow);
  background: rgba(168, 85, 247, 0.09);
  color: var(--text-main);
}
.audio-drop-icon { font-size: 1.6rem; line-height: 1; }
.audio-drop-hint { font-size: 0.62rem; opacity: 0.55; }
.audio-library-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.audio-library-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
}
.audio-lib-icon { opacity: 0.6; font-style: normal; }

/* ── Profile cards ── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.profile-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-main);
}
.profile-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent-glow);
}
.profile-card.active {
  background: rgba(168,85,247,0.15);
  border-color: var(--accent-glow);
  box-shadow: 0 0 14px rgba(168,85,247,0.3);
}
.profile-icon { font-size: 1.4rem; }
.profile-name { font-size: 0.78rem; font-weight: 600; color: var(--text-main); }
.profile-desc { font-size: 0.63rem; color: var(--text-muted); line-height: 1.3; }

/* Profile badge in header */
.profile-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(168,85,247,0.18);
  border: 1px solid rgba(168,85,247,0.35);
  color: var(--accent-glow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

/* ===== Page d'accueil : gestionnaire de cartes (launcher) ===== */
.launcher-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; background: var(--bg-main);
  font-family: var(--font-body); color: var(--text-main);
}
.launcher-overlay.hidden { display: none; }

.launcher-scroll { flex: 1; overflow-y: auto; padding: 24px 26px; }
.launcher-create {
  max-width: 1100px; margin: 0 auto 22px;
  padding: 18px 20px; border-radius: 14px;
  background: var(--bg-panel-solid); border: 1px solid var(--border-light);
}
.launcher-overlay.not-admin .launcher-create { display: none; }
.lc-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.lc-row .lp-field { flex: 1; min-width: 200px; margin-bottom: 0; }
.lc-create-btn { width: auto; flex: none; margin-top: 0; padding: 10px 22px; align-self: flex-end; }
.lp-create-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 10px; }
/* Séparation claire « Créer une carte » ↔ « Mes cartes » */
.launcher-mine-header {
  max-width: 1100px; margin: 4px auto 16px; padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.launcher-mine-title { margin-bottom: 0; display: flex; align-items: center; gap: 9px; }
.launcher-mine-title .lmh-ico { font-size: 1.05rem; }
.lp-title { font-family: var(--font-title); font-size: 1.05rem; letter-spacing: 0.06em; margin-bottom: 14px; color: var(--accent-glow); }
.lp-field { margin-bottom: 14px; }
.lp-field > label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 5px; }
.lp-field input[type=text], .lp-field input[type=number], .lp-field select {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-light);
  color: var(--text-main); font-size: 0.85rem; outline: none;
}
.lp-field input:focus, .lp-field select:focus { border-color: var(--accent-glow); }
.lp-row2 { display: flex; gap: 10px; }
.lp-row2 > div { flex: 1; }
.lp-slug-row { display: flex; align-items: center; gap: 0; }
.lp-slug-prefix { font-size: 0.72rem; color: var(--text-muted); padding: 0 6px 0 2px; font-family: monospace; }
.lp-slug-status { font-size: 0.68rem; text-transform: none; letter-spacing: 0; }
.lp-slug-status.ok { color: var(--accent-green); }
.lp-slug-status.no { color: var(--accent-red); }
.lp-check { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; text-transform: none; letter-spacing: 0; color: var(--text-main); margin: 6px 0; cursor: pointer; }
.lp-check input { width: auto; cursor: pointer; }
.lp-btn { display: block; width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-light); background: rgba(255,255,255,0.05); color: var(--text-main); font-size: 0.82rem; font-weight: 600; cursor: pointer; margin-top: 8px; transition: opacity 0.15s; }
.lp-btn:hover { opacity: 0.85; }
.lp-btn-primary { background: var(--accent-glow); color: #1a0b2e; border-color: transparent; }
.lp-btn-ghost { background: rgba(255,255,255,0.04); }
.lp-msg { font-size: 0.75rem; margin-top: 8px; min-height: 16px; }
.lp-msg.ok { color: var(--accent-green); }
.lp-msg.no { color: var(--accent-red); }

.launcher-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.launcher-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 26px; border-bottom: 1px solid var(--border-light); }
.launcher-logo { display: flex; align-items: center; gap: 10px; }
.launcher-logo h1 { font-family: var(--font-title); font-size: 1.1rem; letter-spacing: 0.1em; }
.launcher-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 300; }
.launcher-actions { display: flex; align-items: center; gap: 10px; }
.launcher-actions .lp-btn { width: auto; margin: 0; }
.launcher-badge { font-size: 0.72rem; color: var(--text-muted); padding: 3px 10px; border: 1px solid var(--border-light); border-radius: 20px; }
.launcher-badge.admin { color: var(--accent-green); border-color: rgba(52,211,153,0.4); }

.launcher-list { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-content: start; }
@media (max-width: 720px) { .launcher-list { grid-template-columns: minmax(0, 1fr); } }
.launcher-empty { grid-column: 1/-1; color: var(--text-muted); text-align: center; padding: 40px; }
.map-card { background: var(--bg-panel-solid); border: 1px solid var(--border-light); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, transform 0.15s; }
.map-card:hover { border-color: var(--border-glow); transform: translateY(-2px); }
.map-card .mc-thumb { width: 100%; height: auto; aspect-ratio: 2 / 1; border-radius: 8px; border: 1px solid var(--border-light); background: #0a0813; display: block; }
.map-card h3 { font-family: var(--font-title); font-size: 1rem; }
.map-card .mc-slug { font-family: monospace; font-size: 0.72rem; color: var(--accent-cyan); }
.map-card .mc-meta { font-size: 0.72rem; color: var(--text-muted); }
.map-card .mc-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.mc-badge { font-size: 0.62rem; padding: 2px 7px; border-radius: 12px; background: rgba(168,85,247,0.16); border: 1px solid rgba(168,85,247,0.35); color: #d8b4fe; }
.mc-badge.legacy { background: rgba(255,255,255,0.05); border-color: var(--border-light); color: var(--text-muted); }
.mc-title-row { display: flex; align-items: center; gap: 6px; }
.mc-title-row h3 { flex: 1; margin: 0; }
.mc-rename { flex: none; background: rgba(255,255,255,0.06); border: 1px solid var(--border-light); color: var(--text-muted); border-radius: 6px; cursor: pointer; padding: 2px 7px; font-size: 0.8rem; }
.mc-rename:hover { color: var(--accent-glow); border-color: var(--border-glow, rgba(168,85,247,0.5)); }
.map-card .mc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mc-btn { flex: 1 1 auto; min-width: max-content; padding: 7px 10px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.78rem; font-weight: 600; }
.mc-edit { background: rgba(168,85,247,0.25); color: #f1e9ff; border: 1px solid rgba(168,85,247,0.5); }
.mc-play { background: rgba(96,165,250,0.25); color: #eaf3ff; border: 1px solid rgba(96,165,250,0.5); }
.mc-dup { flex: none; background: rgba(56,189,248,0.12); color: var(--accent-cyan); border: 1px solid rgba(56,189,248,0.35); font-size: 0.9rem; }
.mc-del { flex: none; background: rgba(248,113,113,0.12); color: var(--accent-red); border: 1px solid rgba(248,113,113,0.35); }
.mc-export { flex: none; background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.18); font-size: 0.9rem; }
.mc-public { flex: none; background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.18); font-size: 0.9rem; }
.mc-public.is-public { background: rgba(52,211,153,0.16); color: #34d399; border-color: rgba(52,211,153,0.45); }
.mc-share { flex: none; background: rgba(168,85,247,0.12); color: var(--accent-glow); border: 1px solid rgba(168,85,247,0.35); font-size: 0.9rem; }
.mc-sharepw { flex: none; background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.18); font-size: 0.9rem; }
.mc-sharepw.is-set { background: rgba(251,191,36,0.16); color: #fbbf24; border-color: rgba(251,191,36,0.45); }
.mc-btn:hover { opacity: 0.85; }

/* Panneau de partage façon Zoom (inline, sans modale) */
.mc-share-panel { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 10px; }
.mc-share-panel.hidden { display: none; }
.mc-share-panel-title { font-size: 0.74rem; font-weight: 600; color: var(--accent-glow); letter-spacing: 0.02em; text-transform: uppercase; }
.mc-share-panel-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-share-btn-free, .mc-share-btn-pw { flex: 1 1 auto; padding: 6px 10px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.75rem; font-weight: 600; transition: opacity 0.15s; }
.mc-share-btn-free { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.4); }
.mc-share-btn-pw { background: rgba(251,191,36,0.13); color: #fbbf24; border: 1px solid rgba(251,191,36,0.4); }
.mc-share-btn-free:hover, .mc-share-btn-pw:hover { opacity: 0.8; }
.mc-share-btn-free:disabled, .mc-share-btn-pw:disabled { opacity: 0.4; cursor: default; }
.mc-share-url-row { display: flex; gap: 6px; align-items: center; }
.mc-share-url { flex: 1; font-family: monospace; font-size: 0.72rem; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border-light); background: rgba(0,0,0,0.35); color: var(--accent-cyan); outline: none; cursor: text; user-select: all; }
.mc-share-url:focus { border-color: var(--border-glow); }
.mc-share-copy { flex: none; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--border-light); background: rgba(255,255,255,0.07); color: var(--text-muted); font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
.mc-share-copy:hover { opacity: 0.8; }
.mc-share-status { font-size: 0.7rem; color: var(--text-muted); line-height: 1.4; }
.mc-share-status--free { color: #34d399; }
.mc-share-status--pw { color: #fbbf24; }
.mc-share-status--private { color: var(--text-muted); }

/* QR code permanent dans le panneau de partage */
.mc-share-qr-block { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
.mc-share-qr-label { font-size: 0.7rem; color: var(--text-muted); line-height: 1.4; text-align: center; max-width: 280px; }
.mc-share-qr { display: none; background: #fff; border-radius: 8px; padding: 6px; width: 150px; height: 150px; box-sizing: content-box; }
/* QR + adresse permanente dans le popup de réglages d'une carte */
.cfg-share-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.cfg-share-row input { flex: 1; font-family: monospace; font-size: 0.78rem; }
.cfg-share-qr { display: none; background: #fff; border-radius: 8px; padding: 6px; width: 168px; height: 168px; box-sizing: content-box; }

/* Case « Afficher sur la page d'accueil publique » dans le panneau de partage */
.mc-home-listed-row { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-main); cursor: pointer; padding-top: 4px; border-top: 1px solid var(--border-light); flex-wrap: wrap; }
.mc-home-listed-row input[type="checkbox"] { accent-color: var(--accent-glow); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.mc-home-listed-hint { font-size: 0.68rem; color: var(--text-muted); font-style: italic; }

/* Vue d'accueil anonyme */
.home-hero { grid-column: 1/-1; text-align: center; padding: 36px 20px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.home-hero-title { font-family: var(--font-title); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.03em; color: var(--text-main); }
.home-hero-desc { font-size: 0.9rem; color: var(--text-muted); max-width: 440px; line-height: 1.5; }
.home-hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.home-cta-btn { display: inline-block; padding: 13px 28px; border-radius: 10px; font-size: 0.95rem; font-weight: 700; text-decoration: none; transition: filter 0.15s, transform 0.12s; }
.home-cta-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.home-cta-login { background: linear-gradient(135deg, rgba(168,85,247,0.35), rgba(168,85,247,0.18)); color: #f1e9ff; border: 1px solid rgba(168,85,247,0.55); }
.home-cta-register { background: linear-gradient(135deg, rgba(96,165,250,0.32), rgba(96,165,250,0.15)); color: #eaf3ff; border: 1px solid rgba(96,165,250,0.5); }
.home-public-section { grid-column: 1/-1; display: flex; flex-direction: column; gap: 14px; }
.home-public-title { font-family: var(--font-title); font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; padding-bottom: 10px; border-bottom: 1px solid var(--border-light); }
.home-maps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .home-maps-grid { grid-template-columns: minmax(0, 1fr); } }
.home-map-card { cursor: pointer; }
.home-lock { font-size: 0.85rem; vertical-align: middle; }

/* Bouton « ← Cartes » + « Enregistrer » dans le bandeau éditeur */
.btn-home, .btn-save-map { font-size: 0.7rem; padding: 5px 10px; }
.play-only .btn-home, .play-only .btn-save-map { display: none !important; }

/* --- Section 3 : ergonomie éditeur --- */
/* Plus d'air entre les paramètres de l'inspecteur (édition de source/HP) */
#inspector-fields .form-group { margin-bottom: 15px; }
.inspector-content .mini-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

/* Boîtes nombres « scrubbables » : indiquer qu'on peut glisser */
input[type="number"] { cursor: ew-resize; }

/* Petits boutons (Export/Import, sauvegarde dans l'app) dans le menu de config */
.btn-grid-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn-sm { font-size: 0.72rem; padding: 7px 9px; }

/* --- Section line-in : groupe inspecteur entrée carte son --- */
#ins-group-linein label.highlight-text-cyan { display: block; margin-bottom: 6px; }
.linein-status {
  font-size: 0.72rem;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.linein-status--error {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(248, 113, 113, 0.08);
}
.linein-status--ok {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(52, 211, 153, 0.08);
}
/* Bouton « ＋ Entrée carte son » dans la barre latérale gauche */
#btn-add-linein {
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
#btn-add-linein:hover {
  background: rgba(96, 165, 250, 0.22);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTRÔLE DISTANT — modale d'appairage hôte
   ═══════════════════════════════════════════════════════════════════════════ */

/* Modale : largeur plus fine, centrée */
.rc-modal-content {
  width: 460px !important;
}

.rc-modal-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

/* Badge d'état de connexion */
.rc-state-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rc-state-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  background: rgba(255,255,255,.07);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  transition: background .3s, color .3s;
}
.rc-state-badge.ok  { background: rgba(52,211,153,.12);  color: var(--accent-green); border-color: rgba(52,211,153,.3); }
.rc-state-badge.warn{ background: rgba(251,191,36,.10);  color: #fbbf24;              border-color: rgba(251,191,36,.3); }
.rc-state-badge.err { background: rgba(248,113,113,.10); color: var(--accent-red);   border-color: rgba(248,113,113,.3); }

.rc-latency {
  font-size: .78rem;
  color: var(--text-muted);
}

/* Bannière d'erreur */
.rc-err-banner {
  background: rgba(248,113,113,.1);
  color: var(--accent-red);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .82rem;
}

/* Carte interne */
.rc-card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rc-card-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

/* QR wrap */
.rc-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rc-qr-wrap canvas {
  border-radius: 8px;
  max-width: 100%;
  background: #fff;
}

/* Textarea blob */
.rc-textarea {
  width: 100%;
  background: rgba(0,0,0,.25);
  color: var(--accent-green);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px;
  font-size: .72rem;
  font-family: monospace;
  resize: vertical;
  min-height: 56px;
}

/* Rangée de boutons */
.rc-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rc-btn-row .btn { flex: 1; min-width: 120px; }

/* Liste des contrôleurs connectés */
.rc-ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.rc-ctrl-row:last-child { border-bottom: none; }
.rc-ctrl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.rc-ctrl-dot.rc-state-ok { background: var(--accent-green); }
.rc-ctrl-name {
  flex: 1;
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hint info bas de modale */
.rc-hint {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 12px;
  border-left: 2px solid var(--accent-glow);
  background: rgba(192,132,252,.05);
  border-radius: 0 6px 6px 0;
}

/* ══ VU-mètre multicanal ══════════════════════════════════════════════════ */
.mc-vumeter {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(10, 8, 22, 0.95);
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 10px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(168,85,247,0.08);
  padding: 8px 10px;
  z-index: 400;
  user-select: none;
  min-width: 60px;
}
.mc-vumeter.hidden { display: none; }

.mc-vumeter-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: move;
  font-family: var(--font-title, 'Outfit', sans-serif);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--accent-glow, #c084fc);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.mc-vumeter-handle:active { cursor: grabbing; }

.mc-vumeter-bars {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: flex-end;
}

.mc-vu-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.mc-vu-bar {
  position: relative;
  width: 14px;
  height: 120px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
}

.mc-vu-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 0%;
  /* Dégradé VU : vert en bas → jaune au milieu → rouge en haut */
  background: linear-gradient(
    to top,
    #22c55e 0%,
    #86efac 40%,
    #facc15 70%,
    #f97316 85%,
    #ef4444 100%
  );
  border-radius: 0 0 3px 3px;
  transition: height 0.04s linear;
}

.mc-vu-label {
  font-size: 0.6rem;
  color: var(--text-muted, #9ca3af);
  text-align: center;
  line-height: 1.2;
  max-width: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
