:root {
  --bg-color: #121212;
  --surface-color: #1e1e1e;
  --text-color: #e0e0e0;
  --accent-color: #bb86fc;
  --success-color: #03dac6;
  --error-color: #cf6679;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
}

/* Header */
header {
  height: 40px;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #333;
  -webkit-app-region: drag;
}

h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  opacity: 0.8;
}

#connection-status {
  font-size: 11px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: #333;
  color: #aaa;
  text-transform: uppercase;
}

#connection-status.connected {
  background-color: rgba(3, 218, 198, 0.2);
  color: var(--success-color);
}

#connection-status.disconnected {
  background-color: rgba(207, 102, 121, 0.2);
  color: var(--error-color);
}

/* Setup Screen */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

#setup-screen {
  text-align: center;
  background: var(--surface-color);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.control-panel {
  width: 300px;
}

.control-group {
  margin-bottom: 15px;
}

.control-group label {
  display: block;
  font-size: 11px;
  color: #aaa;
  margin-bottom: 5px;
  text-transform: uppercase;
}

input[type="text"],
select {
  width: 100%;
  padding: 8px;
  background: #000;
  color: white;
  border: 1px solid #444;
  border-radius: 4px;
  box-sizing: border-box;
}

#email-input,
#password-input,
#room-id-input,
#user-name-input {
  width: 100%;
  padding: 12px;
  background: #000;
  color: white;
  border: 1px solid #444;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 14px;
}

button {
  width: 100%;
  padding: 12px;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 10px;
}

button:hover {
  background: #0055aa;
}

.big-btn {
  background: #0066cc !important;
  color: white;
  padding: 15px !important;
  font-size: 1.2em !important;
  margin-top: 20px !important;
  border-radius: 8px !important;
}

.big-btn:hover {
  background: #0055aa !important;
}

/* BROADCAST SCREEN - FIXED HEIGHT LAYOUT */
#broadcast-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  background: #111;
}

/* Top bar - fixed 50px */
.top-bar {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: #222;
  border-bottom: 1px solid #333;
}

.status-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  flex-shrink: 1; 
  min-width: 0; 
  max-width: 70%; /* V2.1.5 Fix: Increased limit to prevent truncating "DIDIER" */
  white-space: nowrap; 
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-indicator {
  font-weight: bold;
  color: #666;
  font-size: 11px;
  /* Slightly smaller for horizontal fit */
  padding: 4px 8px;
  background-color: #333;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-indicator.connected {
  color: #00ff00;
}

.rec-and-buttons-bunker {
  display: flex;
  align-items: center;
  gap: 15px; 
  margin-left: auto;
  flex-shrink: 0;
  height: 100%;
  width: fit-content; /* V2.1.5: Fix - No extra length on the left */
}

#rec-metadata {
  display: none; /* Controlled by JS flex */
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.85); /* V4.0.0: Opaque bg instead of expensive backdrop-filter */
  padding: 4px 15px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

#rec-timer {
  color: #ef4444;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 16px;
  min-width: 80px;
  text-align: center;
}

.stats-display {
  font-size: 10px;
  color: #888;
  font-family: monospace;
}

#settings-toggle-btn {
  padding: 8px 15px;
  background: #444;
  font-size: 12px;
}

/* Meters area - takes remaining space */
.meters-wrapper {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: #333; /* Gap color */
  overflow: hidden;
  position: relative;
  margin-top: 40px;
}

.meter-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #333;
  background: #000;
  padding: 10px;
  padding-top: 45px; /* SPACE FOR ABSOLUTE HEADER */
  position: relative;
  min-width: 150px;
  min-height: 200px; /* V14.9.28: Ensure minimum height */
  overflow: hidden;
}

.meter-panel:last-child {
  border-right: none;
}

.meter-panel h3 {
  margin: 0;
  font-size: 11px;
  color: #fff;
  padding: 6px;
  border-radius: 4px;
  text-transform: uppercase;
  text-align: center;
  flex-shrink: 0;
  z-index: 20;
}

.vu-readout {
  display: none !important; /* V2.4.3: Disabled in favor of .db-label in Header */
}
  
