:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #050505;
  --yellow: #f7b916;
  --stage-width: min(100vw, 50dvh);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050505;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, input { font: inherit; }

.experience {
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 50% 40%, rgba(247, 185, 22, .08), transparent 36%),
    #050505;
}

.stage {
  position: relative;
  width: var(--stage-width);
  aspect-ratio: 1 / 2;
  max-height: 100%;
  overflow: hidden;
  background: #050505;
  isolation: isolate;
  box-shadow: 0 0 64px rgba(0, 0, 0, .8);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  opacity: 0;
}

.screen.is-active {
  display: block;
  opacity: 1;
  animation: screen-in 280ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.015); }
  to { opacity: 1; transform: scale(1); }
}

.full-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.button-art { z-index: 4; }
.frame-art { z-index: 3; }

.hitbox {
  position: absolute;
  z-index: 6;
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border-radius: 8px;
}

.hitbox:focus-visible,
.camera-switch:focus-visible,
.fallback-label:focus-within {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.hitbox:active { background: rgba(255, 255, 255, .16); }
.home-hit { left: 28.93%; top: 78%; width: 42%; height: 7.13%; }
.capture-hit { left: 29.07%; top: 75.27%; width: 42%; height: 7.13%; }
.retake-hit { left: 5.87%; top: 65.4%; width: 34.93%; height: 6.93%; }
.confirm-hit { left: 59.2%; top: 65.4%; width: 34.93%; height: 6.93%; }

.camera-window {
  position: absolute;
  z-index: 1;
  left: 6.4%;
  top: 33.13%;
  width: 86.93%;
  height: 26.07%;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, #15120a 0 8px, #1c170c 8px 16px);
}

.camera-window video,
.camera-window img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-window video.is-front { transform: scaleX(-1); }

.camera-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12%;
  color: #fff;
  font-size: clamp(12px, 3.2vw, 18px);
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  background: rgba(0, 0, 0, .72);
}

.camera-status:empty { display: none; }

.camera-switch {
  position: absolute;
  z-index: 7;
  left: 83.2%;
  top: 34.4%;
  width: 9.6%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 2.2%;
  border: 1px solid rgba(247, 185, 22, .8);
  border-radius: 50%;
  color: #050505;
  background: rgba(247, 185, 22, .92);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .48);
}

.camera-switch svg { width: 100%; fill: currentColor; }
.camera-switch:disabled { opacity: .45; }

.fallback-label {
  position: absolute;
  z-index: 8;
  left: 30%;
  top: 55.7%;
  width: 40%;
  padding: 2.4% 3%;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  text-align: center;
  font-size: clamp(12px, 3vw, 17px);
  background: rgba(0, 0, 0, .84);
}

.fallback-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.shutter-flash {
  position: absolute;
  z-index: 12;
  inset: 0;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}

.shutter-flash.is-flashing { animation: flash 220ms ease-out; }
@keyframes flash { 0% { opacity: 0; } 35% { opacity: .92; } 100% { opacity: 0; } }

.upload-prompt { z-index: 3; }

.upload-state,
.upload-result {
  position: absolute;
  z-index: 5;
  left: 14%;
  top: 59.4%;
  width: 72%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1.2vw, 8px);
  color: #fff;
  text-align: center;
  font-size: clamp(11px, 2.8vw, 16px);
}

.upload-state strong { color: var(--yellow); letter-spacing: .08em; }
.upload-state small { color: rgba(255, 255, 255, .64); }

.loader {
  width: clamp(18px, 5.4vw, 34px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.upload-result {
  top: 44%;
  gap: clamp(8px, 2vw, 14px);
  padding: 7% 5%;
  border: 2px solid var(--yellow);
  clip-path: polygon(4% 0, 96% 0, 100% 10%, 100% 90%, 96% 100%, 4% 100%, 0 90%, 0 10%);
  background: rgba(0, 0, 0, .92);
}

.result-mark {
  display: grid;
  place-items: center;
  width: clamp(36px, 11vw, 64px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: #050505;
  font-weight: 900;
  font-size: 1.8em;
  background: var(--yellow);
}

.upload-result strong { color: var(--yellow); font-size: 1.35em; }
.upload-result span { color: rgba(255, 255, 255, .72); }

.upload-result button {
  width: 76%;
  min-height: 38px;
  border: 1px solid var(--yellow);
  color: #050505;
  font-weight: 800;
  letter-spacing: .12em;
  background: var(--yellow);
}

.upload-result .secondary-action { color: var(--yellow); background: transparent; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
