/* Gaegu 폰트를 @font-face로 직접 정의하여 브라우저 간 일관성 보장 */
/* 온라인 웹 폰트만 사용 */
@font-face {
  font-family: "Gaegu";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src:
    url("https://fonts.gstatic.com/s/gaegu/v15/TuGfUVB3xyZ5EOoW_RvsLw.woff2")
      format("woff2"),
    url("https://fonts.gstatic.com/s/gaegu/v15/TuGfUVB3xyZ5EOoW_RvsLw.woff")
      format("woff");
  unicode-range:
    U+0020-007F, U+00A0-00FF, U+AC00-D7A3, U+1100-11FF, U+3130-318F,
    U+A960-A97F, U+D7B0-D7FF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #5f6f52;
  --primary-hover: #46523c;
  --accent-color: #ffc857;
  --background-bg: #f5f5f0;
  --card-bg: #ffffff;
  --text-main: #2c3329;
  --text-sub: #5f6f52;
  --border-color: rgba(44, 51, 41, 0.15);
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: var(--background-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  padding-bottom: 50px;
}

.container {
  width: 100%;
  max-width: 600px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

/* 시작 화면일 때만 컨텐츠를 세로 가운데 정렬 */
#startScreen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: auto;
  max-height: 70vh;
}

#page-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px; /* main card -> FAQ 간격 */
  min-height: 100vh;
  justify-content: flex-start;
  padding-top: 10vh;
}

.screen {
  display: none;
  padding: 40px 20px;
  text-align: center;
}

.screen.active {
  display: block;
}

h1,
h2 {
  color: var(--text-main);
  margin-bottom: 20px;
  word-break: keep-all;
  white-space: normal;
}

h1 {
  font-size: 2.5em;
  color: var(--text-main);
}

/* 서브 텍스트 강조 (옵션) */
#startScreen p {
  color: var(--text-sub);
}

#startScreen p strong,
#startScreen p .accent-number {
  color: var(--accent-color);
  font-weight: 600;
}

.btn {
  padding: 15px 30px;
  font-size: 16px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  margin: 10px;
  word-break: keep-all;
  white-space: normal;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--primary-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.btn-secondary {
  background: #e5e4dc;
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #d7d5c9;
}

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

/* 카메라 화면 */
#cameraScreen {
  display: none;
  padding: 0;
}

#cameraScreen.active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 1000;
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 95vw;
  max-height: calc(80vh - 100px); /* 웹캠 높이 100px 감소 */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
  margin-bottom: 40px;
}

#video {
  width: 100%;
  height: auto;
  max-height: calc(80vh - 100px); /* 웹캠 높이 100px 감소 */
  object-fit: contain;
  display: block;
  transform: scaleX(-1); /* 기본적으로 좌우 반전 적용 */
}

.controls {
  padding: 20px;
}

/* 카운트다운 및 카운터 (비디오 아래) - 0d9af04 스타일 */
.camera-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 0 0 auto;
  margin-top: 20px;
}

.timer-container {
  text-align: center;
}
/* Accessibility & SEO Helper Class */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* 카운트다운 오버레이 — Floating Glass (글래스모피즘) */
.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 20;
  pointer-events: none;
  line-height: 1;
  animation: heartbeat 0.6s ease-in-out infinite;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* 타이머 안내 문구 오버레이 (비디오 중앙 아래) */
.timer-info {
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  font-size: 16px;
  font-weight: 700;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
}

/* 플래시 효과 */
#flashEffect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.1s ease-out;
}

/* 촬영 영역 가이드 마스크 (LAYOUTS.captureRatio 적용, JS에서 aspect-ratio 설정) */
/* 촬영 영역 가이드 — Dark Glass (글래스모피즘, 주변 어둡게 + 반투명 테두리) */
#cameraMask {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  max-width: 100%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 10;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-hover) 100%
  );
  width: 0%;
  transition: width 0.1s linear;
}