.vu-stats {
  position: relative;
  margin-top: auto; 
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  width: 100%;
  font-family: 'Roboto Mono', monospace;
  font-size: 9px;
  color: #aaa;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #222;
  height: 46px; /* V2.1.5: Fixed height for alignment across all panels */
}

.vu-stats span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* Canvas container with explicit height calculation */
.meter-panel canvas {
  width: 100% !important;
  flex: 1; /* Take remaining space */
  display: block;
  background: #050505;
  border-radius: 4px;
  min-height: 0;
  min-width: 0;
}

/* Controls panel - auto height */
.audio-controls {
  height: auto;
  min-height: 80px;
  flex-shrink: 0;
  background: #1a1a1a;
  border-top: 1px solid #333;
  padding: 15px;
  /* overflow: hidden; REMOVED to allow visibility */
}

.control-row {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.toggles {
  display: flex;
  gap: 15px;
  background: #000;
  padding: 8px;
  border: 1px solid #444;
  border-radius: 4px;
  align-items: center;
  height: 36px;
}

.toggles label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #ddd;
  font-size: 12px;
}

.slider-markers {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: #888;
  margin-top: 4px;
  padding-right: 48px;
  /* Offset for the dB label on the right */
  padding-left: 2px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

/* Panel Volume Control */
.panel-volume-container {
  position: relative;
  margin-top: 10px; /* V14.9.32: Separate from canvas */
  background: #111;
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 30;
  border: 1px solid #222;
  height: 42px; /* V2.1.5: Fixed height for alignment */
}

.panel-volume-slider {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: #2196F3;
}

#gain-in {
  accent-color: #F44336;
}

body:not(.mobile-mode) #btn-mute-mic {
  width: auto !important;
  min-width: 48px !important;
  padding: 3px 4px !important;
}

.panel-volume-label {
  font-family: monospace;
  font-size: 10px;
  color: #4CAF50;
  min-width: 35px;
  text-align: right;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85); /* V4.0.0: More opaque bg instead of blur */
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-top: 20px;
}

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

.modal-content {
  background: #1a1a1a;
  padding: 30px;
  border-radius: 12px;
  width: 95%;
  max-width: 900px; /* V14.9.33: Wider for 2 columns */
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #333;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid #222;
  padding-bottom: 15px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2em;
  color: #4CAF50;
  letter-spacing: 1px;
}

.close-modal {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.close-modal:hover {
  color: white;
}

.settings-btn {
  background: #222;
  border: 1px solid #333;
  color: #aaa;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  width: 100px; /* V2.1.5: FIXED WIDTH - NO EXPANSION */
  height: 32px !important; /* V2.1.5: FIXED HEIGHT (ULTRA-PRO) */
  flex-shrink: 0;
  margin: 0;
  box-sizing: border-box;
}

.settings-btn:hover {
  background: #333;
  color: white;
  border-color: #444;
}

/* --- RECORDING STYLES --- */
.rec-btn {
    background: #333;
    color: #ef4444;
    border: 1px solid #444;
    padding: 0 12px;
    border-radius: 4px; /* V2.1.5: Harmonized with Settings */
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
    width: 95px; /* V2.1.5: FIXED WIDTH - NO SHIFT */
    height: 32px !important; /* V2.1.5: FIXED HEIGHT (ULTRA-PRO) */
    flex-shrink: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.rec-btn:hover {
    background: #444;
    color: #ff0000;
}

.rec-btn.recording {
    background: #dc2626 !important;
    color: white !important;
    border-color: #ff0000 !important;
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

@keyframes pulse-secure {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Note (21/09) : classe non utilisée dans index.html ni renderer_SOURCE.js.
   Conservée telle quelle — ce n'est pas elle qui animait la page. */
.secure-active span {
    animation: pulse-secure 2s infinite;
    display: inline-block;
}

/* --- STATIONS & CHECKBOXES (V2.1.5) --- */
.station-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #333;
    font-size: 11px;
    color: #ccc;
}

.btn-del-station {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0 4px;
    font-size: 14px;
    margin: 0;
    width: auto;
}

.btn-del-station:hover {
    color: #ff4444;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 16px;
    width: 16px;
    background-color: #333;
    border-radius: 3px;
    border: 1px solid #444;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #444;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #2196F3;
    border-color: #2196F3;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ====================================================
   📱 MOBILE REPORTER MODE
   ==================================================== */
body.mobile-mode #setup-screen {
    width: 95%;
    padding: 20px;
    margin: auto;
    box-sizing: border-box;
}

body.mobile-mode #setup-screen .control-panel {
    width: 100% !important;
    box-sizing: border-box;
}

body.mobile-mode #setup-screen h2 {
    font-size: 60px !important;
    margin-bottom: 40px !important;
}

body.mobile-mode #setup-screen .control-group label {
    font-size: 40px !important;
    margin-bottom: 20px !important;
}

