/* ============================================================
   THE ROBOTAXI RACE — gamified homepage layer (race.html)
   Sits on top of css/style.css. All classes prefixed rr-.
   ============================================================ */

.rr-page {
  --rr-waymo: #4a9eff;
  --rr-tesla: #ef4444;
  --rr-gold:  #f4c430;
  --rr-silver:#c9d2de;
  --rr-bronze:#d8925b;
  --rr-panel: #111117;
  --rr-panel2:#16161e;
  --rr-line:  rgba(255,255,255,0.09);
  --rr-display: 'Saira Condensed', 'Arial Narrow', var(--font);
}

/* board below adopts the race colors (Waymo blue / Tesla red) */
.rr-page .sb-brand-waymo, .rr-page .sb-waymo::before { color: var(--rr-waymo); }
.rr-page .sb-brand-tesla, .rr-page .sb-tesla::before { color: var(--rr-tesla); }
.rr-page .sb-cell.sb-waymo { border-top-color: var(--rr-waymo); }
.rr-page .sb-cell.sb-tesla { border-top-color: var(--rr-tesla); }

.rr-wrap { max-width: 1120px; margin: 0 auto; padding: 28px 24px 8px; display: flex; flex-direction: column; gap: 40px; }
.rr-display { font-family: var(--rr-display); letter-spacing: 0.02em; }
.rr-h1 { margin: 6px 0 0; font-weight: 800; font-size: clamp(42px, 7vw, 68px); line-height: 0.95; }
.rr-h2 { margin: 0; font-weight: 800; font-size: clamp(28px, 4vw, 36px); line-height: 1.05; }
.rr-h2-big { font-size: clamp(34px, 5vw, 46px); }
.rr-h3 { margin: 0 0 10px; font-weight: 700; font-size: 20px; color: var(--text-muted); }
.rr-sub { margin: 6px 0 0; color: var(--text-muted); font-size: 16px; max-width: 620px; }
.rr-muted { color: var(--text-muted); margin: 0; font-size: 14px; }
.rr-fine { margin: 10px 0 0; color: var(--text-dim); font-size: 13px; }
.rr-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-label); }

.rr-card { background: var(--rr-panel); border: 1px solid var(--rr-line); border-radius: 20px; padding: 28px; }
.rr-section { display: flex; flex-direction: column; gap: 16px; }
.rr-sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.rr-card .rr-sec-head { margin-bottom: 20px; }

