/* Aperçu jouable de Magnetar — styles minimaux (le décor vient des images exportées). */
.mg-root {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #141417;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.mg-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 820px;
  transform-origin: 0 0;
}
.mg-page {
  position: absolute;
  inset: 0;
  background-size: 1440px 820px;
  background-repeat: no-repeat;
}
.mg-page[hidden],
.mg-ctl[hidden] {
  display: none;
}
.mg-ctl {
  position: absolute;
  background-repeat: no-repeat;
  cursor: ns-resize;
}
.mg-sprites {
  cursor: pointer;
}
.mg-menu {
  position: absolute;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(120px, max-content);
  column-gap: 2px;
  min-width: 140px;
  padding: 4px 0;
  background: #242429;
  border: 1px solid #3a3a42;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font: 12px/1.2 system-ui, sans-serif;
}
.mg-menu-item {
  display: block;
  width: 100%;
  padding: 5px 12px;
  border: 0;
  background: none;
  color: #d8d2c4;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.mg-menu-list {
  display: flex;
  flex-direction: column;
}
.mg-menu-head {
  padding: 4px 12px 3px;
  color: #8b8676;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.mg-menu-sep {
  height: 1px;
  margin: 4px 0;
  background: #3a3a42;
}
.mg-menu-item:disabled {
  opacity: 0.35;
  cursor: default;
}
.mg-menu-item:disabled:hover {
  background: none;
}
.mg-menu-item:hover {
  background: rgba(232, 224, 208, 0.18);
}
.mg-menu-item[aria-current='true'] {
  color: #86f0b4;
}

.mg-nav {
  position: absolute;
  z-index: 5;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mg-combo {
  cursor: pointer;
}
.mg-combo-text {
  position: absolute;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  pointer-events: none;
}

.mg-led {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}
.mg-deco {
  pointer-events: none;
}

/* Zones cliquables des badges SYNC / SWARM (le décor reste celui du fond). */
.mg-hit {
  z-index: 4;
  cursor: pointer;
}
/* Boutons d'action : TRIGGER, sélecteurs MSEG 1-4, INVERT / REVERSE / CLEAR. */
.mg-action {
  cursor: pointer;
}
.mg-mseg {
  position: absolute;
  cursor: crosshair;
}

.mg-screen {
  position: absolute;
}
.mg-xy {
  cursor: crosshair;
}
.mg-fxlist {
  cursor: grab;
}

/* Infobulle « terminal » : vert phosphore dans un cadre vert, lignes de balayage, curseur qui clignote
   (écrans de bord façon Alien). Posée dans <body> (ou l'élément plein écran) pour n'être jamais rognée. */
.mg-tip {
  position: fixed;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
  padding: 8px 12px 7px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  font: 14px/1.3 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #86f0b4;
  text-shadow: 0 0 6px rgba(134, 240, 180, 0.65);
  background:
    repeating-linear-gradient(to bottom, rgba(134, 240, 180, 0.06) 0 1px, transparent 1px 3px),
    rgba(2, 10, 6, 0.93);
  border: 1px solid #86f0b4;
  box-shadow: 0 0 14px rgba(134, 240, 180, 0.35), inset 0 0 14px rgba(134, 240, 180, 0.1);
}
.mg-tip.is-on {
  opacity: 1;
  transform: none;
}
.mg-tip-value {
  color: #d6ffe9;
}
.mg-tip-value::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.35em;
  vertical-align: -0.12em;
  background: #86f0b4;
  box-shadow: 0 0 6px rgba(134, 240, 180, 0.8);
  animation: mg-tip-cursor 1s steps(1) infinite;
}
.mg-tip-dest {
  color: #86f0b4;
  opacity: 0.85;
}
.mg-tip-dest:empty {
  display: none;
}
@keyframes mg-tip-cursor {
  50% { opacity: 0; }
}

/* Plein écran du MSEG : fond du rack agrandi, par-dessus la page SEQUENCE (sous le header). */
.mg-mseg-full {
  position: absolute;
  z-index: 6;
  background-size: 100% 100%;
}
.mg-mseg:focus {
  outline: none;
}

/* Saisie numérique d'un point MSEG (même esprit que l'infobulle « terminal »). */
.mg-dialog {
  position: absolute;
  z-index: 2147483001;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
  padding: 12px 14px;
  font: 13px/1.3 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color: #86f0b4;
  background: rgba(2, 10, 6, 0.96);
  border: 1px solid #86f0b4;
  box-shadow: 0 0 14px rgba(134, 240, 180, 0.35);
}
.mg-dialog-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mg-dialog-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mg-dialog-row input {
  width: 96px;
  padding: 3px 6px;
  font: inherit;
  color: #d6ffe9;
  background: #0a120c;
  border: 1px solid #2f7a4c;
}
.mg-dialog-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.mg-dialog-btns button {
  padding: 3px 12px;
  font: inherit;
  color: #86f0b4;
  background: transparent;
  border: 1px solid #2f7a4c;
  cursor: pointer;
}
.mg-dialog-btns .mg-dialog-ok {
  background: #14342c;
}

