:root {
  /* Surfaces OLED & atelier industriel sombre */
  --bg-base: #07080a;
  --bg-raised: rgba(13, 16, 22, 0.84);
  --bg-overlay: rgba(18, 22, 30, 0.94);
  --bg-active: rgba(34, 41, 54, 0.95);
  --surface-chassis: rgba(255, 255, 255, 0.045);

  /* Typographie & contrastes calcules */
  --fg-primary: #f3f5f8;
  --fg-secondary: #a1aab8;
  --fg-muted: #656f7e;

  /* Bordures usinees */
  --border-subtle: rgba(243, 245, 248, 0.08);
  --border-default: rgba(243, 245, 248, 0.15);
  --border-emphasis: rgba(243, 245, 248, 0.34);

  /* Accents metier (Ambre thermique / Cyan pneumatique) */
  --accent-amber: #f59e0b;
  --accent-amber-soft: rgba(245, 158, 11, 0.16);
  --accent-amber-border: rgba(245, 158, 11, 0.42);
  --accent-cyan: #22d3ee;
  --accent-cyan-soft: rgba(34, 211, 238, 0.14);
  --accent-cyan-border: rgba(34, 211, 238, 0.38);
  --status-success: #10b981;
  --status-success-soft: rgba(16, 185, 129, 0.16);
  --status-danger: #f43f5e;

  /* Polices techniques deterministes (zero latence / zero FOUT) */
  --font-sans: "Bahnschrift", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;

  /* Rayons concentriques & cibles */
  --radius-shell: 1.35rem;
  --radius-core: calc(1.35rem - 0.3rem);
  --target-size: 28px;
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-snap: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  inline-size: 100%;
  block-size: 100dvh;
  overflow: hidden;
  background-color: var(--bg-base);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  user-select: none;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Scene principale pleine fenetre */
.arena {
  position: relative;
  inline-size: 100%;
  block-size: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #16181e 0%, #07080a 72%);
}

.render-layer {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  display: block;
}

#gl-canvas {
  z-index: 1;
  touch-action: none;
  cursor: crosshair;
}

#fx-canvas {
  z-index: 2;
  pointer-events: none;
}

.vignette-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 56%, rgba(4, 5, 8, 0.45) 100%);
}

/* Rigs buse & reticule premier plan */
.nozzle-rig {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
  filter: drop-shadow(-14px 20px 18px rgba(0, 0, 0, 0.65));
}

.reticle {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  transform: translate3d(-999px, -999px, 0);
  will-change: transform;
}

.reticle-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 14px rgba(245, 158, 11, 0.25);
  transition: border-color 0.14s var(--ease-snap), box-shadow 0.14s var(--ease-snap);
}

.reticle[data-mode="air"] .reticle-ring {
  border-color: rgba(34, 211, 238, 0.85);
  border-style: dashed;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 16px rgba(34, 211, 238, 0.3);
}

.reticle[data-firing="true"] .reticle-ring {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 22px rgba(245, 158, 11, 0.5);
}

.reticle[data-mode="air"][data-firing="true"] .reticle-ring {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 22px rgba(34, 211, 238, 0.55);
}

.reticle-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  inline-size: 4px;
  block-size: 4px;
  margin-left: -2px;
  margin-top: -2px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

/* Ligne interactive Avant / Apres */
.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6;
  inline-size: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.75);
  pointer-events: none;
  display: none;
}

.compare-divider.is-active {
  display: block;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-overlay);
  border: 1px solid var(--accent-cyan-border);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: auto;
  cursor: ew-resize;
}

/* HUD Double-Biseau & Chrome fixe */
.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

.hud-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.hud-row--bottom {
  align-items: flex-end;
}

.shell-frame {
  pointer-events: auto;
  padding: 0.3rem;
  border-radius: var(--radius-shell);
  background: var(--surface-chassis);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52);
  contain: layout style;
}

.shell-core {
  border-radius: var(--radius-core);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Panneau Superieur Gauche : Plaque & Zones */
.mission-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.58rem;
  min-block-size: 3.25rem;
}

