:root {
  --bg: #f3f8f3;
  --surface: #ffffff;
  --surface-soft: #f7fbf7;
  --text: #102017;
  --muted: #647067;
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-soft: #e8f7ed;
  --primary-border: #b8e4c6;
  --primary-ring: rgba(22, 163, 74, 0.16);
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --border: #d5e1d7;
  --shadow: 0 10px 28px rgba(16, 32, 23, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.site-header,
.category-tabs,
main,
.site-footer {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 38px 0 18px;
}

.header-layout {
  display: grid;
  position: relative;
  gap: 20px;
  padding-top: 54px;
}

.language-control {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 42px;
  padding: 5px 8px 5px 14px;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--primary-border);
  border-radius: 9999px;
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.1);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.language-control::after {
  position: absolute;
  right: 20px;
  width: 7px;
  height: 7px;
  pointer-events: none;
  content: "";
  border-right: 2px solid var(--primary-dark);
  border-bottom: 2px solid var(--primary-dark);
  transform: translateY(-2px) rotate(45deg);
}

.language-control span {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.language-control select {
  width: auto;
  min-height: 34px;
  padding: 7px 34px 7px 12px;
  color: var(--primary-dark);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: linear-gradient(180deg, #ffffff 0%, var(--primary-soft) 100%);
  border: 1px solid var(--primary-border);
  border-radius: 9999px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.language-control select:focus {
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.intro {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.category-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 0;
  background: linear-gradient(180deg, rgba(243, 248, 243, 0.98), rgba(243, 248, 243, 0.9));
  backdrop-filter: blur(12px);
}

.category-select-control {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--primary-border);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.1);
}

.category-select-control::after {
  position: absolute;
  right: 28px;
  bottom: 25px;
  width: 8px;
  height: 8px;
  pointer-events: none;
  content: "";
  border-right: 2px solid var(--primary-dark);
  border-bottom: 2px solid var(--primary-dark);
  transform: rotate(45deg);
}

.category-select-control span {
  font-size: 0.78rem;
  font-weight: 900;
}

.category-select-control select {
  width: 100%;
  min-height: 44px;
  padding: 0 42px 0 14px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: linear-gradient(180deg, #ffffff 0%, var(--primary-soft) 100%);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  outline: none;
}

.category-select-control select:focus {
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.tab-scroll {
  display: none;
}

.tab-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab-button:hover,
.tab-button:focus,
.tab-button.is-active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  outline: none;
}

.category-section {
  margin: 18px 0 30px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.category-section[hidden] {
  display: none;
}

.section-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2,
.seo-summary h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: -0.04em;
}

.section-heading p:last-child,
.seo-summary p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.keyword-list li {
  padding: 8px 11px;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 800;
  background: #ffffff;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
}

.page-link-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.page-link-grid a,
.tool-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
  background: var(--primary);
  border-radius: 12px;
}

.landing-page .site-header {
  padding-bottom: 10px;
}

.landing-section {
  display: grid;
  gap: 16px;
}

.faq-item {
  padding: 16px 0;
  border-top: 1px solid var(--primary-border);
}

.faq-item:first-of-type {
  margin-top: 16px;
}

.faq-item h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.faq-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.calculator-card {
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.calculator-card h3 {
  margin-bottom: 6px;
  font-size: 1.14rem;
  letter-spacing: -0.03em;
}

.card-description {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.input-row {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
.calculator-card select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #cfd6e2;
  border-radius: 12px;
  outline: none;
}

input:focus,
.calculator-card select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.calculator-card select {
  cursor: pointer;
}

.date-field {
  display: grid;
  grid-template-columns: 1fr auto 0.72fr auto 0.72fr 48px;
  gap: 6px;
  align-items: center;
}

.date-field input {
  min-height: 48px;
  text-align: center;
}

.date-separator {
  color: var(--muted);
  font-weight: 900;
}

.date-picker {
  padding: 0;
  color: transparent;
  cursor: pointer;
}

.date-picker::-webkit-calendar-picker-indicator {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  cursor: pointer;
}

.age-grid {
  grid-template-columns: 1fr;
}

.age-card {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 4vw, 30px);
}

.age-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 12% 8%, rgba(34, 197, 94, 0.16), transparent 28%),
    radial-gradient(circle at 92% 20%, rgba(20, 184, 166, 0.13), transparent 30%);
}

.age-card > * {
  position: relative;
}

.age-layout {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.age-input-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--primary-border);
  border-radius: 18px;
}

.age-result {
  min-height: 128px;
  align-content: center;
  margin-top: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: var(--primary-border);
}

.bmi-scale {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.bmi-scale-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.bmi-scale-row.is-active {
  color: var(--primary-dark);
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.result-box {
  display: grid;
  gap: 7px;
  min-height: 86px;
  margin-top: 14px;
  padding: 15px;
  background: #ffffff;
  border: 1px solid #cfd6e2;
  border-left: 5px solid var(--primary);
  border-radius: 12px;
}

.result-value {
  color: var(--primary-dark);
  font-size: clamp(1.22rem, 5vw, 1.7rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.result-formula {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
}

.result-box.is-error {
  background: var(--danger-bg);
  border-color: #f4b8ae;
  border-left-color: var(--danger);
}

.result-box.is-error .result-value {
  color: var(--danger);
}

.seo-summary {
  margin: 0 0 30px;
  padding: 20px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: 22px;
}

.policy-section {
  display: grid;
  gap: 16px;
}

.policy-updated {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.site-footer {
  padding: 0 0 34px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

@media (min-width: 680px) {
  .site-header,
  .category-tabs,
  main,
  .site-footer {
    width: min(1080px, calc(100% - 48px));
  }

  .category-tabs {
    padding: 12px 0;
  }

  .category-select-control {
    display: none;
  }

  .tab-scroll {
    display: flex;
    gap: 8px;
    padding: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(184, 228, 198, 0.7);
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(16, 32, 23, 0.06);
  }

  .tab-scroll::-webkit-scrollbar {
    height: 6px;
  }

  .tab-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-border);
    border-radius: 999px;
  }

  .calculator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .age-card {
    grid-column: 1 / -1;
  }

  .date-card {
    grid-column: 1 / -1;
  }

  .health-card {
    grid-column: 1 / -1;
  }

  .age-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    align-items: stretch;
  }

  .age-input-panel {
    align-content: center;
    padding: 18px;
  }

  .input-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .date-input-row {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .date-add-row {
    grid-template-columns: minmax(300px, 1.35fr) minmax(160px, 0.65fr) minmax(160px, 0.65fr);
  }

  .three-column {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .site-header {
    padding-top: 52px;
  }

  .header-layout {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding-top: 0;
    padding-right: 210px;
  }

  .language-control {
    top: 2px;
  }

  .category-section,
  .seo-summary {
    padding: 24px;
  }
}
