/* Boss Coffee PG scene screens */
:root {
  --scene-brown: #301006;
  --scene-brown-deep: #160704;
  --scene-gold: #eda51e;
  --scene-gold-light: #ffd777;
  --scene-cream: #fff7df;
  --scene-stroke: #7a2f12;
  --scene-border: rgba(255, 219, 111, 0.82);
  --scene-radius: 10px;
  --scene-artboard-width: min(100vw, 56.25vh);
  --job-panel-gradient-angle: 0deg;
  /* Thin gradient outline around text: gold on top -> warm brown at bottom (follows BG) */
  --text-outline-gradient:
    0 -1.4px 0 #ffd277,
    1.1px -0.9px 0 #f4ab22,
    1.4px 0.5px 0 #df8c12,
    0.9px 1.3px 0 #a85412,
    0 1.6px 0 #7a2f12,
    -0.9px 1.2px 0 #8a3a12,
    -1.4px 0.4px 0 #c4760e,
    -1.1px -0.9px 0 #f0a51e;
}

@property --job-panel-gradient-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

@supports (width: 100dvw) {
  :root {
    --scene-artboard-width: min(100dvw, 56.25dvh);
  }
}

.app-header[hidden],
#pgWorkflowStepper[hidden],
.stepper[hidden],
.scene[hidden] {
  display: none !important;
}

body.is-scene {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  background: var(--scene-brown-deep);
}

@supports (min-height: 100dvh) {
  body.is-scene {
    min-height: 100dvh;
  }
}

body.is-scene #app {
  width: 100%;
  min-height: 100vh;
  margin: 0;
}

@supports (min-height: 100dvh) {
  body.is-scene #app {
    min-height: 100dvh;
  }
}

.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--scene-brown-deep);
  box-shadow: none;
  color: var(--scene-cream);
  font-family: 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  isolation: isolate;
  transform-origin: 50% 54%;
}

.scene.scene-enter {
  z-index: 4;
  animation: sceneEnter 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scene.scene-exit {
  z-index: 3;
  pointer-events: none;
  animation: sceneExit 300ms cubic-bezier(0.76, 0, 0.24, 1) both;
}

@keyframes sceneEnter {
  from {
    opacity: 0;
    filter: blur(12px) saturate(0.92);
    transform: translate3d(0, 24px, 0) scale(0.985);
  }

  to {
    opacity: 1;
    filter: blur(0) saturate(1);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes sceneExit {
  from {
    opacity: 1;
    filter: blur(0) saturate(1);
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    opacity: 0;
    filter: blur(10px) saturate(0.95);
    transform: translate3d(0, -14px, 0) scale(1.012);
  }
}

@supports (min-height: 100dvh) {
  .scene {
    min-height: 100dvh;
  }
}

.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #492415;
}

.scene-bg img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center bottom;
}

.scene-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(clamp(8px, 2vw, 14px) + env(safe-area-inset-top))
    calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-right))
    calc(clamp(18px, 4.5vw, 34px) + env(safe-area-inset-bottom))
    calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.4vh, 18px);
}

@supports (min-height: 100dvh) {
  .scene-inner {
    min-height: 100dvh;
  }
}

