@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-color: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --underweight-color: #38bdf8;
  --normal-color: #22c55e;
  --overweight-color: #fbbf24;
  --obese-color: #f87171;
  --border-radius: 10px;
  --box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: Inter, system-ui, sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e1b4b 45%, #312e81 100%);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.has-site-shell {
  align-items: stretch;
  padding: 0 0 2rem;
}

a { color: #818cf8; }

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 200;
}
.skip-link:focus { top: 0; }

.site-header {
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 3px solid #818cf8;
  padding: 0.75rem 1rem;
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.site-wordmark {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
  text-decoration: none;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.85rem;
}
.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover { color: #818cf8; text-decoration: underline; }

.ad-row { display: flex; justify-content: center; margin: 12px auto; overflow: hidden; }
.ad-rail { display: flex; flex-direction: column; gap: 16px; flex: none; padding-top: 0.5rem; }
.ad-frame { border: 0; display: block; max-width: 100%; }
.ad-native { margin: 16px auto; min-height: 80px; text-align: center; }
.ad-sticky-mobile {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  justify-content: center;
  background: rgba(15, 23, 42, 0.94);
  padding: 4px 0;
}

.page-layout {
  display: flex;
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
  align-items: flex-start;
}
.page-main { flex: 1; min-width: 0; }

.app-container {
  margin: 1rem auto 2rem;
  width: 100%;
}

.glass-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--box-shadow);
  margin-bottom: 1rem;
}

.seo-intro, .who-cite {
  max-width: 65ch;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.55;
}

.medical-disclaimer {
  border-left: 4px solid var(--warning-color);
  padding: 0.75rem 1rem;
  background: rgba(245, 158, 11, 0.08);
  border-radius: var(--border-radius);
  font-size: 0.88rem;
  color: #fde68a;
  margin-bottom: 1rem;
}

.medical-disclaimer strong { color: #fef3c7; }

.unit-selector {
  border: none;
  margin-bottom: 1rem;
}
.unit-selector legend, .mode-selector legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.bmi-form .form-group {
  margin-bottom: 0.85rem;
}
.bmi-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}
.bmi-form input[type="number"],
.bmi-form input[type="date"],
.bmi-form select {
  width: 100%;
  max-width: 22rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0f172a;
  color: #f8fafc;
  font-size: 1rem;
}
.bmi-form input:focus, .bmi-form select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}
.help-text { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 0.25rem; }
.hidden-field { display: none !important; }

.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  max-width: 22rem;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: #e2e8f0;
  width: 100%;
  margin-top: 1rem;
}

.results-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid rgba(148, 163, 184, 0.25); }
.results-section[hidden] { display: none !important; }

.bmi-result-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-around;
  padding: 1.25rem;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, #4338ca, #7c3aed);
}
.bmi-value .label { font-size: 0.85rem; opacity: 0.9; }
.bmi-value .value { font-size: 2.75rem; font-weight: 800; }
.bmi-category {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
  text-align: center;
}
.bmi-category.underweight { background: var(--underweight-color); color: #0f172a; }
.bmi-category.normal { background: var(--normal-color); color: #0f172a; }
.bmi-category.overweight { background: var(--overweight-color); color: #0f172a; }
.bmi-category.obese { background: var(--obese-color); color: #fff; }

.child-result-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.metric-box {
  background: rgba(15, 23, 42, 0.5);
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.metric-box .metric-label { font-size: 0.75rem; color: var(--text-muted); }
.metric-box .metric-value { font-size: 1.2rem; font-weight: 700; }

.chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.chart-bar {
  padding: 0.5rem;
  border-radius: 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f172a;
}
.chart-bar.underweight { background: var(--underweight-color); }
.chart-bar.normal { background: var(--normal-color); }
.chart-bar.overweight { background: var(--overweight-color); }
.chart-bar.obese { background: var(--obese-color); color: #fff; }
.chart-bar.active { outline: 3px solid #fff; transform: scale(1.03); }

.history-section { margin-top: 1.5rem; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.history-item {
  padding: 0.65rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--primary);
}
.btn-small { padding: 0.35rem 0.65rem; font-size: 0.8rem; background: var(--danger-color); color: #fff; }

.toast-error {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger-color);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  z-index: 50;
  max-width: 90%;
}
.toast-error[hidden] { display: none !important; }

.faq-block { margin-top: 2rem; }
.faq-block h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.faq-item { margin-bottom: 1rem; }
.faq-item strong { display: block; margin-bottom: 0.25rem; color: #e2e8f0; }
.faq-item p { color: var(--text-muted); font-size: 0.92rem; }

.site-footer {
  width: 100%;
  background: #0f172a;
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  line-height: 1.5;
}
.site-footer a { color: #e2e8f0; }
.smartlink { font-size: 0.75rem; opacity: 0.85; }

.prose-static {
  max-width: 65ch;
  line-height: 1.55;
  color: var(--text-muted);
  padding: 1.5rem 0 2rem;
}
.prose-static h1 { color: var(--text-main); font-size: 1.75rem; margin-bottom: 0.75rem; }
.prose-static h2 { color: var(--text-main); font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
.prose-static p, .prose-static li { margin: 0.5rem 0; }

@media (max-width: 960px) { .ad-rail { display: none; } }
@media (max-width: 560px) {
  .ad-sticky-mobile { display: flex; }
  body.has-site-shell { padding-bottom: 58px; }
  .ad-top .ad-frame, .ad-mid .ad-frame { transform: scale(0.92); transform-origin: top center; }
}
@media (max-width: 390px) {
  .site-nav { font-size: 0.78rem; }
  .glass-card { padding: 1rem; }
  .bmi-value .value { font-size: 2.25rem; }
}
@media print {
  .ad-row, .ad-rail, .ad-native, .ad-sticky-mobile, .site-header, .site-footer, .no-print, .wf-more-tools { display: none !important; }
}