.photo-counter {
  font-size: 2.2em;
  color: #fff;
  font-weight: bold;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.4);
  padding: 10px 25px;
  border-radius: 25px;
}

/* 사진 선택 화면 */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.button-group .btn {
  width: 100%;
  margin: 0;
}

/* 사진 선택 화면 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.photo-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.photo-item:hover {
  transform: scale(1.05);
}

.photo-item.selected {
  border-color: var(--accent-color);
  box-shadow: 0 0 18px rgba(255, 200, 87, 0.5);
}

/* 사진 선택 그리드 — LAYOUTS 비율 유지(와이드/세로형 찌그러짐 방지) */
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.photo-item .checkmark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-weight: bold;
  font-size: 18px;
}

/* 결과 화면 */
.result-container {
  margin: 20px 0;
  padding: 20px;
  background: transparent;
  border-radius: 15px;
  /*
    레이아웃(Strip/Grid) 전환 시 아래 UI가 밀리지 않도록
    "보이는 프레임 영역" 높이를 고정한다.
    (캔버스 내부 픽셀 크기 1600/1800이 아니라, 화면상 표시 높이 기준)
  */
  height: 700px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#stickerCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Layout Picker */
.layout-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 15px 10px;
  margin: 0 auto;
}

/* 결과 화면에서는 레이아웃 선택 비활성화 (색상만 변경 가능) */
#resultScreen .layout-picker {
  display: none !important;
}

/* 레이아웃 선택 화면 */
.layout-select-screen-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* 개발 테스트 모드 시: 좌(선택) | 우(미리보기) 2단 구성 */
#layoutSelectScreen.layout-with-preview .layout-select-screen-inner {
  flex-direction: row;
  align-items: flex-start;
  max-width: none;
  gap: 32px;
}

#layoutSelectScreen.layout-with-preview .layout-select-main {
  flex: 1;
  min-width: 0;
}

.layout-frame-preview-panel {
  display: none;
  flex-shrink: 0;
  width: 280px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

#layoutSelectScreen.layout-with-preview
  .layout-frame-preview-panel.layout-frame-preview-panel-visible {
  display: block;
}

.layout-frame-preview-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px 0;
}

.layout-frame-preview {
  position: relative;
  width: 100%;
  height: auto;
  max-height: 420px;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border-color);
  container-type: size;
  container-name: frame-preview;
}

.layout-frame-preview-slot {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.25);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}

/* 푸터: 브랜드·날짜·QR (실제 스티커와 동일 비율·위치) */
.layout-frame-preview-brand,
.layout-frame-preview-date,
.layout-frame-preview-qr {
  position: absolute;
  pointer-events: none;
  color: #333333;
  font-family: "Gaegu", cursive, sans-serif;
}

.layout-frame-preview-brand {
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.2;
}

.layout-frame-preview-date {
  display: flex;
  align-items: flex-end;
  line-height: 1.2;
}

.layout-frame-preview-qr {
  overflow: hidden;
}

.layout-frame-preview-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.layout-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin: 30px auto;
  max-width: 900px;
  overflow-x: hidden;
  overflow-y: visible;
}

/* 레이아웃 카테고리 */
.layout-category {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  overflow: visible;
}

.layout-category:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.layout-category-content {
  display: flex;
  align-items: center;
  gap: 25px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  width: 100%;
  overflow: visible;
}

.layout-category-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}

.layout-category-options {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  overflow: visible;
  padding: 5px 0;
}

.layout-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  width: 104px;
  padding: 6px;
  overflow: visible;
}

.layout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  width: 92px;
  min-width: 92px;
  height: 88px;
  box-sizing: border-box;
}

.layout-btn:hover {
  border-color: var(--primary-color);
  background: rgba(255, 200, 87, 0.1);
}

.layout-btn.active {
  border-color: var(--primary-color);
  background: rgba(95, 111, 82, 0.12);
  color: var(--text-main);
}

/* active 상태에서도 미리보기·라벨은 노란/검정 유지 (겹침 방지용 여백 확보) */
.layout-btn.active .layout-preview .preview-box {
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
}

