/*
-----------------------------------------------------------
Copyright (c) 2026 Ahngunism. All rights reserved.
-----------------------------------------------------------
File    : style.css
Project : 2303_MOON_BABY
Theme   : Soft & warm — baby saju calculator
-----------------------------------------------------------
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg:        #fdf8f6;
  --bg-card:   #ffffff;
  --bg-hover:  #fdf3ef;
  --bg-muted:  #f7f0ec;

  --ink:       #2c1810;
  --ink-2:     #3d2116;
  --ink-3:     #7a5548;
  --ink-4:     #a67c6e;
  --ink-5:     #c9afa6;

  --line:      #ecddd8;
  --line-2:    #dccfc9;

  --peach:     #f97316;
  --peach-soft:#fff4ee;
  --peach-mid: #ffe5d5;
  --lavender:  #a78bfa;
  --lav-soft:  #f5f3ff;
  --mint:      #10b981;
  --mint-soft: #ecfdf5;
  --gold:      #d97706;
  --gold-soft: #fffbeb;

  --ok:        #059669;
  --ok-soft:   #ecfdf5;
  --warn:      #d97706;
  --warn-soft: #fffbeb;
  --bad:       #dc2626;
  --bad-soft:  #fef2f2;

  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-1:  0 1px 3px rgba(44,24,16,0.06), 0 1px 2px rgba(44,24,16,0.04);
  --shadow-2:  0 8px 24px -6px rgba(44,24,16,0.10), 0 2px 6px rgba(44,24,16,0.04);
  --shadow-3:  0 20px 48px -12px rgba(44,24,16,0.14);

  --font: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
input, select { font-family: inherit; }

/* ============================================================
   CONTAINERS
   ============================================================ */
.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}
.wrap-wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  background: rgba(253,248,246,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
}
.brand-icon { font-size: 22px; line-height: 1; }
.topbar-meta {
  font-size: 13px;
  color: var(--ink-4);
  font-weight: 500;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 500px; height: 500px;
  background: radial-gradient(ellipse, rgba(249,115,22,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-emoji { font-size: 56px; line-height: 1; margin-bottom: 20px; }
.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--peach);
  margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 16px;
}
.hero-title span { color: var(--peach); }
.hero-sub {
  font-size: 16px;
  color: var(--ink-3);
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--peach);
  color: #fff;
  box-shadow: 0 4px 14px rgba(249,115,22,0.35);
}
.btn-primary:hover {
  background: #ea6c0a;
  box-shadow: 0 6px 20px rgba(249,115,22,0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; font-size: 16px; padding: 16px 28px; border-radius: 14px; }
.btn-lg { padding: 16px 36px; font-size: 16px; }

/* ============================================================
   FORM CARD
   ============================================================ */
.form-section { padding: 0 0 80px; }

.input-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-2);
  margin-bottom: 20px;
}
.input-card + .input-card { margin-top: 0; }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.card-icon.dad  { background: #eff6ff; }
.card-icon.mom  { background: #fdf4ff; }
.card-icon.baby { background: var(--peach-soft); }
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.card-sub {
  font-size: 13px;
  color: var(--ink-4);
  margin-top: 2px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.field-row-3 { grid-template-columns: repeat(3, 1fr); }
.field-row-1 { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.field select,
.field input[type="date"],
.field input[type="number"] {
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--peach);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a67c6e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.submit-wrap {
  margin-top: 8px;
}
.submit-hint {
  text-align: center;
  font-size: 13px;
  color: var(--ink-5);
  margin-top: 12px;
}

/* ============================================================
   RESULT PAGE
   ============================================================ */

/* 상단 요약 */
.result-hero {
  padding: 48px 0 32px;
  text-align: center;
}
.result-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--peach-soft);
  border: 1px solid var(--peach-mid);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--peach);
  margin-bottom: 20px;
}
.result-title {
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.3;
}
.result-sub {
  font-size: 15px;
  color: var(--ink-3);
}

/* 부모 사주 요약 카드 */
.parents-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 32px 0;
}
.parent-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
}
.parent-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.parent-emoji { font-size: 20px; }
.parent-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.pillar-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pillar-cell {
  background: var(--bg-muted);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
}
.pillar-cell-label {
  font-size: 10px;
  color: var(--ink-5);
  margin-bottom: 3px;
  font-weight: 500;
}
.pillar-cell-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.pillar-cell-sub {
  font-size: 10px;
  color: var(--ink-4);
}