.scene-logo {
  width: min(calc(var(--scene-artboard-width) * 0.56), 286px);
  height: auto;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

.scene-title,
.scene-subtitle {
  margin: 0;
  color: var(--scene-cream);
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  letter-spacing: -0.018em;
  line-height: 1.12;
  font-weight: 900;
  -webkit-text-stroke: clamp(1px, 0.26vw, 1.6px) var(--scene-stroke);
  paint-order: stroke fill;
  text-shadow: var(--text-outline-gradient);
}

.scene-title {
  max-width: 11.5em;
  font-size: clamp(1.85rem, calc(var(--scene-artboard-width) * 0.083), 2.65rem);
}

.scene-title span {
  display: inline-block;
  margin-top: 0.1em;
  font-size: 0.7em;
  line-height: 1.15;
}

.scene-title--photo,
.scene-title--loading {
  max-width: 12.5em;
  font-size: clamp(1.5rem, calc(var(--scene-artboard-width) * 0.066), 2.15rem);
  line-height: 1.2;
}

.scene-title--loading {
  margin-top: clamp(2px, 1vh, 8px);
}

.scene-subtitle {
  margin-top: clamp(4px, 1vh, 10px);
  font-size: clamp(1.1rem, calc(var(--scene-artboard-width) * 0.052), 1.72rem);
}

.scene-cta {
  appearance: none;
  width: min(280px, 72vw);
  min-height: clamp(44px, calc(var(--scene-artboard-width) * 0.112), 56px);
  border: 3px solid rgba(255, 238, 175, 0.9);
  border-radius: var(--scene-radius);
  background:
    linear-gradient(94deg, #df8c12 0%, #f6b22d 38%, #ffe188 52%, #ef9b18 72%, #dc8410 100%);
  color: #171007;
  box-shadow: 0 8px 18px rgba(66, 20, 3, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 14px);
  padding: clamp(8px, 2vw, 12px) clamp(18px, 5vw, 28px);
  font-family: inherit;
  font-size: clamp(1.06rem, calc(var(--scene-artboard-width) * 0.045), 1.38rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.scene-cta:disabled,
.photo-tool:disabled,
.gender-btn:disabled,
.final-print-button:disabled,
.final-end-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.scene-cta:focus-visible,
.photo-tool:focus-visible,
.gender-btn:focus-visible,
.job-row:focus-visible,
.scan-secondary:focus-visible,
.final-print-button:focus-visible,
.final-end-button:focus-visible {
  outline: 3px solid var(--scene-cream);
  outline-offset: 3px;
}

.scene-title--scan {
  max-width: 9.2em;
  font-size: clamp(2.15rem, calc(var(--scene-artboard-width) * 0.11), 3.7rem);
  line-height: 0.95;
}

/* Scan background stage with foreground objects (mirrors Final page placement) */
.scan-bg {
  /* 1:2 portrait BG cover anchored center-bottom (see .landing-bg). */
  --scan-stage-size: max(125vw, 65vh);
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #2a180c;
}

@supports (height: 100lvh) {
  .scan-bg {
    --scan-stage-size: max(125vw, 65lvh);
  }
}

.scan-stage {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--scan-stage-size);
  height: calc(var(--scan-stage-size) * 2);
  transform: translateX(-50%);
  transform-origin: center bottom;
  pointer-events: none;
}

.scan-bg-image,
.scan-scene-layer {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}

.scan-bg-image {
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.scan-scene-layer {
  object-fit: fill;
  transform: translateX(-50%);
  transform-origin: center bottom;
}

.scan-scene-bean {
  z-index: 1;
  left: 43.69792%;
  bottom: 2.68229%;
  width: 49.27083%;
  height: 18.90625%;
}

.scan-scene-product {
  z-index: 3;
  left: 59.29688%;
  bottom: 0;
  width: 30.15625%;
  height: 27.68229%;
}

.scan-inner {
  justify-content: flex-start;
  gap: clamp(12px, 2.6vh, 22px);
}

.scan-logo {
  width: min(calc(var(--scene-artboard-width) * 0.54), 260px);
}

.scan-copy {
  display: grid;
  justify-items: center;
  gap: clamp(4px, 1vh, 8px);
  margin-top: clamp(2px, 0.8vh, 8px);
}

.scan-helper {
  margin: 0;
  color: var(--scene-cream);
  font-size: clamp(0.95rem, calc(var(--scene-artboard-width) * 0.04), 1.28rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--text-outline-gradient);
  -webkit-text-stroke: clamp(0.75px, 0.18vw, 1.2px) var(--scene-stroke);
  paint-order: stroke fill;
}

.scan-camera-shell {
  --scan-shell-size: clamp(250px, 76vw, 390px);
  position: relative;
  width: var(--scan-shell-size);
  aspect-ratio: 1 / 1;
  margin-top: clamp(4px, 1.4vh, 14px);
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  background: rgba(38, 13, 5, 0.58);
  box-shadow: 0 18px 42px rgba(42, 11, 2, 0.36);
  overflow: hidden;
}

.scan-camera-shell::after {
  content: '';
  position: absolute;
  z-index: 4;
  left: 15%;
  right: 15%;
  top: 16%;
  height: clamp(2px, 0.7vw, 4px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 22px rgba(255, 255, 255, 0.36);
  opacity: 0;
  pointer-events: none;
}

.scan-camera-shell.is-scan-active::after {
  animation: scan-line-move 1.85s ease-in-out infinite alternate;
}

@keyframes scan-line-move {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(calc(clamp(250px, 76vw, 390px) * 0.69));
    opacity: 1;
  }
}

@keyframes job-panel-gradient-rotate {
  from {
    --job-panel-gradient-angle: 0deg;
  }

  to {
    --job-panel-gradient-angle: 360deg;
  }
}

.scan-camera {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 12px;
  background: rgba(8, 3, 1, 0.82);
  object-fit: cover;
}

.scan-camera.is-obs-camera,
.scan-camera.is-desktop-camera {
  aspect-ratio: 1 / 1;
}

.scan-camera video,
.scan-camera canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.scan-corner {
  display: none;
}

.scan-corner::before,
.scan-corner::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.32);
}

.scan-corner::before {
  width: 100%;
  height: clamp(4px, 1vw, 6px);
}

.scan-corner::after {
  width: clamp(4px, 1vw, 6px);
  height: 100%;
}

.scan-corner--tl {
  top: clamp(12px, 3.2vw, 18px);
  left: clamp(12px, 3.2vw, 18px);
}

.scan-corner--tr {
  top: clamp(12px, 3.2vw, 18px);
  right: clamp(12px, 3.2vw, 18px);
}

.scan-corner--bl {
  bottom: clamp(12px, 3.2vw, 18px);
  left: clamp(12px, 3.2vw, 18px);
}

.scan-corner--br {
  right: clamp(12px, 3.2vw, 18px);
  bottom: clamp(12px, 3.2vw, 18px);
}

.scan-corner--tr::before,
.scan-corner--br::before {
  right: 0;
}

.scan-corner--tr::after,
.scan-corner--br::after {
  right: 0;
}

.scan-corner--bl::before,
.scan-corner--br::before {
  bottom: 0;
}

.scan-corner--bl::after,
.scan-corner--br::after {
  bottom: 0;
}

.scan-actions {
  width: min(300px, 78vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vh, 14px);
}

.scan-actions > * {
  transform: translateX(0);
  opacity: 1;
  transition:
    opacity 280ms ease,
    transform 280ms ease;
}

.scan-actions.is-exiting > * {
  opacity: 0;
  transform: translateX(-18px);
  pointer-events: none;
}

.scan-actions.is-exiting > *:nth-child(2) {
  transition-delay: 60ms;
}

.scan-actions.is-exiting > *:nth-child(3) {
  transition-delay: 120ms;
}

.scan-primary {
  width: 100%;
  max-width: none;
  min-height: clamp(48px, calc(var(--scene-artboard-width) * 0.13), 62px);
  padding-inline: clamp(12px, 4vw, 22px);
  font-size: clamp(1rem, calc(var(--scene-artboard-width) * 0.044), 1.28rem);
  white-space: nowrap;
}

.scan-secondary {
  appearance: none;
  width: 100%;
  min-height: clamp(46px, calc(var(--scene-artboard-width) * 0.12), 58px);
  border: 3px solid rgba(255, 238, 175, 0.86);
  border-radius: var(--scene-radius);
  background: linear-gradient(96deg, rgba(217, 128, 10, 0.9), rgba(248, 177, 48, 0.95) 48%, rgba(220, 126, 9, 0.9));
  color: #170f06;
  box-shadow: 0 8px 18px rgba(66, 20, 3, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  font-family: inherit;
  font-size: clamp(0.86rem, calc(var(--scene-artboard-width) * 0.037), 1.08rem);
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}

.scan-secondary[hidden] {
  display: none !important;
}

.scan-stop,
.scan-legacy {
  display: none !important;
}

.job-panel {
  width: min(100%, 360px);
  display: grid;
  gap: clamp(6px, 1.4vh, 10px);
  margin-top: clamp(4px, 1vh, 8px);
  padding: clamp(10px, 2.6vw, 16px);
  border: 2px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(#492415, #492415) padding-box,
    conic-gradient(
      from var(--job-panel-gradient-angle),
      #584827 0%,
      #c7a03c 30%,
      #f9de90 37%,
      #c7a03c 43%,
      #584827 50%,
      #584827 60%,
      #c7a03c 77%,
      #f9de90 80%,
      #c7a03c 84%,
      #584827 100%
    ) border-box;
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 18px rgba(249, 222, 144, 0.1);
  animation: job-panel-gradient-rotate 6.2s linear infinite;
}

.job-row {
  appearance: none;
  width: 100%;
  min-height: clamp(46px, calc(var(--scene-artboard-width) * 0.12), 62px);
  border: 2px solid rgba(255, 219, 111, 0.45);
  border-radius: var(--scene-radius);
  background: #2B0B00;
  color: var(--scene-cream);
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
  padding: clamp(7px, 2vw, 10px) clamp(12px, 4vw, 18px);
  font-family: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.job-row.selected,
.job-row.is-selected,
.gender-btn.selected,
.gender-btn.is-selected {
  background: linear-gradient(95deg, #eb9216 0%, #f6b53a 52%, #db7d0d 100%);
  color: #171007;
  border-color: rgba(255, 248, 216, 0.92);
}

.job-row-icon,
.job-row img {
  width: clamp(26px, 7vw, 42px);
  height: clamp(26px, 7vw, 42px);
  object-fit: contain;
  flex: 0 0 auto;
}

.job-row-label {
  font-size: clamp(0.9rem, calc(var(--scene-artboard-width) * 0.038), 1.15rem);
  line-height: 1.15;
}

.scene-gender-row {
  width: min(100%, 340px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 3vw, 16px);
  padding: clamp(10px, 2.6vw, 16px);
  border: 2px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(#492415, #492415) padding-box,
    conic-gradient(
      from var(--job-panel-gradient-angle),
      #584827 0%,
      #c7a03c 30%,
      #f9de90 37%,
      #c7a03c 43%,
      #584827 50%,
      #584827 60%,
      #c7a03c 77%,
      #f9de90 80%,
      #c7a03c 84%,
      #584827 100%
    ) border-box;
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 18px rgba(249, 222, 144, 0.1);
  animation: job-panel-gradient-rotate 6.2s linear infinite;
}

.gender-btn {
  appearance: none;
  min-height: clamp(48px, calc(var(--scene-artboard-width) * 0.13), 66px);
  border: 2px solid rgba(255, 219, 111, 0.45);
  border-radius: var(--scene-radius);
  background: #2B0B00;
  color: var(--scene-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: clamp(0.95rem, calc(var(--scene-artboard-width) * 0.04), 1.2rem);
  font-weight: 900;
  cursor: pointer;
}

.gender-btn img {
  width: clamp(24px, 7vw, 40px);
  height: clamp(24px, 7vw, 40px);
  object-fit: contain;
}

.photo-guide {
  width: min(330px, 82vw);
  display: flex;
  justify-content: center;
  margin-top: -2px;
}

.photo-guide-icons {
  width: 100%;
  max-height: clamp(42px, 10vh, 76px);
  object-fit: contain;
}

.photo-frame {
  position: relative;
  width: clamp(260px, 72vw, 400px);
  aspect-ratio: 1 / 1;
  border: 4px solid rgba(255, 221, 116, 0.96);
  border-radius: 50%;
  overflow: hidden;
  background: rgba(30, 10, 4, 0.72);
  box-shadow: 0 14px 34px rgba(54, 13, 2, 0.34);
  flex: 0 0 auto;
}

.photo-frame video,
.photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-frame video[hidden],
.photo-frame img[hidden] {
  display: none;
}

.photo-frame video.is-front-camera-preview {
  transform: scaleX(-1);
}

.photo-frame img.is-pannable {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.photo-frame img.is-pannable:active {
  cursor: grabbing;
}

.photo-actions {
  width: min(280px, 72vw);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 2vw, 10px);
}

.photo-tool {
  appearance: none;
  min-height: clamp(52px, calc(var(--scene-artboard-width) * 0.14), 72px);
  border: 2px solid rgba(255, 238, 175, 0.86);
  border-radius: var(--scene-radius);
  background:
    linear-gradient(96deg, rgba(217, 128, 10, 0.9), rgba(248, 177, 48, 0.95) 48%, rgba(220, 126, 9, 0.9));
  color: #170f06;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
}

.photo-tool img {
  width: clamp(20px, 5.5vw, 32px);
  height: clamp(20px, 5.5vw, 32px);
  object-fit: contain;
}

.photo-tool span {
  font-size: clamp(0.58rem, calc(var(--scene-artboard-width) * 0.025), 0.76rem);
  line-height: 1.05;
}

.scene-photo .scene-cta {
  width: min(220px, 58vw);
  max-width: 220px;
}

.loading-box {
  position: relative;
  width: min(82vw, 82vh, 520px);
  aspect-ratio: 1 / 1;
  margin-top: auto;
  margin-bottom: auto;
  border: 4px solid rgba(255, 221, 116, 0.96);
  border-radius: 16px;
  background: rgba(38, 13, 5, 0.52);
  box-shadow: 0 18px 42px rgba(42, 11, 2, 0.36);
}

.loading-ring {
  position: absolute;
  top: 14%;
  left: 14%;
  width: 72%;
  height: 72%;
  object-fit: contain;
  animation: sceneSpin 1.15s linear infinite;
}

.loading-bean {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  height: 30%;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.loading-progress,
.loading-error-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3vh, 24px);
}

.loading-progress[hidden],
.loading-error-state[hidden] {
  display: none !important;
}

.loading-error-state {
  margin-top: auto;
  margin-bottom: auto;
  padding: clamp(14px, 4vw, 26px);
}

.loading-error-icon {
  width: clamp(88px, 26vw, 142px);
  height: auto;
  color: var(--scene-gold-light);
  filter: drop-shadow(0 10px 18px rgba(78, 24, 4, 0.32));
}

.scene-title--loading-error {
  max-width: 12em;
  font-size: clamp(1.35rem, calc(var(--scene-artboard-width) * 0.06), 2.05rem);
  line-height: 1.08;
}

.loading-error-copy {
  max-width: 18em;
  margin: -4px 0 0;
  color: rgba(255, 247, 223, 0.9);
  font-size: clamp(0.98rem, calc(var(--scene-artboard-width) * 0.038), 1.18rem);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 0 rgba(93, 34, 9, 0.45);
}

.loading-retry-button {
  width: min(250px, 68vw);
}

@keyframes sceneSpin {
  to { transform: rotate(360deg); }
}

.view-frame {
  position: relative;
  width: clamp(220px, 58vw, 330px);
  aspect-ratio: 2 / 3;
  border: 4px solid rgba(255, 221, 116, 0.96);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(31, 10, 4, 0.7);
  box-shadow: 0 16px 38px rgba(40, 10, 2, 0.34);
}

#viewResultImage {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.scene-view .scene-cta--icon {
  gap: clamp(10px, 3vw, 18px);
  width: min(320px, 78vw);
  max-width: 320px;
  padding-inline: clamp(18px, 5vw, 30px);
}

.scene-view .scene-cta--icon img {
  width: clamp(26px, 7vw, 42px);
  height: clamp(26px, 7vw, 42px);
  object-fit: contain;
  flex: 0 0 auto;
}

.view-error {
  width: min(320px, 78vw);
  margin: 0;
  border: 2px solid rgba(255, 235, 225, 0.74);
  border-radius: 10px;
  background: rgba(110, 18, 10, 0.78);
  color: #fff5ea;
  padding: 12px 14px;
  text-align: center;
  font-weight: 900;
}

.scene-view.is-error #btnViewGet {
  visibility: hidden;
  pointer-events: none;
}

.scene-final {
  --final-artboard-width: min(100vw, 56.25vh);
}

@supports (width: 100dvw) {
  .scene-final {
    --final-artboard-width: min(100dvw, 56.25dvh);
  }
}

.final-bg {
  /* 1:2 portrait BG cover anchored center-bottom (see .landing-bg). */
  --final-stage-size: max(125vw, 65vh);
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #2a180c;
}

@supports (height: 100lvh) {
  .final-bg {
    --final-stage-size: max(125vw, 65lvh);
  }
}

.final-stage {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--final-stage-size);
  height: calc(var(--final-stage-size) * 2);
  transform: translateX(-50%);
  transform-origin: center bottom;
  pointer-events: none;
}

.final-bg-image,
.final-scene-layer {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}

.final-bg-image {
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.final-scene-layer {
  object-fit: fill;
  transform: translateX(-50%);
  transform-origin: center bottom;
}

.final-scene-bean {
  z-index: 1;
  left: 43.69792%;
  bottom: 2.68229%;
  width: 49.27083%;
  height: 18.90625%;
}

.final-scene-product {
  z-index: 3;
  left: 59.29688%;
  bottom: 0;
  width: 30.15625%;
  height: 27.68229%;
}

.final-inner {
  position: relative;
  z-index: 2;
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(clamp(10px, 3vw, 22px) + env(safe-area-inset-top))
    calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-right))
    calc(clamp(18px, 5vw, 34px) + env(safe-area-inset-bottom))
    calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--scene-cream);
  font-family: 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@supports (min-height: 100dvh) {
  .final-inner {
    min-height: 100dvh;
  }
}

.final-logo {
  width: min(calc(var(--final-artboard-width) * 0.54), 292px);
  height: auto;
  display: block;
  margin-bottom: clamp(10px, 2vh, 18px);
  object-fit: contain;
}

.final-title {
  margin: 0 0 clamp(18px, 3.6vh, 32px);
  text-align: center;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--scene-cream);
  font-weight: 900;
  text-shadow: var(--text-outline-gradient);
  -webkit-text-stroke: clamp(1.1px, 0.32vw, 1.8px) var(--scene-stroke);
  paint-order: stroke fill;
}

.final-title span {
  display: block;
  font-size: clamp(2.5rem, calc(var(--final-artboard-width) * 0.15), 4.55rem);
}

.final-title small {
  display: block;
  margin-top: clamp(8px, 1.2vh, 12px);
  font-size: clamp(1.18rem, calc(var(--final-artboard-width) * 0.062), 2rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.final-qr-wrap {
  position: relative;
  width: clamp(178px, calc(var(--final-artboard-width) * 0.54), 292px);
  aspect-ratio: 1 / 1;
  padding: clamp(8px, 2vw, 12px);
  background: #ffffff;
  border: clamp(6px, 1.8vw, 10px) solid #050505;
  box-shadow:
    0 0 0 clamp(4px, 1.2vw, 7px) rgba(238, 166, 26, 0.98),
    0 0 0 clamp(5px, 1.45vw, 9px) rgba(255, 220, 89, 0.72),
    0 10px 26px rgba(48, 12, 2, 0.4);
}

.final-qr-wrap::before {
  content: '';
  position: absolute;
  inset: calc(clamp(20px, 5.5vw, 32px) * -1);
  pointer-events: none;
  --corner-len: clamp(20px, 5.4vw, 34px);
  --corner-thick: clamp(3px, 0.9vw, 5px);
  --corner-color: rgba(243, 166, 22, 0.95);
  background:
    linear-gradient(var(--corner-color), var(--corner-color)) top left,
    linear-gradient(var(--corner-color), var(--corner-color)) top left,
    linear-gradient(var(--corner-color), var(--corner-color)) top right,
    linear-gradient(var(--corner-color), var(--corner-color)) top right,
    linear-gradient(var(--corner-color), var(--corner-color)) bottom left,
    linear-gradient(var(--corner-color), var(--corner-color)) bottom left,
    linear-gradient(var(--corner-color), var(--corner-color)) bottom right,
    linear-gradient(var(--corner-color), var(--corner-color)) bottom right;
  background-repeat: no-repeat;
  background-size:
    var(--corner-len) var(--corner-thick),
    var(--corner-thick) var(--corner-len),
    var(--corner-len) var(--corner-thick),
    var(--corner-thick) var(--corner-len),
    var(--corner-len) var(--corner-thick),
    var(--corner-thick) var(--corner-len),
    var(--corner-len) var(--corner-thick),
    var(--corner-thick) var(--corner-len);
}

#finalResultQr {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.final-error {
  width: min(320px, 78vw);
  margin: clamp(8px, 1.8vh, 14px) 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(255, 238, 208, 0.78);
  background: rgba(116, 18, 9, 0.78);
  color: #fff4e8;
  text-align: center;
  font-weight: 900;
}

.final-print-actions {
  width: min(285px, 72vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 12px);
  margin-top: clamp(22px, 3.7vh, 34px);
}

.final-print-button {
  appearance: none;
  min-height: clamp(66px, calc(var(--final-artboard-width) * 0.18), 86px);
  border: 3px solid rgba(255, 238, 175, 0.9);
  border-radius: var(--scene-radius);
  background:
    linear-gradient(96deg, rgba(219, 127, 9, 0.95), rgba(247, 177, 48, 0.98) 45%, rgba(255, 214, 98, 0.9) 51%, rgba(219, 126, 10, 0.96));
  color: #130d05;
  box-shadow: 0 8px 18px rgba(52, 13, 2, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  font-family: inherit;
  font-weight: 900;
}

.final-print-button img {
  width: clamp(28px, calc(var(--final-artboard-width) * 0.09), 46px);
  height: clamp(28px, calc(var(--final-artboard-width) * 0.09), 46px);
  object-fit: contain;
}

.final-print-button span {
  font-size: clamp(0.68rem, calc(var(--final-artboard-width) * 0.028), 0.82rem);
  line-height: 1.05;
}

.final-end-button {
  appearance: none;
  width: min(270px, 70vw);
  min-height: clamp(46px, calc(var(--final-artboard-width) * 0.12), 62px);
  margin-top: clamp(8px, 1.4vh, 12px);
  border: 3px solid rgba(255, 238, 175, 0.9);
  border-radius: var(--scene-radius);
  background:
    linear-gradient(96deg, rgba(219, 127, 9, 0.95), rgba(247, 177, 48, 0.98) 45%, rgba(255, 214, 98, 0.9) 51%, rgba(219, 126, 10, 0.96));
  color: #130d05;
  box-shadow: 0 8px 18px rgba(52, 13, 2, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 12px);
  padding: 8px 18px;
  font-family: inherit;
  font-size: clamp(1rem, calc(var(--final-artboard-width) * 0.048), 1.36rem);
  font-weight: 900;
  text-transform: uppercase;
}

.final-end-button img {
  width: clamp(26px, calc(var(--final-artboard-width) * 0.075), 38px);
  height: clamp(26px, calc(var(--final-artboard-width) * 0.075), 38px);
  object-fit: contain;
}

.final-print-button.is-busy,
.final-end-button.is-busy {
  opacity: 0.72;
}

@media (max-height: 700px) {
  .scene-inner {
    gap: clamp(7px, 1.4vh, 12px);
    padding-top: calc(clamp(10px, 2.6vw, 18px) + env(safe-area-inset-top));
    padding-bottom: calc(clamp(12px, 3vw, 22px) + env(safe-area-inset-bottom));
  }

  .scene-logo {
    width: min(calc(var(--scene-artboard-width) * 0.48), 230px);
  }

  .scan-logo {
    width: min(calc(var(--scene-artboard-width) * 0.44), 210px);
  }

  .scene-title--scan {
    font-size: clamp(1.8rem, calc(var(--scene-artboard-width) * 0.092), 2.8rem);
  }

  .scan-helper {
    font-size: clamp(0.8rem, calc(var(--scene-artboard-width) * 0.034), 1.04rem);
  }

  .scan-camera-shell {
    --scan-shell-size: min(72vw, 52vh, 330px);
    width: var(--scan-shell-size);
    margin-top: 0;
  }

  .scan-actions {
    width: min(300px, 80vw);
    gap: 8px;
  }

  .scene-title {
    font-size: clamp(1.42rem, calc(var(--scene-artboard-width) * 0.062), 2.08rem);
  }

  .scene-title--photo,
  .scene-title--loading {
    font-size: clamp(1.2rem, calc(var(--scene-artboard-width) * 0.052), 1.72rem);
  }

  .job-panel {
    gap: 7px;
  }

  .job-row {
    min-height: 42px;
  }

  .photo-frame {
    width: clamp(210px, 60vw, 320px);
  }

  .loading-box {
    width: min(72vw, 68vh, 420px);
  }

  .view-frame {
    width: clamp(190px, 48vw, 260px);
  }

  .final-inner {
    padding-top: calc(clamp(6px, 1.6vw, 12px) + env(safe-area-inset-top));
    padding-bottom: calc(clamp(10px, 2.4vw, 18px) + env(safe-area-inset-bottom));
  }

  .final-logo {
    width: min(calc(var(--final-artboard-width) * 0.42), 220px);
    margin-bottom: 8px;
  }

  .final-title {
    margin-bottom: clamp(16px, 3vh, 24px);
  }

  .final-title span {
    font-size: clamp(2.05rem, calc(var(--final-artboard-width) * 0.115), 3.4rem);
  }

  .final-title small {
    font-size: clamp(0.98rem, calc(var(--final-artboard-width) * 0.048), 1.42rem);
    margin-top: 5px;
  }

  .final-qr-wrap {
    width: clamp(148px, calc(var(--final-artboard-width) * 0.46), 230px);
  }

  .final-print-actions {
    margin-top: clamp(16px, 2.6vh, 24px);
  }

  .final-print-button {
    min-height: clamp(56px, calc(var(--final-artboard-width) * 0.145), 72px);
  }

  .final-end-button {
    min-height: 44px;
  }
}

@media (min-width: 700px) and (min-height: 760px) {
  .scene-inner,
  .final-inner {
    width: min(100%, 560px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene.scene-enter {
    animation: sceneFadeIn 140ms ease-out both;
    filter: none;
    transform: none;
  }

  .scene.scene-exit {
    animation: sceneFadeOut 120ms ease-out both;
    filter: none;
    transform: none;
  }

  .loading-ring {
    animation: none;
  }
}

@keyframes sceneFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sceneFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ───────────────────────────────────────────────
   PG lighting background: glow + CSS fireflies
   ─────────────────────────────────────────────── */
.landing-stage,
.scan-stage,
.final-stage,
.scene-bg {
  isolation: isolate;
}

.landing-bg-image,
.scan-bg-image,
.final-bg-image,
.scene-bg > img {
  z-index: 0;
}

.pg-lighting-layer {
  position: absolute;
  inset: 0;
  /* Render above the scene objects (cov/bean/product, z-index 1-3) but still
     below the UI content layer. Keeping the animated lighting on top of the
     object stack avoids forcing the objects into their own compositor layers,
     which otherwise pixel-snaps their translateX(-50%) and shifts them out of
     alignment with the baked background image. */
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.55;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.pg-lighting-glow,
.pg-firefly-field,
.pg-firefly {
  position: absolute;
  display: block;
  pointer-events: none;
}

.pg-lighting-glow {
  /* Sit near the baked light burst, which lands low on screen with the 1:2 BG. */
  left: 60%;
  top: 82%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 54%, rgba(255, 246, 166, 0.62) 0 4%, rgba(255, 200, 69, 0.3) 11%, rgba(233, 117, 12, 0.12) 31%, transparent 64%),
    radial-gradient(circle at 34% 64%, rgba(255, 174, 35, 0.24), transparent 50%);
  filter: blur(8px) saturate(1.2);
  transform: translate(-50%, -50%);
  animation: pg-lighting-breathe 5.8s cubic-bezier(0.33, 0, 0.2, 1) infinite alternate;
}

.pg-firefly-field {
  inset: 0;
}

.pg-firefly {
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 222, var(--spark-alpha)) 0 16%, rgba(255, 216, 96, 0.62) 38%, rgba(255, 147, 23, 0.12) 64%, transparent 72%);
  box-shadow:
    0 0 calc(var(--size) * 1.8) rgba(255, 240, 151, 0.78),
    0 0 calc(var(--size) * 3.8) rgba(255, 146, 20, 0.28);
  filter: saturate(1.25);
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.7);
  animation:
    pg-firefly-drift var(--duration) cubic-bezier(0.32, 0, 0.2, 1) infinite,
    pg-firefly-pulse calc(var(--duration) * 0.62) ease-in-out infinite;
  animation-delay: var(--delay), calc(var(--delay) * 0.6);
}

@keyframes pg-lighting-breathe {
  0% {
    opacity: 0.38;
    transform: translate(-50%, -50%) scale(0.9);
  }
  55% {
    opacity: 0.76;
  }
  100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes pg-firefly-drift {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.58);
  }
  16% {
    opacity: 0.72;
  }
  62% {
    opacity: 0.86;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift-x), var(--drift-y), 0) scale(var(--pulse-scale));
  }
}

