:root {
  --brand: #2563eb;
  --brand-light: #eff6ff;
  --brand-dark: #1e40af;
  --text: #111827;
  --text2: #4b5563;
  --text3: #9ca3af;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg2: #f9fafb;
  --bg3: #f3f4f6;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.logo { font-size: 17px; font-weight: 700; color: var(--brand); text-decoration: none; letter-spacing: -0.3px; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { font-size: 14px; color: var(--text2); text-decoration: none; }
.nav-links a:hover { color: var(--brand); }

/* LAYOUT */
.page { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* HERO */
.hero { padding: 32px 0 24px; }
.hero h1 { font-size: clamp(22px, 5vw, 30px); font-weight: 800; line-height: 1.25; color: var(--text); letter-spacing: -0.5px; margin-bottom: 10px; }
.hero p { font-size: 16px; color: var(--text2); max-width: 560px; }

/* CALCULATOR CARD */
.calc-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
}
.calc-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.calc-tab {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.calc-tab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--bg); }
.calc-body { padding: 20px 16px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media(max-width:480px){ .field-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-hint { font-size: 11px; color: var(--text3); }

.input-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input-wrap input {
  flex: 1; border: none; outline: none; padding: 10px 12px;
  font-size: 15px; color: var(--text); background: transparent; width: 100%;
}
.input-unit { padding: 0 12px; font-size: 13px; color: var(--text3); background: var(--bg2); border-left: 1px solid var(--border); white-space: nowrap; align-self: stretch; display: flex; align-items: center; }

select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--bg); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  outline: none;
}
select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.gender-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.gender-toggle button {
  flex: 1; padding: 10px; font-size: 14px; font-weight: 500;
  border: none; background: var(--bg); color: var(--text2); cursor: pointer; transition: all .15s;
}
.gender-toggle button.active { background: var(--brand); color: #fff; }

.unit-toggle { display: flex; gap: 8px; margin-bottom: 18px; }
.unit-toggle button {
  padding: 6px 14px; font-size: 13px; font-weight: 500; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text2); cursor: pointer;
}
.unit-toggle button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.calc-btn {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--brand); color: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; margin-top: 8px; transition: background .15s;
  letter-spacing: 0.1px;
}
.calc-btn:hover { background: var(--brand-dark); }
.calc-btn:active { transform: scale(.99); }

/* RESULTS */
.results { display: none; margin-top: 20px; }
.results.show { display: block; }
.results-top { text-align: center; padding: 16px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.results-top .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin-bottom: 4px; }
.results-top .bmr-val { font-size: 14px; color: var(--text2); }
.results-top .bmr-val span { font-weight: 600; color: var(--text); }

.goal-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media(max-width:520px){ .goal-cards { grid-template-columns: 1fr; } }

.goal-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  position: relative;
}
.goal-card.featured { border-color: var(--brand); background: var(--brand-light); }
.featured-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.goal-card .goal-name { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.goal-card .goal-cal { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 2px; }
.goal-card .goal-unit { font-size: 11px; color: var(--text3); margin-bottom: 10px; }
.goal-card .goal-note { font-size: 11px; color: var(--text2); }

.macro-section { margin-top: 20px; }
.macro-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .05em; }
.macro-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.macro-tab {
  padding: 5px 12px; font-size: 13px; font-weight: 500; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text2); cursor: pointer;
}
.macro-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.macro-bars { display: flex; flex-direction: column; gap: 10px; }
.macro-row { display: flex; align-items: center; gap: 10px; }
.macro-name { font-size: 13px; font-weight: 600; width: 70px; flex-shrink: 0; }
.macro-bar-wrap { flex: 1; background: var(--bg3); border-radius: 4px; height: 8px; overflow: hidden; }
.macro-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.macro-grams { font-size: 13px; font-weight: 600; width: 60px; text-align: right; flex-shrink: 0; }

.result-note { margin-top: 16px; padding: 12px 14px; background: var(--amber-bg); border-left: 3px solid var(--amber); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--text2); }

/* CONTENT */
.content-section { padding: 36px 0; border-top: 1px solid var(--border); }
.content-section h2 { font-size: clamp(19px, 4vw, 24px); font-weight: 800; color: var(--text); margin-bottom: 12px; letter-spacing: -0.3px; }
.content-section h3 { font-size: 17px; font-weight: 700; color: var(--text); margin: 20px 0 8px; }
.content-section p { font-size: 15px; color: var(--text2); margin-bottom: 14px; }
.content-section ul, .content-section ol { padding-left: 20px; margin-bottom: 14px; }
.content-section li { font-size: 15px; color: var(--text2); margin-bottom: 6px; }

/* INFO CARDS */
.info-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
@media(max-width:480px){ .info-cards { grid-template-columns: 1fr; } }
.info-card { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg2); }
.info-card .ic-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin-bottom: 4px; }
.info-card .ic-val { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.info-card .ic-desc { font-size: 12px; color: var(--text2); }

/* TABLE */
.tbl-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 420px; }
th { background: var(--bg2); padding: 10px 14px; font-size: 13px; font-weight: 700; text-align: left; color: var(--text); border-bottom: 1px solid var(--border); }
td { padding: 9px 14px; font-size: 13px; color: var(--text2); border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--bg2); }

/* FORMULA */
.formula-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 12px 0; font-family: 'Courier New', monospace; font-size: 13px; color: var(--text); line-height: 2; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%; padding: 16px 0; text-align: left; font-size: 15px; font-weight: 600;
  color: var(--text); background: none; border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-q:hover { color: var(--brand); }
.faq-icon { font-size: 20px; color: var(--text3); flex-shrink: 0; transition: transform .2s; }
.faq-icon.open { transform: rotate(45deg); }
.faq-a { font-size: 15px; color: var(--text2); padding: 0 0 16px; display: none; }
.faq-a.show { display: block; }

/* GOAL STEPS */
.step-list { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.step-item { display: flex; gap: 14px; align-items: flex-start; }
.step-num { width: 28px; height: 28px; background: var(--brand); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: flex-start; font-size: 13px; font-weight: 700; flex-shrink: 0; justify-content: center; }
.step-content { font-size: 15px; color: var(--text2); padding-top: 3px; }
.step-content strong { color: var(--text); font-weight: 600; }

/* PILL TAGS */
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.tag-pill { font-size: 12px; padding: 3px 10px; background: var(--brand-light); color: var(--brand-dark); border-radius: 20px; font-weight: 500; }

/* CALLOUT */
.callout { padding: 14px 16px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 14px; }
.callout.green { background: var(--green-bg); border-left: 3px solid var(--green); color: #166534; }
.callout.blue { background: var(--brand-light); border-left: 3px solid var(--brand); color: var(--brand-dark); }
.callout.red { background: var(--red-bg); border-left: 3px solid var(--red); color: #991b1b; }

/* FOOTER */
footer { border-top: 1px solid var(--border); padding: 24px 16px; text-align: center; }
footer p { font-size: 13px; color: var(--text3); }
footer a { color: var(--text3); text-decoration: none; }
footer a:hover { color: var(--brand); }

/* Smooth scroll target offset */
[id] { scroll-margin-top: 60px; }