/* ==========================================================================
   Base Layout, Typography & Global Controls Stylesheet
   ========================================================================== */

:root {
  --bg-primary: #fdfbf7;
  --bg-card: #ffffff;
  --bg-secondary: #f4ede2;
  --text-main: #2b2520;
  --text-muted: #736b63;
  --border-color: #e5ded3;
  --accent-gold: #c59b27;
  --accent-gold-dark: #9e7a17;
  --accent-gold-soft: #fbf5e6;
  --accent-crimson: #a63a3a;
  --accent-navy: #1b263b;

  /* 궁합 포인트색: 한지·골드 톤에 맞춘 저채도 자주(오배자색) */
  --accent-plum: #7a4a6b;
  --accent-plum-dark: #5e3552;
  --accent-plum-light: #a8789a;
  --plum-bg: #f6eef3;
  --plum-border: #e6d3df;
  
  /* 오행 색상: 한지 톤에 맞춘 저채도 (오행 표시 전용) */
  --wood-color: #4f6b45;   /* 목: 먹빛 녹 */
  --wood-bg: #edf1e7;
  --wood-border: #d5dfc9;
  --fire-color: #a63a3a;   /* 화: 적 */
  --fire-bg: #f6e9e6;
  --fire-border: #e8cfc9;
  --earth-color: #a8782a;  /* 토: 황토 */
  --earth-bg: #f4ecdc;
  --earth-border: #e6d8b9;
  --metal-color: #6b7378;  /* 금: 쇠회색 */
  --metal-bg: #eceeed;
  --metal-border: #d7dbd9;
  --water-color: #3a5a7a;  /* 수: 먹빛 청 */
  --water-bg: #e8edf2;
  --water-border: #cdd7e1;

  /* 상태색 (성공/활성): 오행 목(木)과 분리 */
  --accent-success: #4f6b45;
  --accent-success-dark: #3a5233;
  --success-bg: #edf1e7;
  --success-border: #d5dfc9;

  --shadow-sm: 0 2px 8px rgba(43, 37, 32, 0.05);
  --shadow-md: 0 6px 20px rgba(43, 37, 32, 0.08);
  --radius: 12px;
  --font-serif: "Noto Serif KR", serif;
  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", "Noto Serif KR", serif;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  width: 100%;
}

@supports not (overflow-x: clip) {
  html {
    overflow-x: hidden;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: clip;
  width: 100%;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

@supports not (overflow-x: clip) {
  body {
    overflow-x: hidden;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 80px 16px;
  width: 100%;
  box-sizing: border-box;
  flex: 1 0 auto;
}

/* ==========================================================================
   Global Navigation Bar (GNB)
   ========================================================================== */
.global-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 251, 247, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  padding-top: env(safe-area-inset-top, 0px);
}

.nav-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
}

.nav-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  width: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
}

.nav-logo-icon {
  color: var(--accent-gold);
}

.nav-brand-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.nav-menu {
  display: flex;
  align-items: center;
  width: 100%;
}

.nav-link {
  flex: 1;
  text-align: center;
  padding: 13px 0 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-main);
}

.nav-link.active {
  color: var(--accent-gold-dark);
  font-weight: 700;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background-color: var(--accent-gold);
  border-radius: 2px 2px 0 0;
}

.nav-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.nav-user-pill:hover {
  border-color: var(--accent-gold);
}

.nav-avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-user-name {
  font-weight: 600;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #fee500;
  color: #191919;
  border-radius: 16px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.nav-login-btn:hover {
  opacity: 0.9;
}

/* ==========================================================================
   Header & Brand Title
   ========================================================================== */
.site-header {
  text-align: center;
  padding: 32px 0 24px;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.site-logo-icon {
  color: var(--accent-gold);
}

.site-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 8px;
  word-break: keep-all;
}

/* ==========================================================================
   Cards & Layout Panels
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Form Hero & Header Brand (운명설계소 중심 헤더)
   ========================================================================== */
.form-hero-wrap {
  text-align: center;
  padding: 6px 8px 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(226, 218, 203, 0.7);
}

.form-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 14px;
  background: rgba(197, 147, 43, 0.08);
  border: 1px solid rgba(197, 147, 43, 0.25);
  border-radius: 20px;
  margin-bottom: 12px;
}

