/* =====================================================
   GARAGE (vehicles and paint) AND AVATARS
   ===================================================== */

/* ---------- Garage page ---------- */
.garage-stage {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 10px;
}
.garage-preview {
  display: block;
  width: 100%;
  height: 200px;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 90%, #ffb02026, transparent 60%),
    linear-gradient(180deg, #23263a, #15161f);
  box-shadow: inset 0 0 0 1px #ffffff12;
}
.garage-info h3 { margin: 0 0 6px; font-size: 24px; }
.garage-info p { margin: 0; line-height: 1.5; }
.garage-heading { margin: 22px 0 12px; }

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.vehicle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 12px;
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  border: 2px solid transparent;
  font-weight: 600;
  transition: transform 0.15s, border-color 0.15s;
}
.vehicle-card:hover { transform: translateY(-3px); filter: none; }
.vehicle-card.active { border-color: var(--accent); background: #ffb02014; }
.vehicle-card strong { font-size: 14px; }
.vehicle-card small { font-size: 16px; }
.vehicle-thumb { width: 100%; height: 64px; }

.paint-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.paint-swatch {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.paint-swatch:hover { transform: scale(1.1); filter: none; }
.paint-swatch.active { border-color: #fff; transform: scale(1.12); }

.garage-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.garage-link { text-decoration: none; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; }

/* ---------- Avatars ---------- */
/* Emoji avatars: the top bar chip, the profile and the leaderboard */
.avatar.emoji, .big-avatar.emoji, .mini-avatar.emoji { color: initial; }
.avatar.emoji { font-size: 17px; }
.big-avatar.emoji { font-size: 40px; }
.mini-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff4d5e);
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 900;
}
.mini-avatar.emoji { font-size: 14px; }

.avatar-picker {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 14px;
  background: var(--panel);
  animation: rise 0.3s both;
}
.avatar-picker h3 { margin: 0 0 10px; font-size: 16px; }
.avatar-picker h3:not(:first-child) { margin-top: 18px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.avatar-option {
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid transparent;
  font-size: 24px;
  transition: transform 0.15s;
}
.avatar-option:hover { transform: scale(1.1); filter: none; }
.avatar-option.active { border-color: #fff; transform: scale(1.1); }
.avatar-bg-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar-bg-option {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.avatar-bg-option.active { border-color: #fff; }

/* ---------- Login / sign-up page ---------- */
.auth-page {
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
  max-width: 1000px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ffffff14;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.auth-pitch {
  display: flex;
  flex-direction: column;
  padding-bottom: 30px;
  background: linear-gradient(180deg, transparent 300px, #1a1c27);
}
.auth-scene { position: relative; }
.auth-canvas { display: block; width: 100%; }
/* The road melts into the card below it */
.auth-scene-fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60px;
  background: linear-gradient(180deg, transparent, var(--card));
  pointer-events: none;
}
.auth-ride {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 1;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #ffffff26;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.auth-ride:hover { background: rgba(255, 176, 32, 0.85); color: #1a1a1a; }
.auth-pitch .auth-reason { margin: 18px 32px 0; }
.auth-pitch h2 {
  margin: 20px 32px 6px;
  font-size: 32px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-sub { margin: 0 32px 20px; font-size: 15px; line-height: 1.5; }
.auth-pitch .perks {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 32px;
  font-size: 14px;
}
.auth-pitch .perks li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff0a;
  border: 1px solid #ffffff10;
  color: var(--text);
  font-weight: 600;
}
.auth-pitch .perks li span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: #ffb0201f;
}
.auth-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
  background: #171922;
  border-left: 1px solid #ffffff10;
}
.auth-form .auth-tabs { background: var(--panel); padding: 4px; border-radius: 12px; }
.auth-form .tab { border-radius: 9px; }
.auth-form input { background: #22253a; border: 2px solid #ffffff10; }
.auth-form input:focus { border-color: var(--accent); }
#auth-submit { margin-top: 6px; box-shadow: 0 8px 24px #ffb02040; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-form { border-left: none; border-top: 1px solid #ffffff10; padding: 24px; }
  .auth-pitch .perks { grid-template-columns: 1fr 1fr; margin: 0 20px; }
  .auth-pitch h2, .auth-sub { margin-left: 20px; margin-right: 20px; }
  .auth-pitch .auth-reason { margin: 16px 20px 0; }
}
@media (max-width: 480px) {
  .auth-pitch .perks { grid-template-columns: 1fr; }
  .auth-pitch h2 { font-size: 26px; }
}

/* ---------- Results board on the track ---------- */
.standings {
  position: absolute;
  top: 44px;
  left: 12px;
  z-index: 3;
  width: min(330px, calc(100% - 24px));
  max-height: calc(100% - 56px);
  overflow-y: auto;
  padding: 12px;
  border-radius: 14px;
  background: rgba(12, 12, 22, 0.86);
  border: 1px solid #ffffff22;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  animation: board-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes board-in { from { opacity: 0; translate: -30px 0; scale: 0.95; } to { opacity: 1; translate: 0 0; scale: 1; } }
.standings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.standings-head strong { font-size: 15px; }
.standings-close {
  padding: 2px 8px;
  font-size: 14px;
  background: transparent;
  color: var(--muted);
}
.standings-close:hover { color: var(--text); filter: none; }
.standings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.standings-list li {
  display: grid;
  grid-template-columns: 34px 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #ffffff0d;
  animation: row-in 0.35s both;
  animation-delay: var(--d, 0s);
}
@keyframes row-in { from { opacity: 0; translate: -14px 0; } to { opacity: 1; translate: 0 0; } }
.standings-list li.me { background: #ffb02026; outline: 1px solid #ffb02066; }
.standings-list li.p1 { background: linear-gradient(90deg, #ffe27a33, #ffffff0d); }
.standings-list .rank { font-size: 18px; font-weight: 900; text-align: center; }
.standings-list .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.standings-list .who small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.standings-list .score { font-weight: 800; font-size: 14px; color: var(--accent); text-align: right; white-space: nowrap; }
.standings-list .score.dnf { color: var(--muted); }
.standings-list .mini-avatar { margin: 0; }

/* ---------- Race timer ---------- */
.race-timer {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 1;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.race-timer.urgent, #timer-stat.urgent span { color: #ff6b6b; animation: urgent 1s ease-in-out infinite; }
.race-timer.urgent { background: rgba(120, 10, 10, 0.6); }
#timer { font-variant-numeric: tabular-nums; }
@keyframes urgent { 50% { transform: scale(1.08); } }

@media (max-width: 700px) {
  .garage-stage { grid-template-columns: 1fr; }
  .garage-preview { height: 160px; }
  .vehicle-grid { grid-template-columns: repeat(2, 1fr); }
}
