:root {
  --bg: #eef1f6;
  --surface: #fff;
  --surface-2: #f3f6fa;
  --border: #e3e7ee;
  --text: #15202e;
  --body: #2a3340;
  --muted: #6b7688;
  --faint: #8a93a3;
  --accent: #38bdf8;
  --accent-ink: #0c93bd;
  --green: #46d39a;
  --green-ink: #16a877;
  --warn: #d98a1f;
  --nav: #15202e;
  --nav-text: #fff;
  --shadow: 0 14px 36px -22px rgba(21, 32, 46, .2);
}

[data-theme="dark"] {
  --bg: #0d1525;
  --surface: #16223a;
  --surface-2: #172234;
  --border: rgba(148, 163, 184, .15);
  --text: #eef3fb;
  --body: #dbe5f3;
  --muted: #8b9bb4;
  --faint: #8b9bb4;
  --accent-ink: #38bdf8;
  --green-ink: #46d39a;
  --warn: #f5b53d;
  --nav: #38bdf8;
  --nav-text: #06243a;
  --shadow: 0 14px 36px -22px rgba(3, 6, 12, .6);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: .25s background, .25s color;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.shell {
  max-width: 1200px;
  margin: auto;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 40px;
  border-bottom: 1px solid var(--border);
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  font-size: 17px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 11px;
  background: var(--accent);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-links {
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links .is-current {
  color: var(--accent-ink);
}

.theme {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 800;
}

.nav-cta,
.button-primary {
  border: 0;
  border-radius: 13px;
  background: var(--nav);
  color: var(--nav-text);
  font-weight: 800;
}

.nav-cta {
  padding: 10px 20px;
  font-size: 14px;
}

.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}

.mobile-menu {
  display: none;
  position: relative;
}

.mobile-menu summary {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu-links {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 230px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-menu-links a {
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.mobile-menu-links a:hover {
  background: var(--surface-2);
  color: var(--accent-ink);
}

.intro {
  padding: 36px 40px 28px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 17px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}

.breadcrumbs a:hover {
  color: var(--accent-ink);
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.intro-lead {
  max-width: 740px;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.disclaimer {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}

.anchor-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.anchor-links a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.anchor-links a:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding: 0 40px 72px;
}

.calculator-form {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-title {
  display: block;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 800;
}

.fields {
  display: grid;
  gap: 18px;
}

.grid-3,
.grid-2 {
  display: grid;
  gap: 12px;
}

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

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

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-label,
.field-label-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.optional {
  color: var(--faint);
  font-weight: 600;
}

.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 52px 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

select.input {
  padding-right: 42px;
  cursor: pointer;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.input[aria-invalid="true"] {
  border-color: var(--warn);
}

.unit {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  transform: translateY(-50%);
}

.field-error {
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
}

.segments {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.segment {
  flex: 1;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.segment.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px -2px rgba(21, 32, 46, .18);
  font-weight: 800;
}

[data-theme="dark"] .segment.is-active {
  background: #22314f;
  box-shadow: none;
}

.goal-extra {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.activity-hint {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.activity-hint strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

#activity-hint-guide {
  color: var(--accent);
  font-weight: 800;
}

#activity-hint-description {
  color: var(--faint);
}

.advanced {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 26px;
  cursor: pointer;
  list-style: none;
}

.advanced > summary::-webkit-details-marker {
  display: none;
}

.advanced-summary {
  display: grid;
  gap: 4px;
}

.advanced-summary strong {
  font-size: 17px;
}

.advanced-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.advanced-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.advanced[open] .advanced-icon {
  transform: rotate(45deg);
}

.advanced-content {
  padding: 0 26px 24px;
}

.tip {
  position: relative;
}

.tip summary {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--faint);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  list-style: none;
}

.tip summary::-webkit-details-marker {
  display: none;
}

.tip-text {
  position: absolute;
  z-index: 20;
  top: 25px;
  left: -60px;
  width: 240px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.button-primary,
.button-secondary {
  padding: 14px 24px;
  cursor: pointer;
}

.button-primary {
  font-size: 16px;
}

.button-secondary {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--body);
  font-size: 14px;
  font-weight: 700;
}

.local-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.results {
  position: sticky;
  top: 24px;
}

.result-empty {
  display: grid;
  min-height: 310px;
  place-items: center;
  text-align: center;
}

.result-empty div {
  max-width: 340px;
}

.result-empty strong {
  display: block;
  margin-bottom: 8px;
  font-size: 21px;
}

.result-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.result-content {
  display: grid;
  gap: 16px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-head h2 {
  margin: 0;
  font-size: 21px;
}

.result-mode {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green-ink);
  font-size: 11px;
  font-weight: 800;
}

.target-result {
  padding: 20px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

.target-result span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.target-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.target-number strong {
  font-size: 40px;
  line-height: 1;
  letter-spacing: -.04em;
}

.target-number small {
  color: var(--muted);
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: inline-block;
  margin-top: 5px;
  font-size: 21px;
}

.metric small {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}

.bmi-block,
.formula-note,
.goal-summary,
.composition {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.bmi-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.bmi-top span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bmi-top strong {
  font-size: 24px;
}

.bmi-track {
  position: relative;
  height: 8px;
  margin: 16px 0 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #56b7dc 0 14%, #46d39a 14% 40%, #f5b53d 40% 60%, #e87e7e 60% 100%);
}

.bmi-marker {
  position: absolute;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
  transform: translate(-50%, -50%);
}

.bmi-label,
.small-note,
.goal-summary p,
.formula-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.small-note {
  margin: 8px 0 0;
}

.goal-summary {
  display: grid;
  gap: 5px;
}

.goal-summary p {
  margin: 0;
}

.warning {
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--body);
  font-size: 12.5px;
  line-height: 1.5;
}

.composition h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.composition-track {
  display: flex;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--green);
}

.composition-fat {
  background: var(--accent);
}

.composition-caption {
  display: block;
  margin-top: 7px;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
}

.composition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.composition-card {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.composition-card span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.composition-card strong {
  display: inline-block;
  margin-top: 4px;
  font-size: 17px;
}

.composition-card small {
  color: var(--faint);
  font-size: 10px;
}

.content-sections {
  display: grid;
  gap: 14px;
  padding: 0 40px 72px;
}

.content-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.content-card h2 {
  margin: 0 0 10px;
  font-size: 25px;
  letter-spacing: -.02em;
}

.content-card p {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 0 40px 72px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cta h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.cta p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.cta-actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
}

.telegram {
  padding: 13px 20px;
  border-radius: 13px;
  background: var(--accent);
  color: #06243a;
  font-size: 14px;
  font-weight: 800;
}

.footer {
  padding: 38px 40px;
  border-top: 1px solid var(--border);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.footer-links a {
  color: var(--accent-ink);
  font-weight: 700;
}

.footer-links a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 3px;
}

@media (max-width: 980px) {
  .nav {
    padding: 14px 20px;
  }

  .nav-links {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .intro {
    padding: 32px 20px 24px;
  }

  .calculator-layout {
    grid-template-columns: 1fr;
    padding: 0 20px 52px;
  }

  .results {
    position: static;
    scroll-margin-top: 16px;
  }

  .content-sections {
    padding: 0 20px 52px;
  }

  .cta {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 20px 52px;
  }

  .footer {
    padding: 32px 20px;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 36px;
  }

  .intro-lead {
    font-size: 15.5px;
  }

  .panel {
    padding: 21px 18px;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .segments {
    align-items: stretch;
  }

  .segment {
    padding-inline: 7px;
    font-size: 12.5px;
  }

  .advanced > summary {
    padding: 20px 18px;
  }

  .advanced-content {
    padding: 0 18px 20px;
  }

  .tip-text {
    position: fixed;
    z-index: 80;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }

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

  .content-card {
    padding: 22px 20px;
  }

  .cta {
    padding: 26px 20px;
  }

  .cta-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .cta-actions > *,
  .form-actions > * {
    width: 100%;
    text-align: center;
  }

  .footer-top {
    align-items: flex-start;
    flex-direction: column;
  }
}
