/* ==========================================================================
   YAYO//LAB — la réparation des photos, façon poste de commande holographique.
   Monde à part, toujours sombre quel que soit le thème de l'application.
   ========================================================================== */

.lab {
  --lab-bg: #02070d;
  --lab-panel: rgba(5, 20, 30, 0.66);
  --lab-line: rgba(73, 242, 255, 0.2);
  --lab-line-strong: rgba(73, 242, 255, 0.55);
  --lab-cyan: #49f2ff;
  --lab-cyan-soft: rgba(73, 242, 255, 0.14);
  --lab-ink: #e2fcff;
  --lab-ink-soft: #8ebfca;
  --lab-amber: #ffb547;
  --lab-red: #ff5470;
  --lab-green: #5dffa8;
  --lab-display: "Orbitron", "Fredoka", sans-serif;
  --lab-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --bracket: var(--lab-cyan);

  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  color: var(--lab-ink);
  background: radial-gradient(ellipse 80% 70% at 50% 46%, #072433 0%, #03101a 45%, var(--lab-bg) 100%);
  font-family: "Nunito", system-ui, sans-serif;
  animation: lab-power 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.lab[hidden] { display: none; }
.lab ::selection { background: rgba(73, 242, 255, 0.35); color: #fff; }

/* Allumage façon tube cathodique : une ligne qui s'ouvre en écran. */
@keyframes lab-power {
  0% { clip-path: inset(49.6% 0 49.6% 0); filter: brightness(3); }
  45% { clip-path: inset(49.6% 0 49.6% 0); filter: brightness(2); }
  100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}

.lab-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.lab-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
.lab-scanlines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22vh;
  background: linear-gradient(to bottom, transparent, rgba(73, 242, 255, 0.035), transparent);
  animation: lab-roll 7s linear infinite;
}
@keyframes lab-roll { from { transform: translateY(-25vh); } to { transform: translateY(110vh); } }

/* ---------- Ossature du poste de commande ---------- */

.lab-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(0, 2.3fr) minmax(270px, 1.05fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top top top"
    "hex core diag"
    "bottom bottom bottom";
  gap: 14px;
  padding: 14px 20px 18px;
  transition: opacity 0.6s ease, filter 0.6s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.lab-frame.booting > * { opacity: 0; }
.lab-frame.dimmed { opacity: 0.12; filter: blur(3px); transform: scale(0.97); }
.lab-frame[hidden] { display: none; }

/* Mise sous tension des panneaux, l'un après l'autre. */
.lab-frame.online > * { animation: panel-on 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.lab-frame.online > :nth-child(2) { animation-delay: 0.12s; }
.lab-frame.online > :nth-child(3) { animation-delay: 0.24s; }
.lab-frame.online > :nth-child(4) { animation-delay: 0.36s; }
.lab-frame.online > :nth-child(5) { animation-delay: 0.48s; }
@keyframes panel-on {
  0% { opacity: 0; clip-path: inset(0 50% 0 50%); filter: brightness(2.4); }
  40% { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0 0 0); filter: brightness(1); }
}

.lab-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--lab-line);
  font-family: var(--lab-mono);
  font-size: 0.78rem;
  color: var(--lab-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.lab-brand {
  font-family: var(--lab-display);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.16em;
  color: var(--lab-ink);
  text-shadow: 0 0 18px rgba(73, 242, 255, 0.55);
}
.lab-brand span { color: var(--lab-amber); margin: 0 0.1em; }
.lab-top-mid { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-top-right { display: flex; align-items: center; gap: 12px; }
.lab-rec {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lab-red);
  box-shadow: 0 0 10px var(--lab-red);
  animation: lab-blink 1.2s steps(2, jump-none) infinite;
}
@keyframes lab-blink { 50% { opacity: 0.15; } }
.lab-clock { color: var(--lab-ink); font-variant-numeric: tabular-nums; }

.lab-skip {
  font-family: var(--lab-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lab-ink-soft);
  background: transparent;
  border: 1px solid var(--lab-line);
  padding: 6px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.lab-skip:hover { color: var(--lab-cyan); border-color: var(--lab-line-strong); background: var(--lab-cyan-soft); }
.lab-skip:focus-visible { outline: 2px solid var(--lab-cyan); outline-offset: 2px; }

/* Panneaux : fond translucide, filet fin et équerres lumineuses aux coins. */
.lab-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 14px 16px;
  border: 1px solid var(--lab-line);
  background:
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) top left / 14px 2px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) top left / 2px 14px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) top right / 14px 2px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) top right / 2px 14px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) bottom left / 14px 2px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) bottom left / 2px 14px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--lab-cyan), var(--lab-cyan)) bottom right / 2px 14px no-repeat,
    var(--lab-panel);
}

