.figure-lab {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #121217;
  overflow: hidden;
}
.figure-lab [hidden] { display: none !important; }
.figure-scenes {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #16151b;
}
.figure-scenes button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding: 10px 8px;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--muted);
}
.figure-scenes button > span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #534c64;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink);
}
.figure-scenes button[aria-pressed="true"] {
  background: #d9d9030d;
  color: var(--ink);
  border-bottom-color: #d9d903;
}
.figure-scenes button[aria-pressed="true"] > span { color: var(--pale); border-color: var(--purple); }
.figure-scenes button:hover { color: var(--ink); background: #211e2a; }
.figure-scenes button[aria-pressed="true"]:hover { color: #f8f6ff; background: #d9d90317; }
.figure-lab button:focus-visible { outline-offset: -4px; }
.explorer-workflow { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(440px, 1fr); }
.explorer-source-panel { padding: 22px; min-width: 0; }
.explorer-source-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: 14px; }
.explorer-source-heading > span:first-child { color: var(--ink); }
.explorer-source-heading > span:last-child { color: var(--blue); font-size: 14px; }
.figure-source { position: relative; isolation: isolate; width: 100%; aspect-ratio: 1920/1135; border-radius: 6px; background: #101014; user-select: none; -webkit-user-select: none; }
.figure-source > img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; pointer-events: none; }
.object-region {
  position: absolute;
  z-index: var(--region-order, 1);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 1px;
  background: transparent;
  touch-action: none;
  cursor: grab;
}
.object-region > span {
  position: absolute;
  left: -1px;
  bottom: -1px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 21px;
  background: var(--object-color, var(--purple));
  color: var(--bg);
  font: 600 12px/1 var(--body);
  opacity: .75;
}
.object-region.is-selected { border: 2px solid var(--object-color, var(--purple)); box-shadow: 0 0 0 1px #0006; }
.object-region.is-selected > span { opacity: 1; }
.object-region:hover > span { opacity: 1; }
.figure-source.is-dragging .object-region { cursor: grabbing; }
.explorer-help { margin: 13px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.explorer-model-panel { display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 14px; align-items: center; align-content: center; padding: 28px 16px; position: relative; border-left: 1px solid var(--border); background: #101014; }
.explorer-flow-guide { grid-column: 1; grid-row: 1; position: relative; width: 100%; height: 0; pointer-events: none; }
.explorer-drag-instruction { position: absolute; bottom: 18px; left: 0; width: 100%; margin: 0; color: #ded7ff; text-align: center; font-size: 14px; line-height: 1.5; }
.explorer-model-wrap { grid-column: 2; grid-row: 1; position: relative; width: 100%; max-width: 280px; }
.explorer-flow-line { position: absolute; height: 3px; width: calc(100% - 24px); left: 12px; top: -1.5px; border-radius: 2px; background: #aaa0f4; }
.explorer-flow-line::after { content: ''; position: absolute; right: -1px; top: 50%; transform: translateY(-50%); border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 10px solid #aaa0f4; }
.explorer-cursor-track { position: absolute; left: 7px; right: 7px; top: 19px; height: 54px; }
.explorer-drag-hand { position: absolute; left: 0; top: 0; width: 44px; height: 44px; filter: drop-shadow(0 4px 4px #0009); animation: explorer-drag-gesture 2.6s ease-in-out infinite; }
@keyframes explorer-drag-gesture {
  0%, 8% { left: 0; opacity: 0; }
  18% { left: 0; opacity: 1; }
  66%, 78% { left: calc(100% - 44px); opacity: 1; }
  94%, 100% { left: calc(100% - 44px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .explorer-drag-hand { animation: none; left: calc(50% - 22px); opacity: 1; } }
.explorer-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 280px;
  min-height: 248px;
  padding: 26px 12px;
  border: 1px solid #716a96;
  border-radius: 12px;
  background: #221f31;
  box-shadow: 0 14px 40px #0003, inset 0 1px #bfb5dd12;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.explorer-model-mark { transform: scale(1.5); margin: 9px 0 26px; }
.explorer-model > strong { font-size: clamp(17px, 1.6vw, 22px); font-weight: 500; color: var(--ink); }
.explorer-model-target { margin-top: 12px; color: var(--object-color, var(--pale)); font-size: 14px; }
.explorer-model-hint { margin-top: 18px; color: #bfb8cd; font-size: 14px; line-height: 1.6; }
.explorer-model:hover, .explorer-model.is-drop-ready { border-color: var(--pale); box-shadow: 0 0 0 3px #8580e425, 0 16px 42px #0004; background: #2d283d; }
.explorer-model.is-drop-ready .explorer-model-hint { color: var(--pale); }
.explorer-model-note { grid-column: 2; grid-row: 2; margin: 17px 0 0; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.65; }
.explorer-crop-ghost { position: fixed; z-index: 200; pointer-events: none; border: 2px solid var(--object-color, var(--pale)); border-radius: 3px; box-shadow: 0 15px 35px #0009; }
.explorer-empty { margin: 0; padding: 23px 22px; border-top: 1px solid var(--border); color: var(--muted); text-align: center; font-size: 14px; background: #101014; }
.explorer-results { position: relative; padding: 24px 22px 104px; border-top: 1px solid #383540; background: #141319; scroll-margin-top: 86px; }
.explorer-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.explorer-result-heading h3 { display: flex; align-items: center; gap: 12px; font-size: 18px; letter-spacing: 0; }
#explorer-result-letter { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--object-color, var(--purple)); border-radius: 5px; font-size: 14px; color: var(--object-color, var(--purple)); }
.explorer-result-heading > p { margin: 0; font-size: 14px; color: var(--muted); }
.explorer-output-grid { display: grid; grid-template-columns: minmax(0, var(--scene-bg-column, 1.65fr)) minmax(0, var(--scene-geo-column, 1.5fr)) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.explorer-output-grid figure { margin: 0; min-width: 0; }
.explorer-output-grid figcaption { color: #c9c4d4; font-size: 14px; line-height: 1.45; padding-top: 9px; }
.explorer-filter-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.explorer-layer-pair, .explorer-geometry > figure { display: grid; grid-template-rows: minmax(0, 1fr) 30px; }
.explorer-layer-pair { padding-right: 0; }
.explorer-layer-stage { position: relative; min-height: 0; border-radius: 6px; background: #101014; container-type: inline-size; overflow: hidden; }
.explorer-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; border-radius: 6px; }
.explorer-source-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; pointer-events: none; }
.explorer-origin-foreground { position: absolute; object-fit: contain; pointer-events: none; filter: url(#explorer-sticker-shadow); }
.explorer-results.is-revealing .explorer-geometry > figure,
.explorer-results.is-revealing .explorer-materials > figure { opacity: 0; transform: translateY(12px); pointer-events: none; }
.explorer-results.is-revealing .explorer-foreground-inset { opacity: 0; pointer-events: none; }
.explorer-results.is-revealing .explorer-foreground-inset > span,
.explorer-results.is-revealing .explorer-layer-pair > figcaption { opacity: 0; }
.explorer-results[data-reveal-phase="move"] .explorer-foreground-inset,
.explorer-results[data-reveal-phase="maps"] .explorer-foreground-inset,
.explorer-results[data-reveal-phase="maps"] .explorer-foreground-inset > span,
.explorer-results[data-reveal-phase="maps"] .explorer-layer-pair > figcaption { opacity: 1; }
.explorer-background-label { position: absolute; top: 9px; left: 9px; border: 1px solid #b6adc932; padding: 3px 7px; border-radius: 3px; background: #15131fc9; color: #e0dce8; font-size: 14px; }
.explorer-background-note { position: absolute; inset: 15% 12% auto; font-size: 14px; color: var(--muted); text-align: center; }
.explorer-foreground-inset { position: absolute; left: 100%; top: 100%; width: 100px; height: 100px; transform: translate(-50%, -50%); z-index: 3; border: 0; padding: 0; background: transparent; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.explorer-foreground-inset.is-dragging { cursor: grabbing; }
.explorer-foreground-inset > img { pointer-events: none; -webkit-user-drag: none; width: 100%; height: 100%; object-fit: contain; filter: url(#explorer-sticker-shadow); }
.explorer-foreground-inset > span { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 4px; background: #141319e8; color: var(--pale); font-size: 14px; line-height: 22px; white-space: nowrap; }
.explorer-layer-pair > figcaption { max-width: none; color: var(--muted); font-size: 14px; }
.explorer-geometry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.explorer-geometry .explorer-map { aspect-ratio: auto; min-height: 0; }
.explorer-geometry .explorer-map > img { aspect-ratio: 1; max-height: 100%; }
.explorer-map { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border: 1px solid #827e8a; border-radius: 5px; background-color: #b5b0c1; background-image: conic-gradient(#c4bfcd 25%, transparent 0 50%, #c4bfcd 0 75%, transparent 0); background-size: 16px 16px; }
.explorer-map > img { width: 100%; height: 100%; min-height: 0; object-fit: contain; padding: 8px; }
.explorer-materials { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.explorer-materials .explorer-map { background: #605e69; }
.explorer-materials .explorer-map > img { padding: 5px; }
.explorer-materials figcaption { font-size: 14px; padding-top: 5px; height: 30px; white-space: nowrap; }
.explorer-materials figcaption > b { color: var(--pale); font-weight: 500; }
.explorer-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1050px) {
  .explorer-source-panel { padding: 18px; }
  .explorer-model-panel { padding: 25px 16px; }
  .explorer-model { min-height: 225px; padding: 21px 10px; }
  .explorer-model-mark { margin-bottom: 22px; }
  .explorer-output-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 104px 20px; }
  .explorer-layer-stage { min-height: 270px; }
  .explorer-geometry .explorer-map { min-height: 270px; }
  .explorer-materials { grid-column: 1/-1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .explorer-materials figcaption { font-size: 14px; }
}
@media (max-width: 1000px) {
  .explorer-workflow { grid-template-columns: 1fr; }
  .explorer-model-panel { grid-template-columns: 160px minmax(0, 280px); column-gap: 24px; justify-content: center; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .explorer-workflow { grid-template-columns: 1fr; }
  .explorer-model-panel { grid-template-columns: 142px minmax(0, 240px); column-gap: 10px; padding: 24px 10px; }
  .explorer-model-wrap { max-width: none; }
  .explorer-model { max-width: none; min-height: 228px; padding: 20px 8px; text-align: center; }
  .explorer-model-mark { margin: 6px 0 24px; transform: scale(1.2); }
  .explorer-model > strong { font-size: 17px; }
  .explorer-model-target { margin-top: 12px; font-size: 14px; }
  .explorer-model-hint { margin-top: 16px; font-size: 14px; }
  .explorer-model-note { display: none; }
  .explorer-results { position: relative; padding: 20px 16px; }
  .explorer-result-heading { flex-wrap: wrap; gap: 9px; }
  .explorer-output-grid { grid-template-columns: 1fr; gap: 24px; }
  .explorer-layer-pair { max-width: 460px; width: 100%; padding-right: 64px; padding-bottom: 60px; margin-inline: auto !important; }

  .explorer-layer-stage { aspect-ratio: 1.3; min-height: 0; }
  .explorer-geometry .explorer-map { aspect-ratio: 1; min-height: 0; }
  .explorer-layer-pair > figcaption { max-width: calc(100% - 70px); }

  .explorer-materials { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .explorer-materials figcaption { font-size: 14px; }
}
@media (max-width: 374px) {
  .explorer-model-panel { grid-template-columns: 112px minmax(0, 1fr); column-gap: 8px; }
}
@media (max-width: 480px) {
  .figure-scenes button { flex-direction: column; font-size: 14px; gap: 4px; padding-inline: 2px; min-height: 62px; }
  .figure-scenes button > span { width: 18px; height: 19px; font-size: 12px; }
  .explorer-source-panel { padding: 14px; }
  .explorer-source-heading { font-size: 14px; gap: 7px; }
  .explorer-source-heading > span:last-child { font-size: 14px; }
  .object-region > span { width: 15px; height: 16px; font-size: 12px; }
  .explorer-help { font-size: 14px; }
  .explorer-empty { font-size: 14px; padding: 20px 14px; }
  .explorer-geometry { gap: 10px; }
}

.explorer-map.is-unavailable::after, .explorer-foreground-inset.is-unavailable::before { content: "Preview unavailable"; padding: 12px; color: var(--ink); font-size: 14px; text-align: center; }

.explorer-map.is-unavailable::after { color: #302b3a; }

.figure-scenes { flex-wrap: wrap; }
.figure-scenes button { white-space: nowrap; }
.explorer-source-panel { position: relative; }
.explorer-tape { position: absolute; left: -10px; top: -14px; z-index: 110; padding: 4px 17px 5px; background: #002fa7; color: #fff; font-family: var(--heading); font-size: 20px; line-height: 1.4; font-weight: 600; letter-spacing: -.025em; transform: rotate(-4deg); box-shadow: 0 4px 10px #0005; pointer-events: none; }
.explorer-source-heading { margin-bottom: 27px; }
.explorer-foreground-inset, .explorer-foreground-inset:focus, .explorer-foreground-inset:focus-visible, .explorer-foreground-inset.is-dragging { outline: none !important; border: 0; box-shadow: none; background: transparent; }
.explorer-foreground-inset:focus-visible > img { filter: url(#explorer-sticker-shadow) drop-shadow(0 0 4px #8580e46b); }
@media(max-width:760px) { .figure-scenes button { flex: 1 0 33.333%; min-height: 46px; } .explorer-tape { left: -6px; font-size: 17px; padding: 4px 12px; } }
