:root {
  --forest: #17251d;
  --forest-2: #22372a;
  --cream: #f3efe4;
  --paper: #fbf9f2;
  --rust: #d45c36;
  --gold: #e6b85f;
  --sage: #91a38f;
  --ink: #172019;
  --muted: #647066;
  --line: rgba(23, 37, 29, 0.16);
  --shadow: 0 28px 70px rgba(16, 30, 21, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header { height: 78px; padding: 0 clamp(22px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; color: var(--cream); background: var(--forest); border-bottom: 1px solid rgba(255,255,255,.1); }
.brand { display: inline-flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; letter-spacing: .1em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: var(--gold); font-size: 9px; letter-spacing: .18em; }
.brand-mark { position: relative; width: 36px; height: 32px; overflow: hidden; border-bottom: 2px solid var(--gold); }
.brand-mark i, .brand-mark b { position: absolute; bottom: -10px; width: 30px; height: 30px; transform: rotate(45deg); background: var(--sage); }
.brand-mark i { left: -9px; }
.brand-mark b { right: -11px; background: var(--rust); }
.event-date { color: rgba(243,239,228,.65); font-size: 11px; font-weight: 700; letter-spacing: .14em; }

.search-view { position: relative; min-height: calc(100svh - 78px); overflow: hidden; color: var(--cream); background: linear-gradient(135deg, #17251d 0%, #213b2b 65%, #34553e 100%); }
.search-view::before { content: ""; position: absolute; inset: 0; opacity: .15; background-image: radial-gradient(rgba(255,255,255,.65) .6px, transparent .6px); background-size: 6px 6px; }
.search-content { position: relative; z-index: 3; width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: clamp(70px, 10vh, 120px) 0 210px; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--rust); font-size: 12px; font-weight: 850; letter-spacing: .18em; }
.search-content .eyebrow { color: var(--gold); }
.search-content h1 { max-width: 760px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 8vw, 92px); font-weight: 500; line-height: .92; letter-spacing: -.05em; }
.search-content h1 em { color: var(--gold); font-weight: 500; }
.intro { max-width: 580px; margin: 28px auto 38px; color: rgba(243,239,228,.76); font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }
.runner-search { position: relative; width: min(650px, 100%); margin: 0 auto; text-align: left; }
.runner-search > label { display: block; margin-bottom: 9px; color: var(--cream); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.search-box { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; min-height: 64px; padding: 7px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: var(--paper); box-shadow: 0 18px 45px rgba(0,0,0,.24); }
.search-box > span { color: var(--muted); font-size: 29px; text-align: center; transform: rotate(-15deg); }
.search-box input { min-width: 0; padding: 0 10px; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: 17px; }
.search-box input::placeholder { color: #879088; }
.search-box button { align-self: stretch; padding: 0 22px; color: white; border: 0; border-radius: 5px; background: var(--rust); font-weight: 800; }
#search-help { margin: 11px 2px 0; color: rgba(243,239,228,.56); font-size: 12px; }
.search-results { position: absolute; z-index: 9; top: calc(100% - 18px); width: 100%; max-height: 300px; overflow-y: auto; border-radius: 7px; background: var(--paper); box-shadow: var(--shadow); }
.result-option { width: 100%; padding: 14px 18px; display: flex; justify-content: space-between; gap: 16px; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.result-option:hover, .result-option:focus { outline: none; background: #e9e6dc; }
.result-option strong { display: block; }
.result-option small { display: block; margin-top: 3px; color: var(--muted); }
.result-option > span:last-child { color: var(--rust); font-weight: 850; white-space: nowrap; }
.race-chips { margin-top: 38px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.race-chips span { padding: 9px 13px; color: rgba(243,239,228,.7); border: 1px solid rgba(255,255,255,.17); border-radius: 99px; font-size: 11px; letter-spacing: .05em; }
.race-chips b { color: var(--cream); }
.landscape { position: absolute; inset: auto 0 0; height: 270px; pointer-events: none; }
.sun { position: absolute; left: 15%; bottom: 85px; width: 82px; height: 82px; border-radius: 50%; background: var(--gold); opacity: .82; }
.ridge { position: absolute; left: -5%; right: -5%; bottom: -170px; height: 320px; transform: rotate(-2deg); background: #294532; border-radius: 50% 50% 0 0; }
.ridge-back { left: 25%; bottom: -185px; background: #45634a; transform: rotate(4deg); }
.ridge-front { background: #132019; clip-path: polygon(0 62%, 8% 49%, 16% 58%, 25% 35%, 33% 50%, 44% 27%, 54% 54%, 65% 33%, 76% 56%, 85% 44%, 100% 65%, 100% 100%, 0 100%); border-radius: 0; }

.recap-view { min-height: 100vh; padding: 0 20px 70px; background: linear-gradient(#e8e2d4, #f5f1e8); }
.recap-topbar { width: min(1040px, 100%); margin: 0 auto; padding: 22px 0; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.text-button { padding: 8px 0; color: var(--forest-2); border: 0; background: none; font-size: 13px; font-weight: 800; }
.recap-card { width: min(1040px, 100%); margin: 0 auto; overflow: hidden; background: var(--paper); border: 1px solid rgba(23,37,29,.12); box-shadow: var(--shadow); }
.runner-heading { position: relative; padding: clamp(30px, 5vw, 58px); display: flex; justify-content: space-between; align-items: flex-start; color: var(--cream); background: var(--forest); overflow: hidden; }
.runner-heading::after { content: ""; position: absolute; right: -60px; bottom: -85px; width: 380px; height: 190px; background: #294533; transform: rotate(-8deg); clip-path: polygon(0 100%, 20% 50%, 37% 73%, 55% 27%, 76% 65%, 100% 36%, 100% 100%); }
.runner-heading > * { position: relative; z-index: 2; }
.runner-heading h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(40px, 7vw, 74px); font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.runner-location { margin: 12px 0 0; color: rgba(243,239,228,.62); }
.finish-stamp { width: 78px; height: 78px; padding-top: 19px; color: var(--gold); border: 1px solid var(--gold); border-radius: 50%; text-align: center; font-size: 9px; font-weight: 800; letter-spacing: .14em; transform: rotate(7deg); }
.finish-stamp b { display: block; font-size: 15px; }
.hero-result { padding: clamp(34px, 6vw, 66px); text-align: center; border-bottom: 1px solid var(--line); background: #f2eee2; }
.hero-result p { margin: 0 0 10px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .17em; }
.hero-result > strong { display: block; color: var(--forest); font-family: Georgia, serif; font-size: clamp(58px, 11vw, 112px); font-weight: 500; line-height: .95; letter-spacing: -.06em; }
.hero-result div { margin-top: 16px; color: var(--muted); font-size: 14px; }
.hero-result div span { color: var(--rust); font-weight: 850; }
.summary { margin: 0; padding: 24px clamp(24px, 6vw, 64px); color: var(--forest); background: var(--gold); font-family: Georgia, serif; font-size: clamp(18px, 3vw, 26px); line-height: 1.45; text-align: center; }
.placement-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.stat { min-height: 180px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); text-align: center; }
.stat:last-child { border-right: 0; }
.stat > span { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .15em; }
.stat strong { margin: 5px 0; color: var(--forest); font-family: Georgia, serif; font-size: clamp(42px, 6vw, 62px); font-weight: 500; }
.stat small { color: var(--muted); font-size: 13px; }
.primary-stat strong { color: var(--rust); }
.comparison-section { padding: clamp(36px, 6vw, 64px); }
.section-heading { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(28px, 5vw, 42px); font-weight: 500; }
.section-heading > p { max-width: 300px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: right; }
.distribution { margin-top: 70px; }
.distribution-line { position: relative; height: 9px; border-radius: 10px; background: linear-gradient(90deg, var(--rust), var(--gold), var(--sage)); }
.runner-marker, .median-marker { position: absolute; top: 50%; width: 20px; height: 20px; border: 4px solid var(--paper); border-radius: 50%; background: var(--forest); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--forest); }
.median-marker { width: 3px; height: 26px; border: 0; border-radius: 0; background: var(--forest); box-shadow: none; }
.runner-marker i, .median-marker i { position: absolute; left: 50%; bottom: 26px; padding: 5px 7px; color: var(--paper); background: var(--forest); font-size: 9px; font-style: normal; font-weight: 850; letter-spacing: .08em; transform: translateX(-50%); white-space: nowrap; }
.median-marker i { bottom: 30px; color: var(--muted); background: transparent; }
.distribution-labels { margin-top: 15px; display: flex; justify-content: space-between; }
.distribution-labels span { display: flex; flex-direction: column; }
.distribution-labels span:last-child { text-align: right; }
.distribution-labels small { color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.distribution-labels b { margin-top: 3px; font-size: 13px; }
.gaps-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 clamp(24px, 6vw, 64px) clamp(38px, 6vw, 64px); border: 1px solid var(--line); }
.gaps-grid div { padding: 25px; border-right: 1px solid var(--line); }
.gaps-grid div:last-child { border: 0; }
.gaps-grid span, .gaps-grid strong { display: block; }
.gaps-grid span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gaps-grid strong { margin-top: 7px; color: var(--forest); font-size: 21px; }
.recap-footer { padding: 25px clamp(24px, 6vw, 64px); display: flex; justify-content: space-between; align-items: center; color: rgba(243,239,228,.65); background: var(--forest); }
.recap-footer span { color: var(--gold); font-size: 10px; font-weight: 850; letter-spacing: .14em; }
.recap-footer p { margin: 0; font-family: Georgia, serif; font-style: italic; }
.status { position: fixed; z-index: 20; right: 20px; bottom: 20px; padding: 10px 14px; color: white; border-radius: 5px; background: var(--forest); box-shadow: var(--shadow); font-size: 12px; transition: opacity .2s; }
.status.ready { opacity: 0; pointer-events: none; }
.status.error { color: white; background: #9f2f24; }

@media (max-width: 680px) {
  .site-header { height: 66px; padding: 0 18px; }
  .event-date { display: none; }
  .search-view { min-height: calc(100svh - 66px); }
  .search-content { width: min(100% - 28px, 600px); padding-top: 62px; }
  .search-content h1 { font-size: clamp(47px, 15vw, 66px); }
  .intro { margin-top: 22px; }
  .search-box { grid-template-columns: 30px 1fr; }
  .search-box button { grid-column: 1 / -1; min-height: 48px; margin-top: 6px; }
  .race-chips { margin-top: 28px; }
  .recap-view { padding: 0 10px 30px; }
  .recap-topbar > span { display: none; }
  .runner-heading { min-height: 205px; }
  .finish-stamp { width: 65px; height: 65px; padding-top: 14px; }
  .placement-grid { grid-template-columns: 1fr; }
  .stat { min-height: 132px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 14px; text-align: left; }
  .gaps-grid { grid-template-columns: 1fr; }
  .gaps-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .recap-footer { display: block; text-align: center; }
  .recap-footer p { margin-top: 8px; font-size: 13px; }
}

@media (prefers-reduced-motion: no-preference) {
  .recap-card { animation: rise .45s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
}