/* --- Visite guidée (magnetar-tour.js) : projecteur + panneau de bord, dans la scène (unités de design) --- */
.mg-tour { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.mg-tour-beam {
  position: absolute; border: 1px solid rgba(134, 240, 180, 0.9); border-radius: 6px;
  box-shadow: 0 0 0 3000px rgba(4, 7, 6, 0.74), 0 0 24px rgba(134, 240, 180, 0.35), inset 0 0 18px rgba(134, 240, 180, 0.12);
  transition: left 0.7s cubic-bezier(0.6, 0, 0.2, 1), top 0.7s cubic-bezier(0.6, 0, 0.2, 1),
              width 0.7s cubic-bezier(0.6, 0, 0.2, 1), height 0.7s cubic-bezier(0.6, 0, 0.2, 1), opacity 0.4s;
}
.mg-tour-beam::before, .mg-tour-beam::after {
  content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid #86f0b4;
}
.mg-tour-beam::before { left: -6px; top: -6px; border-right: 0; border-bottom: 0; }
.mg-tour-beam::after { right: -6px; bottom: -6px; border-left: 0; border-top: 0; }
.mg-tour.is-full .mg-tour-beam { border-color: transparent; box-shadow: none; background: rgba(4, 7, 6, 0.78); }
.mg-tour.is-full .mg-tour-beam::before, .mg-tour.is-full .mg-tour-beam::after { display: none; }
.mg-tour-panel {
  position: absolute; pointer-events: auto; box-sizing: border-box; width: 470px; padding: 16px 20px 14px;
  background: rgba(8, 14, 11, 0.96); border: 1px solid #2f7a4c; border-radius: 4px; color: #cfeedd;
  font: 15px/1.5 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transition: left 0.7s cubic-bezier(0.6, 0, 0.2, 1), top 0.7s cubic-bezier(0.6, 0, 0.2, 1);
  background-image: repeating-linear-gradient(0deg, rgba(134, 240, 180, 0.03) 0 1px, transparent 1px 3px);
}
.mg-tour-head { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; color: #5fae84; }
.mg-tour-title { margin: 8px 0 6px; font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; color: #86f0b4;
  text-shadow: 0 0 10px rgba(134, 240, 180, 0.45); }
.mg-tour-body { margin: 0; }
.mg-tour-try { margin: 10px 0 0; color: #f0d28f; min-height: 1.5em; }
.mg-tour-try.is-done { color: #86f0b4; }
.mg-tour-nav { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.mg-tour-nav span { flex: 1; }
.mg-tour-nav button {
  font: inherit; font-size: 13px; letter-spacing: 0.04em; cursor: pointer; padding: 6px 12px; border-radius: 3px; white-space: nowrap;
  background: none; color: #cfeedd; border: 1px solid #2f7a4c;
}
.mg-tour-nav button:hover:not(:disabled) { border-color: #86f0b4; color: #86f0b4; }
.mg-tour-nav button:disabled { opacity: 0.35; cursor: default; }
.mg-tour-nav .mg-tour-next { background: #86f0b4; color: #0a1510; border-color: #86f0b4; }
.mg-tour-nav .mg-tour-next:hover:not(:disabled) { background: #a8f7cb; border-color: #a8f7cb; color: #0a1510; }
.mg-tour-nav .mg-tour-next.is-ready { animation: mg-tour-pulse 1.2s ease-in-out infinite; }
.mg-tour-nav .mg-tour-quit { border-color: transparent; color: #7c8f85; padding-left: 0; }
@keyframes mg-tour-pulse { 50% { box-shadow: 0 0 0 5px rgba(134, 240, 180, 0.25); } }
@media (prefers-reduced-motion: reduce) {
  .mg-tour-beam, .mg-tour-panel { transition: none; }
  .mg-tour-nav .mg-tour-next.is-ready { animation: none; }
}
.mg-tour-cursor {
  position: absolute; width: 0; height: 0; z-index: 2; pointer-events: none;
  transition-property: left, top; transition-timing-function: cubic-bezier(0.5, 0, 0.2, 1);
}
.mg-tour-cursor svg { position: absolute; left: -3px; top: -2px; fill: #eafff3; stroke: #0a1510; stroke-width: 1.4;
  filter: drop-shadow(0 0 6px rgba(134, 240, 180, 0.8)); }
.mg-tour-tag { position: absolute; left: 22px; top: 18px; white-space: nowrap; padding: 2px 7px; border-radius: 3px;
  background: #86f0b4; color: #0a1510; font: 600 12px/1.3 'IBM Plex Mono', ui-monospace, Menlo, monospace; }
.mg-tour-tag:empty { display: none; }
.mg-tour-ripple { position: absolute; width: 0; height: 0; pointer-events: none; }
.mg-tour-ripple::after {
  content: ''; position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #86f0b4; animation: mg-tour-ripple 0.6s ease-out forwards;
}
@keyframes mg-tour-ripple { from { transform: scale(0.2); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }
.mg-tour-nav .mg-tour-full[hidden] { display: none; }
.mg-tour-end { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.mg-tour-end[hidden] { display: none; }
.mg-tour-manual {
  display: inline-block; padding: 10px 18px; border-radius: 3px; text-decoration: none; white-space: nowrap;
  font: 600 15px/1.3 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.05em;
  color: #86f0b4; border: 1px solid #86f0b4;
}
.mg-tour-manual:hover { border-color: #fff; color: #fff; }
.mg-tour-manual[hidden] { display: none; }
.mg-tour-buy {
  display: inline-block; padding: 10px 18px; cursor: pointer; border-radius: 3px; white-space: nowrap;
  font: 600 15px/1.3 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.05em;
  background: #86f0b4; color: #0a1510; border: 1px solid #86f0b4;
}
.mg-tour-buy:hover { background: #fff; border-color: #fff; }
.mg-tour-buy[hidden] { display: none; }
