.pace-page {
  width: 100%;
  flex: 1;
  background:
    linear-gradient(180deg, #f4fbff 0%, #ffffff 38%, #ffffff 100%);
}

.pace-hero {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(42px, 8vw, 82px) 20px 26px;
  text-align: center;
}

.pace-eyebrow {
  margin: 0 0 14px;
  color: var(--color-aqua-dark);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pace-hero h1 {
  margin: 0 auto;
  max-width: 12ch;
  color: var(--color-navy);
  font-size: clamp(3rem, 9vw, 6.7rem);
  font-weight: 950;
  line-height: 0.92;
  text-wrap: balance;
}

.pace-intro {
  max-width: 42rem;
  margin: 24px auto 0;
  color: #425a72;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 650;
  line-height: 1.45;
  text-wrap: pretty;
}

.pace-calculator {
  width: min(calc(100% - 40px), 980px);
  margin: 0 auto clamp(48px, 8vw, 86px);
  padding: clamp(18px, 4vw, 34px);
  background: var(--color-white);
  border: 1px solid rgba(6, 21, 37, 0.12);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(6, 21, 37, 0.1);
}

.unit-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  background: #eef6fb;
  border: 1px solid rgba(6, 21, 37, 0.09);
  border-radius: 8px;
}

.unit-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.unit-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.unit-option span {
  display: flex;
  min-height: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 7px;
  color: #425a72;
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.unit-option small {
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.78;
}

.unit-option input:checked + span {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: 0 10px 22px rgba(6, 21, 37, 0.18);
}

.pace-control {
  margin-top: clamp(22px, 4vw, 34px);
  padding: clamp(20px, 4vw, 32px);
  background: linear-gradient(180deg, #061525 0%, #0f2841 100%);
  border-radius: 8px;
  color: var(--color-white);
}

.pace-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 14px;
  margin-bottom: clamp(24px, 5vw, 42px);
}

.pace-readout-label {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#pace-output {
  color: var(--color-aqua);
  font-size: clamp(2.4rem, 8vw, 5.2rem);
  font-weight: 950;
  line-height: 0.9;
  white-space: nowrap;
}

.pace-gauge {
  position: relative;
  padding: 42px 0 4px;
}

.pace-gauge::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  height: 18px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #ff6f73 0%, #ffd166 32%, #b7f071 62%, #00d7b6 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 12px 28px rgba(0, 0, 0, 0.24);
}

.pace-ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 30px;
  height: 60px;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.72) 0,
    rgba(255, 255, 255, 0.72) 2px,
    transparent 2px,
    transparent calc(100% / 24)
  );
  mask-image: linear-gradient(180deg, #000 0 22px, transparent 22px 38px, #000 38px 100%);
  pointer-events: none;
}

#pace-slider {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 64px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

#pace-slider::-webkit-slider-runnable-track {
  height: 18px;
  background: transparent;
}

#pace-slider::-webkit-slider-thumb {
  width: 36px;
  height: 36px;
  margin-top: -9px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-white);
  border: 5px solid var(--color-aqua);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

#pace-slider::-moz-range-track {
  height: 18px;
  background: transparent;
}

#pace-slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  background: var(--color-white);
  border: 5px solid var(--color-aqua);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.pace-scale {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 750;
}

.pace-scale span:nth-child(2) {
  text-align: center;
}

.pace-scale span:last-child {
  text-align: right;
}

.pace-results {
  margin-top: clamp(26px, 5vw, 42px);
}

.pace-results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.pace-results h2,
.pace-copy h2,
.pace-faq h2 {
  margin: 0;
  color: var(--color-navy);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 900;
  line-height: 1;
}

.pace-results-header p {
  max-width: 24rem;
  margin: 0;
  color: #60758a;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: right;
}

.pace-results-actions {
  display: flex;
  justify-content: flex-end;
  min-height: 34px;
  margin: -4px 0 10px;
}

.pace-reset-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(6, 21, 37, 0.12);
  border-radius: 999px;
  background: var(--color-white);
  color: #425a72;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pace-reset-button:hover {
  border-color: rgba(0, 215, 182, 0.68);
  color: var(--color-navy);
  transform: translateY(-1px);
}

.pace-reset-button[hidden] {
  display: none;
}

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

.pace-result-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  background: #f7fafc;
  border: 1px solid rgba(6, 21, 37, 0.09);
  border-radius: 8px;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.pace-result-card.is-pinned {
  background: #ecfffb;
  border-color: rgba(0, 215, 182, 0.62);
  box-shadow: 0 12px 26px rgba(0, 215, 182, 0.12);
}

.pace-result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-right: 34px;
}

.pace-result-distance {
  margin: 0;
  color: #425a72;
  font-size: 0.9rem;
  font-weight: 850;
}

.pace-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.pace-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(6, 21, 37, 0.12);
  border-radius: 50%;
  background: var(--color-white);
  color: #425a72;
  cursor: pointer;
  opacity: 0.78;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pace-icon-button svg {
  width: 16px;
  height: 16px;
}

.pace-pin-button svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.pace-pin-button[aria-pressed="true"] svg path {
  fill: currentColor;
  stroke: currentColor;
}

.pace-delete-button svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.pace-pin-button,
.pace-delete-button {
  opacity: 0;
  pointer-events: none;
}

