.wb-tool {
  --wb-tool-ink: #17342f;
  --wb-tool-muted: #5c716d;
  --wb-tool-accent: #087f70;
  --wb-tool-accent-dark: #05685d;
  --wb-tool-border: #d6e7e1;
  --wb-tool-surface: #f3faf7;
  --wb-tool-white: #fff;
  box-sizing: border-box;
  width: 100%;
  max-width: 720px;
  margin: clamp(24px, 4vw, 40px) auto;
  overflow: hidden;
  color: var(--wb-tool-ink);
  background: var(--wb-tool-white);
  border: 1px solid var(--wb-tool-border);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(31, 72, 64, 0.1);
  font-family: inherit;
  text-align: left;
}

.wb-tool *, .wb-tool *::before, .wb-tool *::after { box-sizing: border-box; }

.wb-tool__header {
  padding: clamp(24px, 5vw, 38px);
  background: radial-gradient(circle at 92% 8%, rgba(91, 189, 165, 0.2), transparent 34%), linear-gradient(145deg, #eef9f5 0%, #f8fcfa 100%);
  border-bottom: 1px solid var(--wb-tool-border);
}

.wb-tool__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  padding: 4px 11px;
  color: var(--wb-tool-accent-dark);
  background: #ddf2eb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.wb-tool__title { margin: 0; color: var(--wb-tool-ink); font-size: clamp(25px, 5vw, 34px); font-weight: 800; letter-spacing: -.025em; line-height: 1.08; }
.wb-tool__intro { max-width: 600px; margin: 14px 0 0; color: var(--wb-tool-muted); font-size: 16px; line-height: 1.55; }
.wb-tool__form, .wb-tool__result { padding: clamp(24px, 5vw, 38px); }

.wb-tool__mode, .wb-tool__sex { min-width: 0; margin: 0; padding: 0; border: 0; }
.wb-tool__mode > legend, .wb-tool__sex > legend, .wb-tool__field label {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  color: var(--wb-tool-ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.wb-tool__mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  background: #edf5f2;
  border-radius: 14px;
}

.wb-tool__mode > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wb-tool__mode label, .wb-tool__choice-row label { position: relative; margin: 0; cursor: pointer; }
.wb-tool__mode input, .wb-tool__choice-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.wb-tool__mode span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--wb-tool-muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.wb-tool__mode input:checked + span { color: var(--wb-tool-accent-dark); background: #fff; box-shadow: 0 2px 8px rgba(23, 52, 47, .1); }
.wb-tool__mode input:focus-visible + span, .wb-tool__choice-row input:focus-visible + span { outline: 3px solid rgba(8, 127, 112, .25); outline-offset: 2px; }

.wb-tool__child-fields {
  display: grid;
  grid-template-columns: 1.35fr minmax(100px, .8fr) minmax(100px, .8fr);
  gap: 14px;
  margin: 0 0 18px;
  padding: 18px;
  background: var(--wb-tool-surface);
  border: 1px solid var(--wb-tool-border);
  border-radius: 16px;
}
.wb-tool__choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wb-tool__choice-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 8px;
  color: var(--wb-tool-ink);
  background: #fff;
  border: 1px solid #b8cec7;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
}
.wb-tool__choice-row input:checked + span { color: #fff; background: var(--wb-tool-accent); border-color: var(--wb-tool-accent); }

.wb-tool__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.wb-tool__input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  height: 54px;
  min-height: 54px;
  overflow: hidden;
  background: var(--wb-tool-white);
  border: 1px solid #b8cec7;
  border-radius: 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.wb-tool__input-wrap:focus-within, .wb-tool__select:focus { border-color: var(--wb-tool-accent) !important; box-shadow: 0 0 0 3px rgba(8, 127, 112, .14) !important; }

section.wb-tool.wb-tool--bmi .wb-tool__input-wrap > input {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 52px !important;
  margin: 0 !important;
  padding: 0 8px 0 16px !important;
  color: var(--wb-tool-ink) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font: inherit !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: normal !important;
  outline: 0 !important;
  appearance: none;
}

section.wb-tool.wb-tool--bmi .wb-tool__select {
  display: block !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 0 38px 0 13px !important;
  color: var(--wb-tool-ink) !important;
  background-color: #fff !important;
  border: 1px solid #b8cec7 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  font: inherit !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: normal !important;
}

.wb-tool__input-wrap input[aria-invalid="true"], .wb-tool__select[aria-invalid="true"] { color: #a52a2a !important; }
.wb-tool__unit { display: flex; align-items: center; padding: 0 16px 0 8px; color: var(--wb-tool-muted); font-size: 14px; font-weight: 700; }
.wb-tool__error { margin: 16px 0 0; padding: 11px 13px; color: #842029; background: #fff1f2; border: 1px solid #f1c4c8; border-radius: 10px; font-size: 14px; line-height: 1.45; }
.wb-tool__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.wb-tool .wb-tool__button {
  min-height: 48px;
  margin: 0;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.wb-tool .wb-tool__button:focus-visible { outline: 3px solid rgba(8, 127, 112, .25); outline-offset: 2px; }
.wb-tool .wb-tool__button--primary { color: #fff; background: var(--wb-tool-accent); }
.wb-tool .wb-tool__button--primary:hover { color: #fff; background: var(--wb-tool-accent-dark); transform: translateY(-1px); }
.wb-tool .wb-tool__button--secondary { color: var(--wb-tool-ink); background: #fff; border-color: #b8cec7; }
.wb-tool .wb-tool__button--secondary:hover { color: var(--wb-tool-ink); background: var(--wb-tool-surface); border-color: #8eaaa2; }

.wb-tool__result { padding-top: 0; }
.wb-tool__result-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; background: var(--wb-tool-surface); border: 1px solid var(--wb-tool-border); border-radius: 16px; }
.wb-tool__result-label { display: block; margin-bottom: 2px; color: var(--wb-tool-muted); font-size: 13px; font-weight: 700; }
.wb-tool__result-value { display: block; color: var(--wb-tool-ink); font-size: clamp(34px, 8vw, 48px); font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.wb-tool__result-category { max-width: 260px; margin: 0; color: var(--wb-tool-accent-dark); font-size: 17px; font-weight: 800; line-height: 1.3; text-align: right; }
.wb-tool__range { display: flex; justify-content: space-between; gap: 16px; margin: 16px 0 0; color: var(--wb-tool-muted); font-size: 15px; line-height: 1.45; }
.wb-tool__range strong { color: var(--wb-tool-ink); white-space: nowrap; }

.wb-bmi-scale { position: relative; margin-top: 26px; padding-top: 15px; }
.wb-bmi-scale__marker { position: absolute; top: 0; left: var(--wb-bmi-position, 0%); width: 2px; height: 27px; background: var(--wb-tool-ink); border-radius: 2px; transform: translateX(-1px); transition: left 280ms ease; }
.wb-bmi-scale__marker::before { position: absolute; top: -3px; left: 50%; width: 9px; height: 9px; background: var(--wb-tool-ink); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(23, 52, 47, .3); content: ''; transform: translateX(-50%); }
.wb-bmi-scale__bar { display: grid; grid-template-columns: 3.5fr 6.5fr 5fr 5fr 5fr 5fr; height: 12px; overflow: hidden; border-radius: 999px; }
.wb-bmi-scale__segment--under, .wb-bmi-chart__band--under { background: #cfe7f2; fill: #cfe7f2; }
.wb-bmi-scale__segment--healthy, .wb-bmi-chart__band--healthy { background: #bfe5d3; fill: #bfe5d3; }
.wb-bmi-scale__segment--over, .wb-bmi-chart__band--over { background: #f3dfa8; fill: #f3dfa8; }
.wb-bmi-scale__segment--obesity-1, .wb-bmi-chart__band--obesity-1 { background: #f2c59f; fill: #f2c59f; }
.wb-bmi-scale__segment--obesity-2, .wb-bmi-chart__band--obesity-2 { background: #ecaa98; fill: #ecaa98; }
.wb-bmi-scale__segment--obesity-3, .wb-bmi-chart__band--obesity-3 { background: #dc8d90; fill: #dc8d90; }
.wb-bmi-scale__ticks { position: relative; height: 22px; margin-top: 6px; color: var(--wb-tool-muted); font-size: 11px; line-height: 1; }
.wb-bmi-scale__ticks span { position: absolute; left: var(--wb-tick); transform: translateX(-50%); }
.wb-bmi-scale__ticks span:nth-child(1) { --wb-tick: 11.67%; }
.wb-bmi-scale__ticks span:nth-child(2) { --wb-tick: 33.33%; }
.wb-bmi-scale__ticks span:nth-child(3) { --wb-tick: 50%; }
.wb-bmi-scale__ticks span:nth-child(4) { --wb-tick: 66.67%; }
.wb-bmi-scale__ticks span:nth-child(5) { --wb-tick: 83.33%; }

.wb-bmi-chart-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--wb-tool-border); }
.wb-bmi-chart-section h4 { margin: 0 0 12px; color: var(--wb-tool-ink); font-size: 18px; line-height: 1.3; }
.wb-bmi-chart { width: 100%; overflow: hidden; background: #fff; border: 1px solid var(--wb-tool-border); border-radius: 14px; }
.wb-bmi-chart svg { display: block; width: 100%; height: auto; font-family: inherit; }
.wb-bmi-chart__band { opacity: .88; }
.wb-bmi-chart__grid { stroke: rgba(23, 52, 47, .12); stroke-width: 1; }
.wb-bmi-chart__axis { stroke: #7d9690; stroke-width: 1.4; }
.wb-bmi-chart__tick { fill: var(--wb-tool-muted); font-size: 11px; }
.wb-bmi-chart__axis-label { fill: var(--wb-tool-ink); font-size: 12px; font-weight: 750; }
.wb-bmi-chart__marker { fill: var(--wb-tool-accent); stroke: #fff; stroke-width: 3; filter: drop-shadow(0 2px 3px rgba(23, 52, 47, .25)); }
.wb-bmi-chart__marker-label { fill: var(--wb-tool-ink); font-size: 12px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.wb-bmi-chart__curve { fill: none; stroke: #c2744b; stroke-width: 1.8; }
.wb-bmi-chart__curve--median { stroke: var(--wb-tool-accent); stroke-width: 2.5; }
.wb-bmi-chart__curve-label { fill: var(--wb-tool-ink); font-size: 10px; font-weight: 750; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.wb-bmi-chart__legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px 12px; }
.wb-bmi-chart__legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--wb-tool-muted); font-size: 11px; line-height: 1.3; }
.wb-bmi-chart__legend-item::before { width: 10px; height: 10px; border-radius: 3px; content: ''; }
.wb-bmi-chart__legend-item--under::before { background: #cfe7f2; }
.wb-bmi-chart__legend-item--healthy::before { background: #bfe5d3; }
.wb-bmi-chart__legend-item--over::before { background: #f3dfa8; }
.wb-bmi-chart__legend-item--obesity-1::before { background: #f2c59f; }
.wb-bmi-chart__legend-item--obesity-2::before { background: #ecaa98; }
.wb-bmi-chart__legend-item--obesity-3::before { background: #dc8d90; }
.wb-bmi-chart__caption { margin: 10px 0 0; color: var(--wb-tool-muted); font-size: 12px; line-height: 1.45; }
.wb-tool__note { margin: 18px 0 0; color: var(--wb-tool-muted); font-size: 13px; line-height: 1.5; }
.wb-tool__note a { font-weight: 750; }
.wb-tool [hidden] { display: none !important; }

@media (max-width: 620px) {
  .wb-tool__child-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-tool__sex { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .wb-tool { border-radius: 18px; }
  .wb-tool__fields { grid-template-columns: 1fr; gap: 14px; }
  .wb-tool__actions { display: grid; grid-template-columns: 1fr; }
  .wb-tool .wb-tool__button { width: 100%; }
  .wb-tool__result-summary { display: block; }
  .wb-tool__result-category { max-width: none; margin-top: 10px; text-align: left; }
  .wb-bmi-chart__legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .wb-tool__child-fields { grid-template-columns: 1fr; }
  .wb-tool__sex { grid-column: auto; }
}

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