:root {
  --bd: #e5e7eb;
  --txt: #111827;
  --mut: #6b7280;
  --bg: #f9fafb;
  --paper: #ffffff;
  --wood: #003b00;
  --fire: #882a2a;
  --earth: #5b5b1c;
  --metal: #626972;
  --water: #333333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(180deg, #f4f2eb 0%, #f9fafb 34%, #f3f4f6 100%);
  color: var(--txt);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(249, 250, 251, 0.82);
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo-slot {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-image {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.brand-logo-placeholder {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(17, 24, 39, 0.48);
  text-transform: uppercase;
}

.brand-copy {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.16em;
  color: var(--mut);
  text-transform: uppercase;
}

.container { max-width: 860px; margin: 28px auto 40px; padding: 16px; }

h1 { margin: 0 0 6px; }

.muted { color: var(--mut); }

.card {
  background: var(--paper);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
}

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }

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

.field { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }

.field span { font-size: 12px; color: var(--mut); }

input,
select {
  padding: 10px 10px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

.checkbox { flex-direction: row; align-items: center; gap: 10px; min-width: auto; }

.actions { margin-top: 14px; display: flex; gap: 12px; align-items: center; }

button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #111827;
  background: #111827;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

.error { color: #dc2626; margin: 10px 0 0; }

.hidden { display: none; }

.pillars-wrap {
  margin-top: 14px;
  width: 100%;
  overflow: hidden;
}

.saju-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.saju-table thead th {
  color: var(--mut);
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 0 0 6px;
}

.saju-table thead th:first-child {
  width: 34px;
  letter-spacing: 0;
}

.saju-table tbody th {
  color: var(--mut);
  font-size: clamp(10px, 2.5vw, 12px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  vertical-align: middle;
  padding: 4px 3px 4px 0;
}

.axis-label {
  display: inline-block;
  line-height: 1.05;
  word-break: break-all;
}

.saju-table td { padding: 4px 3px; }

.pillar-card {
  min-height: clamp(84px, 24vw, 128px);
  border-radius: 16px;
  padding: clamp(7px, 1.8vw, 14px) clamp(4px, 1.2vw, 10px) clamp(7px, 1.8vw, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.4vw, 8px);
  color: #f5f1e8;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(17, 24, 39, 0.14);
}

.pillar-card[data-element="wood"] { background: linear-gradient(180deg, #0a5216 0%, var(--wood) 100%); }
.pillar-card[data-element="fire"] { background: linear-gradient(180deg, #a03a3a 0%, var(--fire) 100%); }
.pillar-card[data-element="earth"] { background: linear-gradient(180deg, #727229 0%, var(--earth) 100%); }
.pillar-card[data-element="metal"] { background: linear-gradient(180deg, #b3b8be 0%, var(--metal) 100%); }
.pillar-card[data-element="water"] { background: linear-gradient(180deg, #4a4a4a 0%, var(--water) 100%); }

.pillar-card.is-empty,
.pillar-card[data-element="unknown"] {
  background: linear-gradient(180deg, #7b8190 0%, #636a77 100%);
}

.pillar-korean {
  font-size: clamp(10px, 3vw, 14px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
}

.pillar-hanja {
  font-family: "Iowan Old Style", "Songti SC", "Noto Serif KR", serif;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 700;
  line-height: 1;
}

.pillar-element {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: clamp(8px, 2.2vw, 11px);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.stack { display: grid; gap: 10px; margin-top: 10px; }

.box {
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.box .title { font-weight: 800; }

.footer { margin-top: 18px; }

.hero-card {
  padding: 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 240, 231, 0.94) 100%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--mut);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  margin: 12px 0 0;
  font-size: clamp(17px, 3vw, 23px);
  font-weight: 700;
  line-height: 1.35;
  color: #1f2937;
}

.hero-lead {
  max-width: 62ch;
  margin: 14px 0 0;
  color: #374151;
  line-height: 1.7;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-chip,
.topic-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.section-intro {
  display: grid;
  gap: 8px;
}

.section-intro h2 {
  margin: 0;
}

.section-intro p {
  margin: 0;
  line-height: 1.65;
}

.content-card,
.faq-card {
  scroll-margin-top: 88px;
}

.topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.topic-link:hover {
  background: #fff;
}

.info-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(229, 231, 235, 0.9);
  scroll-margin-top: 88px;
}

.info-section h3 {
  margin: 0 0 10px;
  font-size: clamp(20px, 3vw, 25px);
  line-height: 1.2;
}

.info-section p {
  margin: 0 0 12px;
  color: #374151;
  line-height: 1.7;
}

.info-grid,
.keyword-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.pillars-grid {
  margin-bottom: 12px;
}

.info-card,
.keyword-card {
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(249, 250, 251, 0.9) 100%);
}

.info-card h4,
.keyword-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.info-card p,
.keyword-card p {
  margin: 0;
  color: #374151;
  line-height: 1.6;
}

.bullet-list,
.keyword-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: #374151;
}

.bullet-list li,
.keyword-list li {
  margin-top: 8px;
  line-height: 1.55;
}

.keyword-list {
  margin-top: 0;
}

.keyword-list li:first-child,
.bullet-list li:first-child {
  margin-top: 0;
}

.accordion-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.accordion {
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.accordion summary {
  position: relative;
  padding: 16px 44px 16px 16px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

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

.accordion summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 22px;
  font-weight: 400;
  color: var(--mut);
}

.accordion[open] summary::after {
  content: "−";
}

.accordion-body {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(229, 231, 235, 0.8);
}

.accordion-body p {
  margin: 12px 0 0;
  color: #374151;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .hero-card {
    padding: 18px;
  }

  .info-grid,
  .keyword-grid {
    grid-template-columns: 1fr;
  }

  .hero-chips,
  .topic-nav {
    gap: 8px;
  }

  .topic-link,
  .hero-chip {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-inner { padding: 10px 14px; }
  .container { margin-top: 22px; }
}

@media (max-width: 560px) {
  .topbar-inner { padding: 10px 12px; }
  .brand { gap: 10px; }
  .brand-logo-slot {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .brand-logo-image {
    width: 24px;
    height: 24px;
  }
  .brand-name { font-size: 16px; }
  .brand-subtitle { font-size: 10px; letter-spacing: 0.12em; }
  .container { margin: 20px auto 28px; padding: 12px; }
  .card { padding: 14px; }
  .saju-table thead th:first-child { width: 28px; }
  .saju-table tbody th { padding-right: 2px; }
  .saju-table td { padding: 3px 2px; }
}

@media (max-width: 380px) {
  .brand-logo-slot {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .brand-logo-image {
    width: 22px;
    height: 22px;
  }
  .brand-name { font-size: 15px; }
  .brand-subtitle { display: none; }
  .saju-table thead th:first-child { width: 24px; }
  .saju-table thead th { letter-spacing: 0.08em; }
  .saju-table tbody th { font-size: 9px; }
  .pillar-card { border-radius: 14px; }
  .pillar-element { padding: 2px 4px; }
}