.plate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.6rem;
  min-block-size: max(var(--target-size), 2.35rem);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s var(--ease-snap), border-color 0.16s var(--ease-snap), transform 0.12s var(--ease-snap);
}

.plate-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-emphasis);
}

.plate-btn:active {
  transform: scale(0.98);
}

.plate-meta {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-amber);
  line-height: 1.1;
}

.plate-title {
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-inline-size: 16.5rem;
}

.zones-strip {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  flex-wrap: wrap;
}

.zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  padding: 0.22rem 0.42rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-secondary);
  white-space: nowrap;
  transition:
    border-color 0.2s var(--ease-snap),
    background-color 0.2s var(--ease-snap),
    color 0.2s var(--ease-snap),
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-timing-function:
    var(--ease-snap),
    var(--ease-snap),
    var(--ease-snap),
    linear(0, 0.22 14%, 0.94 34%, 1.18 48%, 0.95 66%, 1.03 82%, 1);
}

.zone-chip.is-clean {
  background: var(--status-success-soft);
  border-color: rgba(16, 185, 129, 0.48);
  color: #6ee7b7;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.28);
}

@media (prefers-reduced-motion: no-preference) {
  .zone-chip.is-clean {
    animation: zoneChipPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-timing-function: linear(0, 0.35 16%, 1.24 44%, 0.94 68%, 1.03 86%, 1);
  }
}

@keyframes zoneChipPop {
  0% {
    transform: scale(0.92);
  }
  50% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.zone-dot {
  inline-size: 6px;
  block-size: 6px;
  border-radius: 999px;
  background: var(--fg-muted);
}

.zone-chip.is-clean .zone-dot {
  background: var(--status-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.85);
}

/* Telemetrie Centrale Droite */
.telemetry-card {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  padding: 0.42rem 0.62rem;
  min-block-size: 3.25rem;
  border: 1px solid transparent;
  transition: border-color 0.25s var(--ease-snap), box-shadow 0.25s var(--ease-snap);
}

.telemetry-card[data-flux-tier="2"] {
  border-color: rgba(245, 158, 11, 0.48);
  box-shadow: inset 0 0 18px rgba(245, 158, 11, 0.12);
}

.telemetry-card[data-flux-tier="3"] {
  border-color: rgba(251, 146, 60, 0.72);
  box-shadow: inset 0 0 22px rgba(249, 115, 22, 0.20), 0 0 18px rgba(245, 158, 11, 0.18);
}

.telemetry-card[data-flux-tier="4"] {
  border-color: rgba(34, 211, 238, 0.85);
  box-shadow: inset 0 0 26px rgba(34, 211, 238, 0.22), 0 0 24px rgba(34, 211, 238, 0.24);
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-inline-size: 4.0rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-secondary);
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--fg-primary);
}

.stat-value--accent {
  color: var(--accent-amber);
}

.stat-value--combo {
  color: var(--accent-cyan);
}

.stat-block--debris {
  min-inline-size: 4.1rem;
}

.stat-block--debris .stat-value {
  font-size: 0.94rem;
}

.stat-block--debris .stat-value[data-cleared="true"] {
  color: var(--status-success);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
}

.progress-track {
  position: relative;
  inline-size: 7.2rem;
  block-size: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.progress-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  inline-size: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.26);
  transition: background-color 0.22s var(--ease-snap), transform 0.22s var(--ease-spring);
}

.progress-tick.is-reached {
  background: #ffffff;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.9);
  transform: scaleY(1.18);
}

.progress-fill {
  position: relative;
  inline-size: 100%;
  block-size: 100%;
  background: linear-gradient(90deg, var(--accent-amber) 0%, #fbbf24 52%, var(--accent-cyan) 80%, var(--status-success) 100%);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.16s var(--ease-snap);
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
  opacity: 0;
  transform: translateX(-100%);
}

@media (prefers-reduced-motion: no-preference) {
  .progress-fill::after {
    opacity: 0.75;
    animation: liquidSheenSweep 2.4s ease-in-out infinite;
  }
}

@keyframes liquidSheenSweep {
  0% {
    transform: translateX(-100%);
  }
  65%, 100% {
    transform: translateX(120%);
  }
}

.combo-bar-track {
  inline-size: 4.4rem;
  block-size: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.15rem;
}

.combo-bar-fill {
  inline-size: 100%;
  block-size: 100%;
  background: var(--accent-cyan);
  transform-origin: left center;
  transform: scaleX(0);
}

.action-cluster {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Boutons d'action unifies */
.btn-icon,
.tool-btn,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-inline-size: var(--target-size);
  min-block-size: var(--target-size);
  border-radius: 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.045);
  color: var(--fg-primary);
  padding: 0.38rem 0.65rem;
  transition:
    background-color 0.15s var(--ease-snap),
    border-color 0.15s var(--ease-snap),
    color 0.15s var(--ease-snap),
    transform 0.1s var(--ease-snap);
}

