/* Калькулятор бегуна (/calc/): тёмный первый экран с «секундомером», дальше четыре калькулятора.
   Поле, которое считается само, подсвечено (.is-result); итог — крупная цифра (.big). */

.page-calc { --dark: #121110; }

/* ---------- Первый экран ---------- */

.chero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--header-h) + clamp(56px, 9vw, 130px)) 0 clamp(56px, 7vw, 100px);
  background:
    radial-gradient(1100px 520px at 90% 10%, rgba(226, 73, 43, 0.32), transparent 60%),
    var(--dark);
  color: #fff;
}
.chero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0 clamp(24px, 4vw, 64px);
  align-items: end;
}
.chero__inner > .eyebrow { grid-column: 1 / -1; }
.chero__title {
  margin-top: 26px;
  font-size: clamp(56px, 10.5vw, 168px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}
.chero__title span { display: block; }
.chero__outline {
  color: transparent;
  -webkit-text-stroke: 2px var(--accent);
}
.chero__lead {
  grid-column: 1;
  max-width: 560px;
  margin-top: clamp(26px, 3vw, 40px);
  font-size: clamp(17px, 1.5vw, 20px);
  color: rgba(255, 255, 255, 0.78);
}

/* «секундомер»: большой темп из первого калькулятора */
.watch {
  grid-column: 2;
  grid-row: 2 / 4;
  align-self: center;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 22px 30px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.04);
}
.watch__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.watch__digits {
  font-size: clamp(64px, 8.5vw, 136px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.chero__nav {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: clamp(40px, 5vw, 72px) 0 0;
  padding: 0;
  list-style: none;
}
.chero__nav a {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  padding: 18px 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.chero__nav b {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.chero__nav a:hover { border-color: #fff; background: #fff; color: var(--ink); }

/* ---------- Калькулятор ---------- */

.calc {
  padding: clamp(72px, 9vw, 140px) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 0;
}
.calc--dark { background: var(--dark); color: #fff; border-top: 0; }
.calc--paper { background: var(--paper); }

.calc__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 4vw, 56px) clamp(32px, 6vw, 110px);
  align-items: start;
}
.calc__head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 12px clamp(20px, 3vw, 48px);
  align-items: end;
}
.calc__num {
  align-self: start;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.calc__title {
  font-size: clamp(40px, 6vw, 92px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.calc__note {
  font-size: 16px;
  color: var(--muted);
  text-wrap: pretty;
}
.calc--dark .calc__note { color: rgba(255, 255, 255, 0.66); }

.calc__form {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.field-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.field { display: flex; flex-direction: column; }
.field__label {
  margin-bottom: 8px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.calc--dark .field__label { color: rgba(255, 255, 255, 0.6); }
.field-set .field__label { display: block; margin-bottom: 12px; }

.field__input {
  width: 100%;
  padding: 6px 0 10px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.field__input::placeholder { color: rgba(13, 13, 13, 0.22); }
.field__input:focus { outline: none; border-bottom-color: var(--accent); }
.field__input:focus-visible { box-shadow: 0 2px 0 var(--accent); }
.calc--dark .field__input { border-bottom-color: rgba(255, 255, 255, 0.8); }
.calc--dark .field__input::placeholder { color: rgba(255, 255, 255, 0.25); }
.calc--dark .field__input:focus { border-bottom-color: var(--accent); }

.field__hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.calc--dark .field__hint { color: rgba(255, 255, 255, 0.5); }
.field.is-result .field__hint { display: none; }

/* поле, которое посчитано, а не введено */
.field.is-result .field__input {
  border-bottom-style: dashed;
  border-bottom-color: var(--accent);
  color: var(--accent);
  cursor: default;
}
.field.is-result .field__label::after {
  content: " · считается";
  color: var(--accent);
}
.field.is-result .chips { display: none; }

.chips--small { margin-top: 12px; gap: 6px; }
.chips--small .chip { min-height: 32px; padding: 0 13px; font-variant-numeric: tabular-nums; }
.calc--dark .chip { border-color: rgba(255, 255, 255, 0.28); color: #fff; }
.calc--dark .chip:hover { border-color: #fff; }
.calc--dark .chip[aria-pressed="true"] { border-color: #fff; background: #fff; color: var(--ink); }

.calc__fine {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}
.calc--dark .calc__fine { color: rgba(255, 255, 255, 0.55); }

/* ---------- Результат ---------- */

.calc__out { min-width: 0; }
.big {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid currentColor;
}
.big__value {
  font-size: clamp(76px, 10vw, 156px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.big__unit {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.calc--dark .big__unit { color: rgba(255, 255, 255, 0.6); }
.calc__out.is-empty .big__value { color: var(--line); }

.calc__err {
  margin-top: 16px;
  font-size: 15px;
  color: var(--accent-dark);
}
.calc--dark .calc__err { color: #ff8a70; }
.calc__err[hidden] { display: none; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.facts__item {
  padding: 18px 16px 18px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 6px 0 0;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.out__head {
  margin-top: clamp(32px, 3.5vw, 48px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.table td + td { padding-left: 16px; }
.table thead th {
  padding-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.table th:first-child { text-align: left; }
.table tbody th { font-weight: 600; white-space: normal; }
.table tbody td { font-size: 18px; font-weight: 700; }
.table small {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.calc--dark .table th,
.calc--dark .table td { border-bottom-color: rgba(255, 255, 255, 0.14); }
.calc--dark .table thead th,
.calc--dark .table small { color: rgba(255, 255, 255, 0.55); }
.table tr.is-own th,
.table tr.is-own td { color: var(--accent); }
.table tr.is-key th,
.table tr.is-key td { font-weight: 800; color: var(--accent-dark); }

.table__go {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.table__go:hover { border-color: var(--accent); background: var(--accent); }

/* раскладка: две половины и таблица отметок */
.halves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.halves__item {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--paper);
}
.halves__item + .halves__item { background: var(--ink); color: #fff; }
.halves__name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}
.halves__time {
  margin-top: 6px;
  font-size: clamp(34px, 3.8vw, 54px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.halves__pace { margin-top: 6px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.table--splits { margin-top: 18px; }
.table--splits tbody td { font-size: 17px; }

/* пульсовые зоны */
.zones { margin: 8px 0 0; padding: 0; list-style: none; }
.zone {
  display: grid;
  grid-template-columns: 3em minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
}
.zone__num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--zc);
}
.zone__text b { display: block; font-size: 17px; }
.zone__text small { display: block; font-size: 13px; color: var(--muted); }
.zone__range {
  font-size: clamp(22px, 2.3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.zone__range::after { content: " уд/мин"; font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
/* полоса: где зона лежит внутри резерва пульса (от покоя до максимума) */
.zone__bar {
  position: relative;
  grid-column: 2 / -1;
  height: 6px;
  margin-top: 6px;
  border-radius: 3px;
  background: rgba(13, 13, 13, 0.06);
}
.zone__bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from);
  right: calc(100% - var(--to));
  border-radius: 3px;
  background: var(--zc);
}
.zone--1 { --zc: #7fa7bf; }
.zone--2 { --zc: #4f9a6a; }
.zone--3 { --zc: #e0a526; }
.zone--4 { --zc: #e2742b; }
.zone--5 { --zc: var(--accent); }

/* ---------- Планшет и телефон ---------- */

@media (max-width: 960px) {
  .chero__inner { grid-template-columns: minmax(0, 1fr); }
  .watch { grid-column: 1; grid-row: auto; justify-self: start; align-items: flex-start; margin-top: 32px; }
  .chero__nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc__grid { grid-template-columns: minmax(0, 1fr); }
  .calc__head { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .chero__title { font-size: clamp(52px, 17vw, 88px); }
  .watch { padding: 16px 22px 14px; border-radius: 22px; }
  .chero__nav a { gap: 10px; padding: 14px 16px 16px; font-size: 14px; }
  .calc__form { gap: 22px; }
  .big__value { font-size: clamp(64px, 21vw, 100px); }
  .table tbody td { font-size: 16px; }
  .table td + td { padding-left: 10px; }
  .halves__item { padding: 14px 16px; }
  .zone { grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 2px 12px; }
  .zone__range::after { content: ""; }
}

/* ---------- 01. Стадион и ползунок темпа ---------- */

.stadium {
  position: relative;
  overflow: hidden;
  padding: clamp(14px, 2vw, 24px) clamp(14px, 2vw, 24px) 0;
  border-radius: 28px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(226, 73, 43, 0.22), transparent 60%),
    var(--dark);
  color: #fff;
  isolation: isolate;
}
.stadium__svg { display: block; width: 100%; height: auto; }
.st-track { fill: none; stroke: #b5432b; stroke-width: 48; }
.st-line { fill: none; stroke: rgba(255, 255, 255, 0.32); stroke-width: 0.8; }
.st-field { fill: #17201a; stroke: rgba(255, 255, 255, 0.55); stroke-width: 1.2; }
.st-finish { stroke: #fff; stroke-width: 2.5; }
.st-run { fill: none; stroke: none; }
.st-trail {
  fill: none;
  stroke: #fff;
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.6;
}
.st-trail--ghost { stroke: #9fc7dd; stroke-width: 3; opacity: 0.45; }
.st-you { fill: #fff; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9)); }
.st-ghost { fill: rgba(159, 199, 221, 0.35); stroke: #9fc7dd; stroke-width: 1.5; }
.stadium:not(.has-ghost) .st-ghost,
.stadium:not(.has-ghost) .st-trail--ghost,
.stadium.is-idle .st-you,
.stadium.is-idle .st-trail,
.stadium.is-idle .st-ghost,
.stadium.is-idle .st-trail--ghost { display: none; }

/* результат — в центре поля */
.stadium__center {
  position: absolute;
  top: clamp(14px, 2vw, 24px);
  left: 0;
  right: 0;
  aspect-ratio: 440 / 260;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.stadium__value {
  font-size: clamp(40px, 7vw, 92px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.stadium__unit {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.stadium__sub {
  margin-top: 4px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 600;
  color: #ffb4a3;
  font-variant-numeric: tabular-nums;
}
.stadium.is-idle .stadium__value { color: rgba(255, 255, 255, 0.25); }

.stadium__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin: 0 calc(clamp(14px, 2vw, 24px) * -1);
  padding: 14px clamp(14px, 2vw, 24px) 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.stadium__ghosts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stadium__label {
  margin-right: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9fc7dd;
}
.stadium__ghosts .chip {
  min-height: 30px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 12px;
}
.stadium__ghosts .chip:hover { border-color: #fff; }
.stadium__ghosts .chip[aria-pressed="true"] { border-color: #9fc7dd; background: #9fc7dd; color: var(--ink); }
.stadium__gap { font-size: 13px; color: rgba(255, 255, 255, 0.7); }

/* ползунок: шкала «холодно → жарко», вправо — быстрее */
.pacebar {
  --pos: 50%;
  position: relative;
  margin-top: 26px;
  padding-top: 40px;
}
.pacebar__marks { position: absolute; inset: 0 0 auto 0; height: 40px; }
.pacebar__mark {
  position: absolute;
  left: var(--at);
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--muted);
}
.pacebar__mark b { font-weight: 700; color: var(--ink); }
.pacebar__mark::after {
  content: "";
  width: 1px;
  height: 8px;
  margin-top: 3px;
  background: var(--ink);
  opacity: 0.4;
}
.pacebar__range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 14px;
  margin: 0;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent var(--pos), rgba(13, 13, 13, 0.1) var(--pos)),
    linear-gradient(90deg, #7fa7bf, #4f9a6a 30%, #e0a526 60%, var(--accent));
  cursor: pointer;
}
.pacebar__range:focus { outline: none; }
.pacebar__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(226, 73, 43, 0.25);
  transition: transform 0.2s var(--ease);
}
.pacebar__range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(226, 73, 43, 0.25);
}
.pacebar__range:active::-webkit-slider-thumb,
.pacebar__range:focus-visible::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(226, 73, 43, 0.35); }
.pacebar__ends {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.pacebar__ends span:last-child { color: var(--accent); }

#pace .calc__err { margin-top: 12px; }
#pace .facts { margin-top: 18px; }

@media (max-width: 760px) {
  .stadium { border-radius: 22px; }
  .stadium__bar { flex-direction: column; align-items: flex-start; }
  .stadium__label { flex-basis: 100%; margin-bottom: 2px; }
  .pacebar__mark { font-size: 10px; }
}
