/* owned by the pro-race builder (docs/pro-contract.md) — race lobby, rooms, leaderboard, friends */

.rc-offline,
.ac-offline {
  border: 1px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  margin: 12px 0;
  line-height: 1.6;
}
.rc-error { color: var(--bad); display: flex; gap: 8px; align-items: center; }
.rc-error:empty { display: none; }
/* during a race: only the race itself (the pickers, friend links and today's board return afterwards) */
.rc-racing .rc-pickers, .rc-racing .rc-mates, .rc-racing .rc-ticker { display: none; }
.rc-error.rc-note { color: var(--text); flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--primary); border-radius: 10px; background: color-mix(in srgb, var(--primary) 10%, transparent); }
.rc-conn { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; margin: 8px 0; }
.rc-conn-reconnecting, .rc-conn-offline { color: var(--warn); }
.rc-inline { display: inline-flex; gap: 6px; align-items: center; }
.rc-hint { font-size: 0.92rem; }
.rc-back { margin-bottom: 8px; }

/* universes */
.rc-universes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rc-universe {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 12px; border-radius: var(--radius, 10px); cursor: pointer;
  background: var(--surface); color: var(--text); border: 2px solid var(--border); font: inherit;
}
.rc-universe span { color: var(--muted); font-size: 0.85rem; }
.rc-universe:hover { border-color: var(--primary); }
.rc-universe.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.rc-universe:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.rc-join { display: inline-flex; gap: 6px; }
.rc-join input, .rc-code-in, .rc-share-url, .rc-page select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.rc-code-in { width: 9em; text-transform: uppercase; letter-spacing: 0.1em; }

/* ticker */
.rc-ticker { display: flex; align-items: center; gap: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; }
.rc-ticker-label { font-weight: 600; white-space: nowrap; color: var(--primary); }
.rc-ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, #000 92%, transparent); /* fade only where text runs off */ }
.rc-ticker-run { display: inline-flex; gap: 28px; white-space: nowrap; }
.rc-ticker-run.rc-scroll { animation: rc-marquee 30s linear infinite; }
.rc-ticker:hover .rc-ticker-run { animation-play-state: paused; }
@keyframes rc-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* room panel */
.rc-stage { margin-top: 16px; }
.rc-roomhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.rc-pill, .rc-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; }
.rc-tag { padding: 0 6px; margin-left: 6px; font-size: 0.8rem; color: var(--muted); }
.rc-share { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.rc-share-url { flex: 1; min-width: 220px; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.rc-players, .rc-friends { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.rc-player, .rc-friends li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.rc-friends li .btn:first-of-type { margin-left: auto; }
.rc-player .btn { margin-left: auto; }
.rc-player-name { font-weight: 600; }
.rc-player-wpm { font-size: 0.85rem; }
.rc-you { outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent); }
tr.rc-you { outline: none; background: color-mix(in srgb, var(--primary) 10%, transparent); }
.rc-vehicle { display: inline-flex; width: 48px; height: 24px; }
.rc-vehicle svg { width: 100%; height: 100%; }
.rc-searching { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.rc-spinner { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: rc-spin 0.9s linear infinite; }
@keyframes rc-spin { to { transform: rotate(360deg); } }

/* race */
.rc-race:empty { display: none; }
.rc-startbar { display: flex; align-items: center; gap: 16px; margin: 12px 0; }
.rc-lights { display: inline-flex; gap: 8px; padding: 8px 10px; background: var(--text); border-radius: 12px; }
.rc-lamp { width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 25%, var(--text)); transition: background 0.15s, box-shadow 0.15s; }
.rc-lamp-0.on, .rc-lamp-1.on { background: var(--bad); box-shadow: 0 0 12px var(--bad); }
.rc-lamp-2.on { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.rc-lamp-3.on { background: var(--good); box-shadow: 0 0 14px var(--good); }
.rc-count { font-size: 2rem; font-weight: 800; color: var(--primary); min-width: 3ch; }

.rc-lanes { display: grid; gap: 6px; margin: 10px 0 16px; }
.rc-lane { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 80px; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.rc-lane-name { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rc-track {
  container-type: inline-size;
  position: relative; height: 34px;
  background: repeating-linear-gradient(90deg, transparent 0 18px, color-mix(in srgb, var(--border) 70%, transparent) 18px 30px) center / 100% 2px no-repeat, var(--surface-2);
  border-radius: 8px;
}
.rc-car { --p: 0; position: absolute; top: 3px; left: 0; transform: translateX(calc(var(--p) * (100cqw - 62px))); width: 56px; height: 28px; transition: transform 0.35s linear; }
.rc-car .rc-vehicle { width: 56px; height: 28px; }
.rc-finish { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; border-radius: 0 8px 8px 0; background: repeating-linear-gradient(0deg, var(--text) 0 5px, var(--surface) 5px 10px); }
.rc-wpm { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.rc-wpm b { color: var(--text); font-size: 1.1rem; }
.rc-done .rc-track {
  container-type: inline-size; background-color: color-mix(in srgb, var(--good) 10%, var(--surface-2)); }

.rc-medal { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4em; padding: 1px 6px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.rc-medal-1 { background: color-mix(in srgb, var(--warn) 75%, var(--surface)); border-color: var(--warn); }
.rc-medal-2 { background: color-mix(in srgb, var(--muted) 45%, var(--surface)); border-color: var(--muted); }
.rc-medal-3 { background: color-mix(in srgb, var(--warn) 45%, var(--bad)); border-color: color-mix(in srgb, var(--warn) 45%, var(--bad)); color: var(--surface); }

.rc-type[inert] { opacity: 0.55; filter: blur(0.5px); }
.rc-type { transition: opacity 0.2s; }
.rc-quote { text-align: right; font-style: italic; }
.rc-finished { font-weight: 600; color: var(--good); }

/* tables (results, leaderboard, compare) */
.rc-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rc-table th, .rc-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.rc-table thead th { background: var(--surface-2); font-size: 0.85rem; color: var(--muted); }
.rc-table tbody tr:last-child td, .rc-table tbody tr:last-child th { border-bottom: 0; }
.rc-cmp tbody th { font-weight: 500; color: var(--muted); }
.rc-win { color: var(--good); font-weight: 700; }
.rc-results { margin-top: 12px; }

.rc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.rc-tab { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.rc-tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text, var(--surface)); }
.rc-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 12px 0; }
.rc-updated { margin-left: auto; font-size: 0.82rem; }
.rc-msg:empty { display: none; }

.rc-wpm { white-space: nowrap; }
.rc-stage { scroll-margin-top: 76px; } /* scrolled into view at the start: below the sticky top bar */
@media (max-width: 1180px) { .rc-stage { scroll-margin-top: 124px; } }
@media (max-width: 640px) {
  .rc-lane { grid-template-columns: 1fr auto; }
  .rc-clock { font-size: 0.85rem; text-align: right; max-width: 60%; }
  .rc-lane-name { grid-column: 1 / -1; }
  .rc-table { font-size: 0.85rem; }
  .rc-table th, .rc-table td { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .rc-ticker-run, .rc-spinner { animation: none; }
  .rc-car { transition: none; }
}
.rc-out { background: color-mix(in srgb, var(--bad) 20%, var(--surface)); border-color: var(--bad); color: var(--bad); }
.rc-failed .rc-track {
  container-type: inline-size; opacity: 0.5; }