.btn-icon {
  padding: 0.38rem;
  inline-size: max(var(--target-size), 2.3rem);
  block-size: max(var(--target-size), 2.3rem);
}

.btn-icon:hover,
.tool-btn:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-emphasis);
}

.btn-icon:active,
.tool-btn:active,
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.96);
}

.btn-icon[aria-pressed="true"],
.tool-btn[aria-pressed="true"] {
  background: var(--accent-amber-soft);
  border-color: var(--accent-amber-border);
  color: #fde68a;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.18);
}

.tool-btn[data-tool="air"][aria-pressed="true"],
.btn-icon[data-mode="cyan"][aria-pressed="true"] {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan-border);
  color: #a5f3fc;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.28), inset 0 0 12px rgba(34, 211, 238, 0.14);
}

.btn-icon[data-mode="vision"][aria-pressed="true"] {
  background: rgba(249, 115, 22, 0.24);
  border-color: rgba(251, 146, 60, 0.78);
  color: #fed7aa;
  box-shadow: 0 0 22px rgba(249, 115, 22, 0.42), inset 0 0 12px rgba(251, 146, 60, 0.2);
  animation: visionBtnPulse 1.4s ease-in-out infinite;
}

@keyframes visionBtnPulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.34), inset 0 0 10px rgba(251, 146, 60, 0.16);
  }
  50% {
    box-shadow: 0 0 28px rgba(249, 115, 22, 0.68), inset 0 0 16px rgba(251, 146, 60, 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-icon[data-mode="vision"][aria-pressed="true"] {
    animation: none;
  }
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: rgba(253, 224, 71, 0.45);
  color: #111318;
  font-weight: 700;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-icon:focus-visible,
.tool-btn:focus-visible,
.plate-btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Barre Inferieure : Buses + Pression + Zoom */
.dock-card {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.42rem;
  flex-wrap: wrap;
}

.tool-btn {
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.42rem 0.72rem;
  min-block-size: 3.1rem;
  min-inline-size: 4.9rem;
}

.tool-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.tool-sub {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--fg-secondary);
}

.tool-btn[aria-pressed="true"] .tool-sub {
  color: inherit;
  opacity: 0.9;
}

.kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.1rem;
  block-size: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1;
}

.psi-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  min-block-size: 3.95rem;
}

.psi-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.psi-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-secondary);
}

.psi-header strong {
  color: var(--accent-amber);
  font-variant-numeric: tabular-nums;
}

.psi-range {
  inline-size: 7.5rem;
  accent-color: var(--accent-amber);
  cursor: pointer;
}

.hint-banner {
  pointer-events: none;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  color: var(--fg-secondary);
  font-size: 0.74rem;
  white-space: nowrap;
  opacity: 0.92;
  transition: opacity 0.35s var(--ease-spring);
}

.hint-banner.is-hidden {
  opacity: 0;
}