.form-hero-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
}

.form-hero-brand-name {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-gold-dark);
}

.form-hero-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin: 0 0 10px 0;
  word-break: keep-all;
}

.form-hero-desc {
  font-size: 0.93rem;
  line-height: 1.7;
  letter-spacing: -0.015em;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 580px;
  word-break: keep-all;
}

.hero-other-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 6px;
}
.hero-other-badge.is-free {
  background: #eef2f7;
  color: #374151;
}
.hero-other-badge.is-paid {
  background: #fff8e6;
  color: var(--accent-gold-dark);
  border: 1px solid #f6e0b5;
}

/* ==========================================================================
   Form Controls & Modern Inputs (iOS 16px Auto-Zoom Protected)
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.form-label svg {
  flex-shrink: 0;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  height: 28px;
  margin-bottom: 8px;
}

.form-label-row .form-label {
  margin-bottom: 0;
  height: 100%;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row > * {
  flex: 1;
  min-width: 0;
}

.form-input, .modern-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background-color: #fff;
  font-family: var(--font-sans);
  font-size: 16px !important;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-input:focus, .modern-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.15);
}

.modern-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.modern-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.modern-input-wrap .modern-input {
  padding-left: 40px;
}

.date-input-wrap {
  position: relative;
}

.date-input-wrap .date-mask-input {
  padding-right: 42px;
}

.date-picker-mini-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
  z-index: 2;
}

.date-picker-mini-btn:hover {
  color: var(--accent-gold-dark);
  background-color: rgba(197, 155, 39, 0.1);
}

.time-select-dropdown {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23887d74' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px !important;
  cursor: pointer;
}

.time-select-dropdown optgroup {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.8rem;
  background-color: var(--bg-primary);
}

.time-select-dropdown option {
  font-weight: normal;
  color: var(--text-main);
  background-color: #ffffff;
  padding: 6px 10px;
}

.input-subhint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 5px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}

.input-subhint.is-valid {
  color: var(--accent-success);
  font-weight: 500;
}

.input-subhint.is-invalid {
  color: #c0392b;
  font-weight: 500;
}

.tab-label {
  cursor: pointer;
  user-select: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-primary);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 4px;
  transition: all 0.15s ease;
}

.tab-sub {
  font-size: 0.74rem;
  opacity: 0.75;
  font-weight: 500;
  margin-left: 3px;
}

.tab-btn:hover {
  border-color: #cfc4b2;
}

.tab-btn.active {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(197, 155, 39, 0.25);
}

.unknown-pill-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.unknown-pill-label input[type="checkbox"] {
  display: none;
}

.unknown-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  line-height: 1;
  transition: all 0.15s ease;
}

.unknown-pill:hover {
  border-color: #cfc4b2;
  background: var(--bg-primary);
}

.unknown-pill-label.active .unknown-pill,
.unknown-pill-label input:checked ~ .unknown-pill {
  background: rgba(197, 147, 43, 0.12);
  border-color: var(--accent-gold);
  color: var(--accent-gold-dark);
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a89f91;
  transition: background-color 0.15s ease;
}

.unknown-pill-label.active .pill-dot,
.unknown-pill-label input:checked ~ .unknown-pill .pill-dot {
  background: var(--accent-gold);
}

/* 음력 윤달 토글 뱃지 */
.leap-toggle-wrap {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.leap-toggle-wrap input[type="checkbox"] {
  display: none;
}

.leap-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  line-height: 1;
  transition: all 0.15s ease;
}

.leap-toggle-pill:hover {
  border-color: #cfc4b2;
  background: var(--bg-primary);
}

