/* =========================================================
   천연(天緣) 사주역학 · 결혼 궁합 연구소 Stylesheet
   Zero external dependency, mobile-first, AdSense-friendly
   ========================================================= */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-alt: #f4efe6;
  --ink: #1e1c1a;
  --ink-muted: #665f57;
  --border: #e5ddd0;
  --border-strong: #d3c7b4;
  --accent: #a63434;       /* 전통 인주(印朱) 붉은빛 */
  --accent-hover: #8c2929;
  --gold: #9a742c;
  --gold-soft: #f7f0df;

  /* 오행 색상 */
  --wood-bg: #eaf6ee;  --wood-fg: #1c6b39;  --wood-bd: #b8dfc6;
  --fire-bg: #fdeeee;  --fire-fg: #b42828;  --fire-bd: #f3c1c1;
  --earth-bg: #fbf4df; --earth-fg: #8d630d; --earth-bd: #ead39a;
  --metal-bg: #f1f3f5; --metal-fg: #44505c; --metal-bd: #cfd6de;
  --water-bg: #eaf2fe; --water-fg: #1d55a6; --water-bd: #bcd3f8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(30, 28, 26, 0.05);
  --shadow-md: 0 6px 20px rgba(30, 28, 26, 0.06);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-seal {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "Batang", "Noto Serif KR", Georgia, serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-muted);
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 600;
}

.nav-links a { color: var(--ink-muted); }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.nav-cta {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: 13px;
}
.nav-cta:hover { background: var(--accent-hover); }

/* Hero */
.hero {
  padding: 36px 0 22px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid #e4d2a8;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.28;
}