body.mobile-mode #setup-screen input[type="text"],
body.mobile-mode #setup-screen input[type="email"],
body.mobile-mode #setup-screen input[type="password"] {
    font-size: 40px !important;
    padding: 25px !important;
    border-radius: 12px !important;
    height: 100px !important;
    margin-bottom: 30px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

body.mobile-mode #setup-screen .listen-only-container {
    display: none !important; /* V16: Hidden on mobile as per user request */
}

body.mobile-mode #setup-screen .switch {
    transform: scale(2.5);
    transform-origin: left center;
    margin-right: 80px !important;
}

body.mobile-mode #setup-screen #connect-btn {
    font-size: 50px !important;
    padding: 40px !important;
    border-radius: 20px !important;
    margin-top: 30px !important;
    width: 100% !important;
}

body.mobile-mode .top-bar {
    /* hauteur minimale plutôt que fixe : avec des textes plus grands, le statut peut
       passer sur deux lignes — la barre s'adapte au lieu de laisser déborder. */
    height: auto !important;
    min-height: 110px !important;
    padding-top: 15px !important;
    padding-bottom: 10px !important;
}

/* Re-enable and style settings button for mobile */
body.mobile-mode .settings-btn {
    display: none !important;
}

body.mobile-mode #mobile-settings-container {
    display: flex !important;
}

/* --- MOBILE "ULTRA BASIC" AUDIO MENU --- */
/* Hide unnecessary config modules */
body.mobile-mode .hide-on-mobile,
body.mobile-mode #stability-monitors {
    display: none !important;
}

/* Make close button massive */
body.mobile-mode .btn-close-modal {
    font-size: 40px !important;
    padding: 30px 60px !important;
    background: #d32f2f !important;
    color: white !important;
    border-radius: 12px !important;
    font-weight: bold !important;
}

/* Enlarge Lock Screen */
body.mobile-mode #lock-icon {
    font-size: 10em !important;
    margin-bottom: 30px !important;
}

body.mobile-mode #lock-explanation {
    font-size: 40px !important;
    line-height: 1.4 !important;
    padding: 20px 40px !important;
}

body.mobile-mode #btn-unlock-screen {
    font-size: 40px !important;
    padding: 30px 50px !important;
    border-radius: 15px !important;
}

/* Force Vertical Stack for visible settings blocks */
body.mobile-mode .settings-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
}

/* Enlarge Dropdowns */
body.mobile-mode #settings-modal select {
    font-size: 36px !important;
    padding: 25px !important;
    height: 120px !important;
    background: #222 !important;
    border: 4px solid #555 !important;
    border-radius: 12px !important;
}

body.mobile-mode #settings-modal label, body.mobile-mode #settings-modal h3 {
    font-size: 40px !important;
    margin-bottom: 25px !important;
    font-weight: bold !important;
}

/* Hide Master Volume Box inside output */
body.mobile-mode #settings-modal .settings-grid > div:nth-child(4) > div {
    display: none !important;
}

/* Modal styling for mobile */
body.mobile-mode .modal-content {
    width: 95% !important;
    max-width: none !important;
    padding: 20px !important;
    border-radius: 15px !important;
}

body.mobile-mode .modal-header h2 {
    font-size: 36px !important;
}
/* --------------------------------------- */

body.mobile-mode .meters-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    gap: 5px !important;
    background: #000;
    margin-top: 75px !important;
}