.leap-toggle-wrap input:checked ~ .leap-toggle-pill {
  background: rgba(197, 147, 43, 0.12);
  border-color: var(--accent-gold);
  color: var(--accent-gold-dark);
}

.branch-select-row {
  background: #fbf9f5;
  border: 1px dashed #e6dbcb;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.branch-select-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.branch-select-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7b5816;
}

.branch-select-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.branch-select-row .branch-select-wrap {
  flex: 1;
  min-width: 0;
}

.branch-select {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.85rem !important;
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  box-sizing: border-box;
}

.back-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  background: #f7f3ec;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.back-nav-link:hover {
  color: var(--text-main);
  border-color: #cfc4b2;
  background: #eee8de;
}

@media (max-width: 640px) {
  .branch-select-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

/* 만세력 기준 안내 카드 (우아하고 정돈된 2단 뱃지) */
.saju-rule-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #fbf9f5;
  border: 1px solid #ebd9b8;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 16px 0 12px;
}

.rule-badge-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rule-icon-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fdf2db;
  color: var(--accent-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rule-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rule-tag {
  font-weight: 700;
  color: #7b5816;
  font-size: 0.78rem;
}

.rule-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

@media (max-width: 640px) {
  .saju-rule-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.field-hint-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 7px 12px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #874d00;
  line-height: 1.4;
}

/* ==========================================================================
   Buttons & Action Controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--accent-gold);
  color: #fff;
  width: 100%;
  font-size: 1.05rem;
  padding: 14px;
}

.btn-primary:hover {
  background-color: var(--accent-gold-dark);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #ebdccf;
}

.btn-danger {
  background-color: transparent;
  color: var(--accent-crimson);
  border: 1px solid #f2d4d4;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-danger:hover {
  background-color: var(--fire-bg);
}

.btn-icon-text {
  gap: 6px;
}

.auth-btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.auth-kakao-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #fee500;
  color: #191919;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.auth-kakao-cta:hover {
  opacity: 0.9;
}

.auth-banner-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #fffcf0 0%, #fffbf2 100%);
  border: 1px solid #f2deaf;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-banner-buttons {
  display: flex;
  gap: 8px;
}

.report-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
}

.report-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
}

.report-list a:hover {
  color: var(--accent-gold-dark);
}

.pay-notice, .readonly-banner, .share-warning {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ==========================================================================
   Spinners & Global Loading Visual States
   ========================================================================== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

.spinner-svg {
  animation: spin 0.8s linear infinite;
  display: inline-block !important;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-block {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

/* Fullscreen Global Loading Overlay */
.global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: rgba(253, 251, 247, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-overlay-card {
  background: #ffffff;
  border: 1.5px solid var(--plum-border);
  border-radius: 20px;
  padding: 36px 28px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 36px rgba(43, 37, 32, 0.12);
  box-sizing: border-box;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.loading-spinner-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fdf8eb;
  border: 1.5px solid #f7dfa4;
  margin-bottom: 18px;
}

.loading-spinning-icon {
  animation: spin 1s linear infinite;
}

.loading-overlay-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2b2520;
  margin-bottom: 8px;
}

.loading-overlay-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.loading-progress-bar {
  width: 100%;
  height: 6px;
  background: #f0e8db;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loading-progress-inner {
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-plum));
  border-radius: 3px;
  animation: progressPulse 1.8s ease-in-out infinite;
}

@keyframes progressPulse {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(350%); width: 30%; }
}

