/* Overrides applicables UNIQUEMENT à /ui-test (ne modifie pas la page principale). */

:root {
  /* Carte blueprint (SVG export) */
  --ui-map-image-base: url("../assets/ui/map.svg");
  --ui-map-image-talk: url("../assets/ui/map.svg");
  --ui-map-image-zoom: url("../assets/ui/map.svg");
}

/* Sur /ui-test: l'UI map doit être au-dessus de tout. */
.ui-layer {
  z-index: 9999 !important;
}

/* Inspection objet : carte + quête sous le panneau texte (évite le chevauchement). */
#app.is-inspecting-object #ui-layer.is-object-taken {
  z-index: 24 !important;
}

/* Les PNG actuels ne sont pas des full-frames HUD → on masque le calque full-frame. */
.ui-layer .ui-visual {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Document reader (UI site) — lisible, non impacté par le post-processing     */
/* -------------------------------------------------------------------------- */

.doc-reader {
  position: fixed;
  inset: 0;
  padding: clamp(14px, 2.5vw, 30px);
  display: grid;
  place-items: center;
  pointer-events: auto;
  z-index: 10000;
}

.doc-reader[hidden] {
  display: none !important;
}

.doc-reader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 800px at 50% 40%, rgba(154, 52, 49, 0.22), rgba(0, 0, 0, 0.78));
  backdrop-filter: blur(2px);
}

.doc-reader__frame {
  position: relative;
  width: min(980px, calc(100% - 24px));
  aspect-ratio: 485 / 421;
  max-height: min(86%, 820px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.doc-reader__chrome {
  position: absolute;
  inset: 0;
  background: url("../assets/ui/pc/doc-panel.svg") no-repeat center / 100% 100%;
  pointer-events: none;
}

.doc-reader__chrome::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(700px 460px at 35% 35%, rgba(255, 107, 99, 0.08), transparent 60%);
  opacity: 0.8;
}

.doc-reader__surface {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.doc-reader__title-wrap {
  position: absolute;
  left: 2.6%;
  right: 10%;
  top: 2.2%;
  padding: 0.6% 1.2% 0.5%;
}

.doc-reader__kicker {
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(92, 237, 246, 0.9);
  font-size: 11px;
  margin-bottom: 10px;
}

.doc-reader__title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.doc-reader__title {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.12;
  font-weight: 900;
  color: rgba(255, 107, 99, 0.98);
}

.doc-reader__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.66);
}

.doc-reader__meta .chip {
  border: 1px solid rgba(255, 107, 99, 0.35);
  padding: 6px 10px;
  background: rgba(255, 107, 99, 0.08);
}

.doc-reader__close {
  position: absolute;
  right: 40.35%;
  top: 1.25%;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(154, 52, 49, 0.9);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 107, 99, 0.95);
  font-size: 24px;
  line-height: 1;
  cursor: var(--cursor-interact);
  z-index: 2;
}

.doc-reader__close:hover {
  background: rgba(255, 107, 99, 0.12);
}

.doc-reader__body {
  position: absolute;
  left: 2.6%;
  /* Décale le scroll vers l'intérieur pour éviter que la barre chevauche le trait SVG */
  right: max(3.6%, calc(1.1% + 22px));
  top: 11.8%;
  bottom: 5.2%;
  overflow: auto;
  overflow-x: hidden;
  border: none;
  background: transparent;
  padding: 12px max(18px, 2.2%) 6px 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.65;
}

/* Image intégrée dans le flux, style "Word" (texte qui s'enroule) */
.doc-reader__inline-figure {
  float: left;
  margin: 4px 16px 10px 0;
  width: min(220px, 42%);
  max-width: 100%;
}

.doc-reader__inline-figure--right {
  float: right;
  margin: 4px 0 10px 16px;
}

.doc-reader__inline-figure--center {
  float: none;
  margin: 6px auto 12px;
  width: min(360px, 70%);
}

.doc-reader__inline-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.doc-reader__inline-figure figcaption {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.62);
}

