.scan-editor {
  border: 1px solid #cbded9;
  background: #f4f9f7;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0
}

.scan-editor h3 {
  margin: 4px 0 12px!important
}

.scan-editor p,
.scan-editor small {
  font-size: 12px;
  line-height: 1.7;
  color: #52706c
}

.scan-editor h3:not(:first-child) {
  margin-top: 24px!important
}

.scan-reference-list article {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid #dce8e3;
  border-radius: 10px;
  margin: 8px 0;
  min-width: 0
}

.scan-reference-list img {
  width: 84px;
  height: 90px;
  object-fit: contain;
  background: #f1f3f1;
  border-radius: 6px
}

.scan-reference-list article>div {
  min-width: 0
}

.scan-reference-list b {
  font-size: 12px;
  display: block;
  overflow-wrap: anywhere
}

.scan-reference-list small {
  display: block;
  font-size: 10px
}

.scan-image-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px
}

.scan-image-actions label,
.scan-upload {
  position: relative;
  cursor: pointer;
  display: block!important;
  overflow: hidden;
  border: 1px dashed #61988b;
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: #1e6558!important;
  text-align: center
}

.scan-image-actions label {
  font-size: 11px!important;
  margin: 0!important;
  padding: 5px 10px
}

.scan-image-actions button {
  font-size: 11px;
  padding: 5px 10px
}

.scan-upload input,
.scan-image-actions input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%
}

.scan-upload:focus-within {
  outline: 2px solid #078577
}

.scan-flow-note {
  padding: 10px;
  background: #e4eee7;
  border-radius: 8px
}

.scan-live-stage {
  position: relative;
  background: #102225;
  isolation: isolate;
  min-height: 320px;
  aspect-ratio: 3/4;
  overflow: hidden;
  border-radius: 16px;
  color: white
}

.scan-live-stage video,
.scan-live-stage canvas,
.scan-live-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center
}

.scan-live-stage [hidden] {
  display: none!important
}

.scan-live-stage svg {
  pointer-events: none;
  z-index: 2
}

.scan-live-stage polygon {
  fill: #f3d47819;
  stroke: #f4dc83;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 7px #ffe19a)
}

.scan-reticle {
  position: absolute;
  inset: 18% 12% 24%;
  border: 1px dashed #d6e7dd66;
  border-radius: 18px;
  pointer-events: none
}

.scan-camera-dialog {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 25px;
  background: #102225e8
}

.scan-camera-dialog h3 {
  font-size: 22px!important;
  color: #fff!important
}

.scan-camera-dialog p {
  font-size: 13px!important;
  color: #cbdcd6!important
}

.scan-camera-dialog small {
  font-size: 10px;
  color: #a0bab1;
  margin: 12px 0
}

.scan-camera-dialog button {
  background: #e5f4cc;
  color: #183b32;
  border: 0;
  border-radius: 9px;
  padding: 13px 24px
}

.scan-symbol {
  font-size: 42px;
  color: #d9edc7
}

.scan-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  z-index: 4;
  padding: 9px;
  border-radius: 8px;
  font-size: 11px!important;
  background: #102225d9;
  color: #e8f3e6!important;
  text-align: center;
  pointer-events: none
}

.scan-stop {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 5;
  color: white;
  background: #172c2adb;
  border: 1px solid #ffffff66;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0!important
}

.scan-reveal {
  position: absolute;
  inset: 30% 8% auto;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 12px;
  background: #102225eb;
  border: 1px solid #ffe5a9;
  border-radius: 14px;
  box-shadow: 0 0 30px #f9d47c66;
  animation: scanReveal .5s ease-out;
  text-align: center
}

.scan-reveal span {
  font-size: 11px;
  color: #f6dda0
}

.scan-reveal strong {
  font-size: 27px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  color: #ffe7a6;
  margin: 10px 0;
  text-shadow: 0 0 18px #ffc94b
}

.scan-reveal small {
  font-size: 10px;
  color: #d4ded2
}

.scan-photo-test {
  display: block;
  font-size: 11px!important;
  color: #31594d;
  margin: 12px 0 6px
}

.scan-photo-test input {
  max-width: 100%;
  font-size: 11px!important
}

.scan-test-note {
  font-size: 10px;
  color: #7c8f84;
  display: block
}

.scan-recognized .scan-reticle {
  display: none
}

.scan-recognized polygon {
  animation: scanGlow .8s infinite alternate
}

@keyframes scanGlow {
  to {
    stroke: #fff;
    filter: drop-shadow(0 0 15px #ffde66)
  }
}

@keyframes scanReveal {
  from {
    opacity: 0;
    transform: scale(.94)
  }
  to {
    opacity: 1;
    transform: scale(1)
  }
}

.scan-mobile-active .runtime .game-scene {
  position: fixed;
  inset: 0;
  padding: 0;
  z-index: 50;
  background: #102225
}

.scan-mobile-active .game-scene>h2,
.scan-mobile-active .game-scene>.scene-photo,
.scan-mobile-active .game-scene>button,
.scan-mobile-active .game-scene>#answerStatus {
  display: none
}

.scan-mobile-active .game-scene>small {
  position: absolute;
  top: max(16px,env(safe-area-inset-top));
  left: 18px;
  right: 60px;
  z-index: 54;
  color: white;
  text-shadow: 0 1px 3px #000
}

.scan-mobile-active .scan-live-stage {
  height: 100dvh;
  min-height: 100dvh;
  border-radius: 0;
  aspect-ratio: auto
}

.scan-mobile-active .scan-stop {
  top: max(16px,env(safe-area-inset-top))
}

.scan-mobile-active .scan-status {
  bottom: max(20px,env(safe-area-inset-bottom));
  font-size: 14px!important
}

.scan-mobile-active .scan-exit {
  position: fixed;
  z-index: 55;
  bottom: 90px;
  left: 16px;
  border: 1px solid #ffffff66;
  color: #fff;
  background: #102225d9;
  border-radius: 20px;
  padding: 8px 14px
}

@media(prefers-reduced-motion:reduce) {
  .scan-recognized polygon,
  .scan-reveal {
    animation: none
  }
}