@keyframes pg-firefly-pulse {
  0%, 100% { filter: brightness(0.86) saturate(1.08); }
  48% { filter: brightness(1.45) saturate(1.35); }
}

@media (max-width: 767px), (max-height: 640px) {
  .pg-lighting-layer {
    opacity: 0.5;
  }

  .pg-firefly {
    box-shadow:
      0 0 calc(var(--size) * 1.4) rgba(255, 240, 151, 0.64),
      0 0 calc(var(--size) * 2.8) rgba(255, 146, 20, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-lighting-layer {
    opacity: 0.34;
  }

  .pg-lighting-glow,
  .pg-firefly {
    animation: none !important;
  }

  .pg-firefly {
    display: none;
  }

  .pg-lighting-glow {
    opacity: 0.42;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ───────────────────────────────────────────────
   Photo page: back-to-job button, top-left
   ─────────────────────────────────────────────── */
.scene-back-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + clamp(8px, 2vw, 14px));
  left: calc(env(safe-area-inset-left) + clamp(10px, 2.4vw, 18px));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(38px, 10vw, 46px);
  height: clamp(38px, 10vw, 46px);
  padding: 0;
  border: 1.5px solid rgba(255, 219, 111, 0.6);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #5a2f18 0%, #3a1d0e 70%, #2a160a 100%);
  color: var(--scene-cream);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.scene-back-btn[hidden] {
  display: none;
}

.scene-back-icon {
  width: 54%;
  height: 54%;
}

.scene-back-btn:hover {
  border-color: #ffe7a3;
  background: radial-gradient(circle at 32% 28%, #6a3a1e 0%, #44230f 70%, #301809 100%);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.scene-back-btn:active {
  transform: scale(0.94);
}

.scene-back-btn:focus-visible {
  outline: 2px solid #ffe7a3;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .scene-back-btn {
    transition: none;
  }
}

/* ───────────────────────────────────────────────
   Portrait lock: block landscape on touch devices
   ─────────────────────────────────────────────── */
.orientation-lock {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 28px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #3a1d0e 0%, #2a160a 60%, #1c0e06 100%);
  color: var(--scene-cream);
  text-align: center;
}

.orientation-lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3vh, 20px);
  max-width: 30rem;
}

.orientation-lock-icon {
  width: clamp(68px, 18vmin, 104px);
  height: auto;
  color: var(--scene-gold-light);
  animation: orientationRock 2.1s ease-in-out infinite;
}

@keyframes orientationRock {
  0%, 18% { transform: rotate(-90deg); }
  46%, 70% { transform: rotate(0deg); }
  100% { transform: rotate(-90deg); }
}

.orientation-lock-title {
  margin: 0;
  font-family: 'Gotham', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(1.3rem, 5vmin, 1.85rem);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--scene-cream);
  text-shadow: var(--text-outline-gradient);
  -webkit-text-stroke: 1px var(--scene-stroke);
  paint-order: stroke fill;
}

