:root {
  --bg: #08090b;
  --card: #13151a;
  --card2: #1a1d23;
  --line: #262a32;
  --text: #f4f5f7;
  --muted: #8b919c;
  --red: #ff2a3d;
  --gold: #ffc23d;
  --swim: #1fb6ff;
  --bike: #ffd21f;
  --run: #ff4d2e;
  --ok: #2fe08b;
  --head: 'Oswald', 'Arial Narrow', Impact, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; flex: none; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.h { font-family: var(--head); text-transform: uppercase; letter-spacing: .02em; }
.muted { color: var(--muted); }

/* header */
.top { position: relative; overflow: hidden; padding: 22px 0 26px; }
.top::before { content: ''; position: absolute; inset: -40% -30% auto auto; width: 120%; height: 160%;
  background: linear-gradient(115deg, transparent 52%, rgba(255,42,61,.22) 52.2%, rgba(255,42,61,.06) 70%, transparent 70.2%); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; position: relative; }
.logo { font-family: var(--head); font-weight: 700; font-size: 34px; font-style: italic; letter-spacing: .04em; line-height: 1; }
.logo b { color: var(--red); }
.tag { font-family: var(--head); font-size: 12px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.race { margin-left: auto; text-align: right; font-family: var(--head); text-transform: uppercase; }
.race .n { font-size: 30px; font-weight: 700; color: var(--red); line-height: 1; }
.race .l { font-size: 11px; color: var(--muted); letter-spacing: .12em; }
.race .rn { font-size: 12px; color: var(--text); letter-spacing: .06em; max-width: 150px; }

.hero { position: relative; margin-top: 20px; }
.hero .k { font-family: var(--head); font-size: 13px; letter-spacing: .25em; color: var(--muted); text-transform: uppercase; }
.hero .big { font-family: var(--head); font-weight: 700; font-size: 64px; line-height: 1; font-style: italic; }
.hero .big small { font-size: 22px; color: var(--muted); font-style: normal; margin-left: 6px; }
.hero .sub { font-family: var(--head); font-size: 16px; color: var(--muted); margin-top: 4px; letter-spacing: .04em; }
.tri { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.tri > div { background: var(--card); border-radius: 12px; padding: 10px 12px; border-top: 3px solid; }
.tri .swim { border-color: var(--swim); } .tri .bike { border-color: var(--bike); } .tri .run { border-color: var(--run); }
.tri .v { font-family: var(--head); font-size: 24px; font-weight: 600; }
.tri .l { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.tri .swim .l svg { color: var(--swim); } .tri .bike .l svg { color: var(--bike); } .tri .run .l svg { color: var(--run); }

section { margin-top: 34px; }
.st { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.st h2 { font-family: var(--head); text-transform: uppercase; font-size: 22px; letter-spacing: .03em; font-style: italic; }
.st h2::before { content: ''; display: inline-block; width: 6px; height: 18px; background: var(--red); transform: skewX(-15deg); margin-right: 10px; vertical-align: -1px; }
.st .muted { font-size: 13px; margin-left: auto; }

/* avatars */
.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--card2); display: inline-grid; place-items: center; }
.av-ini { background: linear-gradient(135deg, hsl(var(--h) 70% 45%), hsl(calc(var(--h) + 40) 70% 25%)); font-family: var(--head); font-weight: 600; color: #fff; }

/* champions */
.champs { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.champs::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .champs { grid-auto-flow: row; grid-template-columns: 1fr 1fr; overflow: visible; } }
.champ { scroll-snap-align: start; position: relative; overflow: hidden; border-radius: 18px; padding: 18px; min-height: 200px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255,194,61,.18), transparent 60%), var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; }
.champ.week { background: radial-gradient(120% 90% at 100% 0%, rgba(255,42,61,.28), transparent 60%), var(--card); border-color: rgba(255,42,61,.5); }
.champ .t { font-family: var(--head); text-transform: uppercase; font-size: 13px; letter-spacing: .2em; color: var(--gold); display: flex; align-items: center; gap: 6px; }
.champ.week .t { color: var(--red); }
.champ .t small { color: var(--muted); letter-spacing: .1em; }
.champ .who { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.champ .av { width: 72px; height: 72px; font-size: 26px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold); }
.champ.week .av { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--red); }
.champ .nm { font-family: var(--head); font-size: 22px; line-height: 1.1; text-transform: uppercase; }
.champ .pt { font-family: var(--head); font-size: 40px; font-weight: 700; font-style: italic; margin-top: auto; line-height: 1; padding-top: 12px; }
.champ .pt small { font-size: 15px; color: var(--muted); font-style: normal; }
.champ .chips { margin-top: 10px; }
.champ.empty .nm { color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--card2); font-variant-numeric: tabular-nums; }
.chip svg { width: 14px; height: 14px; }
.chip.swim svg { color: var(--swim); } .chip.bike svg { color: var(--bike); } .chip.run svg { color: var(--run); }
.chip.zero { opacity: .4; }

