* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: #0b0f14;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif;
}

.stage {
  width: min(100%, 900px);
  height: 100%;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 200px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

#video,
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  /* 영상은 화면에 보이지 않게 두고 인식에만 쓴다. */
  opacity: 0;
  pointer-events: none;
}
#canvas { display: block; }

.status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 8px 12px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.55);
}

.intro {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(2, 6, 23, 0.92);
  overflow: auto;
}

.intro[hidden] { display: none; }

.intro-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 520px);
  max-height: 100%;
  overflow: auto;
  padding: 16px;
  border: 1px solid #1e293b;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
}

.intro-title {
  margin: 0;
  font-size: 20px;
}

.intro-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #cbd5e1;
}

.start-btn { flex: 0 0 auto; }

.stop-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  background: rgba(51, 65, 85, 0.85);
}

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

button {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(2, 6, 23, 0.82);
}

.result[hidden] { display: none; }

.result-title {
  margin: 0;
  font-size: 22px;
}

.result-score {
  margin: 0;
  font-size: 16px;
  color: #cbd5e1;
}

.ranking-status {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
  min-height: 18px;
}

.again-btn {
  flex: 0 0 auto;
  padding: 10px 20px;
}
