:root {
  color-scheme: light dark;
  --bg: #f4e9d0;
  --fg: #3a2e20;
  --card: #fffcf5;
  --accent: #a15c34;
  --border: #e6d8b8;
  --shadow: 0 2px 8px rgba(90, 62, 27, 0.08);
  --emblem-a: #a15c34;
  --emblem-b: #3f6f93;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --fg: #ece6df;
    --card: #262019;
    --accent: #d8a373;
    --border: #3a322a;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    --emblem-a: #d8a373;
    --emblem-b: #5b8ec4;
  }
}

.bg-emblem {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(140vw, 1100px);
  height: min(140vw, 1100px);
  transform: translate(-50%, -50%) rotate(-12deg);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
}

h1 {
  margin-bottom: 0.25rem;
  color: var(--accent);
}

.subtitle {
  margin-top: 0;
  opacity: 0.75;
  margin-bottom: 1.5rem;
}

form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  flex: 1;
  min-width: 70px;
}

.checkbox-field, .leap-month-field {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  min-width: auto;
}

input, select {
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}

button {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

section#result {
  margin-top: 2rem;
}

h2 {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  margin-top: 1.75rem;
}

#pillars-table, #fortune-info, #interpretation, #extra-info, #oheng-chart {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
}

.pillar-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.3rem;
}

.pillar-cell .label {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 0.3rem;
}

.pillar-cell .value {
  font-size: 1.3rem;
  font-weight: 600;
}

#extra-info {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.oheng-chart-row {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.oheng-donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--border);
}

.oheng-donut::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--card);
}

.oheng-legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.oheng-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.oheng-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.yearly-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.yearly-list span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}

#interpretation .section {
  margin-bottom: 1.25rem;
}

#interpretation .section:last-child {
  margin-bottom: 0;
}

#interpretation h3 {
  color: var(--accent);
  margin-bottom: 0.3rem;
}

#interpretation p {
  line-height: 1.7;
  margin: 0.3rem 0 0.9rem;
}

.locked-section {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 0.9rem 0.25rem;
  overflow: hidden;
}

.lock-badge {
  font-size: 0.8rem;
  opacity: 0.7;
}

.section-body.blurred {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
}

.text-blur {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}

.preview-section {
  padding-bottom: 0.9rem;
}

.admin-banner {
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.pricing-card {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.pricing-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.pricing-desc {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0 0 0.9rem;
}

.pricing-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.unlock-btn {
  padding: 0.7rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.unlock-btn.tier2 {
  background: color-mix(in srgb, var(--accent) 80%, black);
}

.unlock-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.share-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.share-btn {
  flex: 1;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.share-btn.kakao {
  background: #fee500;
  border-color: #fee500;
  color: #3a2e20;
}

.share-btn.email {
  background: var(--card);
}

.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  opacity: 0.75;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-biz, .footer-copy {
  margin: 0.3rem 0;
}

.placeholder {
  opacity: 0.6;
}

.mobile-break {
  display: none;
}

@media (max-width: 600px) {
  .mobile-break {
    display: block;
  }
}

.error {
  color: #b3261e;
  font-weight: 600;
}

.retry-btn {
  margin-top: 0.5rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

/* 이용약관 / 개인정보처리방침 등 약관 페이지 공용 스타일 */
.legal-page article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  line-height: 1.8;
  font-size: 0.92rem;
}

.legal-page h1 {
  font-size: 1.4rem;
}

.legal-page .updated-at {
  opacity: 0.7;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.legal-page h2 {
  color: var(--fg);
  font-size: 1rem;
  margin-top: 1.6rem;
  margin-bottom: 0.5rem;
}

.legal-page article > h2:first-child {
  margin-top: 0;
}

.legal-page p, .legal-page li {
  margin: 0.4rem 0;
}

.legal-page ul, .legal-page ol {
  padding-left: 1.3rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}