.loading-step-badges {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.loading-badge {
  font-size: 0.74rem;
  background: #faf6f0;
  color: #796c5e;
  border: 1px solid #ebd9c8;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Error & Status Pages
   ========================================================================== */
.error-page-card {
  text-align: center;
  padding: 48px 24px 42px;
  max-width: 520px;
  margin: 36px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.error-icon-wrapper {
  margin-bottom: 22px;
}

.error-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-icon-404 {
  background: var(--accent-gold-soft);
  color: var(--accent-gold-dark);
}

.error-icon-login {
  background: #fef9db;
  color: var(--accent-gold-dark);
}

.error-icon-warn {
  background: #fdf0ed;
  color: #c0392b;
}

.error-icon-general {
  background: #f1f2f6;
  color: #747d8c;
}

.error-code-badge {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--accent-gold-dark);
  font-weight: 700;
  letter-spacing: 2.5px;
  margin-top: 12px;
}

.error-headline {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.35;
}

.error-message {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 30px;
}

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
  width: 100%;
}

.error-btn-primary {
  width: 100%;
  padding: 13px 20px;
  font-size: 0.95rem;
}

.error-btn-secondary {
  width: 100%;
  padding: 11px 20px;
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  .error-page-card {
    padding: 36px 18px 32px;
    margin: 20px auto;
  }
  .error-icon-circle {
    width: 64px;
    height: 64px;
  }
  .error-icon-circle svg {
    width: 32px;
    height: 32px;
  }
  .error-headline {
    font-size: 1.25rem;
  }
  .error-message {
    font-size: 0.88rem;
  }
}

/* ==========================================================================
   Mobile Responsive Rules for Global Base Layout (< 600px)
   ========================================================================== */
@media (max-width: 600px) {
  .container {
    padding: 16px 14px calc(130px + env(safe-area-inset-bottom, 0px)) 14px;
  }

  .site-header {
    padding: 20px 0 16px;
  }

  .site-title {
    font-size: 1.35rem;
    flex-direction: column;
    gap: 6px;
    line-height: 1.35;
    text-align: center;
  }

  .site-logo-icon {
    width: 30px;
    height: 30px;
    margin-bottom: 2px;
  }

  .site-subtitle {
    font-size: 0.82rem;
    margin-top: 6px;
    line-height: 1.45;
    padding: 0 10px;
  }

  .form-row {
    flex-direction: column;
    gap: 16px;
  }

  .form-row > * {
    width: 100%;
  }

  .tab-btn {
    height: 44px;
    font-size: 0.88rem;
  }

  .modern-input {
    height: 48px;
    font-size: 16px !important;
  }

  .branch-select {
    height: 46px;
    font-size: 16px !important;
  }

  .auth-banner-card {
    padding: 14px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .auth-user-info {
    width: 100%;
  }

  .auth-banner-buttons {
    width: 100%;
  }

  .auth-btn-sm {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
  }

  .auth-kakao-cta {
    width: 100%;
    justify-content: center;
    padding: 12px 14px;
    font-size: 0.92rem;
  }
}


/* ==========================================================================
   Footer & Legal Document Styles (Clean & Centered)
   ========================================================================== */
.site-footer {
  margin-top: auto;
  width: 100%;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 24px 16px 36px;
  text-align: center;
}

.site-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.site-footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: -0.2px;
}

.legal-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.82rem;
}

.legal-links a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.legal-links a:hover {
  color: var(--text-main);
}

.legal-links a.legal-privacy {
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   법률 문서 카드 (.legal-doc: /terms, /privacy, /refund, /business)
   ========================================================================== */
.legal-doc {
  padding: 36px 32px;
  line-height: 1.75;
  color: var(--text-main);
  word-break: keep-all;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.legal-doc .card-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--accent-gold);
  color: var(--text-main);
}

/* 상단 리드 문구 */
.legal-lead {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.7;
  color: #374151;
  background: #fbf9f5;
  border-left: 3.5px solid var(--accent-gold);
  padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0 20px 0;
}

.legal-lead a {
  color: var(--accent-gold-dark);
  text-decoration: underline;
  font-weight: 600;
}

/* 사업자 정보 접기/펼치기 및 요약 (가독성/주목도 최소화 및 사생활 보호) */
.legal-biz-details {
  margin: 6px 0 16px;
  background: transparent;
  border: none;
}

.legal-biz-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  color: #9c9589;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  list-style: none;
}

.legal-biz-summary::-webkit-details-marker {
  display: none;
}

.legal-biz-summary::before {
  content: "▸";
  font-size: 0.72rem;
  color: #c4bfb6;
  transition: transform 0.15s ease;
}