.doc-reader__inline-figure--placeholder {
  aspect-ratio: 1;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

.doc-reader__body::after {
  content: "";
  display: block;
  clear: both;
}

.doc-reader__body p {
  margin: 0 0 12px;
}

.doc-reader__body code {
  background: rgba(92, 237, 246, 0.08);
  padding: 2px 6px;
  border: 1px solid rgba(92, 237, 246, 0.18);
}

/* Assombrissement du reste quand zoomé (sans bloquer les clics cam). */
.ui-dim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
  z-index: 0;
}

.ui-layer.is-zoomed .ui-dim {
  opacity: 1;
}

/* Map (image) */
.ui-map-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.ui-map-visual::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--map-w, 0) * 1px);
  height: calc(var(--map-h, 0) * 1px);
  transform: translate3d(var(--map-left, 0px), var(--map-top, 0px), 0) scale(var(--map-scale, 1));
  transform-origin: top left;
  background: var(--ui-map-image-base) no-repeat center / 100% 100%;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-layer.is-talking .ui-map-visual::before {
  background: var(--ui-map-image-talk) no-repeat center / 100% 100%;
}

.ui-layer.is-zoomed .ui-map-visual::before {
  background: var(--ui-map-image-zoom) no-repeat center / 100% 100%;
}

.ui-layer.is-object-taken .ui-map-visual::before {
  background: var(--ui-map-image-base) no-repeat center / 100% 100%;
  filter: saturate(1.35) contrast(1.08) hue-rotate(-8deg);
  box-shadow: none;
}

.ui-map-hud {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--map-w, 0) * 1px);
  height: calc(var(--map-h, 0) * 1px);
  transform: translate3d(var(--map-left, 0px), var(--map-top, 0px), 0) scale(var(--map-scale, 1));
  transform-origin: top left;
  z-index: 2;
  pointer-events: none;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Blender Pro", "Segoe UI", system-ui, sans-serif;
}

/* Positions HUD sur la carte (w=366 / h=300, ui-config) */
.ui-map-hud-hour {
  position: absolute;
  left: 21.368px;
  top: 268px;
  font-weight: 800;
  font-size: 9.04px;
  line-height: normal;
  color: #00e5ff;
  white-space: nowrap;
}

.ui-map-hud-date {
  position: absolute;
  left: 21.368px;
  top: 276px;
  font-weight: 700;
  font-size: 6.849px;
  line-height: normal;
  color: #00e5ff;
  white-space: nowrap;
}

.ui-map-hud-coords {
  position: absolute;
  left: 342px;
  top: 15px;
  width: 25px;
  font-weight: 800;
  font-size: 7.945px;
  line-height: normal;
  color: #ff3040;
  white-space: nowrap;
}

.ui-map-hud-coord-line {
  margin: 0;
  padding: 0;
}

/* Hotspots cam: au-dessus de la carte et du bouton zoom (hit zone z-index 2). */
.ui-hotspots {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--map-w, 0) * 1px);
  height: calc(var(--map-h, 0) * 1px);
  transform: translate3d(var(--map-left, 0px), var(--map-top, 0px), 0) scale(var(--map-scale, 1));
  transform-origin: top left;
  z-index: 5;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Icônes caméra (#FFD400 dans camera-diamond.svg) : inactives assombries ; active = lueur jaune (pas cyan / rose). */
.ui-hotspots .map-hotspot {
  z-index: 6;
  isolation: isolate;
  background-color: transparent;
  background-image: url("../assets/ui/camera-diamond.svg");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  transition: filter 160ms ease;
}

.ui-hotspots .map-hotspot:not(.is-active):not(:disabled) {
  filter: brightness(0.4) saturate(0.88);
}

.ui-hotspots .map-hotspot.is-active:not(:disabled) {
  filter:
    drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 7px rgba(255, 212, 0, 0.92))
    drop-shadow(0 0 16px rgba(255, 212, 0, 0.42));
}