/* Layout Preview: LAYOUTS 비율 반영, 버튼 내 고정 영역만 사용 (라벨 침범 방지) */
.layout-preview {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: -14px;
  max-width: 44px;
  max-height: 44px;
  overflow: hidden;
  box-sizing: border-box;
}

.layout-strip {
  flex-direction: column;
  width: 14px;
  height: 40px;
  justify-content: space-between;
  flex-shrink: 0;
  align-self: center;
}

.layout-grid {
  flex-wrap: wrap;
  width: 30px;
  height: 40px;
  flex-shrink: 0;
  align-self: center;
}

.preview-box {
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
  border-radius: 2px;
  transition: background 0.2s ease;
}

.layout-preview.layout-strip {
  flex-direction: column;
  width: 14px;
  height: 40px;
  justify-content: space-between;
  flex-shrink: 0;
  align-self: center;
}

.layout-strip .preview-box {
  width: 100%;
  min-height: 0;
  flex: 1 1 0;
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
  border-radius: 2px;
}

.layout-preview.layout-grid {
  width: 30px;
  height: 40px;
}

.layout-grid .preview-box {
  width: calc(50% - 1px);
  height: auto;
  flex: 0 0 calc(50% - 1px);
  aspect-ratio: 3 / 4;
  min-height: 0;
}

