body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top, #ffffff 0, #f4f7fb 35%, #edf2f7 100%);
  color: #132238;
  margin: 0;
  padding: 24px 16px 48px;
}

main {
  max-width: 820px;
  margin: 0 auto;
}

header,
section {
  margin-bottom: 20px;
}

form,
.card {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(19, 34, 56, 0.06);
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  font-size: 16px;
  min-height: 46px;
  background: #ffffff;
}

input::placeholder {
  color: #8a97a8;
}

input:focus {
  outline: 2px solid rgba(21, 94, 239, 0.18);
  outline-offset: 0;
  border-color: #155eef;
}

button {
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: #155eef;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

a.button-link {
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

dl {
  margin: 0;
}

dl div {
  padding: 10px 0;
  border-top: 1px solid #e4e7eb;
}

dl div:first-child {
  border-top: 0;
  padding-top: 0;
}

dt {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

dd {
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 20px;
}

.error {
  border-color: #d64545;
  background: #fff4f4;
}

.warning-card {
  border-color: #d7a128;
  background: #fff9ec;
}

.warning-list {
  margin: 0;
  padding-left: 20px;
}

.warning-list li + li {
  margin-top: 8px;
}

.form-shell {
  padding: 24px;
}

.form-shell-collapsed {
  padding: 0;
  overflow: hidden;
}

.form-shell details {
  display: block;
}

.form-shell summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

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

.form-shell summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef4ff;
  color: #155eef;
  font-size: 20px;
  line-height: 1;
}

.form-shell details[open] summary::after {
  content: "-";
}

.form-heading {
  margin-bottom: 18px;
}

.tt-form {
  padding: 0;
  box-shadow: none;
  border: 0;
  background: transparent;
}

.form-shell-collapsed .tt-form {
  padding: 0 22px 22px;
  border-top: 1px solid #e2e8f0;
}

.form-summary {
  color: #5b6b80;
  font-size: 14px;
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 16px;
}

.field {
  min-width: 0;
}

.field label {
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.form-actions button {
  min-width: 148px;
}

.result-actions {
  margin-top: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: #155eef;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.button-link-secondary {
  background: #132238;
  color: #ffffff;
}

.result-card {
  padding: 24px;
}

.decision-card {
  text-align: center;
  background: linear-gradient(135deg, #132238 0%, #1a365d 100%);
  color: #ffffff;
}

.decision-card .section-eyebrow,
.decision-card .decision-support {
  color: rgba(255, 255, 255, 0.78);
}

.section-eyebrow {
  margin-bottom: 8px;
  color: #5b6b80;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.decision-statement {
  margin-bottom: 12px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.1;
}

.decision-support {
  margin-bottom: 0;
  font-size: 15px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.target-duration,
.pacing-hint {
  margin-bottom: 0;
  color: #5b6b80;
  font-size: 14px;
}

.pacing-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.pacing-print-link {
  padding: 9px 14px;
  font-size: 14px;
}

.target-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

.target-power {
  margin: 12px 0 6px;
  font-size: clamp(42px, 8vw, 64px);
  font-weight: 800;
  line-height: 1;
  color: #0f766e;
}

.target-power span {
  font-size: 0.42em;
  font-weight: 700;
  color: #2d4f6c;
}

.target-range {
  margin-bottom: 6px;
  font-size: 18px;
  font-weight: 600;
}

.target-secondary {
  margin-bottom: 0;
  color: #5b6b80;
  font-size: 14px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.status-item {
  padding: 16px;
  border-radius: 14px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
}

.status-label {
  margin-bottom: 8px;
  color: #5b6b80;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-value {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
}

.badge-good {
  background: #dcfce7;
  color: #166534;
}

.badge-caution {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #b42318;
}

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

.insight-item {
  padding: 14px 16px;
  border-left: 4px solid #d0d7e2;
  background: #fbfcfe;
}

.insight-label {
  margin-bottom: 4px;
  color: #5b6b80;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.insight-value {
  margin-bottom: 0;
  font-size: 16px;
}

.pacing-list {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.pacing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
}

.pacing-phase {
  font-weight: 600;
}

.pacing-power {
  font-size: 20px;
  color: #132238;
}

.details-panel {
  margin-top: 18px;
  border-top: 1px solid #e2e8f0;
  padding-top: 18px;
}

.details-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #155eef;
}

.details-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.details-grid div {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
}

.details-grid dt {
  color: #5b6b80;
}

.race-card-page {
  background: #ffffff;
  color: #111111;
  padding: 24px 16px 40px;
  font-family: "Helvetica Neue", "Arial", sans-serif;
}

.race-card-main {
  max-width: 760px;
  margin: 0 auto;
}

.race-card-main-sticker {
  max-width: 360px;
}

.race-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.race-card-actions .button-link,
.print-button {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.race-card-actions .button-link {
  margin-right: auto;
}

.race-card-actions .button-link:hover,
.print-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.12);
}

.race-card-actions .button-link:focus-visible,
.print-button:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.print-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-left: auto;
  border: 1px solid #111111;
  background: #111111;
  background-image: linear-gradient(180deg, #1f1f1f 0%, #111111 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.print-button::before {
  content: "⎙";
  font-size: 18px;
  line-height: 1;
}

.race-card-actions .button-link-secondary {
  background: #f3f3f3;
  color: #111111;
  border: 1px solid #d6d6d6;
}

.race-card-actions .button-link-secondary:hover {
  background: #ececec;
}

.race-card-shell {
  background: #ffffff;
  border: 2px solid #111111;
  border-radius: 0;
  box-shadow: none;
  padding: 32px;
  page-break-inside: avoid;
}

.race-sticker-shell {
  padding: 24px 20px;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  text-align: center;
}

.race-sticker-target {
  margin-bottom: 20px;
}

.race-sticker-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.race-sticker-target h1 {
  margin: 0;
  font-size: clamp(52px, 18vw, 80px);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.race-sticker-pacing {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.race-sticker-pacing li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
}

.race-sticker-pacing span {
  letter-spacing: 0.06em;
}

.race-sticker-pacing strong {
  font-size: 30px;
}

.race-sticker-instruction {
  margin: 20px 0 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.race-card-header {
  border-bottom: 2px solid #111111;
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.race-card-kicker,
.race-card-label,
.race-card-range {
  margin-bottom: 0;
  color: #111111;
}

.race-card-kicker {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.race-card-header h1 {
  margin: 14px 0 10px;
  font-size: clamp(56px, 12vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.race-card-header h1 span {
  font-size: 0.34em;
}

.race-card-label {
  font-size: 18px;
  font-weight: 700;
}

.race-card-range {
  margin-top: 8px;
  font-size: 16px;
}

.race-card-section + .race-card-section {
  margin-top: 28px;
}

.race-card-section h2 {
  margin-bottom: 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.race-card-instruction {
  margin-bottom: 0;
  max-width: 18ch;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.race-card-pacing {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 10px;
}

.race-card-pacing li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #111111;
  font-size: 20px;
}

.race-card-pacing li:last-child {
  border-bottom: 0;
}

.race-card-pacing span {
  font-weight: 700;
}

.race-card-pacing strong {
  font-size: 24px;
}

.print-only-hidden {
  display: flex;
}

@media (max-width: 640px) {
  body {
    padding: 16px 12px 32px;
  }

  main {
    max-width: 100%;
  }

  .result-card,
  .form-shell,
  .card {
    padding: 18px;
  }

  .form-shell-collapsed {
    padding: 0;
  }

  .section-heading,
  .pacing-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .pacing-card-actions {
    width: 100%;
    align-items: stretch;
  }

  .pacing-print-link {
    width: 100%;
  }

  .form-shell summary {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
  }

  .form-shell-collapsed .tt-form {
    padding: 0 18px 18px;
  }

  .form-grid,
  .status-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button {
    width: 100%;
  }

  .race-card-actions,
  .print-only-hidden {
    flex-direction: column;
    align-items: stretch;
  }

  .race-card-header h1 {
    font-size: clamp(44px, 18vw, 72px);
  }

  .race-card-instruction,
  .race-card-pacing li,
  .race-card-pacing strong {
    font-size: 20px;
  }

  .race-sticker-target h1 {
    font-size: clamp(44px, 20vw, 72px);
  }

  .race-sticker-pacing li,
  .race-sticker-pacing strong,
  .race-sticker-instruction {
    font-size: 20px;
  }

  .race-card-actions .button-link,
  .print-button {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  html {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body,
  .race-card-page {
    background: #ffffff;
    color: #111111;
    padding: 0;
  }

  main,
  .race-card-main {
    max-width: none;
    margin: 0;
  }

  .print-only-hidden {
    display: none !important;
  }

  .race-card-shell {
    border: 2px solid #111111;
    padding: 32px;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .race-card-header {
    border-bottom: 2px solid #111111;
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .race-card-kicker,
  .race-card-label,
  .race-card-range,
  .race-card-header h1,
  .race-card-instruction,
  .race-card-pacing strong,
  .race-card-pacing span {
    color: #111111;
  }

  .race-card-pacing li {
    border-bottom: 1px solid #111111;
  }

  .race-card-section + .race-card-section {
    margin-top: 20px;
  }

  .race-card-main-sticker {
    width: 70mm;
    max-width: 70mm;
    margin: 0 auto;
  }

  .race-sticker-shell {
    width: 70mm;
    min-height: auto;
    padding: 6mm 5mm;
    border-width: 2px;
  }

  .race-sticker-target {
    margin-bottom: 5mm;
  }

  .race-sticker-label {
    font-size: 9pt;
  }

  .race-sticker-target h1 {
    font-size: 34pt;
  }

  .race-sticker-pacing {
    gap: 2mm;
  }

  .race-sticker-pacing li {
    font-size: 13pt;
  }

  .race-sticker-pacing strong {
    font-size: 18pt;
  }

  .race-sticker-instruction {
    margin-top: 5mm;
    font-size: 16pt;
  }
}