.ui-hotspots .map-hotspot:not(.is-active):not(:disabled):hover,
.ui-hotspots .map-hotspot:not(.is-active):not(:disabled):focus-visible {
  filter: brightness(0.55) saturate(0.92) drop-shadow(0 0 8px rgba(255, 212, 0, 0.28));
}

/* Pas d’anneau ::after sur l’actif ; léger jaune au survol seulement. */
.ui-hotspots .map-hotspot::after {
  pointer-events: none;
  inset: -4px;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  transform: none;
  transition: box-shadow 150ms ease;
}

.ui-hotspots .map-hotspot:hover::after,
.ui-hotspots .map-hotspot:focus-visible::after {
  background: transparent !important;
  box-shadow: 0 0 0 1px rgba(255, 212, 0, 0.35), 0 0 10px rgba(255, 212, 0, 0.2) !important;
}

.ui-hotspots .map-hotspot.is-active::after {
  background: transparent !important;
  box-shadow: none !important;
}

/* Zone de clic (zoom) = map entière (sous les cams). */
.ui-map-hit {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--map-w, 0) * 1px);
  height: calc(var(--map-h, 0) * 1px);
  transform: translate3d(var(--map-left, 0px), var(--map-top, 0px), 0) scale(var(--map-scale, 1));
  transform-origin: top left;
  border: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  z-index: 2;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Compose `button.ui-map-hit` pour battre la règle générique
   `button:not(:disabled) { cursor: var(--cursor-interact) }`. */
button.ui-map-hit {
  cursor: var(--cursor-zoom);
}

.ui-layer.is-zoomed button.ui-map-hit {
  cursor: var(--cursor-unzoom);
}

/* -------------------------------------------------------------------------- */
/* Quest HUD (UI test) — sous la map                                           */
/* -------------------------------------------------------------------------- */

/* absolute = repère #ui-layer (cadre 16:9), cohérent avec --quest-left/top calculés dans ce repère (pas le viewport entier). */
.ui-quest {
  position: absolute;
  left: var(--quest-left, 16px);
  top: var(--quest-top, 16px);
  width: var(--quest-w, 360px);
  min-width: min(var(--quest-w, 360px), calc(100% - 32px));
  max-width: min(var(--quest-w, 360px), calc(100% - 32px));
  max-height: calc(100% - var(--quest-top, 16px) - clamp(10px, 2vmin, 20px));
  /* Synchronise le mouvement avec la map (zoom) */
  transition:
    left 520ms cubic-bezier(0.22, 1, 0.36, 1),
    top 520ms cubic-bezier(0.22, 1, 0.36, 1),
    width 520ms cubic-bezier(0.22, 1, 0.36, 1),
    min-width 520ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 520ms cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  z-index: 10020;
  opacity: 0.98;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}

.ui-quest[hidden] {
  display: none !important;
}

.ui-quest__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 0 0 8px;
  width: 100%;
  min-width: 0;
}

