.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 9, 0.84);
  backdrop-filter: blur(4px);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-backdrop.open .modal-card { animation: modalPopIn 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
#gm-modal { z-index: 800; }

.modal-card {
  background: linear-gradient(180deg, #181c21 0%, #101317 100%);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  width: min(760px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.modal-card.wide { width: min(940px, 96vw); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: linear-gradient(180deg, #242a31 0%, #181c21 100%);
  border-bottom: 1px solid #0b0d10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #eef2f5;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  line-height: 1.55;
  font-size: 14px;
}
.modal-close {
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Lockout Banner */
.lockout-banner {
  background: linear-gradient(180deg, #541414 0%, #3a0d0d 100%);
  border: 1px solid var(--crimson);
  border-radius: 3px;
  padding: 12px 16px;
  margin-bottom: 14px;
  color: #f6d4d4;
}
.lockout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}
.lockout-bar {
  height: 6px;
  background: #240808;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.lockout-fill {
  height: 100%;
  background: linear-gradient(90deg, #e06565, var(--crimson));
  width: 100%;
  transition: width 0.2s linear;
}

/* Clue Documents (Genuine Cotton Archival Stationery) */
.doc-paper {
  background: linear-gradient(180deg, #f2ecdc 0%, #eae2cd 100%);
  color: #1c1e21;
  border-radius: 2px;
  padding: 20px 24px;
  border: 1px solid #aba28d;
  font-family: var(--font-mono);
  font-size: 13px;
  box-shadow: inset 0 0 32px rgba(72, 54, 24, 0.12), 0 8px 22px rgba(0, 0, 0, 0.5);
}
.doc-paper h3 {
  margin: 0 0 10px;
  font-size: 15px;
  border-bottom: 2px solid #8f2d2d;
  padding-bottom: 6px;
  text-transform: uppercase;
  color: #1c1e21;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12.5px;
}
.doc-table th, .doc-table td {
  border: 1px solid #807867;
  padding: 6px 8px;
  text-align: left;
}
.doc-table th { background: #dcd4bf; }
.stamp-ok { color: #196136; font-weight: 700; }
.stamp-fail { color: #8f2d2d; font-weight: 700; }

.postit-note {
  margin-top: 14px;
  background: linear-gradient(180deg, #f5ea9e 0%, #ece088 100%);
  color: #292410;
  padding: 13px 16px;
  border-left: 5px solid #c2a028;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  font-family: var(--font-ui);
  font-size: 13px;
}

.terminal-box {
  background: #0c0e11;
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #c8d2ce;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.85);
}

/* E1 Padlock (Knurled Steel & Brass Wheels) */
.padlock-wheels {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 18px 0;
}
.wheel-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #23282f 0%, #15191e 100%);
  border: 2px solid var(--border-bright);
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px rgba(0, 0, 0, 0.55);
}
.wheel-digit {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  color: #deb261;
  width: 48px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0b0d10 0%, #191d22 50%, #080a0c 100%);
  border: 1px solid #3c434d;
  border-radius: 3px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.85);
}

/* E2 Digicode (Cast Steel Keypad) */
.keypad-wrap {
  max-width: 310px;
  margin: 12px auto;
  background: linear-gradient(180deg, #1f242a 0%, #14181c 100%);
  border: 2px solid var(--border-bright);
  border-radius: 4px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.6);
}
.keypad-screen {
  background: #0b0e0d;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 6px;
  text-align: center;
  color: #a9d1c2;
  min-height: 50px;
  margin-bottom: 14px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9);
}
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.keypad-btn {
  padding: 12px 0;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

/* E3 Breakers */
.breakers-layout {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  align-items: start;
}
.breaker-list { display: flex; flex-direction: column; gap: 8px; }
.breaker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: linear-gradient(180deg, #181c21 0%, #111418 100%);
  border: 1px solid var(--border-steel);
  border-radius: 3px;
}
.breaker-row.on { border-color: var(--amber); background: #211c12; }
.switch-toggle {
  min-width: 72px;
  font-family: var(--font-mono);
  font-weight: 700;
}
.switch-toggle.on {
  background: linear-gradient(180deg, #d79c3a 0%, #b57a1c 100%);
  color: #121212;
  border-color: #e8be6c;
}
.meters-card {
  background: #0b0e11;
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  padding: 12px;
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.75);
}

/* E4 Oscilloscope (P31 CRT Glass Bezel) */
.osc-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}
.osc-screen-box {
  background: #04100b;
  border: 2px solid #224a3c;
  border-radius: 4px;
  padding: 10px;
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.9);
}
#osc-canvas {
  width: 100%;
  height: 210px;
  background: #020b07;
  border: 1px solid #163b2f;
  border-radius: 3px;
  display: block;
}
.signal-bar {
  height: 10px;
  background: #0b1612;
  border: 1px solid #214a3c;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.signal-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--crimson), var(--amber), var(--green));
  transition: width 0.15s ease;
}
.morse-cheat {
  margin-top: 10px;
  padding: 8px 10px;
  background: #0b0e11;
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 8px;
}

/* E5 Centrifuge */
.rotor-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.rotor-slot {
  background: #0e1216;
  border: 2px dashed var(--border-bright);
  border-radius: 4px;
  padding: 12px;
  text-align: center;
  min-height: 104px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.rotor-slot.filled {
  border-style: solid;
  border-color: var(--cyan);
  background: #152124;
}
.vial-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.vial-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.vial-btn.active { border-color: var(--amber); background: var(--amber-dim); }
.vial-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* E6 Vigenere Table */
.vigenere-wrap {
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  margin: 10px 0;
  background: #090c0e;
}
.vig-table {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10.5px;
  width: 100%;
  text-align: center;
}
.vig-table th, .vig-table td {
  border: 1px solid #1e242b;
  padding: 2px 4px;
  min-width: 18px;
}
.vig-table th {
  background: #15191e;
  color: var(--cyan);
  position: sticky;
  top: 0;
}
.vig-table th.row-h {
  left: 0;
  z-index: 2;
  color: var(--amber);
}
.vig-table td.hl-rc { background: rgba(114, 179, 166, 0.14); }
.vig-table td.hl-cell { background: rgba(201, 139, 44, 0.36); color: #fff; font-weight: 700; }

/* E8 Hydraulic Valves */
.valves-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.valve-card {
  background: linear-gradient(180deg, #171b20 0%, #101316 100%);
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  padding: 12px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.gauges-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.gauge-box {
  background: #0b0e11;
  border: 1px solid var(--border-steel);
  border-radius: 3px;
  padding: 10px;
  text-align: center;
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.8);
}
.gauge-box.ok { border-color: var(--green); background: rgba(88, 184, 120, 0.12); }

/* GM PIN Gate */
.gm-pin-box {
  max-width: 440px;
  margin: 16px auto;
  text-align: center;
}

/* ---- Identifiants MJ ---- */
.gm-cred-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.gm-cred-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--cyan);
}
.gm-cred-grid input { width: 100%; }
.gm-cred-opt { color: var(--text-muted); font-size: 10.5px; }
.gm-cred-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.gm-cred-msg { font-size: 12px; min-height: 16px; flex: 1; }
.portal-gm-space {
  padding: 10px 12px;
  background: rgba(94, 34, 57, 0.18);
  border: 1px solid #6e2b45;
  border-radius: 3px;
}
.portal-gm-space .hint-card { background: rgba(10, 12, 15, 0.55); }

/* ---- Voix humaine (réglages) ---- */
.vm-cloud {
  padding: 10px 12px;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  background: rgba(10, 14, 18, 0.6);
}
.vm-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--cyan); }
.vm-lbl input, .vm-lbl select {
  width: 100%;
  padding: 7px 10px;
  background: #090f16;
  color: #fff;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
}
.vm-steps { margin: 6px 0 6px 18px; padding: 0; line-height: 1.5; }
.vm-steps li { margin-bottom: 3px; }
.vm-lbl .vm-id { margin-top: 4px; font-size: 11.5px; padding: 5px 8px; }

/* ---- Studio vocal ---- */
.voice-studio .vs-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.voice-studio .vs-help { font-size: 12px; color: var(--text-dim); margin: 0 0 10px; line-height: 1.5; }
.voice-studio .vs-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; margin-bottom: 10px; cursor: pointer; }
.voice-studio .vs-bar { height: 6px; border-radius: 3px; background: #0b0e11; border: 1px solid var(--border-steel); overflow: hidden; }
.voice-studio .vs-bar span { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .3s ease; }
.voice-studio .vs-log { font-size: 11.5px; min-height: 18px; margin: 6px 0 10px; font-family: var(--font-mono); }
.voice-studio .vs-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