body.mobile-mode #remote-meter-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px;
}

body.mobile-mode .meter-panel {
    border-right: none;
    border-bottom: 2px solid #333;
    min-height: 450px !important; /* Huge slots */
    padding: 20px !important;
    padding-top: 60px !important;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

/* Force horizontal canvas proportions */
body.mobile-mode canvas {
    min-height: 100px !important;
    height: 100px !important;
    max-height: 100px !important;
    border-radius: 8px;
}

/* Enlarge Local Headers */
body.mobile-mode .vu-header {
    height: 130px !important;
    overflow: visible !important;
}

body.mobile-mode .vu-label {
    font-size: 48px !important;
    font-weight: 900;
    pointer-events: none; /* Let clicks pass through to absolute buttons below */
}

body.mobile-mode .db-label {
    pointer-events: none;
    font-size: 42px !important;
    font-weight: bold !important;
    bottom: 10px !important;
    top: auto !important;
    z-index: 10;
}
/* Enlarge controls for touch */
body.mobile-mode .panel-volume-container {
    height: 70px !important;
    padding: 10px 20px;
    margin-top: 20px !important;
}

body.mobile-mode .mute-mini-btn {
    display: none !important; /* Hide remote mutes by default */
}

/* Show and Enlarge Local Mic Mute Button — carré net sur mobile */
body.mobile-mode #btn-mute-mic {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    width: 130px !important;
    height: 130px !important;
    font-size: 34px !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    text-align: center !important;
    border-radius: 0 !important;
    font-weight: bold !important;
    color: #fff !important;
    background-color: #4CAF50 !important; /* Vert ON AIR */
    border: none !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    transform: none !important;
    min-width: auto !important;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    z-index: 999 !important;
}

body.mobile-mode #btn-mute-mic.muted {
    background-color: #f44336 !important; /* Rouge OFF PGM */
}
/* Allow 2-line text in mobile mic button */
body.mobile-mode #btn-mute-mic br {
    display: block !important;
}

body.mobile-mode .rec-btn {
    font-size: 40px !important;
    font-weight: 900 !important;
    width: auto !important;
    padding: 0 35px !important;
    height: 80px !important;
    border-radius: 20px !important;
    background-color: #333 !important;
    color: #ef4444 !important;
    border: 3px solid #ef4444 !important;
    margin: 4px 0 !important;
}

body.mobile-mode #vdo-demo-badge {
    position: absolute !important;
    top: 125px !important;
    left: 20px !important;
    transform: none !important;
    font-size: 24px !important;
    padding: 10px 24px !important;
}

body.mobile-mode #license-display {
    font-size: 26px !important;
    color: #ccc !important;
    margin-top: 15px !important;
}

body.mobile-mode #rec-timer {
    font-size: 40px !important;
    font-weight: bold !important;
}

body.mobile-mode .panel-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 30px;
    background: #050505;
    border: 2px solid #1a1a1a;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.8);
    border-radius: 15px;
    flex: 1;
}

body.mobile-mode .panel-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #2196F3 !important;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}

body.mobile-mode .panel-volume-slider::-moz-range-thumb {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #2196F3 !important;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}

/* Local Mic Slider - Red */
body.mobile-mode #gain-in::-webkit-slider-thumb {
    background: #F44336 !important;
}

body.mobile-mode #gain-in::-moz-range-thumb {
    background: #F44336 !important;
}

/* V-MOBILE-UPTIME (20/08): la durée de connexion était tronquée sur mobile.
   Cause : le texte complet ("CONNECTÉ SUR CANAL 3 · Actif depuis 0h 12m") était rendu
   en 40px majuscules dans .status-group, lui-même plafonné à 70% de largeur avec
   `overflow:hidden` + `text-overflow:ellipsis` — largeur nécessaire très supérieure à
   celle d'un téléphone, donc coupure systématique de la fin, c'est-à-dire de la durée.
   Correctif : on empile les deux informations au lieu de les mettre bout à bout, on rend
   la largeur complète disponible (REC, son chronomètre et le bouton Réglages sont déjà
   masqués sur mobile, la droite de la barre est libre) et on autorise le retour à la ligne
   pour qu'aucun libellé ne puisse plus être coupé, même sur un écran très étroit.
   Les tailles restent volontairement grandes : l'affichage mobile est conçu pour être lu
   à distance, comme un écran de contrôle. */
