@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  color-scheme: light;
  --bg: #f4f6fb; --surface: #fff; --text: #191f28; --muted: #6b7684; --line: #e5e8eb;
  --accent: #3182f6; --accent-strong: #1b64da; --accent-soft: #e8f3ff;
  --shadow: 0 1px 2px #0000000a, 0 8px 24px #0000000f;
  --page: max(16px, calc(50% - 380px));
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101216; --surface: #1b1e24; --text: #e9ecf1; --muted: #9aa3ae; --line: #2c313a;
    --accent: #4c9bff; --accent-strong: #7db5ff; --accent-soft: #1a2a40;
    --shadow: 0 1px 2px #0006, 0 8px 24px #0004;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.75 "Pretendard Variable", Pretendard, system-ui, sans-serif;
  word-break: keep-all; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

header {
  position: sticky; top: 0; z-index: 10; padding: 14px var(--page);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
header a { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; }
header a::before {
  content: "="; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6c5ce7); color: #fff; font-size: 1.1rem; line-height: 1;
}

main { padding: 0 var(--page) 32px; }
h1 { margin: 32px 0 20px; font-size: clamp(1.6rem, 5vw, 2.1rem); line-height: 1.3; letter-spacing: -0.02em; }
h2 { margin: 48px 0 12px; font-size: 1.3rem; letter-spacing: -0.01em; }
h2::before { content: ""; display: block; width: 24px; height: 4px; margin-bottom: 12px; border-radius: 2px; background: var(--accent); }
h3 { margin: 24px 0 4px; font-size: 1.05rem; }
p, li { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
li { margin-bottom: 6px; }
strong { color: var(--text); }

/* 메인 화면 */
.hero { padding: 40px 0 8px; }
.hero h1 { margin: 0 0 12px; font-size: clamp(1.9rem, 6vw, 2.6rem); }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--accent), #6c5ce7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 28px 0 0; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  color: var(--muted); font-size: .92rem; line-height: 1.55; text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.cards a:hover, .cards a:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.cards .icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 12px; background: var(--accent-soft); font-size: 1.4rem; }
.cards strong { font-size: 1.08rem; }

/* 계산기 */
form { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
label { display: block; margin-bottom: 16px; font-size: .9rem; font-weight: 600; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  font: inherit; font-size: 1.05rem; font-weight: 600; color: var(--text);
  background: var(--bg); border: 1.5px solid transparent; border-radius: 12px; outline: none;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus { border-color: var(--accent); background: var(--surface); }
dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 24px 0 0; padding: 20px; border-radius: 16px; background: var(--accent-soft); }
dt { color: var(--muted); font-size: .95rem; }
dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
dt.total, dd.total { padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
dt.total { align-self: end; color: var(--text); font-weight: 700; }
dd.total { font-size: 1.5rem; color: var(--accent-strong); letter-spacing: -0.02em; }

/* BMI 게이지: 15~35 범위, 경계 18.5 / 23 / 25 */
.gauge {
  position: relative; height: 12px; margin: 8px 0 6px; border-radius: 6px;
  background: linear-gradient(90deg, #60a5fa 0 17.5%, #34d399 17.5% 40%, #fbbf24 40% 50%, #f87171 50%);
}
.gauge i { position: absolute; top: -5px; width: 22px; height: 22px; margin-left: -11px; border: 4px solid var(--surface); border-radius: 50%; background: var(--text); box-shadow: var(--shadow); transition: left .2s; }
.gauge-labels { display: grid; grid-template-columns: 17.5% 22.5% 10% 1fr; font-size: .75rem; color: var(--muted); }
.gauge-labels span:last-child { text-align: right; }

.scroll { overflow-x: auto; }
form .scroll { margin-top: 24px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
caption { padding-bottom: 8px; text-align: left; font-weight: 600; color: var(--muted); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
tbody th, tr > th:first-child, td:first-child { text-align: left; }
main > .scroll, main > table { padding: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }

footer { padding: 24px var(--page) 40px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

@media (max-width: 480px) {
  form { padding: 18px; }
  dd.total { font-size: 1.3rem; }
}