.lab-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-family: var(--lab-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--lab-cyan);
}
.lab-panel-title::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--lab-cyan);
  box-shadow: 0 0 8px var(--lab-cyan);
  animation: lab-blink 2.4s steps(2, jump-none) infinite;
}
.lab-panel-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--lab-line); }
.lab-panel-title:not(:first-child) { margin-top: 18px; }

/* ---------- Flux binaire (le vrai contenu du fichier, octet par octet) ---------- */

.lab-hex { grid-area: hex; display: flex; flex-direction: column; }
.hex-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-family: var(--lab-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  color: rgba(226, 252, 255, 0.82);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%);
  mask-image: linear-gradient(to bottom, transparent, #000 22%);
}
.hx { flex-shrink: 0; animation: hx-in 0.18s ease-out; }
@keyframes hx-in { from { opacity: 0; transform: translateX(-6px); } }
.hx-off { color: rgba(142, 191, 202, 0.6); margin-right: 1.2ch; }
.hx-m { color: var(--lab-cyan); background: rgba(73, 242, 255, 0.14); font-weight: 600; }
.hx-m.bad { color: #fff; background: rgba(255, 84, 112, 0.55); }
.hx-tag {
  position: relative;
  padding-left: 9.2ch;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  white-space: normal;
  color: var(--lab-cyan);
}
.hx-tag::before {
  content: "";
  position: absolute;
  left: 7.6ch;
  top: 0.55em;
  border: 4px solid transparent;
  border-bottom: 6px solid currentColor;
  border-top: 0;
}
.hx-tag.bad { color: var(--lab-red); font-weight: 600; }
.hx-tag.warn { color: var(--lab-amber); }
.hx-gap { color: rgba(142, 191, 202, 0.45); letter-spacing: 0.1em; }
.hx-file {
  flex-shrink: 0;
  margin: 6px 0 2px;
  color: var(--lab-amber);
  letter-spacing: 0.08em;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Le cœur : la photo dans ses anneaux ---------- */

.lab-core {
  grid-area: core;
  position: relative;
  min-height: 0;
  --ring: 480px;
}

.core-rings {
  position: absolute;
  left: 50%;
  top: calc(50% - 18px);
  width: var(--ring);
  height: var(--ring);
  transform: translate(-50%, -50%);
  overflow: visible;
}
.core-rings .ring { transform-origin: 300px 300px; }
.r-cross { stroke: rgba(73, 242, 255, 0.1); stroke-width: 1; stroke-dasharray: 3 7; }
.r-ticks { fill: none; stroke: rgba(73, 242, 255, 0.45); stroke-width: 7; stroke-dasharray: 1.4 8.75; }
.r-pip { fill: var(--lab-amber); filter: drop-shadow(0 0 6px var(--lab-amber)); }
.r-arcs { fill: none; stroke: rgba(73, 242, 255, 0.55); stroke-width: 2.5; stroke-dasharray: 230 34 60 34 120 34 40 34; }
.r-track { fill: none; stroke: rgba(73, 242, 255, 0.1); stroke-width: 6; }
.r-progress {
  fill: none;
  stroke: var(--lab-cyan);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 1589.6;
  stroke-dashoffset: 1589.6;
  filter: drop-shadow(0 0 8px rgba(73, 242, 255, 0.8));
  transition: stroke-dashoffset 0.5s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.4s ease;
}
.lab-core.damaged .r-progress { stroke: var(--lab-amber); filter: drop-shadow(0 0 8px rgba(255, 181, 71, 0.8)); }
.lab-core.fixed .r-progress { stroke: var(--lab-green); filter: drop-shadow(0 0 10px rgba(93, 255, 168, 0.9)); }
.r-major { fill: none; stroke: rgba(73, 242, 255, 0.28); stroke-width: 14; stroke-dasharray: 2 59.7; }

.core-photo {
  position: absolute;
  left: 50%;
  top: calc(50% - 18px);
  width: 300px;
  height: 380px;
  transform: translate(-50%, -50%);
  background: #000;
  box-shadow: 0 0 0 1px rgba(73, 242, 255, 0.45), 0 0 50px rgba(73, 242, 255, 0.18), 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1), height 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}
.core-photo canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lab-core.damaged .core-photo { --bracket: var(--lab-red); box-shadow: 0 0 0 1px rgba(255, 84, 112, 0.6), 0 0 50px rgba(255, 84, 112, 0.2), 0 20px 60px rgba(0, 0, 0, 0.6); }
.lab-core.fixed .core-photo { --bracket: var(--lab-green); box-shadow: 0 0 0 1px rgba(93, 255, 168, 0.7), 0 0 70px rgba(93, 255, 168, 0.3), 0 20px 60px rgba(0, 0, 0, 0.6); }

/* Grille de mesure pendant l'analyse. */
.core-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(rgba(73, 242, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 242, 255, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  transition: opacity 0.4s ease;
}
.lab-core.analyzing .core-photo::after { opacity: 1; }

.core-brackets {
  position: absolute;
  inset: -14px;
  pointer-events: none;
  background:
    linear-gradient(var(--bracket), var(--bracket)) top left / 26px 3px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top left / 3px 26px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top right / 26px 3px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top right / 3px 26px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / 26px 3px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / 3px 26px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / 26px 3px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / 3px 26px no-repeat;
  filter: drop-shadow(0 0 6px var(--bracket));
}
.lab-core.analyzing .core-brackets { animation: bracket-breathe 1.1s ease-in-out infinite; }
@keyframes bracket-breathe { 50% { inset: -22px; } }

/* Faisceau de scan qui balaie la photo. */
.core-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(73, 242, 255, 0.05) 40%, rgba(73, 242, 255, 0.32) 96%, #c8fdff 100%);
  box-shadow: 0 6px 18px -6px #49f2ff;
}
.lab-core.analyzing .core-scan { opacity: 1; animation: core-scan 1.5s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
@keyframes core-scan { from { transform: translateY(-100%); } to { transform: translateY(385%); } }

/* Tête d'écriture pendant la reconstruction. */
.core-write {
  position: absolute;
  left: -5%;
  right: -5%;
  top: 0;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  background: #d8feff;
  box-shadow: 0 0 6px #fff, 0 0 18px #49f2ff, 0 0 40px #49f2ff;
  will-change: transform;
}
.lab-core.rebuilding .core-write { opacity: 1; }

.core-stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 8px 20px 6px;
  font-family: var(--lab-display);
  font-weight: 900;
  font-size: clamp(1.1rem, 2.4vw, 1.9rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lab-green);
  border: 3px solid var(--lab-green);
  background: rgba(2, 20, 12, 0.72);
  text-shadow: 0 0 14px var(--lab-green);
  box-shadow: 0 0 30px rgba(93, 255, 168, 0.4), inset 0 0 20px rgba(93, 255, 168, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-8deg) scale(2.2);
}
.core-stamp.show { animation: stamp 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2.2); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(0.96); }
}