body.mobile-mode .status-group {
    max-width: 100% !important;
    overflow: visible !important;
    white-space: normal !important;
}

body.mobile-mode .status-indicator {
    /* Taille proportionnelle à la largeur réelle de l'écran, bornée : la phrase complète
       ("CONNECTÉ SUR CANAL 1 · ACTIF DEPUIS 0H 12M", 42 caractères) ne peut pas tenir sur
       une ligne à 26px sur un téléphone — c'est ce qui la faisait couper. clamp() lui donne
       la plus grande taille qui reste lisible sans déborder, et le retour à la ligne reste
       autorisé en dernier recours : on préfère deux lignes à un texte tronqué. */
    font-size: clamp(18px, 5.5vw, 32px) !important;
    padding: 10px 14px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
}

/* Nom du logiciel : lisible face au statut (26px) sur mobile, sans l'écraser.
   La place est disponible depuis que REC, son chronomètre et le bouton Réglages
   sont masqués sur mobile. */
/* Logo : 26px convient sur ordinateur, mais c'est minuscule sur mobile où le texte de
   statut est à 26px et la barre fait 110px de haut. Le CSS surcharge les attributs
   width/height du SVG ; le viewBox assure une mise à l'échelle nette. */
body.mobile-mode #app-logo {
    width: 52px !important;
    height: 52px !important;
}

body.mobile-mode #app-name-display {
    font-size: 26px !important;
    letter-spacing: 1.5px !important;
}

body.mobile-mode #status-text {
    /* Dans le prolongement de "CONNECTÉ SUR CANAL X" et à la MÊME taille : en dessous et
       plus petit, l'information devenait difficile à lire. `inherit` garantit qu'elle suit
       automatiquement la taille adaptative ci-dessus. */
    display: inline !important;
    margin-left: 6px !important;
    font-size: inherit !important;
    opacity: 0.9 !important;
}

body.mobile-mode .mobile-massive-btn {
    font-size: 36px !important;
    padding: 35px !important;
}

body.mobile-mode .panel-volume-label {
    font-size: 32px !important;
    font-weight: bold !important;
    text-align: left;
}

/* Explicit text labels for volume percentages */
body.mobile-mode #gain-in-label::before {
    content: "MICRO : ";
    color: #F44336;
}

body.mobile-mode #remote-meter-panel .panel-volume-label::before {
    content: "SON : ";
    color: #2196F3;
}

/* Hide detailed stats to keep UI clean */
body.mobile-mode .peer-stats-container {
    display: none !important;
}

/* Enlarge emojis for mobile touch controls */
body.mobile-mode .panel-volume-container > span {
    font-size: 32px !important;
}

body.mobile-mode .vu-stats {
    display: none !important;
}

/* Massive Checkboxes for Mobile */
body.mobile-mode .checkbox-container {
    padding-left: 60px !important;
}

body.mobile-mode .checkmark {
    height: 40px !important;
    width: 40px !important;
    border-radius: 8px !important;
}

body.mobile-mode .checkbox-container .checkmark:after {
    left: 14px !important;
    top: 5px !important;
    width: 10px !important;
    height: 20px !important;
    border-width: 0 5px 5px 0 !important;
}

/* V3.1.28: Readable Mobile Modal Settings */
body.mobile-mode #settings-modal .volume-row {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas: 
        "label value"
        "slider slider" !important;
    gap: 15px !important;
    align-items: center !important;
    margin-top: 25px !important;
    margin-bottom: 25px !important;
}

body.mobile-mode #settings-modal .volume-row label {
    grid-area: label !important;
    margin: 0 !important;
}

body.mobile-mode #settings-modal .volume-row input[type="range"] {
    grid-area: slider !important;
    width: 100% !important;
}

body.mobile-mode #settings-modal .volume-row > div,
body.mobile-mode #settings-modal .volume-row .value-label {
    grid-area: value !important;
    justify-self: end !important;
}

