/* SNOVAHA 각도법 — 감성 리디자인 */
:root {
  --bg: #fdfcff;
  --surface: #ffffff;
  --text-primary: #191f28;
  --text-secondary: #4e5968;
  --text-tertiary: #8b95a1;
  --primary: #3182f6;
  --primary-hover: #1b64da;
  --pink: #f26d9c;
  --pink-soft: #ffe4ee;
  --blue: #4d8df6;
  --blue-soft: #e3eeff;
  --gold: #f5b942;
  --border: #ecebf3;
  --night: #0b1026;
  --shadow-sm: 0 2px 4px rgba(25, 31, 40, 0.04);
  --shadow-md: 0 6px 16px rgba(25, 31, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(25, 31, 40, 0.12);
  --radius: 16px;
  --radius-lg: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ───────── Nav ───────── */
.global-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(253, 252, 255, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(236, 235, 243, 0.7);
  z-index: 100;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.nav-logo:hover { opacity: 0.75; }
.nav-back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.nav-back:hover { color: var(--primary); }

/* ───────── Hero ───────── */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(242, 109, 156, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(77, 141, 246, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(245, 185, 66, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #fbf8ff 0%, #fdfcff 100%);
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: var(--blue-soft);
  padding: 8px 16px;
  border-radius: 999px;
  margin-bottom: 24px;
  animation: fadeInUp 0.8s ease both;
}
.hero h1 {
  font-size: 44px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  animation: fadeInUp 0.8s ease 0.1s both;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--pink) 0%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .sub {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  animation: fadeInUp 0.8s ease 0.2s both;
}
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 10px 18px;
  border-radius: 999px;
  margin-bottom: 36px;
  animation: fadeInUp 0.8s ease 0.3s both;
}
.hero-cta { animation: fadeInUp 0.8s ease 0.4s both; }

/* 떠다니는 별 */
.star {
  position: absolute;
  color: var(--gold);
  opacity: 0;
  animation: twinkle 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50% { opacity: 0.85; transform: scale(1.1); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  transition: var(--transition);
}
.btn.primary {
  background: linear-gradient(120deg, var(--pink) 0%, var(--blue) 120%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(242, 109, 156, 0.35);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(242, 109, 156, 0.45); }
.btn.solid {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(49, 130, 246, 0.3);
}
.btn.solid:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn.outline {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn.outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn.small { padding: 10px 18px; font-size: 14px; border-radius: 10px; }

/* ───────── App ───────── */
.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 20px 40px;
}
.app-header { text-align: center; margin-bottom: 40px; }
.app-header h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.app-header p { color: var(--text-secondary); font-size: 15px; }

/* 스텝 인디케이터 */
.stepper {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
}
.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 96px;
  position: relative;
  color: var(--text-tertiary);
  font-size: 12.5px;
  font-weight: 600;
}
.step-dot::before {
  content: attr(data-n);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 800;
  transition: var(--transition);
}
.step-dot:not(:first-child)::after {
  content: '';
  position: absolute;
  top: 17px;
  right: calc(50% + 22px);
  width: calc(100% - 44px);
  height: 2px;
  background: var(--border);
}
.step-dot.active { color: var(--primary); }
.step-dot.active::before {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(49, 130, 246, 0.35);
}
.step-dot.done { color: var(--text-secondary); }
.step-dot.done::before {
  content: '✓';
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--primary);
}

/* 스텝 패널 */
.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
  animation: fadeInUp 0.5s ease both;
}
.panel.active { display: block; }
.panel h3 { font-size: 21px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.01em; }
.panel .panel-sub { color: var(--text-secondary); font-size: 14.5px; margin-bottom: 24px; }

/* Step 1: 주수 */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.week-chip {
  padding: 18px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.week-chip small { display: block; font-size: 12px; font-weight: 500; color: var(--text-tertiary); margin-top: 4px; }
.week-chip:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.week-chip.selected {
  border-color: var(--primary);
  background: var(--blue-soft);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(49, 130, 246, 0.18);
}
.week-chip.selected small { color: var(--primary); }
.week-note {
  display: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 24px;
}
.week-note.ok { display: block; background: #eef8f1; color: #1c7a3d; }
.week-note.warn { display: block; background: #fff7e8; color: #9a6b12; }

/* Step 2: 업로드 */
.dropzone {
  border: 2px dashed #cfd6e4;
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafbff;
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--blue-soft);
}
.dropzone .dz-icon { font-size: 40px; margin-bottom: 12px; }
.dropzone .dz-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.dropzone .dz-sub { font-size: 13.5px; color: var(--text-tertiary); }
.upload-privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f2f8f4;
  color: #1c7a3d;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 20px;
}
.upload-error {
  display: none;
  background: #fdf0f0;
  color: #c0392b;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.upload-error.show { display: block; }

/* Step 3: 측정 */
.measure-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
}
.guide-chip.spine { background: var(--blue-soft); color: var(--blue); }
.guide-chip.nub { background: var(--pink-soft); color: var(--pink); }
.guide-chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.guide-chip.spine .dot { background: var(--blue); }
.guide-chip.nub .dot { background: var(--pink); }

.canvas-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #10131c;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  touch-action: none;
}
#measureCanvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }

.measure-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.angle-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
}
.angle-readout .val { font-size: 34px; letter-spacing: -0.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.angle-readout .hint { font-size: 13px; font-weight: 600; color: var(--text-tertiary); }
.brightness-ctl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.brightness-ctl input[type="range"] { width: 130px; accent-color: var(--primary); }

.panel-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.panel-actions .spacer { flex: 1; }

/* ───────── 가이드/주의 섹션 ───────── */
.info-section { max-width: 760px; margin: 0 auto; padding: 48px 20px; }
.info-section h2 { font-size: 26px; font-weight: 800; margin-bottom: 24px; letter-spacing: -0.02em; text-align: center; }
.info-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.info-card h4 { font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.info-card p { font-size: 14px; color: var(--text-secondary); }

.disclaimer {
  max-width: 760px;
  margin: 0 auto 72px;
  padding: 0 20px;
}
.disclaimer-box {
  background: #fff7e8;
  border: 1px solid #f3e3bd;
  border-radius: var(--radius);
  padding: 22px 24px;
  font-size: 13.5px;
  color: #7a5a10;
  line-height: 1.7;
}
.disclaimer-box strong { display: block; font-size: 15px; margin-bottom: 6px; }

.site-footer {
  padding: 40px 24px 56px;
  text-align: center;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  font-size: 13px;
  background: var(--surface);
}
.site-footer a { color: var(--text-secondary); text-decoration: none; font-weight: 600; }

/* ───────── 결과 오버레이 ───────── */
.reveal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1a2242 0%, var(--night) 70%);
  overflow-y: auto;
  padding: 24px;
}
.reveal-overlay.show { display: flex; }

/* phase 1: 심장박동 */
.heartbeat-stage { text-align: center; color: #fff; animation: fadeInUp 0.6s ease both; }
.heart {
  font-size: 84px;
  display: inline-block;
  animation: heartbeat 1.15s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(242, 109, 156, 0.55));
  margin-bottom: 28px;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.22); }
  28% { transform: scale(1); }
  42% { transform: scale(1.22); }
  70% { transform: scale(1); }
}
.heartbeat-stage p { font-size: 17px; color: rgba(255, 255, 255, 0.85); font-weight: 500; }
.heartbeat-stage .dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* phase 2: 결과 */
.result-stage {
  display: none;
  width: 100%;
  max-width: 460px;
  text-align: center;
  color: #fff;
  animation: fadeInUp 0.7s ease both;
  padding: 40px 0;
}
.result-stage.show { display: block; }
.result-emoji { font-size: 72px; margin-bottom: 16px; display: inline-block; animation: pop 0.8s cubic-bezier(0.2, 1.6, 0.4, 1) both 0.15s; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.result-title { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.result-title .girl { color: #ff9dbf; }
.result-title .boy { color: #8ab6ff; }
.result-message { font-size: 16px; color: rgba(255, 255, 255, 0.85); margin-bottom: 30px; line-height: 1.7; }

.result-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 20px;
  min-width: 104px;
}
.stat-card .label { font-size: 12px; color: rgba(255, 255, 255, 0.55); margin-bottom: 2px; }
.stat-card .value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.conf-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 0 auto 10px;
  max-width: 320px;
}
.conf-bar .fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}
.conf-bar .fill.girl { background: linear-gradient(90deg, #ff9dbf, #f26d9c); }
.conf-bar .fill.boy { background: linear-gradient(90deg, #8ab6ff, #4d8df6); }
.result-weeknote { font-size: 13px; color: rgba(255, 255, 255, 0.55); margin-bottom: 30px; }

.result-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.result-actions .btn { width: 100%; max-width: 320px; }
.btn.ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.btn.ghost:hover { border-color: rgba(255, 255, 255, 0.6); color: #fff; }
.result-disclaimer { margin-top: 26px; font-size: 12px; color: rgba(255, 255, 255, 0.4); line-height: 1.6; }

/* 별 버스트 */
.burst-star {
  position: fixed;
  z-index: 1001;
  pointer-events: none;
  font-size: 20px;
  animation: burst 1.4s ease-out forwards;
}
@keyframes burst {
  0% { transform: translate(0, 0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.15); opacity: 0; }
}

/* ───────── 광고 (AdSense 설정 시에만 노출) ───────── */
.ad-section { max-width: 760px; margin: 0 auto; padding: 0 20px 24px; }
.ad-box { display: none; margin: 24px auto 0; width: 100%; max-width: 400px; text-align: center; }
.ad-box.ad-visible { display: block; }
.ad-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.reveal-overlay .ad-label { color: rgba(255, 255, 255, 0.4); }
.ad-unit {
  display: block;
  min-height: 250px;
  border-radius: 12px;
  background: rgba(128, 128, 160, 0.06);
}
.reveal-overlay .ad-unit { background: rgba(255, 255, 255, 0.05); }

/* ───────── 반응형 ───────── */
@media (min-width: 768px) {
  .hero h1 { font-size: 56px; }
  .hero .sub { font-size: 20px; }
  .info-cards { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 40px 44px; }
  .result-actions { flex-direction: row; justify-content: center; }
  .result-actions .btn { width: auto; }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 34px; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .angle-readout .val { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