.core-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 18px;
  font-family: var(--lab-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lab-ink-soft);
}
#core-count { color: var(--lab-ink); font-weight: 600; white-space: nowrap; }
.core-name { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0.04em; }
.core-phase {
  min-width: 18ch;
  font-family: var(--lab-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--lab-cyan);
}
.lab-core.damaged .core-phase { color: var(--lab-amber); }
.lab-core.fixed .core-phase { color: var(--lab-green); }

/* ---------- Diagnostic ---------- */

.lab-diag { grid-area: diag; display: flex; flex-direction: column; }
.diag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  overflow: hidden;
}
.diag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: rgba(73, 242, 255, 0.04);
  flex-shrink: 0;
  border: 1px solid transparent;
  animation: diag-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes diag-in {
  from { clip-path: inset(0 100% 0 0); background: rgba(73, 242, 255, 0.35); }
  to { clip-path: inset(0 0 0 0); }
}
.diag-k { font-weight: 700; font-size: 0.88rem; color: var(--lab-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-v {
  font-family: var(--lab-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.diag-row .icon { width: 16px; height: 16px; stroke-width: 2.6; }
.diag-row.ok .diag-v, .diag-row.ok .icon { color: var(--lab-cyan); }
.diag-row.warn .diag-v, .diag-row.warn .icon { color: var(--lab-amber); }
.diag-row.bad .diag-v, .diag-row.bad .icon { color: var(--lab-red); }
.diag-row.bad { border-color: rgba(255, 84, 112, 0.35); background: rgba(255, 84, 112, 0.07); }
.diag-row.bad .diag-v { animation: lab-blink 0.9s steps(2, jump-none) 3; }
.diag-row.fixed { border-color: rgba(93, 255, 168, 0.3); background: rgba(93, 255, 168, 0.07); animation: diag-fixed 0.6s ease-out; }
.diag-row.fixed .diag-v, .diag-row.fixed .icon { color: var(--lab-green); }
@keyframes diag-fixed { from { background: rgba(93, 255, 168, 0.4); } }

.scope { width: 100%; height: 64px; display: block; flex-shrink: 0; }

.readouts { margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.readouts div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.readouts dt { font-size: 0.82rem; font-weight: 700; color: var(--lab-ink-soft); }
.readouts dd {
  margin: 0;
  font-family: var(--lab-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lab-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Bas : journal de bord et progression ---------- */

.lab-bottom {
  grid-area: bottom;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
  align-items: end;
}
.lab-log {
  height: 7.4em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-family: var(--lab-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--lab-ink);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%);
  mask-image: linear-gradient(to bottom, transparent, #000 45%);
}
.log-line { flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-line time { color: rgba(142, 191, 202, 0.65); margin-right: 1.2ch; }
.log-line.ok { color: var(--lab-green); }
.log-line.warn { color: var(--lab-amber); }
.log-line.bad { color: var(--lab-red); }
.log-line.typing::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: currentColor;
  animation: lab-blink 0.5s steps(2, jump-none) infinite;
}

.lab-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-family: var(--lab-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lab-cyan);
}
.lab-percent {
  font-family: var(--lab-mono);
  font-size: 1.5rem;
  letter-spacing: 0;
  color: var(--lab-ink);
  font-variant-numeric: tabular-nums;
}
.lab-bar {
  position: relative;
  height: 12px;
  border: 1px solid var(--lab-line-strong);
  padding: 2px;
}
.lab-bar-fill {
  height: 100%;
  width: 0%;
  background:
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.28) 0 6px, transparent 6px 12px),
    linear-gradient(90deg, #1aa9c2, var(--lab-cyan));
  background-size: 24px 100%, 100% 100%;
  box-shadow: 0 0 14px rgba(73, 242, 255, 0.6);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  animation: bar-flow 0.8s linear infinite;
}
@keyframes bar-flow { to { background-position: 24px 0, 0 0; } }

.filmstrip { display: flex; gap: 6px; margin-top: 10px; height: 40px; overflow: hidden; }
.film {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--lab-green);
  background: #000 center / cover no-repeat;
  box-shadow: 0 0 10px rgba(93, 255, 168, 0.35);
  animation: film-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.film.bad { border-color: var(--lab-red); box-shadow: 0 0 10px rgba(255, 84, 112, 0.35); background: repeating-linear-gradient(45deg, rgba(255, 84, 112, 0.25) 0 4px, transparent 4px 8px); }
@keyframes film-in { from { opacity: 0; transform: translateY(-30px) scale(1.6); } }

/* ---------- Démarrage ---------- */

.lab-boot {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 20px;
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.7, 0, 0.84, 0);
}
.lab-boot.gone { opacity: 0; transform: scaleY(0.02); pointer-events: none; }
.lab-boot[hidden] { display: none; }
.boot-logo {
  font-family: var(--lab-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 8vw, 5.6rem);
  letter-spacing: 0.14em;
  color: #effeff;
  text-shadow: 0 0 22px rgba(73, 242, 255, 0.85), 0 0 60px rgba(73, 242, 255, 0.45);
  white-space: nowrap;
}
.boot-lines {
  width: min(680px, 100%);
  min-height: 11em;
  font-family: var(--lab-mono);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--lab-ink-soft);
}
.boot-line { display: flex; gap: 1ch; white-space: nowrap; }
.boot-line .dots { flex: 1 1 auto; overflow: hidden; color: rgba(142, 191, 202, 0.35); }
.boot-line .dots::before { content: "..................................................................................................."; }
.boot-line .st { color: var(--lab-green); font-weight: 600; }
.boot-line .st.wait { color: var(--lab-amber); }
.boot-line .st.bad { color: var(--lab-red); }

/* ---------- Final ---------- */

.lab-finale {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
.lab-finale[hidden] { display: none; }
.finale-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40vmin;
  height: 40vmin;
  border-radius: 50%;
  border: 2px solid var(--lab-cyan);
  box-shadow: 0 0 40px var(--lab-cyan), inset 0 0 40px rgba(73, 242, 255, 0.5);
  transform: translate(-50%, -50%) scale(0);
  animation: wave 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes wave {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(5); opacity: 0; }
}
.finale-title {
  position: relative;
  font-family: var(--lab-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 5.4vw, 4.4rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #f2ffff;
  text-shadow: 0 0 20px rgba(73, 242, 255, 0.9), 0 0 70px rgba(73, 242, 255, 0.5);
}
.finale-sub {
  position: relative;
  font-family: var(--lab-mono);
  font-size: clamp(0.85rem, 1.6vw, 1.1rem);
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--lab-green);
  text-shadow: 0 0 12px rgba(93, 255, 168, 0.6);
  text-transform: uppercase;
}
.lab-finale.failed .finale-title { text-shadow: 0 0 20px rgba(255, 84, 112, 0.9), 0 0 70px rgba(255, 84, 112, 0.5); }
.lab-finale.failed .finale-sub { color: var(--lab-red); text-shadow: none; }

.lab-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%, #fff 0%, rgba(200, 253, 255, 0.8) 30%, rgba(73, 242, 255, 0) 75%);
  opacity: 0;
}
.lab-flash.on { animation: flash-out 0.9s ease-out; }
@keyframes flash-out { 0% { opacity: 0.95; } 100% { opacity: 0; } }

/* ---------- Résultats : place au calme, gros boutons ---------- */

.lab-results {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  padding: 40px 20px 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--lab-line-strong) transparent;
  animation: results-in 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.lab-results[hidden] { display: none; }
@keyframes results-in { from { opacity: 0; transform: translateY(26px); filter: blur(6px); } }
.lab-results::-webkit-scrollbar { width: 10px; }
.lab-results::-webkit-scrollbar-thumb { background: var(--lab-line-strong); }

.results-inner { max-width: 1080px; margin: 0 auto; }
.results-head { text-align: center; }
.results-icon {
  width: 64px;
  height: 64px;
  fill: none;
  stroke: var(--lab-green);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 14px rgba(93, 255, 168, 0.7));
}
.results-head.failed .results-icon { stroke: var(--lab-red); filter: drop-shadow(0 0 14px rgba(255, 84, 112, 0.7)); }
.results-title {
  margin: 10px 0 6px;
  font-family: var(--lab-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-wrap: balance;
  color: #f2ffff;
  text-shadow: 0 0 24px rgba(73, 242, 255, 0.45);
}
.results-sub { margin: 0 auto; max-width: 60ch; font-size: 1.15rem; font-weight: 600; color: var(--lab-ink-soft); }
.results-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}
.results-actions[hidden] { display: none; }
.results-hint {
  margin: 14px auto 0;
  max-width: 56ch;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--lab-amber);
  border: 1px solid rgba(255, 181, 71, 0.4);
  background: rgba(255, 181, 71, 0.08);
}
.results-hint[hidden] { display: none; }