/* nominations */
.noms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nom { background: var(--card); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); }
.nom .t { display: flex; align-items: center; gap: 6px; font-family: var(--head); text-transform: uppercase; font-size: 13px; letter-spacing: .08em; }
.nom .t svg { width: 18px; height: 18px; }
.nom.swim .t svg { color: var(--swim); } .nom.bike .t svg { color: var(--bike); } .nom.run .t svg { color: var(--run); }
.nom.fire .t svg { color: var(--red); } .nom.sun .t svg { color: var(--gold); }
.nom .who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; line-height: 1.2; }
.nom .av { width: 34px; height: 34px; font-size: 13px; }
.nom .v { font-family: var(--head); font-size: 22px; font-weight: 600; }
.nom .v small { font-family: -apple-system, sans-serif; font-size: 11px; color: var(--muted); display: block; font-weight: 400; }

/* tabs & leaderboard */
.tabs { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: 600 13px/1 var(--head); text-transform: uppercase; letter-spacing: .08em; padding: 10px 0; border-radius: 9px; cursor: pointer; }
.tabs button.on { background: var(--red); color: #fff; }
.lb { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 30px 44px 1fr auto; gap: 10px; align-items: center; background: var(--card); border-radius: 14px; padding: 10px 12px; }
.row .rk { font-family: var(--head); font-size: 22px; font-weight: 700; font-style: italic; color: var(--muted); text-align: center; }
.row:nth-child(1) .rk { color: var(--gold); } .row:nth-child(2) .rk { color: #d0d4dc; } .row:nth-child(3) .rk { color: #d98c4a; }
.row:nth-child(1) { box-shadow: inset 3px 0 0 var(--gold); }
.row .nm { font-weight: 600; line-height: 1.2; }
.row .chips { margin-top: 5px; }
.row .p { font-family: var(--head); font-size: 24px; font-weight: 700; text-align: right; line-height: 1; }
.row .p small { display: block; font-family: -apple-system, sans-serif; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.split { display: flex; height: 4px; border-radius: 2px; overflow: hidden; margin-top: 7px; background: var(--card2); gap: 2px; }
.seg.swim { background: var(--swim); } .seg.bike { background: var(--bike); } .seg.run { background: var(--run); }
.empty-note { color: var(--muted); padding: 22px; text-align: center; background: var(--card); border-radius: 14px; }

/* iron challenge */
.iron { display: flex; flex-direction: column; gap: 8px; }
.ir { background: var(--card); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.ir .av { width: 36px; height: 36px; font-size: 13px; }
.ir .nm { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.bars { display: grid; grid-template-columns: 1fr 3fr 1.6fr; gap: 4px; }
.bar { height: 7px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.bar.swim i { background: var(--swim); } .bar.bike i { background: var(--bike); } .bar.run i { background: var(--run); }
.ir .pc { font-family: var(--head); font-size: 20px; font-weight: 600; text-align: right; min-width: 52px; }
.finisher { font-family: var(--head); font-size: 11px; letter-spacing: .1em; background: var(--red); color: #fff; padding: 3px 7px; border-radius: 6px; transform: skewX(-10deg); display: inline-block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; background: currentColor; }
.legend .swim { color: var(--swim); } .legend .bike { color: var(--bike); } .legend .run { color: var(--run); }
.legend em { color: var(--muted); font-style: normal; }

/* sleep */
.sl { display: flex; flex-direction: column; gap: 8px; }
.slr { background: var(--card); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; border-left: 4px solid var(--line); }
.slr.bad { border-color: var(--red); } .slr.warn { border-color: var(--gold); } .slr.ok { border-color: var(--swim); } .slr.good { border-color: var(--ok); }
.slr .nm { font-weight: 600; }
.slr .adv { font-size: 13px; color: var(--muted); margin-top: 2px; }
.slr .hv { font-family: var(--head); font-size: 26px; font-weight: 600; text-align: right; line-height: 1; }
.slr .hv small { display: block; font-family: -apple-system, sans-serif; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.slr.bad .hv { color: var(--red); } .slr.warn .hv { color: var(--gold); }
.best-sleep { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(47,224,139,.15), transparent); border-radius: 14px; padding: 12px; margin-top: 8px; font-size: 14px; }
.best-sleep svg { color: var(--ok); width: 22px; height: 22px; }

/* records & feed */
.recs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rec { background: var(--card); border-radius: 14px; padding: 12px; border-bottom: 3px solid; }
.rec.swim { border-color: var(--swim); } .rec.bike { border-color: var(--bike); } .rec.run { border-color: var(--run); }
.rec .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.rec .v { font-family: var(--head); font-size: 26px; font-weight: 600; line-height: 1.1; margin: 4px 0; }
.rec .w { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.feed { display: flex; flex-direction: column; }
.fi { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fi .av { width: 36px; height: 36px; font-size: 13px; }
.fi .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.fi .ic.swim { background: rgba(31,182,255,.15); color: var(--swim); } .fi .ic.bike { background: rgba(255,210,31,.15); color: var(--bike); }
.fi .ic.run { background: rgba(255,77,46,.15); color: var(--run); } .fi .ic.other { background: var(--card2); color: var(--muted); }
.fi .ic svg { width: 18px; height: 18px; }
.fi .tx { font-size: 14px; line-height: 1.25; } .fi .tx b { font-weight: 600; }
.fi .tx small { display: block; color: var(--muted); font-size: 12px; }
.fi .d { font-family: var(--head); font-size: 17px; text-align: right; }

footer { margin-top: 40px; text-align: center; font-size: 12px; color: var(--muted); }
footer a { text-decoration: underline; }

/* athlete page */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 18px; }
.prof { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.prof .av { width: 96px; height: 96px; font-size: 34px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--red); }
.prof h1 { font-family: var(--head); text-transform: uppercase; font-size: 30px; line-height: 1.05; font-style: italic; }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 150px; background: var(--card); border-radius: 14px; padding: 14px 12px 26px; position: relative; }
.chart .c { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; position: relative; }
.chart .c i { display: block; border-radius: 2px; min-height: 0; }
.chart .c i.swim { background: var(--swim); } .chart .c i.bike { background: var(--bike); } .chart .c i.run { background: var(--run); }
.chart .c span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.sleepc { display: flex; align-items: flex-end; gap: 4px; height: 110px; background: var(--card); border-radius: 14px; padding: 14px 12px 26px; position: relative; }
.sleepc .c { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; }
.sleepc .c i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--swim); }
.sleepc .c i.bad { background: var(--red); } .sleepc .c i.warn { background: var(--gold); } .sleepc .c i.good { background: var(--ok); }
.sleepc .c span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.sleepc .goal { position: absolute; left: 12px; right: 12px; border-top: 1px dashed rgba(255,255,255,.3); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.badge { background: var(--card); border-radius: 14px; padding: 12px 8px; text-align: center; border: 1px solid var(--line); }
.badge .e { font-size: 28px; line-height: 1; }
.badge .n { font-family: var(--head); font-size: 13px; text-transform: uppercase; margin-top: 6px; line-height: 1.15; }
.badge .d { font-size: 11px; color: var(--muted); margin-top: 3px; }
.badge.locked { opacity: .3; filter: grayscale(1); }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-family: var(--head); letter-spacing: .2em; text-transform: uppercase; }
