/* Spike Run – only what's specific to this game.
   Header, segmented buttons and the rest come from /css/style.css. */

.sr-layout {
  gap: 16px;
}

/* ---------- Progress bar ---------- */

.sr-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 900px);
  font-size: 14px;
  font-weight: 600;
}

.sr-attempt,
.sr-best {
  flex: none;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sr-best {
  min-width: 70px;
  text-align: right;
}

.sr-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}

.sr-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--accent);
}

.sr-pct {
  flex: none;
  min-width: 42px;
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------- Game area ---------- */

/* The stage sits in a centred column, so it needs its own width */
.sr-stage {
  position: relative;
  width: min(100%, 900px);
  touch-action: none;           /* taps are jumps, not scrolling or zooming */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.sr-view {
  width: 100%;
}

.sr-canvas {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
}

.sr-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  background: var(--overlay-light);
  text-align: center;
  pointer-events: none;         /* taps go through to the game… */
}

.sr-overlay p {
  margin: 0;
}

.sr-overlay .game-actions {
  margin-top: 10px;
  pointer-events: auto;         /* …except on the buttons */
}

/* ---------- Practice toggle + keys ---------- */

.sr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}

.sr-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-fill);
}

.sr-keys {
  max-width: 640px;
  text-align: center;
}

.sr-swatch {
  display: inline-block;
  width: 14px;
  height: 7px;
  border-radius: 7px 7px 0 0;
  vertical-align: 1px;
}

.sr-swatch.is-pad {
  background: var(--warn);
}

kbd {
  display: inline-block;
  min-width: 22px;
  margin: 0 1px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Online race ---------- */

.sr-race-setup,
.sr-race {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.sr-race-setup > p {
  margin: 0;
}

.sr-setup-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

/* Everyone's progress in the race */
.sr-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100%, 900px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-board li {
  display: grid;
  grid-template-columns: 22px minmax(0, 120px) 1fr 44px 74px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.sr-board .sr-rank {
  color: var(--text-faint);
  font-weight: 700;
  text-align: right;
}

.sr-board .sr-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-board li.is-me .sr-name {
  color: var(--accent);
}

.sr-board .sr-bar {
  height: 6px;
}

.sr-board li:not(.is-me) .sr-bar span {
  background: var(--text-muted);
}

.sr-board .sr-pct {
  min-width: 0;
  font-size: 13px;
}

.sr-board .sr-status {
  color: var(--text-muted);
  text-align: right;
}

.sr-board li.is-done .sr-status {
  color: var(--accent);
  font-weight: 700;
}

.sr-note {
  min-height: 21px;
  margin: 0;
  text-align: center;
}

@media (max-width: 520px) {
  .sr-board li {
    grid-template-columns: 18px minmax(0, 80px) 1fr 40px;
  }
  .sr-board .sr-status {
    display: none;
  }
}

/* Phone held sideways: fit the screen height (see css/style.css) */
@media (orientation: landscape) and (max-height: 540px) {
  .sr-stage { width: min(900px, var(--play-w), calc(var(--play-h) * 16 / 7)); }
  .sr-keys { display: none; }
}
@media (orientation: landscape) and (max-height: 540px) {
  :root { --land-side: 236px; }
}
/* With friends, phone held sideways */
@media (orientation: landscape) and (max-height: 540px) {
  .sr-race { --play-h: calc(100dvh - 176px); }
}