.orientation-lock-text {
  margin: 0;
  color: rgba(255, 247, 223, 0.86);
  font-family: 'Gotham', system-ui, sans-serif;
  font-size: clamp(0.95rem, 3.4vmin, 1.12rem);
  font-weight: 600;
  line-height: 1.4;
}

@media (orientation: landscape) and (max-height: 540px) {
  .orientation-lock {
    display: flex;
  }

  body.is-scene,
  body.is-welcome {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orientation-lock-icon {
    animation: none;
    transform: rotate(-30deg);
  }
}

/* ───────────────────────────────────────────────
   ReferenceAnimation motion pass for PG flow
   ─────────────────────────────────────────────── */
.scene.scene-enter {
  animation: pg-scene-surface-enter 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scene.scene-exit {
  animation: pg-scene-surface-exit 260ms cubic-bezier(0.76, 0, 0.24, 1) both;
}

.scan-corner {
  display: none !important;
}

.scan-camera-shell::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 14%;
  height: clamp(2px, 0.7vw, 4px);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92) 18%, #ffffff 50%, rgba(255, 255, 255, 0.92) 82%, transparent);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.78), 0 0 28px rgba(255, 255, 255, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

.scan-camera-shell.is-scan-active::after {
  opacity: 1;
  animation: pg-scan-line 1.85s ease-in-out infinite alternate;
}

.scene-enter .job-panel,
.scene-enter .scene-gender-row,
.scene-enter #btnJobConfirm,
.scene-enter .photo-frame,
.scene-enter .photo-actions,
.scene-enter #btnPhotoNext,
.scene-enter .loading-progress,
.scene-enter .loading-error-state,
.scene-enter .view-frame,
.scene-enter #btnViewGet,
.scene-enter .final-scene-layer,
.scene-enter .final-qr-wrap,
.scene-enter .final-print-actions,
.scene-enter .final-end-button {
  opacity: 0;
}

.scene-job.scene-enter .job-panel {
  animation: pg-reveal-rise 760ms cubic-bezier(0.2, 0.82, 0.22, 1) 140ms both;
}

.scene-job.scene-enter .scene-gender-row {
  animation: pg-reveal-rise 720ms cubic-bezier(0.2, 0.82, 0.22, 1) 540ms both;
}

.scene-job.scene-enter #btnJobConfirm {
  animation: pg-reveal-rise 680ms cubic-bezier(0.2, 0.82, 0.22, 1) 940ms both;
}

