/* =========================기본 리셋 & 폰트========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nanum Gothic', sans-serif;
  background: #f6f7f9;
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================헤더========================= */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.header__logo {
  height: 40px;
}

.header__title {
  font-size: 20px;
  font-weight: 700;
}

/* =========================상단 안내 영역========================= */
.main-box {
  padding: 20px;
  text-align: center;
}

.main-box p {
  margin: 0 0 12px;
  font-size: 16px;
}

/* 버튼 그룹 */
.btn-group {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn {
  padding: 10px 18px;
  font-size: 15px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  transition: background 0.2s, transform 0.1s;
}

.btn:hover {
  background: #1e40af;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sub {
  background: #6b7280;
}

.btn-sub:hover {
  background: #4b5563;
}

/* =========================카메라 + 정보 영역========================= */
.camera-section {
  display: flex;
  gap: 20px;
  padding: 20px;
  flex: 1;
}

/* =========================카메라 박스 (핵심)========================= */
.cam-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

/* 비디오가 박스를 꽉 채우도록 */
.cam-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* contain으로 바꾸면 잘림 없음 */
  display: block;
}

/* webcam-container는 레이아웃만 담당 */
#webcam-container {
  position: absolute;
  inset: 0;
}

/* =========================카메라 placeholder========================= */
#camera-placeholder {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
  border-radius: 16px;
}

/* =========================오른쪽 정보 박스========================= */
.info-box {
  flex: 1;
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#result {
  font-size: 20px;
  font-weight: 700;
}

#guide {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
}

/* =========================푸터========================= */
footer {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: #6b7280;
}

/* =========================반응형 (태블릿/모바일)========================= */
@media (max-width: 900px) {
  .camera-section {
    flex-direction: column;
    align-items: center;
  }

  .info-box {
    width: 100%;
  }

  .cam-wrap {
    width: 100%;
  }
}