/* Ergänzung zu style.css: alles, was es beim Rennen noch nicht gibt
   (Emoji-Fahrzeugraster, Joystick, Live-Rangliste, Podium, Punkte-Toasts,
   Liste offener Räume zum Beitreten ohne Code). */

.open-rooms-section { margin-top: 22px; }
.open-rooms-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.65;
  margin-bottom: 8px;
}
.open-rooms-list { display: flex; flex-direction: column; gap: 8px; }
.open-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 10px 12px;
}
.open-room-host { font-weight: 700; font-size: 15px; }
.open-room-count { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.open-room-row .btn {
  min-height: auto;
  padding: 10px 16px;
  font-size: 14px;
}

.crew-picker-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.65;
  margin: 4px 0 8px;
}
.crew-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.crew-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 10px 4px;
  cursor: pointer;
  color: var(--sand);
}
.crew-btn.selected {
  border-color: var(--turquoise);
  background: rgba(47, 217, 196, 0.15);
}
.crew-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.12);
}
.crew-btn-name { font-size: 12px; font-weight: 600; }

/* Foto-Avatare in Lobby-Roster, Live-Rangliste und Ergebnissen - fallen
   sanft auf den farbigen Punkt zurück, falls kein Foto hinterlegt ist
   (z. B. Bots). */
.roster-avatar,
.live-avatar,
.podium-avatar,
.results-avatar {
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.roster-avatar { width: 28px; height: 28px; }
.live-avatar { width: 16px; height: 16px; }
.podium-avatar { width: 36px; height: 36px; margin: 0 auto; }
.results-avatar { width: 22px; height: 22px; margin-right: 6px; vertical-align: middle; }

.join-by-code { margin-top: 18px; }
.join-by-code summary {
  cursor: pointer;
  font-size: 13px;
  opacity: 0.75;
  padding: 6px 0;
}
.join-by-code .field { margin-top: 10px; }
.join-by-code .btn { margin-top: 10px; }

#screen-game { padding: 10px; gap: 8px; position: relative; }

.hud-score { font-size: 13px; margin-top: 4px; opacity: 0.9; }
/* Sichtbarer Hinweis in den letzten 30 Sekunden: Items zählen doppelt
   (siehe ENDSPURT_MULTIPLIER in chaosRoom.js) - macht den Endspurt auch im
   HUD spürbar, nicht nur über den roten Timer. */
.hud-score.endspurt-active::after {
  content: " ×2";
  color: var(--sun-yellow);
  font-weight: 800;
  animation: timerPulse 1s ease-in-out infinite;
}
#hudScore { display: inline-block; }
.score-pop { animation: scorePop 380ms ease-out; }
@keyframes scorePop {
  0% { transform: scale(1); }
  35% { transform: scale(1.4); color: var(--sun-yellow); }
  100% { transform: scale(1); }
}

.timer-urgent { color: var(--coral); animation: timerPulse 1s ease-in-out infinite; }
@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.countdown-pop { animation: countdownPop 550ms cubic-bezier(0.34, 1.56, 0.64, 1); display: inline-block; }
@keyframes countdownPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.hud-status-mini { display: flex; align-items: center; gap: 5px; font-size: 10px; opacity: 0.75; margin-top: 5px; }

.chaos-live-board { min-width: 150px; }
.chaos-live-title { font-size: 11px; opacity: 0.7; margin-bottom: 4px; letter-spacing: 0.5px; }
.live-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}
.live-row.self { font-weight: 700; }
.live-rank { width: 14px; text-align: right; opacity: 0.75; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.live-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.live-score { margin-left: auto; opacity: 0.9; }

.chaos-arena-wrap { position: relative; flex: 1; min-height: 0; min-width: 0; touch-action: none; }
#arena {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: #f3e9d2;
  display: block;
  touch-action: none;
}

.float-toasts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-toast {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 18px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.35);
  animation: floatUp 900ms ease-out forwards;
}
.float-toast.positive { color: #2ECC71; }
.float-toast.negative { color: var(--coral); }
@keyframes floatUp {
  from { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
  to { opacity: 0; transform: translate(-50%, -50%) translateY(-46px); }
}

.hud-host-controls {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.hud-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 37, 49, 0.7);
  color: var(--sand);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 49, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;
  text-align: center;
}
.pause-overlay-inner { padding: 20px; }
.pause-title { font-size: 24px; font-weight: 800; color: var(--sun-yellow); margin-bottom: 8px; }
.pause-overlay .hint { opacity: 0.85; margin-bottom: 12px; }

/* Führungswechsel-Ansage: bewusst über dem Spielfeld (im HUD-Bereich, nicht
   im chaos-arena-wrap), damit sie nie die Sicht auf die eigentliche Runde
   blockiert - anders als big-message, das gezielt über dem Feld liegt (dort
   auch richtig, z.B. für Golden Pizza/Endspurt). */
.leader-banner {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 37, 49, 0.92);
  border: 1px solid rgba(255, 217, 61, 0.5);
  color: var(--sun-yellow);
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.big-message {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(11, 37, 49, 0.85);
  color: var(--sun-yellow);
  padding: 10px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  pointer-events: none;
  z-index: 6;
}

/* Countdown-Overlay (aus style.css) muss im Zweifel über dem Joystick
   liegen, nicht dahinter. */
#countdownOverlay { z-index: 6; }

/* Dynamischer Joystick: erscheint dort, wo der Daumen zuerst aufsetzt (siehe
   chaosClient.js placeJoystickAt) - links/top werden per JS gesetzt, hier nur
   Größe/Optik/Zentrierung auf den Berührungspunkt sowie das Ein-/Ausblenden.
   pointer-events: none, weil die gesamte Spielfläche (chaos-arena-wrap) das
   Touch-Handling übernimmt, nicht der Joystick selbst - er ist rein visuell. */
.joystick-base {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease-out;
  z-index: 4;
}
.joystick-base.active { opacity: 1; }
.joystick-knob {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--turquoise);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 14px;
}
.podium-slot {
  flex: 1;
  max-width: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 14px 14px 0 0;
  text-align: center;
  padding: 10px 6px;
}
.podium-slot .medal { font-size: 26px; }
.podium-slot .p-name { font-weight: 700; font-size: 13px; margin-top: 4px; word-break: break-word; }
.podium-slot .p-score { font-size: 12px; opacity: 0.75; }
.podium-slot.rank-1 { padding-top: 22px; order: 2; background: rgba(255,217,61,0.18); }
.podium-slot.rank-2 { order: 1; }
.podium-slot.rank-3 { order: 3; }

#screen-results { position: relative; overflow: hidden; }
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  opacity: 0.95;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(115vh) rotate(600deg); opacity: 0.4; }
}
/* Inhalt des Ergebnis-Screens über dem Konfetti, nicht darunter versteckt. */
#screen-results > h1,
#screen-results > .podium,
#screen-results > .awards-row,
#screen-results > .results-table,
#screen-results > .btn,
#screen-results > .hint {
  position: relative;
  z-index: 1;
}

/* Lustige Endstatistiken (Pizzakönig, Rammbock, Pechvogel) - kleine Chips
   unter dem Podium, nur sichtbar wenn wenigstens einer der Zähler > 0 ist
   (siehe renderAwards in chaosClient.js). */
.awards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 16px;
}
.award-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 92px;
}
.award-emoji { font-size: 20px; }
.award-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.8; }
.award-name { font-size: 13px; font-weight: 700; }
.award-count { font-size: 11px; opacity: 0.7; }