.scene-job.scene-enter #btnJobConfirm:disabled {
  animation-name: pg-reveal-rise-muted;
}

.scene-photo.scene-enter .photo-frame {
  animation: pg-soft-fade 820ms cubic-bezier(0.2, 0.82, 0.22, 1) 140ms both;
}

.scene-photo.scene-enter .photo-actions {
  animation: pg-reveal-rise 720ms cubic-bezier(0.2, 0.82, 0.22, 1) 560ms both;
}

.scene-photo.scene-enter #btnPhotoNext {
  animation: pg-reveal-rise 680ms cubic-bezier(0.2, 0.82, 0.22, 1) 960ms both;
}

.scene-photo.scene-enter #btnPhotoNext:disabled {
  animation-name: pg-reveal-rise-muted;
}

.scene-loading.scene-enter .loading-progress,
.scene-loading.scene-enter .loading-error-state {
  animation: pg-soft-fade 820ms cubic-bezier(0.2, 0.82, 0.22, 1) 160ms both;
}

.scene-view.scene-enter .view-frame {
  animation: pg-media-reveal 820ms cubic-bezier(0.2, 0.82, 0.22, 1) 160ms both;
}

.scene-view.scene-enter #btnViewGet {
  animation: pg-reveal-rise 720ms cubic-bezier(0.2, 0.82, 0.22, 1) 620ms both;
}