/* hero */
.rr-hero { display: flex; flex-direction: column; gap: 24px; }
.rr-hero-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.rr-kicker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rr-lap { font-family: var(--rr-display); font-weight: 800; font-size: 14px; letter-spacing: 0.12em; padding: 4px 11px; border-radius: 999px; background: var(--rr-gold); color: #1a1404; }
.rr-kicker-text { font-family: var(--rr-display); font-weight: 700; font-size: 14px; letter-spacing: 0.12em; color: var(--rr-gold); }
.rr-sponsor { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; font-size: 13px; color: var(--text-dim); }
.rr-sponsor a { color: var(--text-muted); font-weight: 600; }

/* track */
.rr-track { background: var(--bg); border: 1px solid var(--rr-line); border-radius: 16px; padding: 16px 18px 14px; }
.rr-track-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.rr-track-title { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-label); }
.rr-lane { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 2px dashed rgba(255,255,255,0.10); min-height: 48px; }
.rr-lane:last-child { border-bottom: 0; }
.rr-lane-name { width: 92px; flex-shrink: 0; display: flex; flex-direction: column; line-height: 1.1; }
.rr-lane-name b { font-family: var(--rr-display); font-weight: 800; font-size: 22px; letter-spacing: 0.04em; }
.rr-lane-name small { font-size: 12px; color: var(--text-dim); }
.rr-road { flex: 1; min-width: 0; position: relative; height: 44px; border-radius: 10px; background: #15151c; overflow: visible; }
.rr-road::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 14px; border-radius: 0 10px 10px 0;
  background: repeating-conic-gradient(#f5f5f5 0 25%, #09090b 0 50%) 0 0 / 7px 7px; }
.rr-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; opacity: .22; width: 0; transition: width 1.1s cubic-bezier(.2,.7,.2,1); }
.rr-car { position: absolute; top: 9px; left: 0; transform: translateX(-100%); transition: left 1.1s cubic-bezier(.2,.7,.2,1); line-height: 0; }
.rr-lane-val { width: 120px; flex-shrink: 0; text-align: right; line-height: 1.05; }
.rr-lane-val b { font-family: var(--rr-display); font-weight: 800; font-size: 34px; }
.rr-lane-val small { display: block; color: var(--text-dim); font-size: 12px; }
.rr-delta { font-size: 12px; font-weight: 700; }
.rr-delta.up { color: var(--accent-green); }
.rr-delta.down { color: #ff8a8a; }
@media (prefers-reduced-motion: reduce) { .rr-fill, .rr-car { transition: none; } }

/* segmented control */
.rr-seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--rr-panel2); border: 1px solid var(--rr-line); border-radius: 12px; }
.rr-seg-btn { min-height: 40px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.rr-seg-btn.is-on { background: var(--rr-gold); color: #1a1404; }
.rr-seg-btn:focus-visible, .rr-opt:focus-visible, .rr-btn-gold:focus-visible { outline: 2px solid var(--rr-gold); outline-offset: 2px; }

/* stat strip */
.rr-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.rr-tile { background: var(--bg); border: 1px solid var(--rr-line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.rr-tile-big { font-weight: 800; font-size: 30px; line-height: 1.1; }
.rr-tile-sub { font-size: 13px; color: var(--text-muted); }
.rr-tile-cta { background: var(--rr-gold); border-color: var(--rr-gold); color: #1a1404; text-decoration: none; transition: transform .12s ease; }
.rr-tile-cta .rr-label, .rr-tile-cta .rr-tile-sub { color: #3b300c; }
.rr-tile-cta:hover { transform: translateY(-2px); color: #1a1404; }
.rr-vs { color: var(--text-dim); font-size: 20px; }

/* standings */
.rr-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.rr-pill { padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--rr-panel2); color: var(--text-muted); }
.rr-pill.w { color: var(--rr-waymo); background: rgba(74,158,255,0.12); }
.rr-pill.t { color: var(--rr-tesla); background: rgba(239,68,68,0.12); }
.rr-table-box { overflow-x: auto; border: 1px solid var(--rr-line); border-radius: 16px; background: var(--rr-panel); }
.rr-table { min-width: 720px; }
.rr-trow { display: grid; grid-template-columns: 2fr 1.15fr 1.15fr 1.7fr; gap: 14px; padding: 14px 20px; align-items: center; border-bottom: 1px solid var(--rr-line); }
.rr-trow:last-child { border-bottom: 0; }
.rr-thead { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-label); padding-top: 12px; padding-bottom: 12px; }
.rr-c-w { color: var(--rr-waymo); } .rr-c-t { color: var(--rr-tesla); }
.rr-cat { display: flex; align-items: center; gap: 12px; }
.rr-medal { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg); border: 1px solid var(--rr-line); color: var(--text-dim); }
.rr-medal.w { color: var(--rr-waymo); } .rr-medal.t { color: var(--rr-tesla); } .rr-medal.tie { color: var(--rr-silver); }
.rr-cat b { display: block; font-size: 16px; }
.rr-cat small { display: block; font-size: 12.5px; color: var(--text-dim); }
.rr-val { font-family: var(--rr-display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.rr-val.na { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--text-dim); }
.rr-val.win { position: relative; }
.rr-call { justify-self: start; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--rr-panel2); color: var(--text-muted); }
.rr-call.w { color: var(--rr-waymo); background: rgba(74,158,255,0.12); }
.rr-call.t { color: var(--rr-tesla); background: rgba(239,68,68,0.12); }

/* questions */
.rr-qgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.rr-q { background: var(--bg); border: 1px solid var(--rr-line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-height: 120px; }
.rr-q-tag { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--text-label); }
.rr-q-tag .season { color: var(--rr-gold); }
.rr-q h3 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; }
.rr-q-detail { margin: -4px 0 0; font-size: 13px; color: var(--text-dim); }
.rr-opts { display: flex; flex-direction: column; gap: 8px; }
.rr-opt { position: relative; overflow: hidden; width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.12);
  background: #15151c; color: var(--text); font: inherit; font-weight: 700; font-size: 15px; text-align: left; cursor: pointer; display: flex; align-items: center; transition: border-color .15s ease, transform .1s ease; }
.rr-opt:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(255,255,255,0.28); }
.rr-opt:disabled { cursor: default; }
.rr-opt-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; opacity: .16; transition: width .6s ease; }
.rr-opt.is-mine .rr-opt-bar { opacity: .32; }
.rr-opt-row { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; }
.rr-opt-row span { display: inline-flex; align-items: center; gap: 8px; }
.rr-opt-pct { font-family: var(--rr-display); font-weight: 800; font-size: 20px; }
.rr-q-foot { font-size: 12.5px; color: var(--text-dim); }
.rr-q-foot .closing { color: var(--rr-gold); font-weight: 600; }
.rr-next { margin-top: 14px; }
.rr-empty { grid-column: 1 / -1; padding: 22px; border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--text-muted); text-align: center; }

