body {
  background: #111;
  color: #eee;
  font-family: sans-serif;
  text-align: center;
  margin: 0;
  overflow: hidden;
}

h1 {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 100px;
  z-index: 10;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: url("assets/images/scene_bg.svg") center center / cover no-repeat;
  overflow: hidden;
}

#cowboy {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  z-index: 1;
}

#webcam {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 480px;
  height: 360px;
  object-fit: cover;
  transform: scaleX(-1); /* 거울 모드: 화면상 좌우가 실제 움직임과 일치하도록 */
  border: 2px solid #ccc;
  border-radius: 8px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#resultImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: rgba(0, 0, 0, 0.75);
  z-index: 3;
}

#status {
  display: none;
}

/* ---------- 한 판 진행 UI ---------- */
#hud {
  position: absolute;
  top: 24px;
  left: 32px;
  z-index: 4;
  text-align: left;
  text-shadow: 0 4px 0 #000, 0 0 16px rgba(0, 0, 0, 0.8);
}

#lives {
  font-size: 72px;
  color: #ff3b3b;
  letter-spacing: 8px;
}

#score {
  font-size: 140px;
  font-weight: 900;
  color: #ffd23f;
  line-height: 1;
}

#gameOver {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(20, 8, 0, 0.88);
}

#gameOver.visible {
  display: flex;
}

#gameOver .label {
  font-size: 64px;
  font-weight: 800;
}

#finalScore {
  font-size: 260px;
  font-weight: 900;
  color: #ffd23f;
  line-height: 1;
}

#gameOver .best {
  font-size: 48px;
  color: #ccc;
}

#restartBtn {
  margin-top: 32px;
  padding: 24px 80px;
  font-size: 56px;
  font-weight: 900;
  color: #111;
  background: #ffd23f;
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

/* 결과 화면에서는 제목(#stage 밖, z-index 10)이 겹치지 않게 숨김 */
body.over h1 {
  display: none;
}

/* ---------- 치명적 오류(카메라 거부·없음, 모델 로드 실패) 안내 ---------- */
#errorOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: rgba(10, 4, 0, 0.95);
  text-align: center;
  padding: 48px;
  box-sizing: border-box;
}

#errorOverlay.visible {
  display: flex;
}

#errorOverlay .msg {
  font-size: 52px;
  font-weight: 800;
  color: #ffd23f;
  line-height: 1.5;
  max-width: 900px;
}

#errorRetryBtn {
  padding: 24px 80px;
  font-size: 44px;
  font-weight: 900;
  color: #111;
  background: #ffd23f;
  border: none;
  border-radius: 20px;
  cursor: pointer;
}