.scene-final.scene-enter .final-scene-layer {
  animation: pg-object-fade 820ms cubic-bezier(0.2, 0.82, 0.22, 1) 140ms both;
}

.scene-final.scene-enter .final-qr-wrap {
  animation: pg-media-reveal 760ms cubic-bezier(0.2, 0.82, 0.22, 1) 600ms both;
}

.scene-final.scene-enter .final-print-actions {
  animation: pg-soft-fade 700ms cubic-bezier(0.2, 0.82, 0.22, 1) 1020ms both;
}

.scene-final.scene-enter .final-end-button {
  animation: pg-reveal-rise 680ms cubic-bezier(0.2, 0.82, 0.22, 1) 1380ms both;
}

.scene-cta.is-pulsing,
.scan-primary.is-pulsing,
.final-end-button.is-pulsing {
  animation: pg-cta-yoyo 1.5s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  transform-origin: 50% 50%;
  will-change: transform;
}

.scene-cta.is-pulsing:disabled,
.scan-primary.is-pulsing:disabled,
.final-end-button.is-pulsing:disabled {
  animation: none;
  transform: none;
}

@keyframes pg-scene-surface-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pg-scene-surface-exit {
  from {
    opacity: 1;
    filter: blur(0) saturate(1);
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    opacity: 0;
    filter: blur(8px) saturate(0.95);
    transform: translate3d(0, -12px, 0) scale(1.006);
  }
}