.lab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  border: none;
  cursor: pointer;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  transition: background-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.lab-btn:active { transform: scale(0.97); }
/* Le clip-path rogne un contour extérieur : le focus se dessine à l'intérieur. */
.lab-btn:focus-visible { outline: 3px solid #02121a; outline-offset: -7px; }
.lab-btn .icon { width: 1.3em; height: 1.3em; }

.lab-btn-main {
  min-width: min(420px, 100%);
  padding: 20px 40px;
  font-size: 1.35rem;
  color: #021219;
  background: var(--lab-cyan);
  box-shadow: 0 0 40px rgba(73, 242, 255, 0.45);
}
.lab-btn-main:hover { background: #a6f9ff; }
.lab-btn-main:disabled { cursor: progress; background: #2a8e9b; }

.lab-btn-ghost {
  padding: 15px 30px;
  font-size: 1.1rem;
  color: var(--lab-cyan);
  background: rgba(73, 242, 255, 0.1);
}
.lab-btn-ghost:hover { background: rgba(73, 242, 255, 0.22); }
.lab-btn-ghost:focus-visible { outline-color: var(--lab-cyan); }

.lab-btn-small {
  width: 100%;
  padding: 13px 16px;
  font-size: 1.05rem;
  color: var(--lab-cyan);
  background: rgba(73, 242, 255, 0.12);
}
.lab-btn-small:hover { background: var(--lab-cyan); color: #021219; }
.lab-btn-small:focus-visible { outline-color: var(--lab-cyan); }

.lab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--lab-ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.lab-link:hover { color: var(--lab-cyan); }
.lab-link:focus-visible { outline: 2px solid var(--lab-cyan); outline-offset: 2px; }
.lab-link[hidden] { display: none; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 36px;
}
.result-photo {
  display: flex;
  flex-direction: column;
  padding: 0;
  animation: card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@keyframes card-in { from { opacity: 0; transform: translateY(18px); } }
.rp-thumb {
  position: relative;
  height: 200px;
  background: #000;
  border-bottom: 1px solid var(--lab-line);
}
.rp-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rp-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--lab-display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #02160d;
  background: var(--lab-green);
}
.rp-badge .icon { width: 13px; height: 13px; stroke-width: 3.2; }
.rp-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; flex: 1 1 auto; }
.rp-name {
  margin: 0;
  font-family: var(--lab-mono);
  font-size: 0.82rem;
  color: var(--lab-ink-soft);
  overflow-wrap: anywhere;
}
.rp-fixes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.rp-fixes li { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; font-size: 0.95rem; line-height: 1.35; }
.rp-fixes .icon { width: 16px; height: 16px; margin-top: 0.15em; color: var(--lab-green); stroke-width: 3; }
.result-photo.bad .rp-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lab-red);
  background: repeating-linear-gradient(45deg, rgba(255, 84, 112, 0.1) 0 10px, transparent 10px 20px), #000;
}
.result-photo.bad .rp-thumb .icon { width: 52px; height: 52px; stroke-width: 1.6; }
.rp-error { margin: 0; font-weight: 700; color: #ffc2cc; }

.results-tip {
  max-width: 64ch;
  margin: 36px auto 0;
  padding: 16px 20px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--lab-ink);
  border-top: 1px solid var(--lab-line);
  border-bottom: 1px solid var(--lab-line);
}
.results-tip strong { color: var(--lab-cyan); }
.results-tip[hidden] { display: none; }
.results-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.results-foot [hidden] { display: none; }

/* ---------- Écrans moyens et petits ---------- */

@media (max-width: 1100px) {
  .lab-frame { grid-template-columns: minmax(0, 1.9fr) minmax(250px, 1fr); grid-template-areas: "top top" "core diag" "bottom bottom"; }
  .lab-hex { display: none; }
}

@media (max-width: 760px) {
  .lab-frame {
    overflow-y: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(330px, 56vh) auto auto;
    grid-template-areas: "top" "core" "diag" "bottom";
    padding: 12px 14px 16px;
  }
  .lab-top-mid, .scope, .lab-diag .lab-panel-title:not(:first-child) { display: none; }
  .lab-bottom { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lab-log { height: 4.8em; }
  .core-caption { gap: 10px; font-size: 0.7rem; }
  .core-name { display: none; }
  .lab-btn-main { padding: 18px 24px; font-size: 1.2rem; }
}

@media (max-height: 700px) and (min-width: 761px) {
  .lab-log { height: 4.8em; }
  .readouts { display: none; }
  .scope { height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .lab, .lab-frame.online > *, .lab-scanlines::after { animation: none !important; }
  .lab-core.analyzing .core-scan, .lab-core.analyzing .core-brackets { animation: none; }
}
