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

body {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

#game {
  position: relative;
  z-index: 1;
  border: 1px solid #1a3a5c;
  border-radius: 4px;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  flex-shrink: 1;
  cursor: none;
}

body.menu #game {
  cursor: pointer;
}

/* --- Dev Overlay (DOM panel à gauche du canvas, ?dev desktop) --- */
#dev-overlay {
  display: none;
  position: relative;
  z-index: 2;
  flex-direction: column;
  flex-shrink: 0;
  gap: 3px;
  padding: 6px;
  margin-right: 8px;
  min-width: 110px;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
#dev-overlay::-webkit-scrollbar { display: none; }
#dev-overlay.active { display: flex; }

#dev-overlay button {
  font: 10px/1.2 monospace;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  padding: 4px 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  transition: opacity 0.1s;
}
#dev-overlay button:hover {
  opacity: 1 !important;
  border-color: #fff;
}

#dev-overlay .life-row {
  display: flex;
  gap: 3px;
}
#dev-overlay .life-row button {
  flex: 1;
}

/* --- Dev Stats (panel droit, timer + intensité) --- */
#dev-stats {
  display: none;
  position: relative;
  z-index: 2;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  padding: 6px;
  margin-left: 8px;
  min-width: 100px;
  font: 12px/1.4 monospace;
  color: #aaa;
}
#dev-stats.active { display: flex; }
#dev-stats .val { color: #fff; font-weight: bold; }
#dev-stats .intensity-bar {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
#dev-stats .intensity-bar span {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 2px;
}
#dev-stats .intensity-bar span.on {
  border-color: #fff;
}

/* --- Progress Lab — panel unique à droite du canvas --- */
#pl-panel {
  display: none;
  flex-direction: column;
  position: relative;
  z-index: 2;
  width: 240px;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  flex-shrink: 0;
  background: rgba(10, 10, 26, 0.94);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 0 8px 8px 0;
  border-left: none;
  font: 13px/1.5 monospace;
  color: #ccc;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
#pl-panel.active { display: flex; }

/* Simulator modal (popup éphémère) */
#pl-simulator {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  width: 360px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  flex-direction: column;
  background: rgba(10, 10, 26, 0.97);
  border: 1px solid rgba(0, 180, 255, 0.6);
  border-radius: 8px;
  font: 13px/1.5 monospace;
  color: #ccc;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
#pl-simulator.open { display: flex; }

.pl-panel-title {
  color: #ffd700;
  font-weight: bold;
  font-size: 13px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}
.pl-sim-title {
  color: #00d4ff;
  font-weight: bold;
  font-size: 14px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(0, 180, 255, 0.3);
}

