@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

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

body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: #f5f5f5;
  color: #111111;
  min-height: 100dvh;
}

.page {
  max-width: 430px;
  margin: 0 auto;
  background: #ffffff;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eeeeee;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}
.header .logo { font-size: 18px; font-weight: 800; color: #111111; text-decoration: none; }
.header .back-btn {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: #111111; padding: 4px; display: flex; align-items: center;
}
.header .header-title { font-size: 16px; font-weight: 700; }
.header .header-right { display: flex; gap: 12px; align-items: center; }
.header .icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: #111111; display: flex; align-items: center;
}

/* Tab bar */
.tab-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid #eeeeee;
  padding: 0 20px;
  gap: 0;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  flex-shrink: 0;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #888888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-item.active {
  color: #111111;
  font-weight: 700;
  border-bottom-color: #111111;
}

/* Content */
.content { flex: 1; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }

/* Cards */
.card {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:active { opacity: 0.8; }
.card-thumb {
  width: 100%;
  aspect-ratio: 8/5;
  object-fit: cover;
  background: #f5f5f5;
  display: block;
  border-radius: 8px;
}
.card-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #cccccc;
}
.card-body { padding: 14px 16px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 13px; color: #888888; }

/* Banner */
.banner-card {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: block;
  text-decoration: none;
}
.banner-card img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 7/10;
}

/* Banner Carousel */
.banner-carousel { position: relative; }
.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 8px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: block;
  text-decoration: none;
}
.carousel-slide img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 7/10;
}
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 2px;
}
.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.carousel-dot.active { background: #111; }

/* CTA Button */
.btn-cta {
  width: 100%;
  height: 52px;
  background: #111111;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-cta:active { opacity: 0.8; }
.btn-cta.disabled { background: #cccccc; cursor: default; }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 14px; font-weight: 600; }
.form-select, .form-input {
  width: 100%;
  height: 48px;
  border: 1px solid #eeeeee;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: #111111;
  background: #ffffff;
  appearance: none;
  -webkit-appearance: none;
}
.form-select:focus, .form-input:focus {
  outline: none;
  border-color: #111111;
}

/* Divider */
.divider { height: 1px; background: #eeeeee; margin: 4px 0; }

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 20px;
  color: #888888;
  font-size: 14px;
  text-align: center;
}

/* Sticky bottom */
.sticky-bottom {
  position: sticky;
  bottom: 0;
  padding: 16px 20px;
  background: #ffffff;
  border-top: 1px solid #eeeeee;
}

/* Source badge */
.source-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid #eeeeee;
  border-radius: 10px;
  font-size: 13px;
}
.source-item .src-name { font-weight: 600; color: #111111; }
.source-item .src-meta { color: #888888; }

/* Auth pages */
.auth-wrap { flex: 1; display: flex; flex-direction: column; padding: 40px 20px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.auth-sub { font-size: 14px; color: #888888; margin-bottom: 32px; }
.auth-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: #888888; }
.auth-footer a { color: #111111; font-weight: 600; text-decoration: none; }

/* Kakao login button */
.btn-kakao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  background: #FEE500;
  color: #191919;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}
.btn-kakao:hover { background: #f5dc00; }
.btn-kakao svg { flex: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  color: #999;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #eee;
}

/* 접근성: 키보드 포커스 표시 복원 (QA M-045) */
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid #6c5ce7 !important;
  outline-offset: 2px;
}

/* ── 다크 모드 (html.dark) — 헤더 토글로 전환, localStorage 'huchu-theme' ── */
html.dark body { background: #0f0f10; color: #e8e6e1; }
html.dark .page { background: #161618; }
html.dark .header { background: #161618; border-bottom-color: #2a2a2c; }
html.dark .header .logo,
html.dark .header .back-btn,
html.dark .header .icon-btn,
html.dark .header .header-title { color: #e8e6e1; }
html.dark .tab-bar { border-bottom-color: #2a2a2c; }
html.dark .tab-item { color: #8a8a8e; }
html.dark .tab-item.active { color: #f2f0eb; border-bottom-color: #f2f0eb; }
html.dark .card { background: #1e1e21; }
html.dark .card-thumb { background: #232326; }
html.dark .card-thumb.placeholder { color: #55555a; }
html.dark .card-sub { color: #8a8a8e; }
html.dark .card-price { color: #e8e6e1 !important; }
html.dark .btn-cta { background: #f2f0eb; color: #111111; }
html.dark .btn-cta.disabled { background: #3a3a3e; color: #77777c; }
html.dark .form-label { color: #cfcdc6; }
html.dark .form-select, html.dark .form-input {
  background: #1e1e21; border-color: #35353a; color: #e8e6e1;
  color-scheme: dark;
}
html.dark .form-select:focus, html.dark .form-input:focus { border-color: #cfcdc6; }
html.dark .divider { background: #2a2a2c; }
html.dark .empty-state { color: #8a8a8e; }
html.dark .sticky-bottom { background: #161618; border-top-color: #2a2a2c; }
html.dark .source-item { border-color: #2a2a2c; }
html.dark .source-item .src-name { color: #e8e6e1; }
html.dark .auth-sub, html.dark .auth-footer { color: #8a8a8e; }
/* 입력 페이지 선택 버튼 (input.html 페이지 내 정의 클래스) */
html.dark .cal-btn, html.dark .gender-btn { background: #1e1e21; border-color: #35353a; color: #cfcdc6; }
html.dark .cal-btn.selected, html.dark .gender-btn.selected { background: #f2f0eb; border-color: #f2f0eb; color: #111111; }
/* 홈 푸터 (index.html 인라인 스타일 대응) */
html.dark .page > footer { background: #131315 !important; }
html.dark .page > footer div, html.dark .page > footer a { color: #8a8a8e !important; }

/* ── 다크 고정 보정: 페이지별 클래스 (결제/마이페이지/약관/입력) ── */
html.dark .pay-summary .price { color: #e8e6e1; }
html.dark .my-info-name, html.dark .my-menu-item, html.dark .storage-name { color: #e8e6e1; }
html.dark .my-menu-item { border-bottom-color: #2a2a2c; }
html.dark .my-menu-item.danger { color: #ff7b6e; }
html.dark .doc-title, html.dark .doc-section h2, html.dark .doc-section h3, html.dark .doc-section strong { color: #e8e6e1; }
html.dark .person-title { color: #e8e6e1; border-top-color: #2a2a2c; }
html.dark .leap-wrap label { color: #9a988f; }
html.dark .leap-wrap input[type=checkbox], html.dark #hour-unknown, html.dark #hour-unknown2 { accent-color: #f2f0eb; }
html.dark .form-group label { color: #9a988f !important; }
html.dark .btn-secondary { background: #2a2a2c; color: #e8e6e1; }
html.dark .spinner { border-color: #2a2a2c; border-top-color: #e8e6e1; }
html.dark .no-media-wrap { background: #161618; }
html.dark .no-media-wrap [style*="color:#111"] { color: #e8e6e1 !important; }
html.dark .auth-footer a { color: #f2f0eb; }
html.dark .auth-divider { color: #8a8a8e; }
html.dark .auth-divider::before, html.dark .auth-divider::after { background: #2a2a2c; }
html.dark .doc-intro { color: #9a988f; border-bottom-color: #2a2a2c; }
html.dark .doc-chapter h2 { color: #8a8a8e; border-bottom-color: #2a2a2c; }
html.dark .doc-section p, html.dark .doc-section li { color: #b8b5ac; }
html.dark .doc-contact { background: #1e1e21; }
html.dark .doc-contact p { color: #b8b5ac; }