.pace-result-card:hover .pace-delete-button,
.pace-result-card:focus-within .pace-delete-button,
.pace-result-card:hover .pace-pin-button,
.pace-result-card:focus-within .pace-pin-button,
.pace-pin-button[aria-pressed="true"] {
  opacity: 1;
  pointer-events: auto;
}

.pace-result-card:hover .pace-card-actions,
.pace-result-card:focus-within .pace-card-actions,
.pace-result-card.is-pinned .pace-card-actions {
  pointer-events: auto;
}

.pace-icon-button:hover {
  border-color: rgba(0, 215, 182, 0.68);
  color: var(--color-navy);
  opacity: 1;
  transform: translateY(-1px);
}

.pace-pin-button[aria-pressed="true"] {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: var(--color-white);
  opacity: 1;
}

.pace-delete-button:hover {
  border-color: rgba(216, 69, 69, 0.42);
  color: #b42323;
}

.pace-result-time {
  display: block;
  color: var(--color-navy);
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  font-weight: 950;
  line-height: 0.98;
  word-break: keep-all;
}

.pace-copy {
  width: min(100%, 740px);
  margin: 0 auto clamp(54px, 8vw, 92px);
  padding: 0 20px;
}

.pace-copy h2 {
  margin-bottom: 16px;
}

.pace-copy p {
  margin: 0 0 18px;
  color: var(--color-text-dark);
  font-size: 1.05rem;
  line-height: 1.72;
  opacity: 0.88;
}

.pace-faq {
  width: min(100%, 740px);
  margin: 0 auto clamp(54px, 8vw, 92px);
  padding: 0 20px;
}

.pace-faq h2 {
  margin-bottom: 18px;
}

.pace-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pace-faq details {
  background: #f7fafc;
  border: 1px solid rgba(6, 21, 37, 0.09);
  border-radius: 8px;
}

.pace-faq summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px;
  color: var(--color-navy);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.3;
  list-style: none;
}

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

.pace-faq summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--color-aqua-dark);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.pace-faq details[open] summary::after {
  content: "-";
}

.pace-faq p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--color-text-dark);
  font-size: 1rem;
  line-height: 1.65;
  opacity: 0.88;
}

.pace-faq a {
  color: var(--color-navy);
  font-weight: 750;
  text-decoration: underline;
}

@media (max-width: 760px) {
  .pace-calculator {
    width: min(calc(100% - 28px), 980px);
  }

  .unit-picker,
  .pace-results-grid {
    grid-template-columns: 1fr;
  }

  .pace-readout,
  .pace-results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pace-results-header p {
    text-align: left;
  }

  .pace-results-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .pace-hero {
    padding-top: 34px;
  }

  .pace-calculator {
    padding: 14px;
  }

  .pace-control {
    padding: 18px 14px;
  }

  #pace-output {
    font-size: 2.35rem;
  }

  .pace-scale {
    font-size: 0.76rem;
  }

  .pace-result-card {
    padding: 14px;
  }
}

@media (hover: none) {
  .pace-card-actions,
  .pace-pin-button,
  .pace-delete-button {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #06111d;
    color: #edf7ff;
  }

  .pace-page {
    background:
      linear-gradient(180deg, #071625 0%, #06111d 42%, #06111d 100%);
  }

  .pace-hero h1,
  .pace-results h2,
  .pace-copy h2,
  .pace-faq h2,
  .pace-result-time {
    color: #f5fbff;
  }

  .pace-eyebrow,
  #pace-output,
  .pace-faq summary::after {
    color: #4be3d2;
  }

  .pace-intro,
  .pace-results-header p,
  .pace-result-distance,
  .pace-copy p,
  .pace-faq p {
    color: #b7c8d9;
    opacity: 1;
  }

  .pace-calculator {
    background: #0a1928;
    border-color: rgba(139, 186, 220, 0.22);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  }

  .unit-picker {
    background: #0f2438;
    border-color: rgba(139, 186, 220, 0.18);
  }

  .unit-option span {
    color: #bfd0df;
  }

  .unit-option input:checked + span {
    background: #f5fbff;
    color: #061525;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
  }

  .pace-control {
    background: linear-gradient(180deg, #08121f 0%, #0b2035 100%);
    border: 1px solid rgba(139, 186, 220, 0.16);
  }

  .pace-result-card,
  .pace-faq details {
    background: #0f2033;
    border-color: rgba(139, 186, 220, 0.18);
  }

  .pace-result-card.is-pinned {
    background: #0e302e;
    border-color: rgba(75, 227, 210, 0.58);
    box-shadow: 0 12px 26px rgba(0, 215, 182, 0.08);
  }

  .pace-reset-button,
  .pace-icon-button {
    background: #071625;
    border-color: rgba(139, 186, 220, 0.22);
    color: #bfd0df;
  }

  .pace-reset-button:hover,
  .pace-icon-button:hover {
    border-color: rgba(75, 227, 210, 0.72);
    color: #f5fbff;
  }

  .pace-pin-button[aria-pressed="true"] {
    background: #4be3d2;
    border-color: #4be3d2;
    color: #061525;
  }

  .pace-faq summary,
  .pace-faq a {
    color: #f5fbff;
  }
}