/* results */
.rr-results { margin-top: 22px; }
.rr-res { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--rr-line); font-size: 14px; }
.rr-res-q { flex: 1 1 320px; }
.rr-res-q small { display: block; color: var(--text-dim); }
.rr-res-badge { padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 12.5px; background: var(--rr-panel2); color: var(--text-muted); }
.rr-res-badge.ok { background: rgba(0,214,143,0.14); color: var(--accent-green); }
.rr-res-badge.miss { background: rgba(239,68,68,0.14); color: #ff8a8a; }

/* join */
.rr-join { margin-top: 22px; padding: 18px 20px; border-radius: 16px; background: #1a1608; border: 1px solid #4a3d12; }
.rr-join-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.rr-join-copy { display: flex; flex-direction: column; gap: 2px; }
.rr-join-copy strong { font-size: 17px; }
.rr-join-copy span, .rr-joined span { color: #cfc39a; font-size: 14px; }
.rr-join-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rr-join-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: #cfc39a; flex: 1 1 170px; }
.rr-join-fields input, .rr-join-fields select { height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid #4a3d12; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.rr-btn-gold { height: 46px; padding: 0 18px; border-radius: 10px; border: 0; background: var(--rr-gold); color: #1a1404; font-family: var(--rr-display); font-weight: 800; font-size: 17px; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: 0 0 auto; }
.rr-btn-gold:disabled { opacity: .6; cursor: default; }
.rr-join-msg { margin: 0; min-height: 1em; font-size: 14px; color: #ffd7a0; }
.rr-joined { display: flex; align-items: center; gap: 12px; }
.rr-joined div { display: flex; flex-direction: column; }

/* leaderboard */
.rr-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.rr-pod { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.rr-ava { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--rr-panel2); border: 3px solid currentColor; }
.rr-ava span { color: var(--text); }
.rr-pod-name { font-weight: 700; font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.rr-pod-block { width: 100%; border-radius: 16px 16px 0 0; background: var(--rr-panel); border: 1px solid var(--rr-line); border-top: 4px solid currentColor;
  display: flex; flex-direction: column; align-items: center; padding-top: 14px; gap: 2px; }
.rr-pod-block b { font-family: var(--rr-display); font-weight: 800; font-size: 38px; line-height: 1; }
.rr-pod-block strong { font-family: var(--rr-display); font-weight: 700; font-size: 24px; color: var(--text); }
.rr-pod-block small { font-size: 12.5px; color: var(--text-muted); }
.rr-lb-list { border: 1px solid var(--rr-line); border-radius: 16px; background: var(--rr-panel); overflow: hidden; }
.rr-lb-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--rr-line); }
.rr-lb-row:last-child { border-bottom: 0; }
.rr-lb-row.me { background: #1a1608; }
.rr-lb-rank { width: 30px; font-family: var(--rr-display); font-weight: 800; font-size: 22px; color: var(--text-dim); }
.rr-lb-ava { width: 38px; height: 38px; border-radius: 50%; background: var(--rr-panel2); border: 2px solid rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.rr-lb-ava.w { border-color: var(--rr-waymo); } .rr-lb-ava.t { border-color: var(--rr-tesla); }
.rr-lb-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rr-lb-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-lb-who small { font-size: 12.5px; color: var(--text-dim); }
.rr-lb-streak { font-size: 13px; color: var(--rr-gold); font-weight: 600; white-space: nowrap; }
.rr-lb-pts { width: 80px; text-align: right; font-family: var(--rr-display); font-weight: 800; font-size: 24px; }
.rr-lb-empty { padding: 26px 20px; text-align: center; color: var(--text-muted); }
.rr-lb-empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* skeletons */
.rr-skel { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.07), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: rr-shimmer 1.4s linear infinite; border-radius: 12px; border-color: transparent; }
@keyframes rr-shimmer { to { background-position: -200% 0; } }

/* the full board heading sits above the existing board */
#board { margin-bottom: -18px; }

@media (max-width: 640px) {
  .rr-wrap { padding: 18px 16px 8px; gap: 32px; }
  .rr-card { padding: 20px 16px; border-radius: 16px; }
  .rr-lane { gap: 10px; }
  .rr-lane-name { width: 64px; }
  .rr-lane-name b { font-size: 18px; }
  .rr-lane-val { width: 74px; }
  .rr-lane-val b { font-size: 26px; }
  .rr-car svg { width: 40px; height: 20px; }
  .rr-car { top: 12px; }
  .rr-strip { grid-template-columns: 1fr 1fr; }
  .rr-tile-big { font-size: 24px; }
  .rr-podium { gap: 8px; }
  .rr-pod-block b { font-size: 30px; }
  .rr-pod-block strong { font-size: 19px; }
  .rr-lb-streak { display: none; }
  .rr-lb-row { gap: 10px; padding: 12px 14px; }
}
.rr-page [hidden] { display: none !important; }
