.calculator-page-header {
  position: relative;
  z-index: 20;
}

body {
  overflow-x: hidden;
}

.calculator-hero {
  position: relative;
  min-height: 680px;
  padding: 170px 0 72px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(24, 22, 20, 0.94) 0%, rgba(24, 22, 20, 0.78) 48%, rgba(24, 22, 20, 0.38) 100%),
    url("../img/hero-matrusa.webp") center/cover no-repeat;
}

.calculator-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 88%);
}

.calculator-hero-container {
  position: relative;
  z-index: 1;
  max-width: 1180px;
}

.calculator-hero-copy {
  max-width: 1040px;
}

.calculator-hero .hero-title {
  max-width: 1040px;
  margin-bottom: 18px;
  padding-top: 0;
  text-align: left;
  color: #ff8c00;
  font-size: clamp(34px, 5.2vw, 76px);
  line-height: 1.03;
  letter-spacing: 2px;
  overflow-wrap: break-word;
}

.calculator-hero .hero-txt {
  max-width: 900px;
  margin-bottom: 28px;
  text-align: left;
  text-transform: none;
  text-wrap: pretty;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.45;
  letter-spacing: 0.6px;
}

.calculator-hero-kicker {
  margin-bottom: 14px;
  font-family: "FuturaPT-Book", sans-serif;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.calculator-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.calculator-hero .hero-btn {
  border-color: #ff8c00;
  background-color: #ff8c00;
  color: #fff;
  box-shadow: rgba(255, 140, 0, 0.22) 0px 16px 34px;
}

.calculator-hero .hero-btn:hover,
.calculator-hero .hero-btn:focus {
  background-color: #fff;
  border-color: #fff;
  color: #2a2a2a;
}

.calculator-hero-link {
  display: inline-flex;
  align-items: center;
  min-height: 49px;
  color: #fff;
  font-family: "FuturaPT-Book", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.calculator-hero-link:hover,
.calculator-hero-link:focus {
  color: #ff8c00;
}

@media screen and (max-width: 767px) {
  .calculator-hero {
    min-height: auto;
    padding: 132px 0 58px;
    background:
      linear-gradient(90deg, rgba(24, 22, 20, 0.94) 0%, rgba(24, 22, 20, 0.82) 58%, rgba(24, 22, 20, 0.5) 100%),
      url("../img/hero-matrusa.webp") 60% center/cover no-repeat;
  }

  .calculator-hero .hero-title {
    font-size: clamp(30px, 10vw, 40px);
    line-height: 1.08;
    text-align: left;
    letter-spacing: 1px;
  }

  .calculator-hero .hero-txt {
    font-size: 16px;
    text-align: left;
    text-align-last: auto;
  }

  .calculator-hero-kicker {
    font-size: 13px;
    letter-spacing: 2px;
  }

  .calculator-hero-actions {
    align-items: stretch;
    margin-bottom: 0;
  }

  .calculator-hero-actions .base-btn {
    width: 100%;
    max-width: 320px;
  }

  .calculator-hero-link {
    min-height: 40px;
  }
}

@media screen and (min-width: 768px) and (max-width: 1119px) {
  .calculator-hero {
    min-height: 620px;
    padding: 150px 0 70px;
    background:
      linear-gradient(90deg, rgba(24, 22, 20, 0.94) 0%, rgba(24, 22, 20, 0.78) 56%, rgba(24, 22, 20, 0.42) 100%),
      url("../img/hero-matrusa.webp") 58% center/cover no-repeat;
  }

  .calculator-hero .hero-title {
    max-width: 760px;
    font-size: clamp(46px, 7vw, 62px);
  }

  .calculator-hero .hero-txt {
    max-width: 720px;
  }
}

.calculator-section {
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.95), rgba(255, 255, 255, 0.98)),
    url("../img/bg-for-me.svg") center/contain no-repeat;
}

.contacts .form {
  position: relative;
}

.contacts .form-list--bottom .form-item {
  width: 100%;
}

.calculator-lead {
  max-width: 860px;
  margin: 0 auto 28px;
  text-align: center;
  font-size: 19px;
  line-height: 1.7;
}

.calculator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  min-width: 0;
}

@media screen and (min-width: 1120px) {
  .calculator-shell {
    grid-template-columns: minmax(300px, 380px) 1fr;
    align-items: start;
  }
}

