/* BMI FitCheck - static Cloudflare Pages site */
:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --surface-glass: rgba(255,255,255,.86);
  --text: #172033;
  --muted: #657086;
  --line: #dfe7f2;
  --primary: #3765f4;
  --primary-strong: #264bd6;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 24px 70px rgba(26, 39, 74, .12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c111d;
  --surface: #151b2a;
  --surface-soft: #101624;
  --surface-glass: rgba(21, 27, 42, .9);
  --text: #eef2ff;
  --muted: #9aa6bc;
  --line: #2b374d;
  --primary: #83a0ff;
  --primary-strong: #5c7ff2;
  --accent: #2dd4bf;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 26px 70px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 6%, rgba(55, 101, 244, .14), transparent 32%),
    radial-gradient(circle at 86% 8%, rgba(16, 185, 129, .14), transparent 30%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 6%, rgba(131,160,255,.2), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(45,212,191,.15), transparent 30%),
    linear-gradient(180deg, #111827 0%, var(--bg) 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img, svg { max-width: 100%; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-weight: 900;
}
.skip-link:focus { top: 14px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(223,231,242,.72);
  background: rgba(246,248,252,.72);
}
:root[data-theme="dark"] .site-header {
  background: rgba(12,17,29,.74);
  border-bottom-color: rgba(43,55,77,.82);
}
.nav {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(55,101,244,.22);
}
.brand-text strong {
  display: block;
  letter-spacing: -.04em;
  font-size: 1.02rem;
}
.brand-text span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links a,
.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
  font-size: .88rem;
}
.nav-links a:hover,
.nav-links a.active,
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-glass);
}
.theme-toggle {
  gap: 7px;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}
.hero {
  padding: clamp(46px, 8vw, 84px) 0 28px;
  text-align: center;
}
.eyebrow {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 16px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(55,101,244,.18);
  background: rgba(55,101,244,.09);
  color: var(--primary);
  font-weight: 950;
  font-size: .88rem;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 8.4vw, 5.4rem);
  line-height: .98;
  letter-spacing: -.09em;
  font-weight: 1000;
}
.hero p {
  max-width: 720px;
  margin: 18px auto 0;
  color: var(--muted);
  line-height: 1.75;
  word-break: keep-all;
  font-size: clamp(.98rem, 2vw, 1.08rem);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.cta, .secondary-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 950;
  border: 1px solid var(--line);
}
.cta {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 16px 32px rgba(55,101,244,.24);
}
.secondary-link {
  color: var(--text);
  background: var(--surface-glass);
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(300px, .84fr);
  gap: 18px;
  align-items: start;
}
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-glass);
  box-shadow: var(--shadow);
}
.calculator-card {
  padding: clamp(20px, 3vw, 30px);
}
.side-stack {
  display: grid;
  gap: 18px;
}
.mini-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-title h2 {
  margin: 0;
  letter-spacing: -.055em;
  font-size: clamp(1.25rem, 4vw, 1.65rem);
}
.section-title p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.62;
  word-break: keep-all;
  font-size: .94rem;
}
.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(55,101,244,.18);
  background: rgba(55,101,244,.09);
  color: var(--primary);
  font-weight: 950;
  font-size: .82rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field {
  display: grid;
  gap: 8px;
}
.field.full { grid-column: 1 / -1; }
label {
  color: var(--text);
  font-weight: 900;
  font-size: .91rem;
}
.input-wrap {
  position: relative;
}
input, select {
  width: 100%;
  min-height: 54px;
  padding: 0 52px 0 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
select { padding-right: 14px; }
input:focus, select:focus {
  border-color: rgba(55,101,244,.72);
  box-shadow: 0 0 0 4px rgba(55,101,244,.14);
}
.unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 900;
  font-size: .86rem;
}
.helper {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
}

