/* ==========================================================================
   디자인 토큰
   - 배경: 맑은 하늘색(도로/야외 안전 캠페인 느낌)
   - 포인트: 스쿨존 옐로우(주의·경쾌함), 산호빛 레드(강조는 최소한으로)
   ========================================================================== */
:root {
  --color-bg: #EAF4FC;
  --color-surface: #FFFFFF;
  --color-text: #1F3B57;
  --color-text-muted: #5C7590;
  --color-line: #D8E6F2;
  --color-accent: #FFB238;
  --color-accent-ink: #21324A;
  --color-signal: #E8593F;
  --color-success: #2E9E63;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 28px rgba(31, 59, 87, 0.10);
  --font-main: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Malgun Gothic", "맑은 고딕", sans-serif;
  --max-width: 480px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app-shell {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
  padding-bottom: 110px; /* 하단 고정 버튼 공간 확보 */
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ==========================================================================
   진행 표시 점
   ========================================================================== */
.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 16px 0 4px;
}
.progress-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-line);
  transition: background .2s ease, transform .2s ease;
}
.progress-dots span.done { background: var(--color-success); }
.progress-dots span.now { background: var(--color-accent); transform: scale(1.3); }

/* ==========================================================================
   화면 전환
   ========================================================================== */
.screen { display: none; padding: 8px 22px 24px; }
.screen.active { display: block; animation: fadeUp .28s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   공통 타이포그래피
   ========================================================================== */
.eyebrow-orgs {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 6px;
}
h1.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  white-space: pre-line;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
h2.screen-title {
  font-size: 21px;
  font-weight: 800;
  margin: 4px 0 14px;
}
p.desc {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0 0 20px;
}

/* ==========================================================================
   하단 고정 CTA
   ========================================================================== */
.cta-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-bg) 60%, rgba(234,244,252,0));
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-outline {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-line);
}
.btn-text {
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  flex: none;
  padding: 12px 6px;
}

/* ==========================================================================
   화면 1: 메인
   ========================================================================== */
.hero-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: var(--color-surface) center/cover no-repeat;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}
.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--color-surface);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 22px;
}
.stat-pill strong { font-size: 18px; color: var(--color-signal); }
.stat-pill span { font-size: 13px; color: var(--color-text-muted); }

/* ==========================================================================
   화면 2: 가족안전약속 목록
   ========================================================================== */
.promise-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.promise-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  font-size: 15px;
}
.promise-num {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   화면 3: 가족명 입력
   ========================================================================== */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.field input[type="text"],
.field input[type="tel"] {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-line);
  font-size: 16px;
  background: var(--color-surface);
  color: var(--color-text);
}
.field input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.field-hint { font-size: 13px; color: var(--color-text-muted); margin-top: 6px; }
.char-count { font-size: 12px; color: var(--color-text-muted); text-align: right; margin-top: 4px; }

.notice-box {
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}

/* ==========================================================================
   화면 4: 인증서
   ========================================================================== */
.certificate-wrap {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  margin-bottom: 18px;
}
#certificateCanvas { width: 100%; height: auto; border-radius: var(--radius-md); display: block; }

.share-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.share-row .btn { font-size: 14.5px; padding: 14px 10px; }

.ios-save-hint {
  display: none;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 10px;
}

/* ==========================================================================
   화면: 경품 응모 여부 / 완료
   ========================================================================== */
.choice-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 20px;
  text-align: center;
  margin-bottom: 20px;
}
.choice-card .emoji { font-size: 34px; margin-bottom: 10px; }

.consent-box {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px;
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}
.consent-box p { margin: 0 0 8px; }
.consent-box .warn { color: var(--color-signal); font-weight: 700; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 2px;
  font-size: 14px;
}
.checkbox-row input[type="checkbox"] {
  width: 20px; height: 20px; margin-top: 1px; accent-color: var(--color-accent);
}

.end-icon { font-size: 46px; text-align: center; margin: 30px 0 12px; }
.end-title { text-align: center; font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.end-desc { text-align: center; color: var(--color-text-muted); font-size: 14.5px; margin-bottom: 26px; }

.error-msg {
  background: #FDECEA;
  color: var(--color-signal);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

.hp-field { position: absolute; left: -9999px; top: -9999px; }

@media (max-width: 360px) {
  h1.hero-title { font-size: 23px; }
}
