/* ==========================================================================
   Simulation de l'Égoïsme — Stylesheets (Code BH Aesthetic + Linear Zero-Slop)
   ========================================================================== */

:root {
  --bg-primary: #0a0f1d;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-card: #151e32;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.2);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --color-dove: #06b6d4;        /* Cyan Altruiste */
  --color-dove-bg: rgba(6, 182, 212, 0.12);
  --color-hawk: #ef4444;        /* Rouge Faucon */
  --color-hawk-bg: rgba(239, 68, 68, 0.12);
  --color-tft: #f59e0b;         /* Jaune Tit-for-Tat */
  --color-tft-bg: rgba(245, 158, 11, 0.12);
  --color-grudger: #a855f7;     /* Violet Rancunier */
  --color-grudger-bg: rgba(168, 85, 247, 0.12);
  --color-carrot: #f97316;      /* Orange Carotte */

  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --danger: #e11d48;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', Consolas, Monaco, monospace;
}

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

html, body {
  width: 100%;
  max-width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

/* ==========================================================================
   Header
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-mark {
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.header-titles h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-titles .subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.day-badge {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.day-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.day-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.phase-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background-color: #374151;
  border-color: var(--border-active);
}

.btn-danger {
  background-color: rgba(225, 29, 72, 0.15);
  color: #fb7185;
  border-color: rgba(225, 29, 72, 0.3);
}
.btn-danger:hover {
  background-color: rgba(225, 29, 72, 0.25);
}

.btn-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
  background-color: rgba(245, 158, 11, 0.25);
}

.btn-info {
  background-color: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border-color: rgba(6, 182, 212, 0.3);
}
.btn-info:hover {
  background-color: rgba(6, 182, 212, 0.25);
}

.btn-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  background-color: rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ==========================================================================
   3D Simulation Section
   ========================================================================== */

.simulation-section {
  position: relative;
  width: 100%;
  height: 58vh;
  min-height: 480px;
  background-color: #1e3a1e;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* In-game HUD: Sundial Clock Widget */
.hud-clock-widget {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #38bdf8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

#hud-clock-time {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.05em;
}

/* Cinematic Story Banner */
.hud-story-banner {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 25;
  max-width: 650px;
  animation: popIn 0.3s ease-out;
}
.hud-story-banner.hidden {
  display: none;
}

.story-chapter-tag {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  letter-spacing: 0.06em;
}

.story-narration-text {
  font-size: 0.88rem;
  color: #f8fafc;
  font-weight: 500;
  line-height: 1.4;
}

/* Story Chapters List in Modal */
.story-chapters-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.story-chapter-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}
.story-chapter-btn:hover {
  background: #283548;
  border-color: #f59e0b;
  transform: translateX(4px);
}

.chap-num {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-weight: 800;
  font-size: 0.9rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.chap-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.chap-info strong {
  font-size: 0.88rem;
  color: #ffffff;
}
.chap-info span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* In-game HUD: Active metrics pills */
.hud-metrics-bar {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  display: flex;
  gap: 0.5rem;
  z-index: 20;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Camera Switcher Buttons */
.hud-camera-modes {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.2rem;
  border-radius: var(--radius-full);
  gap: 0.2rem;
}

.btn-cam {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-cam:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.btn-cam.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Visual Legend Overlay */
.hud-visual-legend {
  position: absolute;
  top: 4.8rem;
  left: 1.5rem;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}
.dove-legend { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.hawk-legend { background: rgba(239, 68, 68, 0.2); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.tft-legend  { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dove-dot { background-color: var(--color-dove); }
.hawk-dot { background-color: var(--color-hawk); }
.tft-dot { background-color: var(--color-tft); }

.hud-camera-hint {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Simulation Controls Floating Toolbar */
.simulation-toolbar {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.btn-ctrl {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}
.btn-ctrl:hover {
  background-color: #374151;
  border-color: var(--border-active);
}

.btn-primary-ctrl {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  padding: 0.45rem 1.1rem;
}
.btn-primary-ctrl:hover {
  background-color: var(--accent-hover);
}

.speed-selector {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding-left: 0.4rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.speed-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-right: 0.2rem;
}

.btn-speed {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-speed:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.btn-speed.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

/* Day Transition Overlay */
.day-transition-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: opacity 0.3s ease;
}
.day-transition-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.transition-card {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  padding: 2rem 3rem;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  max-width: 480px;
  animation: popIn 0.3s ease-out;
}

.transition-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.transition-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Dashboard Section
   ========================================================================== */

.dashboard-section {
  padding: 1.5rem;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.kpi-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.kpi-card.border-dove { border-left: 4px solid var(--color-dove); }
.kpi-card.border-hawk { border-left: 4px solid var(--color-hawk); }
.kpi-card.border-tft  { border-left: 4px solid var(--color-tft); }

.kpi-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.text-dove { color: var(--color-dove); }
.text-hawk { color: var(--color-hawk); }
.text-tft  { color: var(--color-tft); }

.kpi-delta {
  font-size: 0.8rem;
  font-weight: 700;
}
.kpi-delta.positive { color: var(--success); }
.kpi-delta.negative { color: var(--danger); }

.kpi-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.chart-body {
  position: relative;
  height: 240px;
  width: 100%;
}

.chart-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}
.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: popIn 0.25s ease-out;
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.god-controls-group h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.control-row label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.control-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent-primary);
}

.god-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ==========================================================================
   Timeline & Live Events Ticker
   ========================================================================== */

.hud-timeline-container {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 29, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 22;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.timeline-step {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.timeline-step.active {
  color: #38bdf8;
  transform: scale(1.05);
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.timeline-arrow {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
}

.timeline-progress-track {
  width: 90px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin-left: 0.4rem;
}

.timeline-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f59e0b);
  border-radius: 9999px;
  transition: width 0.1s linear;
}

/* Live Events Ticker Bar */
.live-events-bar {
  background: #0d1424;
  border-top: 1px solid var(--border-subtle);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.82rem;
  z-index: 30;
}

.live-events-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.live-events-ticker {
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ==========================================================================
   Mobile Responsiveness (Optimisé Téléphone / Tout compact et lisible)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 0.45rem 0.65rem;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    max-width: 100vw;
  }
  .header-left {
    order: 1;
    flex: 1 1 0%;
    min-width: 0;
    gap: 0.45rem;
    overflow: hidden;
  }
  .header-titles {
    min-width: 0;
    overflow: hidden;
  }
  .header-titles h1 {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-titles .subtitle {
    display: none;
  }
  .logo-mark {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .header-center {
    order: 2;
    flex: 0 0 auto;
    gap: 0.3rem;
  }
  .day-badge {
    padding: 0.15rem 0.45rem;
  }
  .day-value {
    font-size: 0.85rem;
  }
  .phase-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
  }
  .header-right {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
  .header-right::-webkit-scrollbar {
    display: none;
  }
  .header-right .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.68rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Bassin 3D compact sur mobile + Scroll vertical 100% libre */
  .simulation-section {
    height: 255px;
    min-height: 245px;
    max-width: 100%;
  }
  .canvas-container,
  .canvas-container canvas {
    touch-action: pan-y pinch-zoom !important;
  }
  .hud-metrics-bar {
    top: 0.35rem;
    left: 0.35rem;
    right: 0.35rem;
    gap: 0.2rem;
    flex-wrap: wrap;
  }
  .hud-pill {
    font-size: 0.58rem;
    padding: 0.12rem 0.35rem;
  }
  .hud-camera-modes,
  .hud-visual-legend,
  .hud-camera-hint,
  .hud-clock-widget {
    display: none;
  }
  .hud-timeline-container {
    top: 2.1rem;
    padding: 0.18rem 0.5rem;
    gap: 0.2rem;
    max-width: 94%;
  }
  .timeline-step {
    font-size: 0.58rem;
  }
  .timeline-arrow {
    display: none;
  }
  .timeline-progress-track {
    width: 32px;
    height: 4px;
  }

  /* Barre d'outils flottante */
  .simulation-toolbar {
    bottom: 0.35rem;
    width: 96%;
    max-width: 96vw;
    padding: 0.24rem 0.35rem;
    gap: 0.2rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
    border-radius: 8px;
  }
  .simulation-toolbar::-webkit-scrollbar {
    display: none;
  }
  .btn-ctrl {
    padding: 0.2rem 0.42rem;
    font-size: 0.65rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .speed-selector {
    padding: 1px 2px;
    flex-shrink: 0;
  }
  .speed-label {
    display: none;
  }
  .btn-speed {
    padding: 0.12rem 0.26rem;
    font-size: 0.65rem;
  }
  .jump-day-group {
    padding: 0.12rem 0.3rem !important;
    margin-left: 0 !important;
    flex-shrink: 0;
  }
  .jump-day-group span {
    font-size: 0.62rem !important;
    white-space: nowrap;
  }
  #input-jump-day {
    width: 32px !important;
    font-size: 0.65rem !important;
    padding: 1px 2px !important;
  }
  #btn-jump-day {
    padding: 0.15rem 0.35rem !important;
    font-size: 0.65rem !important;
  }

  /* Live Events Bar */
  .live-events-bar {
    padding: 0.3rem 0.55rem;
    font-size: 0.65rem;
    max-width: 100%;
  }
  .live-events-badge {
    font-size: 0.55rem;
    padding: 1px 4px;
  }

  /* Dashboard Analytique : KPIs ultra-compacts (3 par ligne) & Graphes 2 par ligne */
  .dashboard-section {
    padding: 0.5rem 0.5rem;
    gap: 0.5rem;
    max-width: 100%;
  }
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .kpi-card {
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    min-width: 0;
  }
  .kpi-card.border-dove,
  .kpi-card.border-hawk,
  .kpi-card.border-tft {
    border-left-width: 2.5px;
  }
  .kpi-title {
    font-size: 0.52rem;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kpi-value-row {
    gap: 0.25rem;
    margin-bottom: 0;
  }
  .kpi-value {
    font-size: 0.92rem;
  }
  .kpi-delta,
  .kpi-badge {
    font-size: 0.55rem;
    padding: 1px 3px;
  }
  .kpi-sub {
    display: none;
  }
  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }
  .chart-card {
    height: auto;
    min-height: 0;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    min-width: 0;
  }
  .chart-header {
    margin-bottom: 0.3rem;
  }
  .chart-header h3 {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chart-tag {
    display: none;
  }
  .chart-body {
    height: 92px !important;
  }
  .chart-footer {
    display: none;
  }
}