.ui-quest__category {
  font-weight: 500;
  font-size: clamp(13px, 1.5vw, 20px);
  letter-spacing: 0.02em;
  color: rgba(255, 48, 64, 0.95);
  text-shadow: 0 0 22px rgba(255, 48, 64, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.ui-quest__brand {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px; /* léger gap logo -> texte */
  row-gap: 2px;
  align-items: center;
  justify-items: end;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(255, 48, 64, 0.95);
  text-transform: uppercase;
  line-height: 1;
  transform: none;
  flex: 0 0 auto;
  max-width: 46%;
  min-width: 0;
}

.ui-quest__brand-dot {
  grid-column: 1;
  grid-row: 1 / span 2;
  height: 100%;
  aspect-ratio: 1 / 1;
  background: url("../assets/ui/quest-observer-dot.svg") no-repeat center / contain;
  filter: drop-shadow(0 0 16px rgba(255, 48, 64, 0.12));
}

.ui-quest__brand-text {
  grid-column: 2;
  grid-row: 1;
  font-size: clamp(10px, 0.95vw, 14px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ui-quest__brand-sub {
  grid-column: 2;
  grid-row: 2;
  font-size: clamp(4px, 0.5vw, 6px);
  opacity: 0.6;
  letter-spacing: 0.26em;
  white-space: nowrap;
  width: var(--observer-w, 100%);
  max-width: var(--observer-w, 100%);
  overflow: visible;
  text-overflow: clip;
  transform: scaleX(var(--observer-sub-scale, 1));
  transform-origin: right center;
}

@media (max-width: 520px) {
  .ui-quest__bar {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .ui-quest__brand {
    justify-items: end;
    max-width: 100%;
  }
}

.ui-quest__body {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 6px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

/* Icône = hauteur du bloc objectif uniquement (ligne 1) */
.ui-quest__icon {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  width: clamp(38px, 4.8vw, 54px);
  min-height: 0;
  height: auto;
  background: url("../assets/ui/quest-exclamation.svg") no-repeat center / contain;
  filter: drop-shadow(0 0 18px rgba(255, 212, 0, 0.18));
}

.ui-quest__title {
  display: none !important;
}

.ui-quest__objective {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  font-weight: 300;
  font-size: clamp(11px, 1.3vw, 17px);
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: rgba(255, 212, 0, 0.92);
  text-wrap: balance;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
}

/* Progression + indice : une seule ligne (pas de retour entre compteur et texte) */
.ui-quest__hint-row {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.5rem;
  max-width: 100%;
  min-width: 0;
}

.ui-quest__progress {
  font-weight: 600;
  font-size: clamp(10px, 1.05vw, 13px);
  line-height: 1.25;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: rgba(200, 220, 235, 0.88);
  font-family: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  flex: 0 0 auto;
  white-space: nowrap;
}

.ui-quest__progress.ui-quest__progress--empty {
  display: none;
}

.ui-quest__hint {
  font-weight: 400;
  font-size: clamp(10px, 1.05vw, 13px);
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: rgba(200, 220, 235, 0.72);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ui-quest__hint.ui-quest__hint--empty {
  display: none;
}

/* Transitions légères lors du changement de caméra/quête */
.ui-quest--leave {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.ui-quest--enter {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 380ms ease, transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Micro glitch (bonus) */
.ui-quest--glitch .ui-quest__title,
.ui-quest--glitch .ui-quest__objective,
.ui-quest--glitch .ui-quest__hint,
.ui-quest--glitch .ui-quest__progress {
  animation: uiQuestGlitch 520ms steps(2, end);
}

@keyframes uiQuestGlitch {
  0% {
    transform: translate(0, 0);
    text-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  20% {
    transform: translate(-1px, 0);
    text-shadow: 2px 0 0 rgba(0, 229, 255, 0.28), -2px 0 0 rgba(255, 48, 64, 0.18);
  }
  45% {
    transform: translate(1px, -1px);
    text-shadow: -2px 0 0 rgba(0, 229, 255, 0.22), 2px 0 0 rgba(255, 48, 64, 0.16);
  }
  100% {
    transform: translate(0, 0);
    text-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

/* -------------------------------------------------------------------------- */
/* Inspection objet — layout Figma (colonne motif + fiche, carte via ui-layer) */
/* -------------------------------------------------------------------------- */

.object-inspect-hud {
  --inspect-gap: clamp(10px, 1.5vw, 22px);
  position: absolute;
  inset: 0;
  /* Au-dessus du lecteur VHS (8600), sous la carte hors inspection (règle #app.is-inspecting-object #ui-layer). */
  z-index: 9200;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  /* Décale sous le header (barre top) pour éviter tout chevauchement. */
  --inspect-pad-y: clamp(12px, 2vh, 28px);
  --inspect-pad-x: clamp(14px, 2vw, 28px);
  --inspect-pad-left: clamp(10px, 1.5vw, 22px);
  --inspect-header-h: 67px;
  padding-top: calc(var(--inspect-header-h) + var(--inspect-pad-y));
  padding-right: var(--inspect-pad-x);
  padding-bottom: var(--inspect-pad-y);
  padding-left: var(--inspect-pad-left);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.48s cubic-bezier(0.33, 1, 0.68, 1),
    visibility 0s linear 0.48s;
}

/* Même fond que inventaire / quêtes / crédits (continuité avec le body). */
.object-inspect-hud::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--hud-overlay-bg);
}

/* Cadre gauche + slot texte visibles ; le panneau texte arrive après (--text-in). */
.object-inspect-hud.object-inspect-hud--open {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.42s cubic-bezier(0.33, 1, 0.68, 1),
    visibility 0s linear 0s;
}

.object-inspect-hud[hidden] {
  display: none !important;
}

.object-inspect-hud__inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--inspect-gap);
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
}

.object-inspect-hud__left {
  position: relative;
  flex: 0 0 38%;
  min-width: 0;
  z-index: 1;
  pointer-events: none;
  border: 1px solid rgba(220, 50, 55, 0.55);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.25);
  isolation: isolate;
  background: transparent;
}

/* Grille légère au-dessus du rendu WebGL (fond scène = #220F12 côté Three). */
.object-inspect-hud__left::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.1;
  background-image: url("../assets/ui/object-taken-pattern.png");
  background-repeat: repeat;
  background-size: 96px 96px;
  pointer-events: none;
}

.object-inspect-hud__mid {
  position: relative;
  z-index: 3;
  flex: 0 0 26%;
  max-width: 26%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  transform-origin: right center;
  transition:
    transform 0.62s cubic-bezier(0.31, 1, 0.34, 1),
    opacity 0.52s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transform, opacity;
}

/* Avant --text-in : panneau hors champ à droite + léger rétrécissement horizontal. */
.object-inspect-hud--open:not(.object-inspect-hud--text-in) .object-inspect-hud__mid {
  transform: translate3d(calc(12px + min(40vw, 440px)), 0, 0) scaleX(0.9);
  opacity: 0;
}

.object-inspect-hud--open.object-inspect-hud--text-in .object-inspect-hud__mid {
  transform: translate3d(0, 0, 0) scaleX(1);
  opacity: 1;
}

.object-inspect-hud .object-panel {
  position: relative;
  top: auto;
  right: auto;
  transform: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.object-panel__chrome {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 1.6vw, 22px) clamp(16px, 1.8vw, 24px) clamp(14px, 1.4vw, 18px);
  border: 1px solid rgba(230, 58, 58, 0.78);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  isolation: isolate;
  overflow: hidden;
}

/* -------------------------------------------------------------------------- */
/* Object-taken (frame 5:804) — assets exportés depuis Figma                    */
/* -------------------------------------------------------------------------- */

.object-inspect-hud {
  /* Ajuste la largeur pour que le détail "colle" mieux à la map à droite */
  --inspect-left-frac: 0.40;
  --inspect-mid-frac: 0.33;
}

.object-taken-backdrop {
  position: fixed;
  z-index: 21; /* derrière #webgl (22) en inspection */
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  background: transparent;
  overflow: hidden;
  /* Pas de bordure parasite sous le pattern */
  box-shadow: none;
}

.object-taken-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: url("../assets/ui/object-taken-pattern.png");
  background-repeat: repeat;
  background-size: 96px 96px;
  pointer-events: none;
}

.object-taken-backdrop[hidden] {
  display: none !important;
}

.inspect-webgl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Entre pattern et chrome/hint */
  z-index: 10025;
  pointer-events: auto;
  background: transparent;
}

.inspect-webgl[hidden] {
  display: none !important;
}

.object-inspect-hud__left {
  flex: 0 0 calc(var(--inspect-left-frac) * 100%);
  border: none;
  box-shadow: none;
  background: transparent;
  max-height: 100%;
  overflow: hidden;
}

/* Pattern HUD avec "trou" (zone vide) pour voir l'objet 3D. */
.object-taken-pattern {
  position: absolute;
  inset: 0;
  z-index: 10020; /* sous l'objet, au-dessus du fond */
  pointer-events: none;
  /* Visible comme dans la frame (pas "washé") */
  opacity: 0.9;
  background-image: url("../assets/ui/object-taken-pattern.png");
}

.object-taken-window {
  position: absolute;
  inset: 0;
  background: url("../assets/ui/figma/object-taken/object-window.svg") no-repeat center / 100% 100%;
  z-index: 10030; /* au-dessus du canvas + pattern */
  pointer-events: none;
  opacity: 0.8;
}

/* Zone dédiée au rendu 3D (sans la zone hint du bas) */
.object-taken-viewport {
  position: absolute;
  /* Calage visuel sur la frame: marge interne + réserve pour le hint */
  left: 3.5%;
  right: 3.5%;
  top: 3.5%;
  bottom: 12.5%;
  z-index: 1;
  pointer-events: none;
}

.object-taken-hint {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 2.6%;
  min-height: 44px;
  padding: 10px 16px;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: "Blender Pro", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 12px;
  line-height: 1.15;
  color: #ff655c;
  background: url("../assets/ui/figma/object-taken/vector10.svg") no-repeat center / 100% 100%;
  z-index: 10031;
  pointer-events: none;
}

.object-inspect-hud__mid {
  flex: 0 0 calc(var(--inspect-mid-frac) * 100%);
  max-width: calc(var(--inspect-mid-frac) * 100%);
  max-height: 100%;
  overflow: hidden;
}

.object-taken-panel {
  border: none;
  box-shadow: none;
  clip-path: none;
  padding: 0;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.object-taken-panel__topbar {
  height: 64px;
  width: 100%;
  background: url("../assets/ui/figma/object-taken/vector1.svg") no-repeat center / 100% 100%;
  position: relative;
}

.object-taken-panel__topbar-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Placement calé sur l’exemple: titre à gauche, genre à droite dans le "notch" */
  padding: 12px 22px 12px;
  gap: 12px;
  pointer-events: none;
}

.object-taken-panel__topbar-left,
.object-taken-panel__topbar-right {
  font-family: "Blender Pro", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ff655c;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-taken-panel__topbar-left {
  font-size: 18px;
  opacity: 0.92;
  flex: 1 1 auto;
  min-width: 0;
}

.object-taken-panel__topbar-right {
  font-size: 30px;
  flex: 0 0 auto;
  max-width: 55%;
  /* Pousse le texte dans la zone qui ressort du SVG */
  margin-right: 10px;
}

.object-taken-panel__fields {
  display: flex;
  flex-direction: column;
  gap: 2%;
  flex: 1 1 auto;
  min-height: 0;
  /* Gap 2% entre topbar et zones texte */
  margin-top: 2%;
}

.object-taken-panel__field {
  position: relative;
  padding: 14px 16px;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  flex: 1 1 auto;
  overflow: hidden;
}

.object-taken-panel__field--desc {
  flex: 2 1 0;
  background: url("../assets/ui/figma/object-taken/vector4.svg") no-repeat center / 100% 100%;
}

.object-taken-panel__field--context {
  flex: 1.2 1 0;
  background: url("../assets/ui/figma/object-taken/vector5.svg") no-repeat center / 100% 100%;
}

.object-taken-panel__field--impact {
  flex: 1 1 0;
  background: url("../assets/ui/figma/object-taken/vector6.svg") no-repeat center / 100% 100%;
}

.object-taken-panel__field--contrib {
  flex: 1.4 1 0;
  background: url("../assets/ui/figma/object-taken/vector7.svg") no-repeat center / 100% 100%;
}

.object-taken-panel__field-label {
  font-family: "Blender Pro", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #ff655c;
}

.object-taken-panel__field-value {
  margin: 0;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(250, 246, 240, 0.92);
  overflow: auto;
}

.object-taken-panel__field-value--empty {
  opacity: 0.35;
}

.object-taken-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  flex: 0 0 auto;
}

.object-taken-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  height: 49px;
  cursor: var(--cursor-interact);
  font-family: "Blender Pro", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 28px;
  line-height: 1;
  text-align: center;
  position: relative;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 18px;
  padding-top: 2px;
}

.object-taken-btn--back {
  color: #371012;
  background: url("../assets/ui/figma/object-taken/vector8.svg") no-repeat center / 100% 100%;
}

.object-taken-btn--back::before {
  content: "";
  position: absolute;
  left: 34px;
  top: 50%;
  width: 22px;
  height: 28px;
  transform: translate(-50%, -50%) rotate(180deg);
  background: url("../assets/ui/figma/object-taken/vector9.svg") no-repeat center / 100% 100%;
  opacity: 0.95;
}

.object-taken-btn--take {
  color: #ff655c;
  background: url("../assets/ui/figma/object-taken/vector3.svg") no-repeat center / 100% 100%;
  /* Texte sur 2 lignes, centré, sans coupe */
  font-size: 22px;
  line-height: 1.05;
  padding-inline: 20px;
  padding-block: 8px;
  white-space: normal;
}

.object-taken-btn--back:hover,
.object-taken-btn--back:focus-visible {
  color: #9a3431;
  background: url("../assets/ui/figma/object-taken/vector8-hover.svg") no-repeat center / 100% 100%;
  /* on ne touche pas la bordure: elle est dans le SVG */
}

.object-taken-btn--back:hover::before,
.object-taken-btn--back:focus-visible::before {
  background: url("../assets/ui/figma/object-taken/vector9-hover.svg") no-repeat center / 100% 100%;
}

.object-taken-btn--take:hover,
.object-taken-btn--take:focus-visible {
  color: #220f12;
  background: url("../assets/ui/figma/object-taken/vector3-hover.svg") no-repeat center / 100% 100%;
  /* on ne touche pas la bordure: elle est dans le SVG */
}

.object-taken-btn--back:hover,
.object-taken-btn--back:focus-visible {
  /* Retire tout halo/teinte indésirable sur "Retour" */
  filter: none;
}

.object-taken-btn:hover,
.object-taken-btn:focus-visible {
  outline: none;
  filter: drop-shadow(0 0 14px rgba(255, 101, 92, 0.22));
}

.object-taken-btn--back:hover,
.object-taken-btn--back:focus-visible {
  filter: none;
}

.object-panel__header {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.object-panel__title {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(250, 246, 240, 0.95);
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.2;
}

.object-inspect-hud #panel-title {
  color: rgba(250, 246, 240, 0.95);
}

.object-panel__genre {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.1rem, 2.1vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 58, 58, 0.98);
  text-shadow: 0 0 24px rgba(255, 40, 50, 0.25);
  flex: 0 0 auto;
  max-width: 46%;
  text-align: right;
  line-height: 1;
}

.object-panel__divider {
  flex: 0 0 auto;
  height: 6px;
  margin: 4px 0 14px;
  border-top: 1px solid rgba(230, 58, 58, 0.72);
  border-bottom: 1px solid rgba(230, 58, 58, 0.42);
}

.object-panel__kicker {
  flex: 0 0 auto;
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 58, 58, 0.9);
}

.object-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

.object-inspect-hud .panel-desc,
.object-inspect-hud .panel-cyber {
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(235, 228, 238, 0.92);
}

.object-inspect-hud .panel-cyber {
  color: rgba(255, 170, 175, 0.88);
  border-top-color: rgba(200, 60, 70, 0.45);
}

.object-panel__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.object-inspect-hud .panel-close {
  margin-bottom: 0;
}

.object-panel__hint {
  flex: 0 0 auto;
  margin-top: 12px;
  font-size: 0.7rem;
  color: rgba(200, 190, 205, 0.72);
}

@media (max-width: 720px) {
  .object-inspect-hud__inner {
    flex-direction: column;
  }

  .object-inspect-hud__left {
    display: none;
  }

  .object-inspect-hud__mid {
    flex: 1 1 auto;
    align-self: stretch;
    z-index: 0;
    padding: 8px;
    background: #220f12;
    box-sizing: border-box;
  }

  /* Pas de latence « texte invisible » : une seule colonne sur mobile. */
  .object-inspect-hud--open:not(.object-inspect-hud--text-in) .object-inspect-hud__mid {
    transform: none;
    opacity: 1;
  }
}