.calculator-panel,
.matrix-panel,
.result-panel {
  box-sizing: border-box;
  max-width: 100%;
  border: 1px solid rgba(42, 42, 42, 0.08);
  border-radius: 18px;
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    rgba(0, 0, 0, 0.14) 0px 18px 38px,
    rgba(255, 255, 255, 0.75) 0px 1px 0px inset;
}

.calculator-panel {
  width: 100%;
  padding: 24px;
}

.calculator-form {
  display: grid;
  gap: 18px;
}

.calculator-field {
  display: grid;
  gap: 8px;
}

.calculator-label {
  font-family: "FuturaPT-Book", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
}

.calculator-input {
  box-sizing: border-box;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid rgba(42, 42, 42, 0.16);
  border-radius: 12px;
  background-color: #fff;
  color: #2a2a2a;
  font: inherit;
  outline: none;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 8px 20px;
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.calculator-input:focus {
  border-color: #ff8c00;
  box-shadow: rgba(255, 140, 0, 0.14) 0px 0px 0px 4px, rgba(0, 0, 0, 0.1) 0px 8px 20px;
}

.calculator-note {
  color: #626262;
  font-size: 15px;
  line-height: 1.55;
}

.calculator-error {
  min-height: 24px;
  color: #b42318;
  font-family: "FuturaPT-Book", sans-serif;
}

.calculator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.calculator-actions .base-btn {
  width: min(100%, 260px);
}

.calculator-link {
  color: #ff8c00;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.matrix-panel {
  padding: clamp(18px, 3vw, 34px);
  overflow: visible;
  min-width: 0;
}

.matrix-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.matrix-person {
  font-family: "FuturaPT-Medium", sans-serif;
  text-transform: uppercase;
  color: #ff8c00;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.matrix-date {
  color: #626262;
  text-align: right;
}

.matrix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  min-width: 0;
}

@media screen and (min-width: 960px) {
  .matrix-grid {
    grid-template-columns: minmax(520px, 720px) 1fr;
  }
}

.matrix-chart {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: min(100%, 820px);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.matrix-outer,
.matrix-square,
.matrix-inner-circle {
  fill: none;
  stroke: rgba(42, 42, 42, 0.85);
  stroke-width: 1.4;
}

.matrix-inner-circle {
  stroke-width: 2;
}

.matrix-line,
.matrix-diamond-line {
  fill: none;
  stroke: rgba(42, 42, 42, 0.35);
  stroke-width: 1.2;
}

.matrix-diamond-line {
  stroke: rgba(42, 42, 42, 0.8);
  stroke-width: 0.8;
}

.matrix-family-line {
  fill: none;
  stroke-width: 2.3;
}

.male-line {
  stroke: #1521a8;
}

.female-line {
  stroke: #ff5476;
}

.matrix-dashed-path {
  fill: none;
  stroke: #111;
  stroke-width: 2.2;
  stroke-dasharray: 18 18;
}

.matrix-node {
  fill: #fff;
  stroke: #2a2a2a;
  stroke-width: 1.5;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.14));
}

.matrix-node.accent {
  fill: #fff;
  stroke: #f5ff19;
  stroke-width: 7;
}

.matrix-node.decade {
  stroke-width: 2.2;
}

.matrix-node.purple {
  stroke: #bd82bd;
  stroke-width: 7;
}

.matrix-node.red {
  stroke: #d33b36;
  stroke-width: 7;
}

.matrix-node.blue {
  stroke: #1f4c9a;
  stroke-width: 4;
}

.matrix-node.cyan {
  stroke: #58add1;
  stroke-width: 4;
}

.matrix-node.green {
  stroke: #55ba43;
  stroke-width: 4;
}

.matrix-node.orange {
  stroke: #ff9518;
  stroke-width: 4;
}

.center-node {
  filter: drop-shadow(0 14px 18px rgba(245, 255, 25, 0.26));
}

.matrix-value {
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #2a2a2a;
}

.matrix-value.light {
  fill: #000;
}

.decade-value {
  font-size: 38px;
}

.center-value {
  font-size: 36px;
}

.mini-value {
  font-size: 25px;
}

.small-value {
  font-size: 18px;
}

