/* BMI Calculator - #3d85c6 brand, compact */
:root {
  --bmi-brand: #3d85c6;
  --bmi-brand-dark: #2c6396;
  --bmi-brand-light: #eaf4fb;
  --bmi-brand-border: #b6d5f2;
  --bmi-bg: #f4f8fc;
  --bmi-surface: rgba(255, 255, 255, 0.95);
  --bmi-solid: #ffffff;
  --bmi-text: #1a1a1a;
  --bmi-muted: #64748b;
  --bmi-shadow: 0 10px 28px rgba(61, 133, 198, 0.12);
  --bmi-radius: 16px;
  --bmi-font: 'DM Sans', system-ui, sans-serif;
}

#tool-main {
  font-family: var(--bmi-font);
  color: var(--bmi-text);
  background: var(--bmi-bg);
  background-image: radial-gradient(ellipse 70% 40% at 50% -5%, rgba(61, 133, 198, 0.1), transparent);
  padding-bottom: 16px;
}

.bmi-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px 8px;
}

.bmi-gender-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bmi-gender-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1.5px solid var(--bmi-brand-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--bmi-solid);
  margin: 0;
}

.bmi-gender-pill:has(input:checked) {
  border-color: var(--bmi-brand);
  background: var(--bmi-brand-light);
  color: var(--bmi-brand-dark);
}

.bmi-gender-pill input {
  accent-color: var(--bmi-brand);
  margin-right: 6px;
}

.bmi-hero {
  text-align: center;
  margin-bottom: 12px;
}

.bmi-hero h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--bmi-brand);
  margin: 0 0 4px;
}

.bmi-hero p {
  color: var(--bmi-muted);
  font-size: 0.85rem;
  margin: 0;
}

.bmi-glass {
  background: var(--bmi-surface);
  border: 1px solid var(--bmi-brand-border);
  border-radius: var(--bmi-radius);
  box-shadow: var(--bmi-shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.bmi-glass > .bmi-field {
  margin-bottom: 12px;
}

.bmi-unit-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.bmi-unit-toggle button {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--bmi-brand-border);
  background: var(--bmi-solid);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--bmi-brand-dark);
  cursor: pointer;
}

.bmi-unit-toggle button.active {
  background: var(--bmi-brand);
  border-color: var(--bmi-brand);
  color: #fff;
}

.bmi-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.bmi-form-grid .bmi-field--full {
  grid-column: 1 / -1;
}

.bmi-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bmi-brand-dark);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bmi-input {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  border: 1.5px solid var(--bmi-brand-border);
  border-radius: 10px;
  background: #f7fbff;
  box-sizing: border-box;
}

.bmi-input:focus {
  border-color: var(--bmi-brand);
  outline: none;
  box-shadow: 0 0 0 2px var(--bmi-brand-light);
}

.bmi-height-ftin {
  display: flex;
  gap: 8px;
}

.bmi-height-ftin .bmi-input {
  flex: 1;
  min-width: 0;
}

.bmi-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bmi-brand);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.bmi-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.bmi-btn {
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.bmi-btn--primary {
  flex: 1;
  background: var(--bmi-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 133, 198, 0.3);
}

.bmi-btn--primary:hover {
  background: var(--bmi-brand-dark);
}

.bmi-btn--ghost {
  background: var(--bmi-solid);
  border: 1px solid var(--bmi-brand-border);
  color: var(--bmi-muted);
  padding-left: 14px;
  padding-right: 14px;
}

.bmi-btn--sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}

.bmi-result[hidden] {
  display: none !important;
}

.bmi-result {
  text-align: center;
  animation: bmiIn 0.3s ease;
}

@keyframes bmiIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bmi-score {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--bmi-brand);
  line-height: 1.1;
  margin-bottom: 4px;
}

.bmi-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.bmi-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3498db 0% 20%, #22c55e 20% 55%, #f59e0b 55% 80%, #ef4444 80% 100%);
  position: relative;
  margin: 8px 0 6px;
}

.bmi-bar-pointer {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 22px;
  background: var(--bmi-brand-dark);
  border-radius: 4px;
  transform: translateX(-50%);
  transition: left 0.25s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.bmi-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--bmi-muted);
  margin-bottom: 10px;
}

.bmi-note {
  font-size: 0.82rem;
  color: var(--bmi-muted);
  margin: 0 0 10px;
  line-height: 1.4;
}

.bmi-note strong {
  color: var(--bmi-brand-dark);
}

.bmi-result-actions {
  margin-bottom: 4px;
}

.bmi-guide-card {
  padding: 12px 14px;
}

.bmi-guide-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--bmi-brand);
  margin: 0 0 8px;
  text-align: center;
}

.bmi-guide-sub {
  font-size: 0.75rem;
  color: var(--bmi-muted);
  text-align: center;
  margin: 0 0 8px;
  line-height: 1.35;
}

.bmi-table-scroll {
  overflow: auto;
  max-height: 220px;
  border: 1px solid var(--bmi-brand-border);
  border-radius: 10px;
}

.bmi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 8px;
}

.bmi-table th,
.bmi-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--bmi-brand-border);
  text-align: center;
}

.bmi-table th {
  background: var(--bmi-brand-light);
  color: var(--bmi-brand-dark);
}

.bmi-cat-under { color: #3498db; font-weight: 600; }
.bmi-cat-normal { color: #22c55e; font-weight: 600; }
.bmi-cat-over { color: #f59e0b; font-weight: 600; }
.bmi-cat-obese { color: #ef4444; font-weight: 600; }

.bmi-table tbody tr.is-active {
  background: var(--bmi-brand-light);
  outline: 2px solid var(--bmi-brand);
  outline-offset: -2px;
}

.bmi-table td.is-gender-col {
  font-weight: 700;
  color: var(--bmi-brand-dark);
}

.bmi-disclaimer {
  font-size: 0.72rem;
  color: var(--bmi-muted);
  margin-top: 8px;
  line-height: 1.35;
}

.bmi-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}

.bmi-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bmi-toast--success { background: #166534; color: #fff; }
.bmi-toast--warning { background: #b45309; color: #fff; }
.bmi-toast--error { background: #b91c1c; color: #fff; }