.layout-horizontal {
  flex-direction: row;
  width: 36px;
  height: 12px;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

.layout-horizontal .preview-box {
  min-width: 0;
  height: 100%;
  flex: 1 1 0;
  aspect-ratio: 2 / 3;
}

.layout-vertical3 {
  flex-direction: column;
  width: 14px;
  height: 32px;
  justify-content: space-between;
  flex-shrink: 0;
  align-self: center;
}

.layout-vertical3 .preview-box {
  width: 100%;
  min-height: 0;
  flex: 1 1 0;
  aspect-ratio: 3 / 2;
}

.layout-horizontal3 {
  flex-direction: row;
  width: 26px;
  height: 12px;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

.layout-horizontal3 .preview-box {
  min-width: 0;
  height: 100%;
  flex: 1 1 0;
  aspect-ratio: 2 / 3;
}

.layout-single {
  width: 28px;
  height: 28px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  align-self: center;
}

.layout-single .preview-box {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

/* 6컷 (2×3) 미리보기 - 3:4 셀 비율 유지 */
.layout-sixcut {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  width: 22px;
  height: 44px;
  gap: 2px;
  flex-shrink: 0;
  align-self: center;
}

.layout-sixcut .preview-box {
  width: 100%;
  min-height: 0;
  aspect-ratio: 3 / 4;
}

/* 매거진 (좌 1장 + 우 2장) 미리보기 */
.layout-preview.layout-magazine {
  display: grid !important;
  grid-template-columns: 12px 12px;
  grid-template-rows: 12px 12px;
  gap: 2px;
  width: 26px !important;
  height: 26px !important;
  flex-shrink: 0;
  align-self: center;
  box-sizing: border-box;
}

.layout-preview.layout-magazine .preview-box:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 10px;
  min-height: 22px;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
  border-radius: 2px;
}

.layout-preview.layout-magazine .preview-box:nth-child(2),
.layout-preview.layout-magazine .preview-box:nth-child(3) {
  min-width: 10px;
  min-height: 10px;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
  border-radius: 2px;
}

.layout-preview.layout-magazine .preview-box:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.layout-preview.layout-magazine .preview-box:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.layout-magazine .preview-box {
  min-height: 0;
  min-width: 0;
}

.layout-label {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

/* 레이아웃 선택 화면 큰 미리보기 */
.layout-preview-container {
  width: 100%;
  max-width: 75px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.layout-preview-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.7);
}

.layout-option:has(.layout-btn.active) .layout-preview-container {
  border: 3px solid var(--primary-color);
  background: rgba(255, 200, 87, 0.15);
}

.layout-preview-large {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.layout-preview-strip-large {
  flex-direction: column;
  gap: 2px;
  width: 35px;
  height: 85px;
}

.layout-preview-grid-large {
  flex-wrap: wrap;
  gap: 2px;
  width: 60px;
  height: 60px;
}

.layout-preview-horizontal-large {
  flex-direction: row;
  gap: 2px;
  width: 85px;
  height: 20px;
}

.layout-preview-vertical3-large {
  flex-direction: column;
  gap: 2px;
  width: 35px;
  height: 65px;
}

.layout-preview-horizontal3-large {
  flex-direction: row;
  gap: 2px;
  width: 60px;
  height: 20px;
}

.layout-preview-single-large {
  width: 45px;
  height: 45px;
  justify-content: center;
  align-items: center;
}

.preview-box-large {
  background: linear-gradient(135deg, #ffc857 0%, #ffd89b 100%);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.layout-preview-strip-large .preview-box-large {
  width: 100%;
  height: calc(25% - 6px);
  flex-shrink: 0;
}

.layout-preview-grid-large .preview-box-large {
  width: calc(50% - 4px);
  height: calc(50% - 4px);
  flex-shrink: 0;
}

.layout-preview-horizontal-large .preview-box-large {
  width: calc(25% - 4.5px);
  height: 100%;
  flex-shrink: 0;
}

.layout-preview-vertical3-large .preview-box-large {
  width: 100%;
  height: calc(33.33% - 4px);
  flex-shrink: 0;
}

.layout-preview-horizontal3-large .preview-box-large {
  width: calc(33.33% - 4px);
  height: 100%;
  flex-shrink: 0;
}

.layout-preview-single-large .preview-box-large {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
}

.layout-preview-large.active .preview-box-large:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Timer Info */
/* Theme Picker */
.theme-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 15px 10px;
  margin: 0 auto;
}

.theme-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid #e0e0e0;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  position: relative;
}

/* 첫 번째 버튼: 왼쪽만 둥글게 */
.theme-btn:first-child {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

/* 마지막 버튼: 오른쪽만 둥글게 */
.theme-btn:last-child {
  border-radius: 0 8px 8px 0;
  border-left: 1px solid #e0e0e0;
}

/* 버튼이 하나만 있을 때 */
.theme-btn:only-child {
  border-radius: 8px;
  border-right: 2px solid #e0e0e0;
}

.theme-btn:hover:not(.active) {
  background: rgba(95, 111, 82, 0.05);
}

.theme-btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
  z-index: 1;
}

.theme-btn.active + .theme-btn {
  border-left-color: #333;
}

/* Color Picker */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 20px 10px;
  max-width: 350px;
  margin: 0 auto;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
  padding: 0;
  background: none;
  outline: none;
  margin: 4px;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  transform: scale(1.2);
  border: 2px solid #333;
}

/* Date Option */
.date-option {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0;
}

.date-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  user-select: none;
}

.date-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.result-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-section {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.share-label {
  font-size: 13px;
  color: var(--text-sub);
}

.share-btn {
  border-radius: 999px;
  border: 1px solid rgba(95, 111, 82, 0.35);
  background: rgba(95, 111, 82, 0.06);
  color: var(--text-main);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.share-btn:hover {
  background: rgba(255, 200, 87, 0.15);
  border-color: var(--accent-color);
  color: var(--text-main);
}

/* Processing Modal */
#processing-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.processing-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.processing-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  word-break: keep-all;
  white-space: normal;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#faq-section {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#faq-section details {
  border-bottom: 1px solid var(--border-color);
  padding: 15px 0;
}

#faq-section summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  word-break: keep-all;
  white-space: normal;
}

#faq-section summary::-webkit-details-marker {
  display: none;
}

#faq-section summary::after {
  content: "▸";
  color: var(--text-main);
  font-size: 14px;
  transition: transform 0.2s ease;
}

#faq-section details[open] summary::after {
  transform: rotate(90deg);
}

