body[data-game="shift"] {
  margin: 0;
  overflow: hidden;
  background: #091422;
}

#camera-stage[data-spatial] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  z-index: 200;
}

#camera-stage[data-spatial]::before,
#camera-stage[data-spatial] .ar-status { display: none; }

.cascade-scene-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}
.cascade-scene-3d:is([data-scene="preview"], [data-scene="held"]) { pointer-events: none; }

#camera-stage[data-spatial] .ar-overlay[data-renderer="webgl"] > .ar-node {
  opacity: 0;
  position: absolute;
  z-index: 1;
  min-height: 0;
  min-width: 0;
  width: max-content;
  margin: 0;
  padding: 5px 8px;
  border: 0;
  border-radius: 4px;
  color: #f5fbff;
  background: #071626f7;
  transform: translate(-50%, 2px);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 var(--ar-accent, #a4ddfa);
  pointer-events: none;
}
#camera-stage:is([data-cascade-scene="anchored"],[data-cascade-scene="center"],[data-cascade-scene="surface"],[data-cascade-scene="surface-hold"],[data-cascade-scene="hunt"],[data-cascade-scene="hunt-surface"]) .ar-overlay[data-renderer="webgl"] > .ar-node:not([data-offscreen]) {
  opacity: 1;
}
#camera-stage[data-spatial] .ar-overlay[data-renderer="webgl"] > .ar-node[data-tone="stopped"] {
  background: #562921;
}
#camera-stage[data-spatial] .ar-overlay[data-renderer="webgl"] > .ar-node[data-tone="green"] {
  background: #174a38;
}
#camera-stage:is([data-cascade-scene="anchored"],[data-cascade-scene="center"],[data-cascade-scene="surface"],[data-cascade-scene="surface-hold"],[data-cascade-scene="hunt"],[data-cascade-scene="hunt-surface"]) .ar-overlay > .ar-node:focus-visible {
  outline: 2px solid #a4ddfa;
  outline-offset: 2px;
}

#shift-screen[data-spatial] {
  position: fixed;
  inset: 0;
  min-height: 0;
  z-index: 202;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px);
  pointer-events: none;
  background: transparent;
}

.spatial-hud,
.camera-gate {
  color: #f5fbff;
  background: #091827f5;
  border: 1px solid #66859a;
  border-radius: 12px;
  width: min(100%, 440px);
  padding: 10px 12px;
}

.spatial-hud h2,
.camera-gate h1 {
  margin: 0;
  font-size: clamp(17px, 4.8vw, 24px);
  line-height: 1.16;
  letter-spacing: -.01em;
}