body.mobile-mode #settings-modal .volume-row > div {
    min-width: 250px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
}

body.mobile-mode #settings-modal .volume-row > div > div {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
    gap: 10px !important;
}

body.mobile-mode #settings-modal .value-label,
body.mobile-mode #settings-modal #jitter-buffer-label {
    font-size: 50px !important;
    font-weight: bold !important;
    color: #4CAF50 !important;
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
}

body.mobile-mode #settings-modal .label-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 20px !important;
    margin-bottom: 25px !important;
}

body.mobile-mode #settings-modal .help-text-modal {
    font-size: 28px !important;
    color: #888 !important;
    display: block !important;
    margin-top: 10px !important;
}

body.mobile-mode #settings-modal .stereo-container-mobile {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-top: 15px !important;
}

body.mobile-mode #settings-modal button[id^="sync-"] {
    font-size: 24px !important;
    padding: 10px 20px !important;
    height: auto !important;
    transform: none !important;
    background-color: #2196F3 !important;
    color: white !important;
    border-radius: 8px !important;
    font-weight: bold !important;
}

body.mobile-mode #settings-modal #jitter-actual-label {
    font-size: 24px !important;
    margin-top: 5px !important;
    display: block !important;
    text-align: right !important;
}

/* Force hide elements on mobile even if they have volume-row grid styles */
body.mobile-mode #settings-modal .hide-on-mobile,
body.mobile-mode #settings-modal .volume-row.hide-on-mobile,
body.mobile-mode .hide-on-mobile {
    display: none !important;
}


/* V-MOBILE-UPTIME-2 (20/08): filet indépendant de la détection d'appareil.
   Le correctif précédent ne s'applique que sous `body.mobile-mode`, classe posée d'après
   l'identité du navigateur (user-agent), pas d'après la largeur de l'écran. Une fenêtre
   de bureau réduite, ou une tablette non reconnue par la détection, conservait donc la
   troncature d'origine (.status-group : max-width 70% + overflow hidden + ellipsis).
   Ces règles s'appliquent à toute fenêtre étroite, quel que soit l'appareil. Elles ne
   touchent volontairement pas aux tailles de police : elles se contentent de supprimer
   la coupure et d'autoriser le passage à la ligne. */
@media (max-width: 900px) {
    .status-group {
        max-width: 100%;
        overflow: visible;
        white-space: normal;
    }

    .status-indicator {
        white-space: normal;
    }

    #status-text {
        display: inline;
        margin-left: 6px !important;
    }
}


/* V3.1.42 — V-MODE-EXPERT : options réseau et d'encodage masquées hors mode expert. */
body:not(.mode-expert) .expert-only { display: none !important; }

/* V-SFU-REGLAGES (26/09) : débit / trames par participant sans effet en SFU (un seul flux émis). */
body.mode-sfu .manual-overrides { display: none !important; }

/* V-SLOTS-SANS-REGLAGES (26/09, décision exploitant) : les menus « Bitrate » et « Trames » en bas de chaque
   slot distant sont retirés de l'interface utilisateur ; ces réglages se font dans l'admin. */
.manual-overrides { display: none !important; }

/* V-BOUTONS-HOTE (26/09, décision exploitant) : actions qui touchent TOUS les postes, réservées à l'hôte. */
body:not(.role-hote) #btn-sync-all-config,
body:not(.role-hote) #btn-reset-room,
body:not(.role-hote) #sync-jitter-all { display: none !important; }

/* V-SERVEURS-HOTE (26/09, décision exploitant) : serveurs de signalisation PeerJS réglables par l'hôte seulement. */
body:not(.role-hote) .hote-seul { display: none !important; }

/* V3.1.89 — V-SIGNAL-HOTE : seul l hôte peut cliquer sur le serveur de connexion (bascule de TOUTE la salle). */
body:not(.role-hote) #server-stats { cursor: default !important; }

/* V3.1.97 — V-VIDEO : vignette caméra sous les vu-mètres (SFU uniquement). Le vu-mètre, élastique,
   cède la hauteur nécessaire. Basse définition assumée : c'est pour des signes, pas pour l'image. */
