/* Layout: full-screen sky; a camera follows the rider up a log-scale column of landmarks.
   Single deliberate look (the sky itself), so colors are fixed rather than theme-switched. */
:root {
  --ink: #0e1a2b;
  --paper: #ffffff;
  --navy: #0d1729;
  --navy-2: #172238;
  --line: rgba(255, 255, 255, .14);
  --muted: #a7b4c6;
  --accent: #ff6a33;
  --zwift: #ff8a55;
  --display: "Saira Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: #bfe6f7; color: var(--ink);
  font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Sky & world ---------- */
.sky { position: fixed; inset: 0; background: linear-gradient(to top, #bfe6f7, #a6d8f3); }
.stars { position: absolute; inset: 0; opacity: 0; }
.stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; }

.world { position: fixed; left: 0; right: 0; bottom: 0; height: 0; will-change: transform; }
.ground { position: absolute; left: 0; right: 0; bottom: -2px; height: 82px; }
.ground svg { width: 100%; height: 100%; display: block; }
.track { position: absolute; left: 50%; width: 2px; margin-left: -1px; bottom: 80px; background: rgba(255, 255, 255, .45); }
.trail { position: absolute; left: 50%; width: 6px; margin-left: -3px; bottom: 80px; height: 0; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 16px rgba(255, 106, 51, .75); }
.rider { position: absolute; left: 50%; bottom: 80px; width: 0; height: 0; z-index: 3; }
.rider .knob { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 5px solid var(--accent); box-shadow: 0 0 0 6px rgba(255, 255, 255, .22), 0 0 20px rgba(255, 106, 51, .8); }
.rider .bike { position: absolute; left: 16px; top: -30px; width: 40px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.world.idle .track, .world.idle .trail, .world.idle .mark, .world.idle .tickd, .world.idle .rider { opacity: 0; }

.cloud { position: absolute; height: 26px; border-radius: 40px; background: rgba(255, 255, 255, .85);
  box-shadow: 18px -10px 0 4px rgba(255, 255, 255, .85), 42px -2px 0 0 rgba(255, 255, 255, .85); }

.tickd { position: absolute; left: 12px; transform: translateY(50%); font: 600 12px var(--display); letter-spacing: .06em;
  display: flex; align-items: center; gap: 6px; opacity: .55; }
.tickd::after { content: ""; width: 26px; height: 1px; background: currentColor; }

.mark { position: absolute; width: 50%; display: flex; align-items: center; transform: translateY(50%);
  font-size: 13px; line-height: 1.15; transition: opacity .3s; }
.mark.l { right: 50%; flex-direction: row-reverse; text-align: right; padding-left: 56px; }
.mark.r { left: 50%; padding-right: 16px; }
.mark .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; transition: background .25s, transform .25s; }
.mark.l .dot { margin-right: -5px; } .mark.r .dot { margin-left: -5px; }
.mark .tick { flex: 0 0 18px; height: 1px; background: currentColor; opacity: .55; }
.mark .txt { min-width: 0; opacity: .55; transition: opacity .3s; }
.mark b { display: block; font-weight: 600; }
.mark small { font: 600 13px var(--display); letter-spacing: .03em; font-variant-numeric: tabular-nums; opacity: .85; }
.mark.passed .txt { opacity: 1; }
.mark.passed .dot { background: currentColor; }
.mark.pop .dot { transform: scale(1.8); }
.mark.zwift .dot { border-color: var(--zwift); }
.mark.zwift.passed .dot { background: var(--zwift); }
.mark.far { opacity: 0; }

/* ---------- HUD ---------- */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 5; text-align: center; pointer-events: none;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 0; }
.hud .alt { font: 800 clamp(2.6rem, 9vw, 4.4rem)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.hud .alt small { font-size: .42em; margin-left: 4px; opacity: .8; }
.hud .passing { margin-top: 4px; font-weight: 600; font-size: 14px; min-height: 1.5em; }
.hud .skip { pointer-events: auto; position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top, 0px));
  border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 99px; padding: 6px 14px; cursor: pointer; opacity: .8; }
.hud .skip:hover { opacity: 1; }

/* ---------- Landing ---------- */
.landing { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 24px 16px 120px; text-align: center; transition: opacity .5s, transform .5s; }
.landing.gone { opacity: 0; transform: translateY(-30px); pointer-events: none; }
h1 { font: 800 clamp(2.4rem, 8vw, 4.6rem)/.95 var(--display); text-transform: uppercase; margin: 0 0 10px; text-wrap: balance; color: var(--ink); }
h1 span { color: var(--accent); }
.lede { margin: 0 0 26px; font-size: 17px; color: #27405c; max-width: 34ch; }
form { width: min(100%, 420px); display: grid; gap: 10px; text-align: left; }
.lbl { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #27405c; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; font: 700 28px var(--display); letter-spacing: .02em; padding: 8px 14px; border-radius: 12px;
  border: 2px solid rgba(14, 26, 43, .15); background: rgba(255, 255, 255, .92); color: var(--ink); font-variant-numeric: tabular-nums; }
.row input:focus { border-color: var(--accent); outline: none; }
.seg { display: inline-flex; border-radius: 12px; overflow: hidden; border: 2px solid rgba(14, 26, 43, .15); background: rgba(255, 255, 255, .7); }
.seg button { border: 0; background: transparent; color: #27405c; font-weight: 600; padding: 0 16px; min-height: 48px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.go { font: 800 20px var(--display); letter-spacing: .08em; text-transform: uppercase; border: 0; border-radius: 12px; min-height: 54px;
  background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(255, 106, 51, .35); }
.go:hover { filter: brightness(1.06); }
.hint { margin: 0; font-size: 13px; color: #3a5574; }
.err { margin: 0; font-size: 14px; color: #b3261e; font-weight: 600; min-height: 1.4em; }

/* ---------- Result sheet ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; justify-content: center; padding: 0 12px;
  transform: translateY(105%); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.sheet.open { transform: none; }
.sheet-inner { width: min(100%, 720px); max-height: 62vh; overflow-y: auto; background: rgba(13, 23, 41, .94); color: #eef3fa;
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.big { font: 800 clamp(2.6rem, 8vw, 3.6rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.big small { font-size: .45em; color: var(--muted); margin-left: 4px; }
.status { margin: 6px 0 0; font-size: 16px; }
.status strong { color: #fff; }
.meter { display: grid; gap: 6px; }
.mtop { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .9s .3s; }
h2 { margin: 6px 0 0; font: 700 14px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.equiv { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.equiv div { background: var(--navy-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.equiv dd { margin: 0; font: 700 26px/1.1 var(--display); font-variant-numeric: tabular-nums; color: #fff; overflow-wrap: anywhere; }
.equiv dt { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
@media (max-width: 560px) { .equiv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: transparent; color: #eef3fa; border-radius: 10px; padding: 0 16px; min-height: 44px; font-weight: 600; cursor: pointer; }
.btn:hover { background: rgba(255, 255, 255, .06); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.foot { margin: 0; font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .landing, .sheet, .bar i, .mark, .mark .dot, .mark .txt { transition: none; }
}
