:root {
  --yellow: #f5cf25;
  --black: #10110f;
  --deep-green: #173f35;
  --ink: #171813;
  --paper: #dfe9dc;
  --muted: #5f6f63;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .28; background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(25vw - 1px), rgba(23,63,53,.1) 25vw); }
.shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 24px; position: relative; }
.brandbar { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.mark { width: 52px; height: 52px; background: var(--deep-green); color: var(--yellow); display: grid; place-items: center; font-weight: 950; font-size: 1.1rem; transform: skew(-7deg); }
.eyebrow, .step { margin: 0 0 3px; font-size: .75rem; font-weight: 850; letter-spacing: .15em; }
h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.03em; }
h2 { margin: 4px 0 0; font-size: clamp(1.7rem, 4vw, 2.8rem); line-height: .98; letter-spacing: -.055em; }
.calculator { border-top: 8px solid var(--black); padding: 24px; background: rgba(255,255,255,.42); box-shadow: 0 18px 55px rgba(23,24,19,.07); }
.intro { margin-bottom: 30px; }
.base-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 9px; font-size: .88rem; font-weight: 800; }
.control { display: flex; min-height: 68px; align-items: center; border: 2px solid var(--black); background: white; }
.control:focus-within { outline: 4px solid rgba(245,207,37,.65); outline-offset: 2px; }
input[type="text"] { width: 100%; min-width: 0; border: 0; outline: 0; padding: 14px 10px 14px 16px; font: 800 1.55rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: transparent; color: var(--black); }
.control b { align-self: stretch; display: grid; place-items: center; padding: 0 13px; background: var(--black); color: white; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.field > small { min-height: 18px; color: var(--muted); font-size: .74rem; line-height: 1.35; font-weight: 600; }
.mode-fieldset { border: 0; padding: 0; margin: 26px 0 18px; }
.mode-fieldset legend { margin-bottom: 9px; font-size: .88rem; font-weight: 800; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-switch label { cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 2px solid rgba(16,17,15,.25); background: rgba(255,255,255,.5); font-weight: 850; }
.mode-switch small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.mode-switch input:checked + span { border-color: var(--black); background: var(--black); color: white; }
.mode-switch input:checked + span small { color: var(--yellow); }
.mode-switch input:focus-visible + span { outline: 4px solid rgba(245,207,37,.7); outline-offset: 2px; }
.query-wrap { max-width: 520px; }
button { width: 100%; border: 0; margin-top: 10px; padding: 19px 22px; background: var(--yellow); color: var(--black); font: 950 1rem/1 Inter, sans-serif; letter-spacing: .05em; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
button:hover { filter: brightness(.96); }
button:focus-visible { outline: 4px solid var(--black); outline-offset: 3px; }
.error { min-height: 23px; color: #a31313; font-size: .86rem; font-weight: 750; padding-top: 7px; }
.results { margin-top: 18px; background: var(--black); color: white; padding: 26px 24px 22px; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,.2); }
.step.dark { color: var(--yellow); }
.summary { padding: 9px 11px; border: 1px solid rgba(255,255,255,.35); font-size: .8rem; font-weight: 800; white-space: nowrap; }
.result-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 1px; background: rgba(255,255,255,.18); margin-top: 1px; }
.metric, .speed-card { background: var(--black); padding: 28px 24px; }
.metric { min-height: 265px; display: flex; flex-direction: column; justify-content: flex-end; }
.metric > p { margin: 0 auto auto 0; color: #c9c8bf; font-weight: 700; }
.metric > output { display: block; color: var(--yellow); font: 900 clamp(3.2rem, 10vw, 6.2rem)/.88 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.09em; }
.metric > span { margin-top: 12px; color: #a8a79f; font-size: .8rem; font-weight: 700; }
.target-range { margin-top: 20px; padding: 13px 15px; border-left: 3px solid var(--yellow); background: #252620; }
.target-range span { display: block; margin: 0 0 6px; color: #d4d3ca; font-size: .8rem; font-weight: 750; }
.target-range strong { display: block; color: white; font: 850 clamp(1.05rem, 3vw, 1.35rem)/1.15 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.035em; }
.target-range small { display: block; margin-top: 6px; color: #85857d; font-size: .68rem; font-weight: 700; }
.speed-card > p { margin: 0 0 22px; color: #a8a79f; font-size: .72rem; font-weight: 850; letter-spacing: .12em; }
.speed-card dl { margin: 0; }
.speed-card dl div { padding: 16px 0; border-top: 1px solid rgba(255,255,255,.18); }
.speed-card dt { color: #b3b2aa; font-size: .78rem; font-weight: 700; }
.speed-card dd { margin: 7px 0 0; color: white; font: 850 1.65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.speed-card dd small { color: var(--yellow); font-size: .68rem; }
.pace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 1px; background: rgba(255,255,255,.18); }
.pace-grid article { padding: 23px 24px; background: var(--black); }
.pace-grid p { margin: 0 0 12px; color: #b3b2aa; font-size: .85rem; font-weight: 700; }
.pace-grid output { color: var(--yellow); font: 900 clamp(2rem, 6vw, 3.65rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.06em; }
.pace-grid span { display: block; margin-top: 8px; color: #85857d; font-size: .75rem; font-weight: 700; }
footer { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: .75rem; font-weight: 650; }

@media (max-width: 700px) {
  body::before { background-size: 50vw 100%; }
  .shell { width: min(100% - 20px, 520px); padding-top: 18px; }
  .brandbar { margin-bottom: 22px; }
  .calculator, .results { padding: 20px 16px; }
  .base-grid, .result-grid, .pace-grid { grid-template-columns: 1fr; }
  .mode-switch span { align-items: flex-start; flex-direction: column; gap: 4px; }
  .field > small { min-height: 0; }
  .metric { min-height: 240px; padding: 22px 16px; }
  .speed-card, .pace-grid article { padding: 22px 16px; }
  .result-head { align-items: flex-start; }
  footer { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .results { animation: reveal .45s ease both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
}