.matrix-label {
  font-family: Arial, sans-serif;
  font-size: 11px;
  text-anchor: middle;
  fill: #555;
}

.decade-label,
.age-label,
.age-value,
.matrix-caption,
.matrix-axis-label,
.matrix-icon {
  font-family: Arial, sans-serif;
  fill: #111;
}

.decade-label {
  font-size: 14px;
}

.edge-label {
  text-anchor: middle;
}

.side-label-left {
  text-anchor: end;
}

.side-label-right {
  text-anchor: start;
}

.age-label {
  font-size: 9px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.age-value {
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.age-dot {
  fill: #111;
}

.age-points {
  display: none;
}

.matrix-caption {
  font-size: 18px;
  text-anchor: middle;
}

.matrix-axis-label {
  font-size: 14px;
  text-anchor: middle;
}

.male-text {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(45deg);
}

.female-text {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(-45deg);
}

.matrix-icon {
  font-size: 30px;
  font-weight: 700;
  fill: #009b35;
}

.matrix-icon.heart {
  fill: #f13258;
  font-size: 36px;
}

.matrix-summary {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.summary-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(42, 42, 42, 0.08);
  background-color: rgba(255, 250, 243, 0.75);
}

.summary-title {
  margin-bottom: 6px;
  font-family: "FuturaPT-Medium", sans-serif;
  color: #ff8c00;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.summary-value {
  font-size: 30px;
  line-height: 1;
  color: #2a2a2a;
}

.summary-text {
  margin-top: 8px;
  color: #555;
  line-height: 1.55;
}

.result-panel {
  margin-top: 24px;
  padding: clamp(18px, 3vw, 28px);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
}

@media screen and (min-width: 980px) {
  .result-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.health-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 14px;
  font-size: 15px;
  background-color: #f4f4f7;
}

.health-table th,
.health-table td {
  padding: 18px 14px;
  border-bottom: 0;
  text-align: center;
}

.health-table th:nth-child(2),
.health-table td:nth-child(2) {
  text-align: left;
}

.health-table th {
  background-color: #f4f4f7;
  color: #111;
  font-family: "FuturaPT-Book", sans-serif;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.2;
  text-transform: none;
}

.health-table th:first-child {
  width: 54px;
  padding: 0;
  background-color: #c7c9d6;
}

.health-table tbody tr {
  background-color: var(--health-row-bg, #f4f4f7);
}

.health-table tbody tr:last-child .health-index {
  border-bottom-left-radius: 14px;
}

.health-table tbody tr:first-child td:last-child {
  border-top-right-radius: 0;
}

.health-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 14px;
}

.health-table tbody tr:nth-child(1) {
  --health-row-bg: #f6eef8;
  --health-accent: #8e49ad;
}

.health-table tbody tr:nth-child(2) {
  --health-row-bg: #eef2ff;
  --health-accent: #556df4;
}

.health-table tbody tr:nth-child(3) {
  --health-row-bg: #ecfbfe;
  --health-accent: #4cc8d1;
}

.health-table tbody tr:nth-child(4) {
  --health-row-bg: #f7fdf1;
  --health-accent: #ace35b;
}

.health-table tbody tr:nth-child(5) {
  --health-row-bg: #fff9ec;
  --health-accent: #ffcb43;
}

.health-table tbody tr:nth-child(6) {
  --health-row-bg: #ffad001c;
  --health-accent: #edae00;
}

.health-table tbody tr:nth-child(7) {
  --health-row-bg: #fff0f0;
  --health-accent: #f53c42;
}

.health-table tbody tr:nth-child(8) {
  --health-row-bg: #f4f4f7;
  --health-accent: #c7c9d6;
}

.health-table .health-index {
  width: 54px;
  padding: 0;
  background-color: var(--health-accent);
  color: #fff;
  font-family: "FuturaPT-Book", sans-serif;
  font-size: 24px;
  line-height: 1;
  vertical-align: middle;
}

.health-table tbody tr:last-child .health-index {
  color: transparent;
}

.health-table td:nth-child(2) strong {
  font-family: "FuturaPT-Book", sans-serif;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
  color: #111;
}

.health-table td:nth-child(2) span {
  color: #2a2a2a;
  font-size: 15px;
  line-height: 1.25;
}

.health-table td:nth-child(n + 3) {
  color: #000;
  font-family: "FuturaPT-Book", sans-serif;
  font-size: 21px;
  line-height: 1;
}

.program-list {
  display: grid;
  gap: 12px;
}

.program-item {
  padding: 14px 16px;
  border-left: 3px solid #ff8c00;
  border-radius: 12px;
  background-color: rgba(255, 250, 243, 0.85);
  box-shadow: rgba(0, 0, 0, 0.08) 0px 8px 18px;
}

.program-item span {
  display: block;
  color: #ff8c00;
  font-family: "FuturaPT-Medium", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.calculator-disclaimer {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: 14px;
  color: #555;
  background-color: rgba(42, 42, 42, 0.05);
}

.matrix-empty .matrix-value,
.matrix-empty .age-value,
.matrix-empty .matrix-icon {
  opacity: 0;
}

.matrix-empty .matrix-summary,
.matrix-empty .result-panel,
.matrix-empty .matrix-date {
  display: none;
}

.calculator-hidden {
  display: none;
}

.calculator-cta {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
}

@media screen and (max-width: 1119px) {
  .calculator-panel {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
  }
}

@media screen and (min-width: 641px) and (max-width: 959px) {
  .matrix-chart {
    max-width: 680px;
  }

  .matrix-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 640px) {
  .calculator-section .container {
    padding-right: 12px;
    padding-left: 12px;
  }

  .calculator-panel {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .calculator-actions,
  .calculator-cta {
    align-items: stretch;
  }

  .calculator-actions .base-btn,
  .calculator-cta .base-btn {
    width: 100%;
  }

  .calculator-link {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .matrix-panel {
    padding: 16px 10px;
    border-radius: 14px;
  }

  .matrix-chart {
    max-width: 520px;
  }

  .matrix-grid {
    gap: 18px;
  }

  .matrix-date {
    width: 100%;
    text-align: left;
  }

  .matrix-person {
    font-size: 22px;
    letter-spacing: 1px;
  }

  .summary-card,
  .program-item,
  .calculator-disclaimer {
    border-radius: 12px;
  }

  .summary-value {
    font-size: 26px;
  }

  .result-panel {
    margin-top: 18px;
    padding: 16px 10px;
    border-radius: 14px;
  }

  .health-table {
    display: block;
    min-width: 0;
    font-size: 13px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
  }

  .health-table thead {
    display: none;
  }

  .health-table tbody {
    display: grid;
    gap: 12px;
  }

  .health-table tr {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0;
    padding: 0;
    border: 1px solid rgba(42, 42, 42, 0.08);
    border-radius: 12px;
    background-color: var(--health-row-bg, rgba(255, 250, 243, 0.85));
    overflow: hidden;
    box-shadow: rgba(0, 0, 0, 0.08) 0px 8px 18px;
  }

  .health-table .health-index {
    grid-row: 1 / span 4;
    display: grid;
    place-items: center;
    width: auto;
    min-height: 100%;
    padding: 0;
    border-bottom: 0;
    background-color: var(--health-accent);
    color: #fff;
    font-size: 22px;
    text-align: center;
  }

  .health-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.08);
    text-align: right;
  }

  .health-table td:nth-child(2) {
    display: block;
    padding-top: 12px;
    text-align: left;
  }

  .health-table td:last-child {
    padding-bottom: 12px;
    border-bottom: 0;
  }

  .health-table td::before {
    content: attr(data-label);
    color: #626262;
    font-family: "FuturaPT-Book", sans-serif;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.8px;
  }

  .health-table .health-index::before,
  .health-table td:nth-child(2)::before {
    display: none;
  }

  .health-table td:nth-child(2) strong {
    display: block;
    color: #111;
    font-family: "FuturaPT-Medium", sans-serif;
    font-size: 16px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .health-table td:nth-child(2) span {
    color: #626262;
  }

  .health-table td:nth-child(n + 3) {
    font-size: 18px;
  }
}

@media screen and (max-width: 420px) {
  .calculator-hero {
    padding-top: 122px;
  }

  .calculator-hero .hero-title {
    font-size: 28px;
  }

  .calculator-hero .hero-txt {
    font-size: 15px;
    line-height: 1.5;
  }

  .matrix-panel {
    padding-right: 8px;
    padding-left: 8px;
  }

  .matrix-caption {
    font-size: 16px;
  }
}