@keyframes pg-reveal-rise {
  from {
    opacity: 0;
    filter: blur(5px);
    transform: translate3d(0, 20px, 0) scale(0.98);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pg-reveal-rise-muted {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }

  to {
    opacity: 0.52;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pg-media-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.965);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pg-soft-fade {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pg-object-fade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.975);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes pg-scan-line {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, calc(var(--scan-shell-size, 270px) * 0.64), 0); }
}

@keyframes pg-cta-yoyo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pg-text-effect-segment {
  display: inline-block;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: inherit;
  text-shadow: inherit;
  -webkit-text-stroke: inherit;
  paint-order: inherit;
  transform-origin: 50% 62%;
  vertical-align: baseline;
}

.scene-title .pg-text-effect-segment,
.final-title .pg-text-effect-segment {
  display: inline-block;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

@keyframes pg-text-effect-slide {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

html[data-pg-motion="legacy"] .scene-enter .scene-title--scan,
html[data-pg-motion="legacy"] .scene-job.scene-enter .scene-title,
html[data-pg-motion="legacy"] .scene-photo.scene-enter .scene-title--photo,
html[data-pg-motion="legacy"] .scene-loading.scene-enter .scene-title--loading-error,
html[data-pg-motion="legacy"] .scene-view.scene-enter .scene-title {
  opacity: 0;
  animation: pg-text-effect-slide 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html[data-pg-motion="legacy"] .scene-enter .scan-helper,
html[data-pg-motion="legacy"] .scene-job.scene-enter .scene-subtitle,
html[data-pg-motion="legacy"] .scene-photo.scene-enter .scene-title--photo span,
html[data-pg-motion="legacy"] .scene-loading.scene-enter .scene-title--loading,
html[data-pg-motion="legacy"] .scene-loading.scene-enter .loading-error-copy {
  opacity: 0;
  animation: pg-soft-fade 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html[data-pg-motion="legacy"] .scene-final.scene-enter .final-title span,
html[data-pg-motion="legacy"] .scene-final.scene-enter .final-title small {
  opacity: 0;
  animation: pg-media-reveal 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html[data-pg-motion="legacy"] .scene-enter .scene-title--scan { animation-delay: 200ms; }
html[data-pg-motion="legacy"] .scene-enter .scan-helper { animation-delay: 320ms; }
html[data-pg-motion="legacy"] .scene-job.scene-enter .scene-title { animation-delay: 120ms; }
html[data-pg-motion="legacy"] .scene-job.scene-enter .scene-subtitle { animation-delay: 580ms; }
html[data-pg-motion="legacy"] .scene-photo.scene-enter .scene-title--photo { animation-delay: 100ms; }
html[data-pg-motion="legacy"] .scene-photo.scene-enter .scene-title--photo span { animation-delay: 220ms; }
html[data-pg-motion="legacy"] .scene-loading.scene-enter .scene-title--loading { animation-delay: 120ms; }
html[data-pg-motion="legacy"] .scene-loading.scene-enter .scene-title--loading-error { animation-delay: 100ms; }
html[data-pg-motion="legacy"] .scene-loading.scene-enter .loading-error-copy { animation-delay: 280ms; }
html[data-pg-motion="legacy"] .scene-view.scene-enter .scene-title { animation-delay: 120ms; }
html[data-pg-motion="legacy"] .scene-final.scene-enter .final-title span { animation-delay: 360ms; }
html[data-pg-motion="legacy"] .scene-final.scene-enter .final-title small { animation-delay: 460ms; }

@media (prefers-reduced-motion: reduce) {
  .scene.scene-enter,
  .scene.scene-exit,
  .scene-enter .job-panel,
  .scene-enter .scene-gender-row,
  .scene-enter #btnJobConfirm,
  .scene-enter .photo-frame,
  .scene-enter .photo-actions,
  .scene-enter #btnPhotoNext,
  .scene-enter .loading-progress,
  .scene-enter .loading-error-state,
  .scene-enter .view-frame,
  .scene-enter #btnViewGet,
  .scene-enter .final-scene-layer,
  .scene-enter .final-qr-wrap,
  .scene-enter .final-print-actions,
  .scene-enter .final-end-button,
  .scene-enter .scene-title--scan,
  .scene-enter .scan-helper,
  .scene-job.scene-enter .scene-title,
  .scene-job.scene-enter .scene-subtitle,
  .scene-photo.scene-enter .scene-title--photo,
  .scene-photo.scene-enter .scene-title--photo span,
  .scene-loading.scene-enter .scene-title--loading,
  .scene-loading.scene-enter .scene-title--loading-error,
  .scene-loading.scene-enter .loading-error-copy,
  .scene-view.scene-enter .scene-title,
  .scene-final.scene-enter .final-title span,
  .scene-final.scene-enter .final-title small,
  .scene-cta.is-pulsing,
  .scan-primary.is-pulsing,
  .final-end-button.is-pulsing,
  .scan-camera-shell.is-scan-active::after {
    animation: none !important;
    opacity: 1;
    filter: none;
  }

  .scene-enter .scene-title--scan,
  .scene-enter .scan-helper,
  .scene-job.scene-enter .scene-title,
  .scene-job.scene-enter .scene-subtitle,
  .scene-photo.scene-enter .scene-title--photo,
  .scene-photo.scene-enter .scene-title--photo span,
  .scene-loading.scene-enter .scene-title--loading,
  .scene-loading.scene-enter .scene-title--loading-error,
  .scene-loading.scene-enter .loading-error-copy,
  .scene-view.scene-enter .scene-title,
  .scene-final.scene-enter .final-title span,
  .scene-final.scene-enter .final-title small,
  .scene-cta.is-pulsing,
  .scan-primary.is-pulsing,
  .final-end-button.is-pulsing {
    transform: none;
  }

  .job-panel,
  .scene-gender-row {
    --job-panel-gradient-angle: 42deg;
    animation: none;
  }

  .scan-camera-shell::after {
    display: none;
  }
}

/* ───────────────────────────────────────────────
   GSAP motion mode (default). Set window.PG_MOTION_MODE = 'legacy' in
   /pg/motion-config.js for local dev fallback only.
   ─────────────────────────────────────────────── */
html[data-pg-motion="gsap"] .scene.scene-enter,
html[data-pg-motion="gsap"] .scene.scene-exit,
html[data-pg-motion="gsap"] .scene-enter .job-panel,
html[data-pg-motion="gsap"] .scene-enter .scene-gender-row,
html[data-pg-motion="gsap"] .scene-enter #btnJobConfirm,
html[data-pg-motion="gsap"] .scene-enter .photo-frame,
html[data-pg-motion="gsap"] .scene-enter .photo-actions,
html[data-pg-motion="gsap"] .scene-enter #btnPhotoNext,
html[data-pg-motion="gsap"] .scene-enter .loading-progress,
html[data-pg-motion="gsap"] .scene-enter .loading-error-state,
html[data-pg-motion="gsap"] .scene-enter .view-frame,
html[data-pg-motion="gsap"] .scene-enter #btnViewGet,
html[data-pg-motion="gsap"] .scene-enter .final-scene-layer,
html[data-pg-motion="gsap"] .scene-enter .final-qr-wrap,
html[data-pg-motion="gsap"] .scene-enter .final-print-actions,
html[data-pg-motion="gsap"] .scene-enter .final-end-button,
html[data-pg-motion="gsap"] .scene-cta.is-pulsing,
html[data-pg-motion="gsap"] .scan-primary.is-pulsing,
html[data-pg-motion="gsap"] .final-end-button.is-pulsing {
  animation: none !important;
}

html[data-pg-motion="gsap"] .scene-enter .job-panel,
html[data-pg-motion="gsap"] .scene-enter .scene-gender-row,
html[data-pg-motion="gsap"] .scene-enter #btnJobConfirm,
html[data-pg-motion="gsap"] .scene-enter .photo-frame,
html[data-pg-motion="gsap"] .scene-enter .photo-actions,
html[data-pg-motion="gsap"] .scene-enter #btnPhotoNext,
html[data-pg-motion="gsap"] .scene-enter .loading-progress,
html[data-pg-motion="gsap"] .scene-enter .loading-error-state,
html[data-pg-motion="gsap"] .scene-enter .view-frame,
html[data-pg-motion="gsap"] .scene-enter #btnViewGet,
html[data-pg-motion="gsap"] .scene-enter .final-scene-layer,
html[data-pg-motion="gsap"] .scene-enter .final-qr-wrap,
html[data-pg-motion="gsap"] .scene-enter .final-print-actions,
html[data-pg-motion="gsap"] .scene-enter .final-end-button {
  opacity: 1;
}
