.page-tool {
  background: #fff;
}

.tool-main {
  flex: 1;
}

.tool-container {
  width: min(100% - 40px, 960px);
  margin: 0 auto;
}

.tool-hero {
  position: relative;
  padding: 76px 0 92px;
  overflow: hidden;
}

.tool-hero__inner {
  position: relative;
}

.tool-eyebrow,
.tool-section__eyebrow {
  margin: 0 0 14px;
  color: var(--wp-purple);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tool-hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--wp-text);
  font-size: clamp(46px, 6vw, 68px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.tool-hero__lead {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--wp-muted2);
  font-size: 19px;
  line-height: 1.65;
}

.bmi-card {
  margin-top: 48px;
  padding: 34px;
  border: 1px solid rgba(92, 56, 255, 0.1);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 30px 80px rgba(43, 30, 111, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bmi-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.bmi-card__head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.bmi-card__head p {
  margin: 6px 0 0;
  color: var(--wp-muted2);
  font-size: 14px;
  line-height: 1.5;
}

.unit-switch {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid rgba(4, 10, 35, 0.1);
  border-radius: 999px;
  background: #f7f6fb;
}

.unit-switch__button {
  min-width: 88px;
  min-height: 42px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  color: var(--wp-muted2);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.unit-switch__button.is-active {
  color: #fff;
  background: var(--wp-purple);
  box-shadow: 0 8px 18px rgba(92, 56, 255, 0.24);
}

.unit-switch__button:focus-visible,
.tool-cta:focus-visible,
.tool-faq-list summary:focus-visible {
  outline: 3px solid rgba(92, 56, 255, 0.26);
  outline-offset: 3px;
}

.bmi-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 30px;
}

.bmi-fields--imperial {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bmi-fields[hidden] {
  display: none;
}

.bmi-field {
  display: grid;
  gap: 9px;
  color: var(--wp-text);
  font-size: 14px;
  font-weight: 600;
}

.bmi-input-wrap {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(4, 10, 35, 0.12);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(4, 10, 35, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bmi-input-wrap:focus-within {
  border-color: rgba(92, 56, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(92, 56, 255, 0.08);
}

.bmi-input-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: none;
  box-shadow: none;
  color: var(--wp-text);
  background: transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  appearance: textfield;
  -moz-appearance: textfield;
}

.bmi-input-wrap input:focus,
.bmi-input-wrap input:focus-visible {
  border: 0;
  outline: none;
  box-shadow: none;
}

.bmi-input-wrap input::-webkit-inner-spin-button,
.bmi-input-wrap input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.bmi-input-wrap > span {
  color: var(--wp-muted2);
  font-size: 13px;
  font-weight: 500;
}

.bmi-error {
  margin: 12px 0 0;
  color: #a63446;
  font-size: 13px;
  line-height: 1.5;
}

.bmi-result {
  margin-top: 24px;
  padding: 28px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(138deg, #040a23 18%, #4426d4 70%, #7259ff 100%);
  box-shadow: 0 24px 50px rgba(23, 17, 61, 0.2);
  transition: opacity 0.2s ease;
}

.bmi-result.is-unavailable {
  opacity: 0.38;
}

.bmi-result__summary {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1.35fr;
  gap: 20px;
  align-items: stretch;
}

.bmi-score,
.bmi-result__fact {
  padding: 4px 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.bmi-score {
  padding-left: 0;
  border-left: 0;
}

.bmi-label {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bmi-score__number {
  margin: 4px 0 0;
  color: #fff;
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}

.bmi-score__unit {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.bmi-result__primary {
  margin: 10px 0 0;
  color: #fff;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.3;
}

.bmi-scale-wrap {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.bmi-scale {
  position: relative;
  display: grid;
  grid-template-columns: 14fr 26fr 20fr 40fr;
  gap: 3px;
  height: 10px;
}

.bmi-scale__segment {
  display: block;
  min-width: 0;
  border-radius: 999px;
}

.bmi-scale__segment--under { background: #78b6ff; }
.bmi-scale__segment--healthy { background: #69dab1; }
.bmi-scale__segment--over { background: #ffd269; }
.bmi-scale__segment--obese { background: #ff8797; }

.bmi-scale__marker {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--wp-purple);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
  transition: left 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.bmi-scale__labels {
  display: grid;
  grid-template-columns: 14fr 26fr 20fr 40fr;
  gap: 8px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  line-height: 1.35;
}

.bmi-scale__labels span:not(:first-child) {
  text-align: center;
}

.bmi-scale__labels span:last-child {
  text-align: right;
}

.bmi-result__message {
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  line-height: 1.65;
}

.tool-content {
  padding-bottom: 112px;
}

.tool-section {
  padding: 74px 0;
  border-top: 1px solid rgba(4, 10, 35, 0.08);
}

.tool-section--intro {
  border-top: 0;
}

.tool-section h2 {
  max-width: 760px;
  margin: 0;
  color: var(--wp-text);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.tool-section > p:not(.tool-section__eyebrow):not(.medical-note),
.tool-section--action > div > p:not(.tool-section__eyebrow) {
  max-width: 780px;
  margin: 22px 0 0;
  color: var(--wp-muted2);
  font-size: 17px;
  line-height: 1.75;
}

.bmi-chart {
  margin-top: 34px;
  overflow: hidden;
  border: 1px solid rgba(92, 56, 255, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
}

.bmi-chart__row {
  display: grid;
  grid-template-columns: 0.85fr 1fr 1.7fr;
  gap: 20px;
  padding: 19px 24px;
  border-top: 1px solid rgba(4, 10, 35, 0.08);
  color: var(--wp-muted2);
  font-size: 15px;
  line-height: 1.5;
}

.bmi-chart__row:first-child {
  border-top: 0;
}

.bmi-chart__row strong {
  color: var(--wp-text);
  font-weight: 650;
}

.bmi-chart__row--head {
  color: var(--wp-purple);
  background: rgba(92, 56, 255, 0.06);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.formula-grid,
.balanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 34px;
}

.formula-card,
.balanced-grid article {
  padding: 30px;
  border: 1px solid rgba(92, 56, 255, 0.1);
  border-radius: 24px;
  background: rgba(249, 248, 255, 0.8);
}

.formula-card h3,
.balanced-grid h3 {
  margin: 0;
  color: var(--wp-text);
  font-size: 18px;
  line-height: 1.4;
}

.formula-card p,
.balanced-grid p {
  margin: 14px 0 0;
  color: var(--wp-muted2);
  font-size: 15px;
  line-height: 1.7;
}

.formula-card .formula-card__equation {
  padding: 18px;
  border-radius: 16px;
  color: var(--wp-purple);
  background: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.example-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 70px;
}

.example-steps {
  display: grid;
  gap: 18px;
}

.example-steps p {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  color: var(--wp-muted2);
  font-size: 16px;
  line-height: 1.6;
}

.example-steps span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #fff;
  background: var(--wp-purple);
  font-size: 13px;
  font-weight: 700;
}

.check-list {
  display: grid;
  gap: 14px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding: 20px 22px 20px 48px;
  border-radius: 18px;
  color: var(--wp-muted2);
  background: rgba(249, 248, 255, 0.8);
  font-size: 15px;
  line-height: 1.65;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 27px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wp-purple);
  box-shadow: 0 0 0 5px rgba(92, 56, 255, 0.1);
}

.check-list strong {
  color: var(--wp-text);
}

.tool-section--action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 46px;
  align-items: end;
}

.tool-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 58px;
  padding: 16px 24px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(138deg, #040a23 30%, #5c38ff 100%);
  box-shadow: 0 16px 30px rgba(57, 37, 162, 0.18);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(57, 37, 162, 0.24);
}

.tool-faq-list {
  margin-top: 34px;
  border-top: 1px solid rgba(4, 10, 35, 0.1);
}

.tool-faq-list details {
  border-bottom: 1px solid rgba(4, 10, 35, 0.1);
}

.tool-faq-list summary {
  position: relative;
  padding: 24px 52px 24px 0;
  color: var(--wp-text);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
  list-style: none;
}

.tool-faq-list summary::-webkit-details-marker {
  display: none;
}

.tool-faq-list summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  color: var(--wp-purple);
  font-size: 24px;
  font-weight: 400;
  transform: translateY(-50%);
}

.tool-faq-list details[open] summary::after {
  content: "−";
}

.tool-faq-list details p {
  max-width: 760px;
  margin: -6px 0 24px;
  color: var(--wp-muted2);
  font-size: 15px;
  line-height: 1.75;
}

.sources-section ol {
  display: grid;
  gap: 14px;
  margin: 30px 0 0;
  padding-left: 22px;
  color: var(--wp-muted2);
  font-size: 14px;
  line-height: 1.7;
}

.sources-section a {
  color: var(--wp-purple);
  text-underline-offset: 3px;
}

.medical-note {
  margin: 30px 0 0;
  padding: 20px 22px;
  border-left: 4px solid var(--wp-purple);
  border-radius: 0 16px 16px 0;
  color: var(--wp-muted2);
  background: rgba(92, 56, 255, 0.06);
  font-size: 14px;
  line-height: 1.7;
}

.medical-note strong {
  color: var(--wp-text);
}

@media (max-width: 1199.98px) {
  .tool-hero {
    padding-top: 46px;
  }
}

@media (max-width: 720px) {
  .tool-container {
    width: min(100% - 32px, 560px);
  }

  .tool-hero {
    padding: 42px 0 60px;
  }

  .tool-hero h1 {
    font-size: 42px;
  }

  .tool-hero__lead {
    margin-top: 18px;
    font-size: 16px;
    line-height: 1.65;
  }

  .bmi-card {
    margin-top: 34px;
    padding: 20px;
    border-radius: 26px;
  }

  .bmi-card__head {
    display: grid;
    gap: 20px;
  }

  .unit-switch {
    width: 100%;
  }

  .unit-switch__button {
    min-width: 0;
    flex: 1;
    min-height: 44px;
  }

  .bmi-fields,
  .bmi-fields--imperial {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 24px;
  }

  .bmi-input-wrap {
    min-height: 54px;
  }

  .bmi-result {
    padding: 22px 20px;
    border-radius: 22px;
  }

  .bmi-result__summary {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .bmi-score,
  .bmi-result__fact {
    padding: 18px 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
  }

  .bmi-score {
    padding-top: 0;
    border-top: 0;
  }

  .bmi-scale-wrap {
    margin-top: 12px;
  }

  .bmi-scale__labels {
    font-size: 10px;
  }

  .tool-content {
    padding-bottom: 72px;
  }

  .tool-section {
    padding: 52px 0;
  }

  .tool-section h2 {
    font-size: 30px;
  }

  .tool-section > p:not(.tool-section__eyebrow):not(.medical-note),
  .tool-section--action > div > p:not(.tool-section__eyebrow) {
    font-size: 16px;
  }

  .bmi-chart {
    margin-top: 28px;
    border-radius: 18px;
  }

  .bmi-chart__row {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 7px 14px;
    padding: 16px 18px;
    font-size: 14px;
  }

  .bmi-chart__row > span:last-child {
    grid-column: 1 / -1;
    font-size: 13px;
  }

  .bmi-chart__row--head > span:last-child {
    display: none;
  }

  .formula-grid,
  .balanced-grid,
  .example-section,
  .tool-section--action {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .formula-card,
  .balanced-grid article {
    padding: 22px;
  }

  .example-steps {
    margin-top: 12px;
  }

  .tool-cta {
    width: 100%;
  }

  .tool-faq-list summary {
    padding-right: 40px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .unit-switch__button,
  .bmi-input-wrap,
  .bmi-scale__marker,
  .tool-cta {
    transition: none;
  }
}