.slot-video {
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 32%;
    flex-shrink: 0;
    margin: 6px 0 4px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex; align-items: center; justify-content: center;
}
.slot-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-video.local-video video { transform: scaleX(-1); } /* miroir pour son propre retour */
/* Bouton caméra : visible seulement quand le poste passe par le SFU */
#btn-camera { display: none; }
body.mode-sfu #btn-camera { display: inline-flex; align-items: center; }
#btn-camera.camera-on { background: #1b5e20 !important; border-color: #4caf50 !important; color: #c8e6c9 !important; }

/* V3.1.99 — V-DEBIT-VIDEO : débit du son à gauche, débit de la vidéo à droite (seulement quand
   une caméra est active pour ce slot ; sinon le débit du son reste seul et centré). */
#local-bitrate-display.avec-video, [id^="bitrate-display-"].avec-video {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 14px !important;
    text-align: left !important;
    white-space: nowrap !important;
}
.bitrate-display-box .deb-video { color: #8ab4f8; }
/* V3.1.102 : flèches des débits comme dans l'admin — reçu ↓ vert, émis ↑ rouge (son et vidéo). */
.bitrate-display-box .fl-bas { color: #4CAF50; font-weight: 900; }
.bitrate-display-box .fl-haut { color: #ff5252; font-weight: 900; }
/* V3.1.105 : aucune caméra sur le poste -> bouton 📹 VIDÉO grisé, inopérant. */
#btn-camera.camera-absente, #btn-camera:disabled { opacity: 0.4 !important; cursor: not-allowed !important; }
/* V3.1.110 — V-VIDEO-DUO : bouton vidéo visible aussi en P2P à deux postes. */
body.video-possible #btn-camera { display: inline-flex; }

/* V3.1.119 — V-REGLAGES-SIMPLES : type de liaison (tuiles) + résumé */
.tuiles-liaison { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .tuiles-liaison { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body.mobile-mode .tuiles-liaison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
button.tuile-liaison { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left; padding: 12px; margin: 0; width: auto; border-radius: 10px; background: #1c1c1c; border: 2px solid #2e2e2e; color: #e6e6e6; font-weight: normal; font-family: inherit; }
button.tuile-liaison:hover { background: #222; border-color: #555; }
button.tuile-liaison.active { background: #2a2413; border-color: #fbbf24; }
.tuile-liaison b { font-size: 0.9em; color: #fff; }
.tuile-liaison span { font-size: 0.72em; color: #aaa; line-height: 1.4; min-height: 4.3em; }
.tuile-liaison i { font-style: normal; font-size: 0.65em; color: #888; }
.tuile-liaison em { font-style: normal; font-family: 'Roboto Mono', monospace; font-size: 1.05em; color: #6fd07a; }
.tuile-liaison em.retard-fort { color: #fbbf24; }
.tuile-liaison em.retard-variable { color: #999; }
.liaison-resume { margin-top: 12px; background: #0c0c0c; border-radius: 8px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.75em; color: #e6e6e6; }
.liaison-resume .k { color: #888; margin-right: 4px; }
#reglages-avances[open] > summary { margin-bottom: 4px; }

/* V3.1.123 — V-DEV-VISUEL : site de développement (dev.dacodec.com) = fond blanc + étiquette fixe en haut.
   Les panneaux gardent leur fond sombre (lisibilité). */
html.site-dev, html.site-dev body { background: #ffffff !important; }
/* En salle, l'écran est entièrement couvert de panneaux sombres aux fonds semi-transparents : les
   passer au blanc rendait des textes illisibles. On encadre donc l'écran d'un large cadre blanc. */
html.site-dev #broadcast-screen { border: 8px solid #ffffff !important; box-sizing: border-box; }
html.site-dev body::before {
  content: "DÉVELOPPEMENT";
  position: fixed; left: 50%; top: 0; transform: translateX(-50%); z-index: 99999;
  background: #d32f2f; color: #fff; font: bold 11px/1 sans-serif; letter-spacing: 2px;
  padding: 4px 14px 5px; border-radius: 0 0 8px 8px; pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