/* Region ARIA accessible unique + couche callouts 3D + banniere palier */
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.callout-layer {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

.callout-pill {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  background: rgba(8, 10, 15, 0.78);
  border: 1px solid var(--accent-amber-border);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fde68a;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.callout-pill[data-variant="gold"] {
  border-color: rgba(251, 191, 36, 0.85);
  color: #fef08a;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.36);
}

.callout-pill[data-variant="cyan"] {
  border-color: var(--accent-cyan-border);
  color: #a5f3fc;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.30);
}

.callout-pill[data-variant="emerald"] {
  border-color: rgba(16, 185, 129, 0.72);
  color: #6ee7b7;
}

.milestone-banner {
  position: fixed;
  left: 50%;
  top: 5.35rem;
  z-index: 19;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.16rem;
  padding: 0.5rem 1.05rem;
  border-radius: 0.95rem;
  background: rgba(10, 12, 18, 0.88);
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  transform: translate3d(-50%, -10px, 0) scale(0.94);
  opacity: 0;
  will-change: transform, opacity;
  contain: layout style;
  transition: transform 0.28s var(--ease-spring), opacity 0.22s var(--ease-snap);
}

.milestone-banner.is-visible {
  transform: translate3d(-50%, 0, 0) scale(1);
  opacity: 1;
}

.milestone-banner[data-variant="cyan"] {
  border-color: var(--accent-cyan-border);
}

.milestone-banner[data-variant="emerald"] {
  border-color: rgba(16, 185, 129, 0.65);
}

.milestone-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-secondary);
}

.milestone-banner-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: nowrap;
}

.milestone-banner-title {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--fg-primary);
  white-space: nowrap;
}

.milestone-bonus-pill {
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: var(--accent-amber-soft);
  border: 1px solid var(--accent-amber-border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: #fde68a;
  white-space: nowrap;
}

.milestone-banner[data-variant="cyan"] .milestone-bonus-pill {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan-border);
  color: #a5f3fc;
}

.milestone-banner[data-variant="emerald"] .milestone-bonus-pill {
  background: var(--status-success-soft);
  border-color: rgba(16, 185, 129, 0.55);
  color: #6ee7b7;
}

/* Toasts de Zone & Popups flottants */
.toast-feed {
  position: fixed;
  left: 50%;
  top: 9.6rem;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.toast-pill {
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-overlay);
  border: 1px solid var(--accent-amber-border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde68a;
  white-space: nowrap;
  animation: toast-rise 1.9s var(--ease-spring) forwards;
}

.toast-pill--success {
  border-color: rgba(16, 185, 129, 0.52);
  color: #6ee7b7;
}

@keyframes toast-rise {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  80% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

/* Modales natives <dialog> (Top Layer animee selon modern-web-guidance) */
dialog {
  margin: auto;
  padding: 0.35rem;
  max-inline-size: min(44rem, calc(100vw - 1.5rem));
  max-block-size: calc(100dvh - 2rem);
  border-radius: var(--radius-shell);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-primary);
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.78);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: var(--ease-snap);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  dialog {
    transform: scale(0.94);
  }
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background-color: rgba(4, 6, 10, 0);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog[open]):where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(1);

    @starting-style {
      transform: scale(0.94);
    }
  }

  &::backdrop {
    background-color: rgba(4, 6, 10, 0.7);

    @starting-style {
      background-color: rgba(4, 6, 10, 0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog,
  dialog::backdrop {
    transition-duration: 0.08s;
  }
  .toast-pill,
  .victory-rank-badge.is-stamped {
    animation-duration: 0.08s;
  }
  .milestone-banner,
  .rank-xp-fill {
    transition-duration: 0.08s;
  }
  .milestone-banner {
    transform: translate3d(-50%, 0, 0);
  }
  .milestone-banner.is-visible {
    transform: translate3d(-50%, 0, 0);
  }
}

.modal-inner {
  border-radius: var(--radius-core);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  padding: 1.25rem;
  overflow-y: auto;
  max-block-size: calc(100dvh - 3rem);
}

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

.modal-title {
  margin: 0.2rem 0 0;
  font-size: clamp(1.15rem, 1rem + 1vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 0.75rem;
}

.level-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  text-align: left;
  color: var(--fg-primary);
  cursor: pointer;
  transition: border-color 0.16s var(--ease-snap), background-color 0.16s var(--ease-snap), transform 0.12s var(--ease-snap);
}

.level-card:hover {
  border-color: var(--border-emphasis);
  background: rgba(255, 255, 255, 0.065);
}

.level-card.is-current {
  border-color: var(--accent-amber-border);
  background: var(--accent-amber-soft);
}

.level-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.level-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  color: var(--fg-secondary);
}

.level-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.level-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--fg-secondary);
  line-height: 1.42;
  text-wrap: pretty;
}