.legal-biz-details[open] .legal-biz-summary::before {
  transform: rotate(90deg);
}

.legal-biz-summary:hover {
  color: #6b6357;
}

.legal-biz,
.legal-contact {
  list-style: none;
  padding: 6px 0 2px;
  margin: 4px 0 10px;
  background: transparent;
  border: none;
  border-top: 1px dashed #e8e3da;
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  font-size: 0.71rem;
  line-height: 1.5;
  color: #9c9589;
  word-break: break-all;
}

.legal-biz li,
.legal-contact li {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.legal-biz li:not(:last-child)::after,
.legal-contact li:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: #d8d3c9;
  font-weight: normal;
}

.legal-biz a,
.legal-contact a {
  color: #857d71;
  text-decoration: none;
}

.legal-biz a:hover,
.legal-contact a:hover {
  text-decoration: underline;
}

/* 목차 네비게이션 (.legal-toc) */
.legal-toc {
  background: #faf8f4;
  border: 1px solid #e8decb;
  border-radius: 10px;
  padding: 18px 22px;
  margin: 22px 0 32px;
}

.legal-toc-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-gold-dark);
  margin: 0 0 12px 0;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.legal-toc-title::before {
  content: "📑";
  font-size: 0.95rem;
}

.legal-toc ol {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 16px;
  padding-left: 1.3rem;
  margin: 0;
  font-size: 0.86rem;
}

.legal-toc ol li {
  margin: 0;
  color: #6b7280;
}

.legal-toc ol li a {
  color: #374151;
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-toc ol li a:hover {
  color: var(--accent-gold-dark);
  text-decoration: underline;
}

/* 조항 소제목 (h3) */
.legal-doc h3 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #1f2937;
  margin: 36px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0e9df;
  scroll-margin-top: 80px;
}

/* 본문 문단 및 링크 */
.legal-doc p {
  line-height: 1.75;
  color: #374151;
  font-size: 0.92rem;
  margin: 10px 0;
}

.legal-doc p a,
.legal-doc li a {
  color: var(--accent-gold-dark);
  text-decoration: underline;
  font-weight: 600;
}

/* 본문 순서 목록 (ol) 및 일반 목록 (ul) */
.legal-doc ol {
  padding-left: 1.3rem;
  margin: 10px 0 20px 0;
  line-height: 1.75;
  color: #374151;
  font-size: 0.92rem;
}

.legal-doc ol li {
  margin-bottom: 8px;
  padding-left: 2px;
}

.legal-doc ol li:last-child {
  margin-bottom: 0;
}

.legal-doc ul {
  margin: 10px 0 18px 1.25rem;
  line-height: 1.75;
  color: #374151;
  font-size: 0.92rem;
}

.legal-doc ul li {
  margin-bottom: 6px;
}

/* 법률 문서 반응형 표 (.legal-table-wrap & .legal-table) */
.legal-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 24px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.legal-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

.legal-table thead th {
  background: #fcf9f4;
  color: #4a4036;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 11px 14px;
  border-bottom: 1.5px solid #ebe2d3;
  border-right: 1px solid #f2ebe0;
  white-space: nowrap;
}

.legal-table thead th:last-child {
  border-right: none;
}

/* 수직 헤더 테이블(Key-Value 명세형, 제8조 국외 이전 등) */
.legal-table tbody th,
.legal-key-value-table tbody th {
  background: #fcf9f4;
  color: #4a4036;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 12px 16px;
  border-bottom: 1px solid #f2ece3;
  border-right: 1.5px solid #ebe2d3;
  text-align: left;
  vertical-align: top;
  white-space: nowrap !important;
  word-break: keep-all !important;
  width: 140px !important;
  min-width: 130px !important;
  box-sizing: border-box;
}

.legal-table tbody tr:last-child th,
.legal-key-value-table tbody tr:last-child th {
  border-bottom: none;
}