/* Panels */
.pl-body { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.pl-separator {
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  margin: 8px 0;
}

/* Rows */
.pl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.pl-sim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.pl-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
.pl-label {
  flex: 1;
  color: #aaa;
  font-size: 12px;
  white-space: nowrap;
}
.pl-qty {
  color: #ffd700;
  font-weight: bold;
  min-width: 36px;
  text-align: center;
}
.pl-desc {
  color: #888;
  font-size: 12px;
  margin-bottom: 12px;
}

/* Buttons */
.pl-btn-sm {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  color: #ccc;
  font: bold 14px/1 monospace;
  width: 28px;
  height: 26px;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-btn-sm:hover { background: rgba(255,255,255,0.15); border-color: #fff; color: #fff; }

.pl-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.25);
  color: #ccc;
  font: 12px/1 monospace;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
}
.pl-btn:hover { background: rgba(255,255,255,0.12); border-color: #fff; color: #fff; }
.pl-btn-active {
  background: rgba(255, 215, 0, 0.15);
  border-color: #ffd700;
  color: #ffd700;
}
.pl-btn-primary {
  background: rgba(0, 180, 255, 0.15);
  border-color: #00b4ff;
  color: #00d4ff;
  font-weight: bold;
  padding: 8px 16px;
  margin-top: 10px;
  width: 100%;
}
.pl-btn-primary:hover { background: rgba(0, 180, 255, 0.3); }
.pl-btn-danger {
  background: rgba(255, 60, 60, 0.1);
  border-color: #ff4444;
  color: #ff4444;
  padding: 8px 16px;
  width: 100%;
}
.pl-btn-danger:hover { background: rgba(255, 60, 60, 0.25); }
.pl-btn-star {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #888;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 3px;
}
.pl-btn-star.pl-btn-active { color: #ffd700; border-color: #ffd700; }
.pl-btn-star:disabled { opacity: 0.3; cursor: default; }

/* Select */
.pl-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font: 12px monospace;
  padding: 4px 8px;
  border-radius: 3px;
  flex: 1;
}

/* Feedback */
.pl-feedback {
  color: #00d4ff;
  font-size: 12px;
  min-height: 18px;
  margin-top: 6px;
}

/* Panel swap selon l'état du jeu */
.pl-system-content { display: none; }
.pl-world-content  { display: block; }
.state-systemMap .pl-system-content { display: block; }
.state-systemMap .pl-world-content  { display: none; }

/* Zone rows */
.pl-zone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.pl-zone-progress {
  font-size: 11px;
  min-width: 70px;
  text-align: right;
}

/* ============================================================
   Dev Panel Lab (?dev) — overlay DOM par-dessus le canvas
   ============================================================ */
#dev-panel-lab {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(10, 10, 26, 0.94);
  border: 1px solid rgba(255, 204, 0, 0.4);
  border-radius: 8px;
  font: 13px/1.5 monospace;
  color: #ccc;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
#dev-panel-lab.active { display: flex; flex-direction: column; }

.dp-header {
  display: flex;
  align-items: center;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(255, 204, 0, 0.2);
}
.dp-title { color: #ffcc00; font-weight: bold; font-size: 14px; }

.dp-body {
  padding: 8px 14px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}
.dp-col { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 600px) {
  #dev-panel-lab { width: auto; }
  .dp-body { grid-template-columns: 1fr; }
}

.dp-section-label { color: #aabbcc; font-weight: bold; font-size: 12px; margin-top: 8px; }
.dp-accordion { cursor: pointer; user-select: none; }
.dp-accordion:hover { color: #ddeeff; }
.dp-collapsed { display: none !important; }
.dp-hint { color: #556666; font-size: 10px; }

.dp-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}
.dp-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.dp-slider-label { color: #ccddee; font-size: 12px; min-width: 60px; }
.dp-slider-hp { color: #556677; font-size: 9px; min-width: 30px; }
.dp-slider {
  flex: 1;
  accent-color: #ffcc00;
  cursor: pointer;
  height: 6px;
}
.dp-slider-val { color: #889999; font-size: 10px; min-width: 36px; text-align: right; }

.dp-btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.dp-btn-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.dp-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.2);
  color: #889999;
  font: 11px/1.2 monospace;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
  position: relative;
}
.dp-btn:hover { background: rgba(255,255,255,0.08); border-color: #667788; color: #ccddee; }
.dp-btn-active {
  background: rgba(255, 204, 0, 0.2) !important;
  border-color: #ffcc00 !important;
  color: #ffcc00 !important;
}
.dp-btn-size { font-size: 9px; color: #556677; margin-left: 8px; }

.dp-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.dp-ai-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font: 12px/1 monospace;
  color: #00d4ff;
  cursor: pointer;
}
.dp-btn-primary {
  flex: 1;
  background: rgba(0, 180, 255, 0.15);
  border: 2px solid #00d4ff;
  color: #00d4ff;
  font: bold 14px/1 monospace;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
}
.dp-btn-primary:hover { background: rgba(0, 180, 255, 0.3); }
.dp-btn-danger {
  background: rgba(255, 60, 60, 0.1);
  border: 1px solid #664444;
  color: #aa6666;
  font: 12px/1 monospace;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
}
.dp-btn-danger:hover { background: rgba(255, 60, 60, 0.25); color: #ff4444; border-color: #ff4444; }

/* ============================================================
   Music Lab (?mus) — overlay DOM par-dessus le canvas
   ============================================================ */
#music-lab {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 780px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: hidden;
  background: rgba(10, 10, 26, 0.94);
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 8px;
  font: 13px/1.5 monospace;
  color: #ccc;
  flex-direction: column;
}
#music-lab.active { display: flex; }

.ml-header {
  display: flex;
  align-items: center;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}
.ml-title { color: #ffcc00; font-weight: bold; font-size: 14px; }

/* Tabs */
.ml-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ml-tab {
  flex: 1;
  background: none;
  border: none;
  color: #667788;
  font: bold 12px/1 monospace;
  padding: 8px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.ml-tab:hover { color: #aaccdd; }
.ml-tab-active { color: #00d4ff; border-bottom-color: #00d4ff; }

/* Body (scrollable) */
.ml-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

/* Panels */
.ml-panel { display: flex; flex-direction: column; gap: 6px; }
.ml-panel-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}
.ml-col { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 700px) {
  #music-lab { width: auto; }
  .ml-panel-cols { grid-template-columns: 1fr; }
}

.ml-section-label { color: #aabbcc; font-weight: bold; font-size: 12px; margin-top: 8px; }

/* Button rows/grids */
.ml-btn-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ml-btn-row { display: flex; gap: 6px; margin-top: 4px; }

.ml-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  color: #889999;
  font: 11px/1.2 monospace;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s, border-color 0.1s;
}
.ml-btn:hover { background: rgba(255,255,255,0.15); border-color: currentColor; }
.ml-btn-active {
  background: rgba(0, 212, 255, 0.15) !important;
  border-color: currentColor !important;
  font-weight: bold;
}

.ml-btn-sm {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  color: #889999;
  font: bold 12px/1 monospace;
  width: 36px;
  height: 28px;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-btn-sm:hover { background: rgba(255,255,255,0.15); }
.ml-btn-sm.ml-btn-active { border-width: 2px; font-weight: bold; }

/* Intensity */
.ml-intensity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.ml-intensity-value { font-size: 28px; font-weight: bold; }
.ml-intensity-label { font-size: 16px; font-weight: bold; }
.ml-intensity-btns { display: flex; gap: 4px; margin-left: auto; }

/* Progress bar */
.ml-progress-bar {
  position: relative;
  background: #1a2233;
  height: 24px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.ml-progress-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: rgba(68, 170, 102, 0.4);
  transition: width 0.2s;
}
.ml-progress-text {
  position: relative;
  z-index: 1;
  font: bold 11px/24px monospace;
  color: #fff;
  padding-left: 8px;
}

/* Sim stats */
.ml-sim-stats { display: flex; gap: 16px; margin-top: 6px; }
.ml-stat { font: bold 13px monospace; }

/* Layer readonly (gameplay tab) */
.ml-layer-row { display: flex; gap: 6px; margin-top: 4px; }
.ml-layer-cell {
  position: relative;
  flex: 1;
  background: #1a2233;
  height: 32px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #334455;
}
.ml-layer-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  opacity: 0.4;
  transition: width 0.3s;
}
.ml-layer-label {
  position: relative;
  z-index: 1;
  font: bold 11px/32px monospace;
  text-align: center;
  display: block;
}

/* Mix tab */
.ml-mix-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ml-mix-btn { min-width: 120px; }
.ml-mix-vol { color: #667788; font-size: 11px; }

/* Transport / Footer */
.ml-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}
.ml-transport {
  border-color: #00d4ff !important;
  color: #00d4ff !important;
  font-weight: bold;
  min-width: 80px;
  text-align: center;
}

.ml-activity {
  position: relative;
  flex: 1;
  background: #1a2233;
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  min-width: 160px;
}
.ml-activity-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: rgba(0, 212, 255, 0.3);
  transition: width 0.3s;
}
.ml-activity-label {
  position: relative;
  z-index: 1;
  font: bold 10px/20px monospace;
  color: #fff;
  padding-left: 6px;
}
.ml-activity-time {
  position: absolute;
  right: 6px;
  top: 0;
  z-index: 1;
  font: 10px/20px monospace;
  color: #88bbdd;
}

.ml-current-section {
  color: #667788;
  font-size: 10px;
  width: 100%;
  margin-top: 2px;
}

/* ==================== Lab Hub ==================== */
#lab-hub {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 360px;
  max-width: 95vw;
  background: rgba(10, 10, 26, 0.94);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  font: 13px/1.5 monospace;
  color: #ccc;
}
#lab-hub.active { display: flex; flex-direction: column; }

.lh-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lh-title {
  font-size: 14px;
  font-weight: bold;
  color: #ffd700;
  letter-spacing: 2px;
}

.lh-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
}

.lh-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.lh-card:hover {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.5);
}
.lh-card-label {
  font: bold 14px monospace;
  color: #ffd700;
}
.lh-card-desc {
  font-size: 11px;
  color: #778899;
}

/* Back button (shared pattern for all panels) */
.lab-back-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #889999;
  font: 11px monospace;
  padding: 3px 10px;
  cursor: pointer;
  border-radius: 3px;
  margin-right: 10px;
}
.lab-back-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.4);
}

/* --- AI Lab --- */
#ai-lab {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 620px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(10, 10, 26, 0.94);
  border: 1px solid rgba(0, 255, 100, 0.35);
  border-radius: 8px;
  font: 13px/1.5 monospace;
  color: #ccc;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
#ai-lab.active { display: flex; flex-direction: column; }

.ai-header {
  display: flex;
  align-items: center;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(0, 255, 100, 0.2);
}
.ai-title {
  color: #0fa;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: 2px;
  flex: 1;
}
.ai-body {
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}
.ai-col { display: flex; flex-direction: column; gap: 8px; }
.ai-section { display: flex; flex-direction: column; gap: 6px; }
.ai-label { color: #0fa; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }

.ai-select {
  background: #1a1a2e;
  color: #ccc;
  border: 1px solid rgba(0,255,100,0.25);
  border-radius: 4px;
  padding: 6px 8px;
  font: 12px monospace;
  width: 100%;
}
.ai-select:disabled { opacity: 0.4; }

.ai-btn {
  background: #1a1a2e;
  color: #0f0;
  border: 1px solid rgba(0,255,100,0.25);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font: 12px monospace;
  transition: background 0.15s;
  text-align: left;
}
.ai-btn:hover { background: rgba(0,255,100,0.1); }
.ai-btn-primary { border-color: rgba(0,255,100,0.5); color: #0fa; font-weight: bold; }
.ai-btn-active { background: rgba(0,255,100,0.15); border-color: #0f0; }
.ai-btn-danger { color: #f55; border-color: rgba(255,80,80,0.3); }
.ai-btn-danger:hover { background: rgba(255,80,80,0.1); }

.ai-stats { display: flex; flex-direction: column; gap: 3px; }
.ai-stat { font-size: 12px; }
.ai-stat b { color: #0f0; }
.ai-best { color: #0fa !important; font-size: 14px; }
.ai-stat-muted { color: #556; font-style: italic; }
.ai-stat-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 3px 0; }
.ai-log { font: 10px/1.4 monospace; color: #8f8; margin: 0; white-space: pre; overflow-x: auto; max-height: 320px; overflow-y: auto; }

.ai-graph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ai-graph-wrap { display: flex; flex-direction: column; gap: 2px; }
.ai-graph-label { font: 9px monospace; color: #0fa8; text-transform: uppercase; letter-spacing: 0.5px; }
.ai-graph {
  width: 100%;
  height: 80px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(0,255,100,0.1);
  border-radius: 4px;
}

/* Modale zoom graphe */
.ai-graph-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.85);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 30px;
}
.ai-graph-modal.active { display: flex; }
.ai-graph-modal-title {
  color: #0fa;
  font: bold 16px monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.ai-graph-modal-canvas {
  width: min(90vw, 800px);
  height: min(50vh, 400px);
  background: rgba(0,20,10,0.6);
  border: 1px solid rgba(0,255,100,0.2);
  border-radius: 6px;
}

/* Mode sidebar : panel à droite pendant l'entraînement */
#ai-lab.ai-sidebar {
  top: 10px;
  right: 10px;
  left: auto;
  transform: none;
  width: 260px;
  max-height: 95vh;
  opacity: 0.92;
}
#ai-lab.ai-sidebar .ai-body {
  grid-template-columns: 1fr;
}
#ai-lab.ai-sidebar .ai-select,
#ai-lab.ai-sidebar .ai-graph { width: 100%; }
#ai-lab.ai-sidebar .ai-graph-grid { grid-template-columns: 1fr; }

@media (max-width: 600px) {
  #ai-lab { width: auto; }
  .ai-body { grid-template-columns: 1fr; }
}