.hero p {
  margin: 0 auto;
  max-width: 660px;
  color: var(--ink-muted);
  font-size: 15px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.btn-preset {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-preset:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.section-gap { margin-top: 20px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

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

/* Form Controls */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-male { background: #2563eb; }
.dot-female { background: #e11d48; }

.cal-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.cal-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.hidden { display: none !important; }

.form-row-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

.field input[type="number"],
.field select,
.chat-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.chat-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.action-note {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.btn-primary {
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(166, 52, 52, 0.22);
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-outline {
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: var(--accent); color: #fff; }

.error-box {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--fire-bd);
  background: var(--fire-bg);
  color: var(--fire-fg);
  font-size: 14px;
  font-weight: 600;
}

/* Element Colors */
.el-wood  { background: var(--wood-bg);  color: var(--wood-fg);  border: 1px solid var(--wood-bd); }
.el-fire  { background: var(--fire-bg);  color: var(--fire-fg);  border: 1px solid var(--fire-bd); }
.el-earth { background: var(--earth-bg); color: var(--earth-fg); border: 1px solid var(--earth-bd); }
.el-metal { background: var(--metal-bg); color: var(--metal-fg); border: 1px solid var(--metal-bd); }
.el-water { background: var(--water-bg); color: var(--water-fg); border: 1px solid var(--water-bd); }

.bar-wood  { background: #22a055; }
.bar-fire  { background: #d63b3b; }
.bar-earth { background: #cf961d; }
.bar-metal { background: #738294; }
.bar-water { background: #2d6cdf; }

/* Summary Verdict Banner */
.verdict-banner {
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.verdict-best { border-color: #6ab989; background: linear-gradient(135deg, #f3fbf6 0%, #ffffff 100%); }
.verdict-good { border-color: #7caae8; background: linear-gradient(135deg, #f3f8ff 0%, #ffffff 100%); }
.verdict-warn { border-color: #dfb456; background: linear-gradient(135deg, #fdf9ee 0%, #ffffff 100%); }
.verdict-fail { border-color: #e07b7b; background: linear-gradient(135deg, #fef4f4 0%, #ffffff 100%); }

.verdict-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.verdict-label { font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.verdict-title { margin: 3px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.verdict-desc { margin: 10px 0 14px; font-size: 14.5px; color: var(--ink); }

.badge-list { display: flex; flex-wrap: wrap; gap: 7px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-neutral {
  background: var(--surface-alt);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}

/* Pillars */
.pillar-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}
.pillar-col.empty { border-style: dashed; opacity: 0.6; }
.pillar-label { font-size: 11px; color: var(--ink-muted); margin-bottom: 6px; font-weight: 600; }

.pillar-char {
  border-radius: 7px;
  padding: 6px 4px;
  margin-bottom: 5px;
}
.pillar-char:last-child { margin-bottom: 0; }
.pillar-hanja { font-family: "Batang", "Noto Serif KR", serif; font-size: 20px; font-weight: 700; line-height: 1.1; }
.pillar-kr { font-size: 11px; margin-top: 2px; font-weight: 600; }

.el-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.el-chip { padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.el-chip.zero { background: var(--bg); color: var(--ink-muted); border: 1px solid var(--border); opacity: 0.55; }

/* Rule Mini Boxes */
.mini-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.mini-box-center { text-align: center; }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.mini-row:last-child { margin-bottom: 0; }
.rule-desc { font-size: 13px; color: var(--ink-muted); margin: 12px 0 0; line-height: 1.55; }

/* 5 Elements Bars */
.el-bar-card {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.el-bar-card.missing { border-color: #e07b7b; background: #fff9f9; }
.bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 8px 0;
}
.bar-fill { height: 100%; border-radius: 999px; }

/* Personality Section */
.trait-box {
  padding: 15px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-weight: 600;
}
.chem-box {
  padding: 13px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
}
.chem-box h4 { margin: 0 0 6px; font-size: 13.5px; }
.chem-box p { margin: 0; color: var(--ink-muted); line-height: 1.55; }

/* Daeun Timeline */
.daeun-summary {
  padding: 13px 15px;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid #e4d2a8;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.daeun-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 9px 7px;
  text-align: center;
}
.daeun-card.marriage {
  border-color: #df6d7d;
  background: #fff6f7;
}
.daeun-age {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 6px;
}
.now-tag {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
}
.daeun-flag {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 5px;
}
.daeun-flag.yes { background: #fde2e6; color: #b91c3a; }
.daeun-flag.no { color: var(--ink-muted); }

/* AdSense Slot */
.adsense-slot {
  margin: 20px 0;
  padding: 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-alt);
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Live Consultation Chat */
.chat-card {
  padding: 0;
  overflow: hidden;
}
.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
  display: inline-block;
  margin-right: 6px;
}
.role-switch {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 2px;
}
.role-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
}
.role-btn.active {
  background: var(--accent);
  color: #fff;
}
.chat-context {
  padding: 11px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.chat-messages {
  height: 290px;
  overflow-y: auto;
  padding: 16px 20px;
  background: #fcfaf7;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg-wrap { display: flex; flex-direction: column; }
.msg-wrap.user { align-items: flex-end; }
.msg-wrap.expert { align-items: flex-start; }
.msg-meta { font-size: 11px; color: var(--ink-muted); margin-bottom: 4px; padding: 0 4px; }
.msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-line;
}
.msg-wrap.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-top-right-radius: 4px;
}
.msg-wrap.expert .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.quick-row {
  padding: 10px 20px 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 20px 16px;
}
.kakao-bar {
  padding: 10px 20px;
  background: #fffbeb;
  border-top: 1px solid #f0e1b0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.btn-kakao {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: #fee500;
  color: #191919;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none !important;
}

/* SEO & AdSense Editorial Guide Section */
.guide-section {
  margin-top: 32px;
}
.guide-section h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.guide-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}
.guide-item h3 { margin: 0 0 8px; font-size: 15.5px; color: var(--accent); }
.guide-item p { margin: 0; font-size: 13.5px; color: var(--ink-muted); line-height: 1.65; }

.faq-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.faq-item summary { font-weight: 700; cursor: pointer; font-size: 14.5px; }
.faq-item p { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-muted); line-height: 1.65; }

/* Footer */
.site-footer {
  margin-top: 44px;
  padding: 26px 0 36px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 12.5px;
  color: var(--ink-muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.footer-links { display: flex; gap: 14px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

/* Responsive */
@media (max-width: 860px) {
  .grid-2, .grid-3, .guide-grid { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-links .hide-mobile { display: none; }
}
@media (max-width: 520px) {
  .grid-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}