.legal-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f2ece3;
  border-right: 1px solid #f5efe6;
  color: #374151;
  line-height: 1.6;
  vertical-align: top;
  word-break: keep-all;
}

.legal-table tbody td:last-child {
  border-right: none;
}

.legal-table tbody tr:last-child td {
  border-bottom: none;
}

.legal-table tbody tr:nth-child(even) {
  background: #fdfcf9;
}

.legal-table tbody tr:nth-child(even) th {
  background: #f9f5ed;
}

.legal-table tbody tr:hover {
  background: #fbf7ef;
}

.legal-table tbody tr:hover th {
  background: #f7f0e2;
}

/* 환불 정책 전용 목록 */
.refund-policy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 20px 1.25rem;
  line-height: 1.75;
  font-size: 0.9rem;
  color: var(--text-main);
}

.refund-policy li {
  margin-bottom: 0;
}

.refund-policy li strong {
  color: var(--text-main);
  font-weight: 700;
}

/* 시행일 문구 */
.legal-effective {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* 사업자 정보 상세 명세서 테이블 (/business) */
.biz-detail-table-wrap {
  margin: 18px 0 24px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.biz-detail-table {
  width: 100%;
  border-collapse: collapse;
}

.biz-detail-table th,
.biz-detail-table td {
  padding: 12px 18px;
  border-bottom: 1px solid #f2ece3;
  text-align: left;
  line-height: 1.6;
}

.biz-detail-table tr:last-child th,
.biz-detail-table tr:last-child td {
  border-bottom: none;
}

.biz-detail-table th {
  width: 28%;
  background: #fcfaf7;
  color: #78716c;
  font-size: 0.8rem;
  font-weight: 500;
  border-right: 1px solid #f2ece3;
  word-break: keep-all;
}

.biz-detail-table td {
  font-size: 0.82rem;
  color: #57534e;
}

.biz-ftc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 3px 8px;
  background: #fff8e6;
  border: 1px solid #ebd9b8;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-gold-dark);
  text-decoration: none !important;
  vertical-align: middle;
}

.biz-ftc-pill:hover {
  background: #fdf2db;
}

.legal-action-bar {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 640px) {
  .legal-doc {
    padding: 22px 16px;
  }

  .legal-doc .card-title {
    font-size: 1.35rem;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .legal-lead {
    font-size: 0.88rem;
    padding: 10px 14px;
    margin: 12px 0 16px;
  }

  .legal-toc {
    padding: 14px 16px;
    margin: 16px 0 24px;
  }

  .legal-toc ol {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .legal-biz-summary {
    font-size: 0.7rem;
  }

  .legal-biz,
  .legal-contact {
    padding: 4px 0;
    font-size: 0.68rem;
    gap: 2px 6px;
    line-height: 1.45;
  }

  .legal-biz li:not(:last-child)::after,
  .legal-contact li:not(:last-child)::after {
    margin-left: 6px;
  }

  .legal-doc h3 {
    font-size: 1.05rem;
    margin: 26px 0 10px 0;
    scroll-margin-top: 70px;
  }

  .legal-doc p,
  .legal-doc ol,
  .legal-doc ul {
    font-size: 0.88rem;
    line-height: 1.7;
  }

  .legal-table-wrap {
    margin: 12px 0 18px;
    border-radius: 6px;
  }

  .legal-table {
    min-width: 480px;
    font-size: 0.8rem;
  }

  .legal-table thead th,
  .legal-table tbody th,
  .legal-table tbody td,
  .legal-key-value-table tbody th,
  .legal-key-value-table tbody td {
    padding: 9px 12px;
  }

  .legal-table tbody th,
  .legal-key-value-table tbody th {
    width: 120px !important;
    min-width: 110px !important;
    font-size: 0.78rem;
  }

  .site-footer-inner {
    padding: 0;
  }

  .legal-links {
    gap: 8px 14px;
  }

  .biz-detail-table th {
    width: 34%;
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .biz-detail-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .legal-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .legal-action-bar .btn {
    width: 100% !important;
  }
}