#faq-section .faq-body {
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 6px;
  word-break: keep-all;
  white-space: pre-line;
}

#page-footer {
  padding: 20px 0 50px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  font-size: 12px;
}

.footer-links a {
  color: var(--text-sub);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.ad-placeholder {
  width: 300px;
  max-width: 100%;
  height: 250px;
  background: rgba(95, 111, 82, 0.08);
  border: 1px solid rgba(95, 111, 82, 0.18);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-weight: 600;
  text-align: center;
  padding: 8px;
  position: relative;
  overflow: hidden;
}

.ad-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  opacity: 0.8;
}

.ad-placeholder::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 3px solid rgba(95, 111, 82, 0.25);
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-top-color: transparent;
  animation: ad-spinner 1.4s linear infinite;
}

@keyframes ad-spinner {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.processing-progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

#processing-progress {
  height: 100%;
  width: 0%;
  background: var(--accent-color);
  transition: width 0.2s linear;
}

/* Guide Section */
#guide-section {
  max-width: 700px;
  margin: 60px auto 40px;
  padding: 0 20px;
}

#guide-section h2 {
  font-size: 1.8em;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 40px;
  word-break: keep-all;
  white-space: normal;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}

.guide-item {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 25px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.guide-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.guide-item .icon {
  font-size: 2.5em;
  margin-bottom: 15px;
  text-align: center;
}

.guide-item h3 {
  font-size: 1.2em;
  color: var(--text-main);
  margin-bottom: 12px;
  font-weight: 600;
  word-break: keep-all;
  white-space: normal;
}

.guide-item p {
  font-size: 0.95em;
  color: #666;
  line-height: 1.6;
  margin: 0;
  word-break: keep-all;
  white-space: normal;
}

@media (max-width: 600px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .photo-item img {
    height: 100%;
    object-fit: contain;
  }

  h1 {
    font-size: 2em;
  }

  #cameraScreen {
    padding: 0;
  }

  .camera-container {
    max-width: 95vw;
    max-height: 70vh;
    margin-bottom: 30px;
  }

  #video {
    max-height: 70vh;
  }

  .countdown {
    font-size: 5rem;
  }

  .photo-counter {
    font-size: 1.5em;
    padding: 8px 20px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  #guide-section {
    margin: 50px auto 30px;
    padding: 0 15px;
  }

  #guide-section h2 {
    font-size: 1.5em;
    margin-bottom: 30px;
  }

  .result-container {
    /* 모바일에서도 레이아웃 전환 시 높이 변화가 없도록 동일 기준 유지 */
    height: min(700px, 70vh);
    padding: 15px;
  }

  .guide-item {
    padding: 20px;
  }
}

/* Loading Screen */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 245, 240, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-content svg {
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
}

.loading-content p {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 500;
}

/* Loading Animations */
@keyframes bounce {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-15px);
  }
}

@keyframes shuffle {
  0%,
  100% {
    transform: rotate(-10deg);
  }
  50% {
    transform: rotate(10deg);
  }
}

.loading-overlay .face-layer {
  animation: bounce 0.8s infinite alternate;
}

.loading-overlay .stack-layer {
  animation: shuffle 1.6s infinite ease-in-out;
}

/* Mascot Logo (Main Page) */
#mascotLogo {
  width: 80px;
  height: 80px;
  display: block;
  margin: 30px auto 0;
  transition: transform 0.2s ease;
}

.mascot-cursor {
  cursor: pointer;
}

.mascot-anim {
  animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
  0% {
    transform: rotate(-5deg);
  }
  25% {
    transform: rotate(5deg);
  }
  50% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Shutter Button (Camera Screen) */
#cameraScreen {
  position: relative;
}

.shutter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  transition: transform 0.2s ease;
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.shutter-btn img {
  width: 60px;
  height: 60px;
  display: block;
}

.shutter-btn:hover {
  transform: translateX(-50%) scale(1.1);
}

.shutter-btn:active {
  transform: translateX(-50%) scale(0.9);
}
