/* ===== 리셋 & 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2C7A6F;
  --primary-dark: #1A3C34;
  --primary-light: #E8F5F3;
  --secondary: #F4A261;
  --accent: #E76F51;
  --text: #1E293B;
  --text-mid: #475569;
  --text-light: #94A3B8;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --bottom-nav-h: 64px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  /* 하단 탭바 공간 확보 */
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input { font-family: inherit; font-size: 16px; /* iOS 줌 방지 */ }

.hidden { display: none !important; }

/* ===== 헤더 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary-dark);
  padding: env(safe-area-inset-top) 0 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 16px;
}

.logo {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo span { color: var(--secondary); }

.header-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

/* ===== 메인 ===== */
.main { padding: 0 0 24px; }

/* ===== 히어로 ===== */
.hero {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 28px 20px 32px;
  color: #fff;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 12px;
}

.hero-hl { color: var(--secondary); }

.hero-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  line-height: 1.8;
}

/* ===== 카드 섹션 (입력 폼) ===== */
.card-section {
  background: var(--card);
  margin: 16px 16px 0;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ===== 탭 ===== */
.tab-wrap {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  transition: all 0.2s;
  /* 터치 영역 최소 44px */
  min-height: 44px;
}

.tab-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ===== 폼 ===== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.req { color: var(--accent); font-size: 13px; }
.opt { color: var(--text-light); font-size: 11px; font-weight: 400; }

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* iOS 줌 방지 */
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  min-height: 52px; /* 터치 영역 */
}

.form-input:focus { border-color: var(--primary); }

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.gender-row {
  display: flex;
  gap: 10px;
}

.gender-btn {
  flex: 1;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-mid);
  transition: all 0.2s;
  min-height: 52px;
}

.gender-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== 버튼 ===== */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  min-height: 54px;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

.btn-primary:active { background: var(--primary-dark); transform: scale(0.98); }

.btn-edit {
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  min-height: 44px;
  white-space: nowrap;
}

/* ===== 기능 소개 ===== */
.features-section {
  padding: 24px 16px 0;
}

.section-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 14px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.feature-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 90px;
}

.feature-card:active { transform: scale(0.97); }

.fi { font-size: 26px; }
.fn { font-size: 12px; font-weight: 700; color: var(--text); text-align: center; }
.fd { font-size: 10px; color: var(--text-light); text-align: center; }

/* ===== 공유 배너 ===== */
.share-banner {
  background: var(--primary-dark);
  margin: 20px 16px 0;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: #fff;
}

.share-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.share-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  margin-bottom: 14px;
}

.share-row {
  display: flex;
  gap: 8px;
}

.btn-kakao {
  flex: 1;
  background: #FEE500;
  color: #3C1E1E;
  padding: 13px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  min-height: 48px;
}

.btn-copy {
  flex: 1;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 13px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  min-height: 48px;
}

/* ===== 대시보드 ===== */
.baby-card-wrap {
  padding: 16px 16px 0;
}

.baby-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.baby-label {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.baby-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

.baby-months {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.this-month-box {
  background: #FFF8F0;
  border: 1.5px solid #FFD199;
  border-radius: var(--radius-sm);
  padding: 16px;
}

.this-month-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.this-month-item {
  font-size: 13px;
  color: var(--text-mid);
  padding: 5px 0;
  border-bottom: 1px solid #FFE8C0;
  line-height: 1.5;
}

.this-month-item:last-child { border-bottom: none; }

/* ===== 퀵 메뉴 ===== */
.quick-section {
  padding: 20px 16px 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.quick-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  transition: all 0.15s;
  min-height: 72px;
}

.quick-card:active { background: var(--primary-light); border-color: var(--primary); }

.qi { font-size: 22px; }
.qn { font-size: 10px; font-weight: 700; color: var(--text); text-align: center; }

/* ===== 면책 고지 ===== */
.disclaimer {
  margin: 20px 16px 0;
  background: #FFF8F0;
  border: 1.5px solid #FFD199;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.8;
}

/* ===== 푸터 ===== */
.footer {
  margin-top: 24px;
  padding: 24px 16px;
  background: var(--text);
  color: rgba(255,255,255,0.55);
  text-align: center;
}

.footer-logo { font-size: 18px; font-weight: 900; color: #fff; margin-bottom: 6px; }
.footer-desc { font-size: 12px; margin-bottom: 14px; }
.footer-links { display: flex; gap: 16px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.footer-links a { font-size: 12px; transition: color 0.2s; }
.footer-links a:hover { color: #fff; }
.footer-copy { font-size: 11px; }

/* ===== 하단 탭바 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.bnav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-light);
  transition: color 0.15s;
  min-height: 44px;
  padding: 8px 4px;
}

.bnav.active { color: var(--primary); }
.bnav:active { color: var(--primary-dark); }

.bnav-icon { font-size: 20px; }
.bnav-label { font-size: 10px; font-weight: 700; }

/* ===== 토스트 ===== */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}

/* ===== 데스크탑 반응형 ===== */
@media (min-width: 640px) {
  .main { max-width: 480px; margin: 0 auto; }
  .hero { padding: 40px 32px 44px; }
  .hero-title { font-size: 32px; }
  .card-section { margin: 20px 0 0; }
  .features-section, .share-banner, .baby-card-wrap, .quick-section, .disclaimer { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .header-sub { display: block; }
  .bottom-nav { display: none; }
  .main { max-width: 900px; }
  .feature-grid { grid-template-columns: repeat(6, 1fr); }
  .quick-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===== 홈 D-day 히어로 (임신 중) ===== */
.dday-home-hero {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 32px 20px 28px;
  color: #fff;
  text-align: center;
}

.dday-home-label {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  font-weight: 600;
}

.dday-home-number {
  font-size: 88px;
  font-weight: 900;
  color: var(--secondary);
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -2px;
}

.dday-home-date {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 16px;
}

.dday-home-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.dday-home-chip {
  background: rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 7px 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
}