.spatial-hud p { margin: 4px 0 0; font-size: .84rem; line-height: 1.35; }
.spatial-metrics, .spatial-evidence { color: #b7e9ff; }
.spatial-feedback { color: #fff1c6; }
.spatial-framing { color: #ffdc91; }
.spatial-mascot {
  float: right;
  width: 37px;
  height: auto;
  aspect-ratio: 336 / 368;
  margin: 0 0 4px 8px;
  object-fit: contain;
}
.spatial-feedback:has(.spatial-mascot) { display: flow-root; }
.spatial-hud::after { content: ""; display: block; clear: both; }
.spatial-evidence {
  display: grid;
  gap: 3px;
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
  font-size: .76rem;
  line-height: 1.23;
}
.spatial-evidence li { display: grid; grid-template-columns: 3.7em max-content 1fr; gap: 6px; align-items: start; }
.spatial-evidence strong { color: #f5fbff; white-space: nowrap; }

.spatial-commands {
  width: min(100%, 440px);
  display: flex;
  justify-content: center;
  align-items: end;
  flex-wrap: wrap;
  gap: 6px;
}
.spatial-commands > button,
.camera-gate > button {
  pointer-events: auto;
  min-height: 46px;
  border: 1px solid #b5dcf1;
  font-size: .9rem;
}
.spatial-commands > button {
  width: auto;
  margin: 0;
  padding-inline: 12px;
}
.spatial-commands > button.secondary,
.camera-gate > button.secondary { color: #f5fbff; background: #0b2941; }

/* Keep the briefing outside the frequently updated game HUD. */
.cascade-intro {
  position: fixed;
  z-index: 205;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(calc(100% - 24px), 380px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 18px;
  overflow: auto;
  color: #f5fbff;
  background: #102537;
  border: 1px solid #84a5bd;
  border-radius: 14px;
}
.cascade-intro::backdrop { background: #060f1975; }
.cascade-intro h2 {
  margin: 4px 0 8px;
  color: #f5fbff;
  font-size: 1.3rem;
  line-height: 1.15;
}
.cascade-intro p, .cascade-intro ol { margin: 0; line-height: 1.4; }
.cascade-intro section > p + p { margin-top: 8px; }
.cascade-intro .cascade-intro-step { color: #b7e9ff; font-size: .82rem; }
.cascade-intro ol { padding-left: 20px; }
.cascade-intro li + li { margin-top: 6px; }
.cascade-intro-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.cascade-intro-header img { width: 50px; height: auto; }
.cascade-intro-header p { flex: 1; font-size: 1rem; font-weight: 750; }
.cascade-intro-header small {
  display: block;
  color: #b7e9ff;
  font-size: .75rem;
  font-weight: 500;
}
.cascade-intro-camera {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid #66859a;
  color: #d6e9f7;
  font-size: .85rem;
}
.cascade-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.cascade-intro button {
  width: auto;
  min-height: 46px;
  margin: 12px 0 0;
  padding-inline: 12px;
  font-size: .9rem;
}

#shift-screen:is([data-step="camera-opening"],[data-step="camera-error"]) { justify-content: center; }
.camera-gate { max-width: 370px; padding: 18px; }
.camera-gate p { font-size: .94rem; line-height: 1.45; margin: 10px 0; }
.camera-gate > button { width: 100%; margin-top: 8px; }
body:has(#camera-stage:not([hidden])) #shift-screen[data-step="camera-opening"] .camera-gate { visibility: hidden; }
#camera-stage > .camera-continue { z-index: 3; }
.camera-help {
  display: grid;
  position: fixed;
  inset: auto 12px max(12px, env(safe-area-inset-bottom));
  z-index: 210;
  max-width: 430px;
  margin: auto;
  padding: 14px;
  border: 1px solid #66859a;
  border-radius: 12px;
  background: #091827;
  color: #f5fbff;
}
.camera-help > :not(summary) { margin-bottom: 8px; }

@media (max-height: 450px) and (orientation: landscape) {
  #shift-screen[data-spatial] { align-items: flex-start; }
  .spatial-hud { width: min(42vw, 360px); }
  .spatial-commands { justify-content: flex-end; align-self: flex-end; }
}

/* The full-screen camera and canvas share one cover crop. */
#camera-stage[data-camera-mirrored] > video { transform: scaleX(-1); }
#camera-stage[data-spatial],
#camera-stage[data-spatial] .ar-overlay {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.spatial-hud h1 {
  margin: 3px 0 0;
  font-size: clamp(1.02rem, 4.7vw, 1.32rem);
  line-height: 1.16;
}
.palm-kicker {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #b7e9ff;
  font-size: .76rem;
  line-height: 1.1;
}
.palm-kicker .palm-count { color: #ffebae; font-size: .94rem; }
.spatial-hud .palm-orient { color: #e0f3ff; }
.spatial-hud .spatial-feedback { color: #fff1c6; }
.spatial-hud .spatial-mascot { width: 32px; }
#shift-screen[data-step="camera-opening"], #shift-screen[data-step="camera-error"] { justify-content: space-between; }
.cascade-intro [data-legacy-outcome]:not(:empty) { margin-top: 10px; }

.spatial-hud .palm-gesture { color: #c7e1f1; font-size: .76rem; }


.cascade-budget { color: #ffe3a0; font-size: .8rem; font-weight: 700; }
#camera-stage .ar-overlay > .ar-node[data-outcome^="sample-"] {
  font-size: 11px;
  padding: 4px 6px;
}
#camera-stage .ar-overlay > .ar-node:is([data-outcome="packet"],[data-outcome="parcel"]) {
  padding-inline: 9px;
  font-size: 16px;
}


.cascade-module-guide {
  display:grid;
  gap:3px;
  list-style:none;
  margin:10px 0 12px;
  padding:0;
  font-size:.88rem;
}
.cascade-score { font-size:1.1rem; color:#ffebae; }
.cascade-progress, .assembly-slots {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  list-style:none;
  gap:4px;
  margin:5px 0 6px;
  padding:0;
}
.assembly-slots { grid-template-columns:repeat(3,minmax(0,1fr)); }
.cascade-progress li, .assembly-slots li {
  border:1px solid #4d677a;
  border-radius:6px;
  padding:4px 2px;
  text-align:center;
  font-size:clamp(.61rem,2.8vw,.76rem);
  line-height:1.1;
  color:#c2d4df;
  overflow-wrap:anywhere;
}
.cascade-progress [aria-current], .assembly-slots [aria-current] {
  border-color:#f8d77e;
  background:#493c22;
  color:#fff4ce;
}
.cascade-progress [data-complete="true"], .assembly-slots [data-filled="true"] {
  border-color:#5cbd8d;
  background:#134234;
  color:#d7ffe3;
}
#camera-stage .ar-overlay > .ar-node[data-outcome="blueprint"] {
  color:#e3faff;
  border:1px solid #52bad6;
}


#camera-stage .cascade-placement-input {
  position:absolute;
  inset:0;
  z-index:4;
  touch-action:none;
  cursor:crosshair;
}
#camera-stage .cascade-placement-point {
  position:absolute;
  z-index:5;
  width:28px;
  height:28px;
  border:2px solid #ffd675;
  border-radius:50%;
  transform:translate(-50%,-50%);
  box-shadow:0 0 0 2px #101c2b, inset 0 0 0 2px #101c2b;
  pointer-events:none;
}
#camera-stage[data-placement="locked"] .cascade-placement-point {
  border-color:#6df0c1;
  opacity:.72;
}
#camera-stage[data-placement="lost"] .cascade-placement-point { border-style:dashed; }
#camera-stage .ar-overlay > .ar-node[data-tone="capture"] {
  background:#4a340d;
  box-shadow:inset 0 -2px 0 #ffda69;
}
.cascade-part-hint span {
  display:inline-block;
  padding:2px 6px;
  border:1px solid #7292a4;
  border-radius:5px;
  font-size:.76rem;
}
.cascade-part-hint [data-part-color]::before {
  content:"";
  display:inline-block;
  width:.62em;
  height:.62em;
  border:1px solid #f3ece2;
  border-radius:50%;
  margin-right:.32em;
  background:var(--part-color,#e4d094);
}
[data-part-color="brown"] { --part-color:#a86a42; }
[data-part-color="red"] { --part-color:#ed4945; }
[data-part-color="yellow"] { --part-color:#ffd35c; }
[data-part-color="blue"] { --part-color:#62aaff; }
[data-part-color="green"] { --part-color:#63ce92; }
[data-part-color="violet"] { --part-color:#b58ff6; }


.spatial-foot { width:min(100%,440px); display:grid; gap:5px; }
.cascade-messages { display:grid; gap:4px; justify-items:center; }
.cascade-messages:empty { display:none; }
.cascade-messages p {
  margin:0;
  padding:5px 10px;
  background:#091827f5;
  border:1px solid #66859a;
  border-radius:7px;
  font-size:.8rem;
  text-align:center;
}
.cascade-outcome {
  pointer-events:auto;
  padding:9px 12px;
  border:1px solid #66859a;
  border-radius:10px;
  background:#091827f5;
  color:#f5fbff;
}
.cascade-outcome h2 { margin:0 0 3px; font-size:1rem; }
.cascade-outcome p { margin:3px 0; font-size:.82rem; }
.cascade-outcome button { margin-top:5px; min-height:44px; }
.cascade-outcome ol { display:grid; grid-template-columns:1fr 1fr; gap:5px; padding:0; margin:4px 0; list-style:none; }
.cascade-outcome li { font-size:.79rem; }
.cascade-outcome small { display:block; color:#c7e1f1; }
#shift-screen[data-spatial] .spatial-hud { padding:7px 10px; }
#shift-screen[data-spatial] .palm-kicker { justify-content:space-between; }
[data-trial-time] { color:#ffe3a0; font-variant-numeric:tabular-nums; }