.calc-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 16px;
}
.primary-button, .ghost-button {
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid var(--line);
  font-weight: 950;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.primary-button {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 16px 32px rgba(55,101,244,.22);
}
.ghost-button {
  padding: 0 16px;
  color: var(--text);
  background: var(--surface-soft);
}
.primary-button:hover, .ghost-button:hover { transform: translateY(-2px); }
.primary-button:active, .ghost-button:active { transform: translateY(0); }

.result-panel {
  margin-top: 18px;
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  overflow: hidden;
}
.result-panel.show { display: block; }
.result-top {
  padding: 22px;
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 16px;
  align-items: center;
}
.score {
  text-align: center;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.score small {
  color: var(--muted);
  font-weight: 900;
}
.score strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 1;
  letter-spacing: -.07em;
}
.category-pill {
  display: inline-flex;
  margin-top: 12px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 950;
  color: #fff;
}
.pill-low { background: #64748b; }
.pill-normal { background: #10b981; }
.pill-over { background: #f59e0b; }
.pill-obese1 { background: #f97316; }
.pill-obese2, .pill-obese3 { background: #ef4444; }

.result-copy h3 {
  margin: 0;
  letter-spacing: -.045em;
  font-size: 1.25rem;
}
.result-copy p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.7;
  word-break: keep-all;
}
.gauge-wrap {
  padding: 0 22px 22px;
}
.gauge-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}
.gauge {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #64748b 0 37%, #10b981 37% 51%, #f59e0b 51% 58%, #f97316 58% 75%, #ef4444 75% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.marker {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--surface);
  transform: translateX(-50%);
}
.insight-grid {
  padding: 0 22px 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.insight {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-soft);
}
.insight span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}
.insight strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
  line-height: 1.35;
}
.warning-box {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(245,158,11,.32);
  background: rgba(245,158,11,.1);
  color: var(--text);
  line-height: 1.62;
  font-size: .9rem;
}

.mini-card p, .content-card p, .content-card li {
  color: var(--muted);
  line-height: 1.72;
  word-break: keep-all;
}
.tool-list, .guide-list, .history-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}
.tool-list li, .guide-list a, .history-list li {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.guide-list a:hover {
  border-color: rgba(55,101,244,.45);
  transform: translateY(-1px);
}
.guide-list strong, .history-list strong {
  display: block;
  font-size: .92rem;
}
.guide-list span, .history-list span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}
.history-list li {
  font-size: .86rem;
}
.empty-history {
  color: var(--muted);
}

.content-section {
  padding: 18px 0 0;
}
.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.content-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
}
.content-card h3 {
  margin: 0 0 10px;
  letter-spacing: -.045em;
  font-size: 1.1rem;
}
.content-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
}
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
  padding: 34px 0 0;
}
.article {
  padding: clamp(22px, 4vw, 36px);
}
.article h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.08em;
}
.article .lead {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.78;
  font-size: 1.04rem;
}
.article h2 {
  margin: 36px 0 10px;
  letter-spacing: -.055em;
  font-size: 1.55rem;
}
.article h3 {
  margin: 24px 0 8px;
  letter-spacing: -.035em;
}
.article p, .article li {
  color: var(--muted);
  line-height: 1.8;
  word-break: keep-all;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
  margin: 16px 0;
  font-size: .92rem;
}
.article th, .article td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
}
.article th {
  background: var(--surface-soft);
  color: var(--text);
}
.sidebar {
  position: sticky;
  top: 86px;
  padding: 18px;
}
.sidebar h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 850;
}
.sidebar a:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.footer {
  margin-top: 46px;
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.footer-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.footer p {
  margin: 6px 0 0;
  line-height: 1.65;
  font-size: .86rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-links a {
  color: var(--muted);
  font-weight: 850;
  font-size: .86rem;
}
.footer-links a:hover { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-width: 220px;
  max-width: calc(100% - 32px);
  text-align: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 900;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(55,101,244,.36);
  outline-offset: 3px;
}

@media (max-width: 930px) {
  .nav {
    min-height: auto;
    padding: 12px 0;
    align-items: flex-start;
    flex-direction: column;
  }
  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .grid-main, .article-layout {
    grid-template-columns: 1fr;
  }
  .side-stack {
    grid-template-columns: 1fr 1fr;
  }
  .side-stack .mini-card:last-child {
    grid-column: 1 / -1;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .container, .nav, .footer-inner {
    width: min(100% - 24px, 1120px);
  }
  .brand-text span { display: none; }
  .hero {
    padding-top: 34px;
  }
  .hero h1 {
    letter-spacing: -.075em;
  }
  .grid-main, .side-stack {
    gap: 14px;
  }
  .side-stack {
    grid-template-columns: 1fr;
  }
  .side-stack .mini-card:last-child {
    grid-column: auto;
  }
  .section-title {
    flex-direction: column;
    gap: 10px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .calc-actions {
    grid-template-columns: 1fr;
  }
  .result-top {
    grid-template-columns: 1fr;
  }
  .insight-grid {
    grid-template-columns: 1fr;
  }
  .gauge-labels {
    grid-template-columns: 1fr 1fr;
    font-size: .7rem;
  }
  .footer-inner {
    flex-direction: column;
  }
  .article {
    padding: 22px;
  }
}

@media (max-width: 380px) {
  .container, .nav, .footer-inner {
    width: min(100% - 18px, 1120px);
  }
  .calculator-card, .mini-card, .content-card, .article {
    border-radius: 22px;
    padding: 16px;
  }
  .nav-links a, .theme-toggle {
    padding: 0 10px;
    font-size: .82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}