.level-stats {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-secondary);
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle);
}

/* Ecran de victoire */
.victory-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.victory-kpi {
  padding: 0.75rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.victory-kpi strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  color: var(--accent-amber);
}

/* Badges XP & Grade dans Catalogue & Victoire */
.rank-pill-card,
.victory-xp-panel {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  padding: 0.72rem 0.85rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.85rem;
}

.rank-pill-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.rank-pill-meta,
.victory-xp-grade {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rank-pill-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--fg-primary);
}

.rank-pill-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-inline-size: 10rem;
}

.rank-pill-xp {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--fg-secondary);
}

.rank-xp-track {
  inline-size: 100%;
  min-inline-size: 8.5rem;
  block-size: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.rank-xp-fill {
  inline-size: 100%;
  block-size: 100%;
  background: linear-gradient(90deg, var(--accent-cyan) 0%, #38bdf8 50%, var(--accent-amber) 100%);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.65s var(--ease-spring);
}

.victory-xp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.victory-xp-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.xp-earned-pill,
.rank-up-tag {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 800;
}

.xp-earned-pill {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--accent-cyan-border);
  color: #a5f3fc;
}

.rank-up-tag {
  background: var(--status-success-soft);
  border: 1px solid rgba(16, 185, 129, 0.62);
  color: #6ee7b7;
}

.victory-rank-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fbbf24;
  transform-origin: left center;
}

.victory-rank-badge.is-stamped {
  animation: stamp-slam 0.28s var(--ease-spring) forwards;
}

@keyframes stamp-slam {
  0% {
    opacity: 0.65;
    transform: scale(1.24) translateY(-4px);
  }
  65% {
    opacity: 1;
    transform: scale(0.96) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.shortcuts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.shortcuts-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.84rem;
}

.shortcuts-list code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.18rem 0.45rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
}

@media (max-width: 780px) {
  .hud-layer {
    padding: 0.45rem;
    gap: 0.45rem;
  }
  .hud-row {
    gap: 0.4rem;
    flex-direction: column;
    align-items: stretch;
  }
  .hud-row--bottom {
    align-items: stretch;
  }
  .shell-frame {
    max-inline-size: 100%;
  }
  .mission-card,
  .telemetry-card {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.45rem 0.6rem;
    padding: 0.4rem 0.55rem;
    min-block-size: auto;
  }
  .zones-strip {
    display: none;
  }
  .plate-btn {
    inline-size: 100%;
  }
  .plate-title {
    max-inline-size: 100%;
  }
  .stat-block {
    min-inline-size: 3.1rem;
    align-items: flex-start;
  }
  .stat-value {
    font-size: 0.94rem;
  }
  .progress-track {
    inline-size: 4.5rem;
  }
  .action-cluster {
    inline-size: 100%;
    justify-content: space-between;
  }
  .dock-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
  }
  .tool-btn {
    min-inline-size: 0;
    min-block-size: var(--target-size);
    padding: 0.3rem 0.25rem;
  }
  .tool-head {
    font-size: 0.68rem;
  }
  .tool-sub {
    display: none;
  }
  .psi-card {
    justify-content: space-between;
    min-block-size: auto;
    padding: 0.38rem 0.6rem;
  }
  .psi-card .action-cluster {
    inline-size: auto;
    justify-content: flex-end;
  }
  .psi-range {
    inline-size: 7.5rem;
  }
  .hint-banner {
    display: none;
  }
  .victory-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0.65rem 0;
  }
  .victory-kpi {
    padding: 0.48rem 0.52rem;
  }
  .victory-kpi strong {
    font-size: 0.96rem;
  }
  .milestone-banner {
    top: 13.05rem;
    max-inline-size: calc(100vw - 1.5rem);
    padding: 0.42rem 0.75rem;
  }
  .milestone-banner-title {
    font-size: 0.74rem;
  }
  .toast-feed {
    top: 16.8rem;
  }
  .rank-pill-progress {
    align-items: flex-start;
    inline-size: 100%;
  }
}