/* 오행 분포 */
.elem-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.elem-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 추천 TOP 3 */
.top3-section { padding: 0 0 40px; }
.section-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--peach);
  margin-bottom: 8px;
}
.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 24px;
}
.top3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.top-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-1);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.top-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.top-card.rank-1 {
  border-color: var(--peach);
  background: linear-gradient(145deg, #fff, var(--peach-soft));
}
.top-card.rank-1::before {
  content: '추천';
  position: absolute;
  top: 12px; right: -22px;
  background: var(--peach);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 28px;
  transform: rotate(45deg);
}
.top-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.top-rank.rank-1 { color: var(--peach); }
.top-time-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 2px;
}
.top-time-range {
  font-size: 12px;
  color: var(--ink-4);
  margin-bottom: 12px;
}
.top-score-wrap {
  margin: 12px 0;
}
.top-score {
  font-size: 36px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}
.top-score.rank-1 { color: var(--peach); }
.top-score-unit {
  font-size: 13px;
  color: var(--ink-4);
  font-weight: 500;
}
.top-animal {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.trait-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}
.trait-tag {
  background: var(--bg-muted);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

/* 전체 점수 차트 */
.chart-section { padding: 0 0 48px; }
.chart-list { display: flex; flex-direction: column; gap: 10px; }

.chart-row {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-1);
}
.chart-row:hover { border-color: var(--peach); box-shadow: var(--shadow-2); }
.chart-row.active { border-color: var(--peach); background: var(--peach-soft); }
.chart-row.top-rank-row { border-color: var(--peach); }

.chart-row-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.chart-rank-badge {
  min-width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  flex-shrink: 0;
}
.chart-rank-badge.r1 { background: var(--peach); color: #fff; }
.chart-rank-badge.r2 { background: var(--lavender); color: #fff; }
.chart-rank-badge.r3 { background: var(--mint); color: #fff; }

.chart-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}
.chart-name-sub { font-size: 12px; color: var(--ink-4); font-weight: 400; margin-left: 4px; }
.chart-time { font-size: 12px; color: var(--ink-4); }
.chart-score-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  min-width: 42px;
  text-align: right;
}
.chart-score-val.high { color: var(--peach); }

.chart-bar-wrap {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 100px;
  overflow: hidden;
}
.chart-bar {
  height: 100%;
  border-radius: 100px;
  background: var(--line-2);
  transition: width 0.6s var(--ease);
}
.chart-bar.high  { background: linear-gradient(90deg, #f97316, #fb923c); }
.chart-bar.mid   { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }
.chart-bar.low   { background: var(--line-2); }

/* 상세 패널 */
.detail-panel {
  display: none;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.detail-panel.open { display: block; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-box {
  background: var(--bg-muted);
  border-radius: 10px;
  padding: 14px;
}
.detail-box-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.detail-pillar-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.detail-pillar-cell {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
}
.detail-pillar-label { font-size: 10px; color: var(--ink-5); }
.detail-pillar-val   { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.detail-pillar-sub   { font-size: 10px; color: var(--ink-4); }

.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.breakdown-label { color: var(--ink-3); flex: 1; }
.breakdown-bar-wrap {
  flex: 2;
  height: 6px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
}
.breakdown-bar {
  height: 100%;
  border-radius: 100px;
  background: var(--peach);
  transition: width 0.5s var(--ease);
}
.breakdown-val {
  font-weight: 700;
  color: var(--ink);
  min-width: 30px;
  text-align: right;
  font-size: 12px;
}

.detail-desc {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.7;
  margin-top: 8px;
}
.detail-fortune {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 10px;
}

/* 오행 배지 */
.elem-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

/* 등급 */
.grade-s { color: var(--peach); }
.grade-a { color: var(--lavender); }
.grade-b { color: var(--mint); }
.grade-c { color: var(--ink-4); }

/* 광고 영역 */
.ad-area { padding: 32px 0; }
.ad-grid {
  display: grid;
  grid-template-columns: repeat(2, 320px);
  gap: 12px;
  justify-content: center;
}
.ad-cell { width: 320px; min-height: 50px; }

/* 푸터 */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-4);
}
.footer-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--peach);
  padding: 8px 16px;
  border: 1.5px solid var(--peach-mid);
  border-radius: 8px;
  transition: all 0.15s;
  margin-bottom: 32px;
  display: inline-flex;
}
.footer-back:hover { background: var(--peach-soft); }

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--ink-4);
}
.empty-state h2 { font-size: 20px; color: var(--ink-3); margin-bottom: 8px; }

/* 로딩 */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(253,248,246,0.85);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 200;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--peach-mid);
  border-top-color: var(--peach);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; color: var(--ink-3); font-weight: 500; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row-3 { grid-template-columns: 1fr 1fr; }
  .parents-summary { grid-template-columns: 1fr; }
  .top3-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .ad-grid { grid-template-columns: 320px; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .input-card { padding: 22px 18px; }
}
@media (max-width: 400px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .pillar-row { grid-template-columns: repeat(4,1fr); }
}
