* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #17152b;
  --surface: #1e1b38;
  --primary: #e94560;
  --primary-hover: #c73e54;
  --accent: #0f3460;
  --text: #eee;
  --text-muted: #999;
  --success: #4ecdc4;
  --danger: #ff6b6b;
  --opt-a: #e94560;
  --opt-b: #3498db;
  --opt-c: #f39c12;
  --opt-d: #2ecc71;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --neon-pink: #ff2d78;
  --neon-fuchsia: #c026d3;
  --neon-blue: #38bdf8;
}

html, body {
  height: 100%;
  font-family: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   SCREENS (shared)
   ═══════════════════════════════════════════════════════════ */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Common ─── */
.logo { font-size: 3.5rem; font-weight: 700; color: var(--primary); margin-bottom: 32px; letter-spacing: -2px; }
.subtitle { font-size: 1.3rem; color: var(--text-muted); margin-bottom: 8px; }
.hint { font-size: 1rem; color: var(--text-muted); margin-top: 8px; }
.centered { text-align: center; }

.btn-primary {
  padding: 18px 48px;
  border: none;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   SETUP SCREEN — Party Landing
   ═══════════════════════════════════════════════════════════ */
#screen-setup {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* ─── Stage lights ─── */
.stage-light {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}
.stage-light--left {
  bottom: -200px;
  left: -150px;
  background: radial-gradient(circle, var(--neon-blue) 0%, transparent 70%);
}
.stage-light--right {
  bottom: -200px;
  right: -150px;
  background: radial-gradient(circle, var(--neon-fuchsia) 0%, transparent 70%);
}

/* ─── Confetti ─── */
.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  border-radius: 2px;
  opacity: 0.85;
  animation: confettiFall linear infinite;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 0.9;
  }
  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0.3;
  }
}

/* ─── Setup Logo (neon) ─── */
.setup-logo {
  font-size: 5.5rem;
  font-weight: 700;
  color: #8b1a3a;
  letter-spacing: -2px;
  text-align: center;
  position: relative;
  z-index: 2;
  text-shadow: none;
  margin-bottom: 40px;
}

@keyframes neonPulse {
  0%, 100% {
    text-shadow:
      0 0 6px var(--neon-pink),
      0 0 18px var(--neon-pink),
      0 0 40px var(--neon-fuchsia),
      0 0 60px rgba(192, 38, 211, 0.25);
  }
  50% {
    text-shadow:
      0 0 4px var(--neon-pink),
      0 0 12px var(--neon-pink),
      0 0 28px var(--neon-fuchsia),
      0 0 40px rgba(192, 38, 211, 0.15);
  }
}

/* ─── Create Room Button ─── */
.btn-create-room {
  position: relative;
  z-index: 2;
  padding: 22px 64px;
  border: 2px solid #b91c3a;
  border-radius: 20px;
  background: linear-gradient(180deg, #a01535 0%, #7a1028 100%);
  color: white;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow:
    0 0 20px rgba(233, 69, 96, 0.4),
    0 4px 0 #5c0c1e,
    0 6px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.btn-create-room:hover {
  transform: scale(1.06);
  box-shadow:
    0 0 35px rgba(233, 69, 96, 0.6),
    0 4px 0 #5c0c1e,
    0 8px 16px rgba(0, 0, 0, 0.5);
}

.btn-create-room:active {
  transform: scale(0.98) translateY(2px);
  box-shadow:
    0 0 15px rgba(233, 69, 96, 0.3),
    0 2px 0 #5c0c1e,
    0 3px 6px rgba(0, 0, 0, 0.4);
}

.btn-create-room:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── Characters ─── */
.character {
  position: absolute;
  z-index: 1;
  animation: charFloat 4s ease-in-out infinite;
}

.character-placeholder {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  user-select: none;
}

/* Behind logo — top row */
.character--top-left {
  top: 18%;
  left: 30%;
  animation-delay: 0s;
}
.character--top-center {
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0.8s;
}
.character--top-right {
  top: 18%;
  right: 30%;
  animation-delay: 1.5s;
}

/* Peeking from sides */
.character--side-left {
  top: 45%;
  left: 3%;
  animation-delay: 0.5s;
}
.character--side-right {
  top: 45%;
  right: 3%;
  animation-delay: 1.2s;
}

/* Near button — bottom */
.character--bottom-left {
  bottom: 12%;
  left: 22%;
  animation-delay: 0.3s;
}
.character--bottom-right {
  bottom: 12%;
  right: 22%;
  animation-delay: 1s;
}

@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Fix center character float (needs both translateX and translateY) */
.character--top-center {
  animation: charFloatCenter 4s ease-in-out infinite;
  animation-delay: 0.8s;
}
@keyframes charFloatCenter {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-12px); }
}

/* ═══════════════════════════════════════════════════════════
   LOBBY
   ═══════════════════════════════════════════════════════════ */
#screen-lobby {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  padding: 30px 50px;
}

.lobby-logo {
  font-size: 3.5rem;
  margin-bottom: 24px;
  color: #8b1a3a;
  text-shadow: none;
}

.lobby-layout {
  display: flex;
  gap: 60px;
  align-items: flex-start;
  margin-bottom: 32px;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 900px;
}

.lobby-left {
  text-align: center;
  flex-shrink: 0;
}

.lobby-right {
  flex: 1;
  min-width: 280px;
}

.lobby-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* Neon code box */
.room-code-box {
  border: 2px solid var(--neon-pink);
  border-radius: 14px;
  padding: 12px 32px;
  margin-bottom: 20px;
  box-shadow:
    0 0 12px rgba(255, 45, 120, 0.4),
    inset 0 0 12px rgba(255, 45, 120, 0.08);
}

.room-code {
  font-size: 4.5rem;
  letter-spacing: 18px;
  font-weight: 700;
  color: var(--neon-pink);
  text-shadow:
    0 0 8px rgba(255, 45, 120, 0.5),
    0 0 20px rgba(255, 45, 120, 0.25);
  margin: 0;
}

.qr-box {
  margin: 0 auto 16px;
}
.qr-box canvas {
  border-radius: 10px;
}

.lobby-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.lobby-url {
  color: var(--neon-blue);
  font-weight: 600;
}

/* Player list */
.player-list {
  min-height: 60px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(4px);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

.player-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}

.player-status {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
}
.player-status.disconnected {
  color: #ef4444;
  opacity: 0.8;
}

.btn-start {
  position: relative;
  z-index: 2;
  margin-top: 8px;
}

/* ─── Mute button ─── */
.btn-mute {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  backdrop-filter: blur(6px);
  font-family: inherit;
}

.btn-mute:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-mute.muted {
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   STARTING
   ═══════════════════════════════════════════════════════════ */
.countdown {
  font-size: 12rem;
  font-weight: 700;
  color: var(--primary);
  animation: pulse 1s ease infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ═══════════════════════════════════════════════════════════
   CATEGORY
   ═══════════════════════════════════════════════════════════ */
.category-title { font-size: 4rem; font-weight: 700; color: var(--success); margin: 16px 0; }
.round-info { font-size: 1.3rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   QUESTION
   ═══════════════════════════════════════════════════════════ */
#screen-question {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  padding: 32px 40px;
  justify-content: center;
  gap: 0;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 960px;
  margin-bottom: 18px;
  font-size: 1.2rem;
  color: var(--text-muted);
  position: relative;
  z-index: 2;
}

.q-number {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.q-category {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 20px;
  border-radius: 50px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.1);
}

/* ─── Circular Timer ─── */
.q-timer-ring {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.q-timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.q-timer-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.q-timer-fill {
  fill: none;
  stroke: var(--neon-pink);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
  filter: drop-shadow(0 0 6px rgba(255, 45, 120, 0.6));
}

.q-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--text);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.q-timer-ring.urgent .q-timer-fill {
  stroke: var(--danger);
  filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.8));
}

.q-timer-ring.urgent .q-timer {
  color: var(--danger);
  animation: timerPulse 0.6s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.18); }
}

/* ─── Question Glass Card ─── */
.q-card {
  width: 100%;
  max-width: 960px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 28px 36px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 2;
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.3),
    inset 0 0 40px rgba(255, 255, 255, 0.02);
}

.q-media {
  display: block;
  max-height: 280px;
  max-width: 100%;
  margin: 0 auto 16px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}
.q-media.hidden { display: none; }

.q-text {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  max-width: 100%;
  line-height: 1.3;
  margin: 0;
}

/* ─── Options Grid ─── */
.options-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 960px;
  position: relative;
  z-index: 2;
}

.option-item {
  padding: 22px 20px 22px 24px;
  border-radius: 16px;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: left;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid transparent;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  animation: optionReveal 0.4s ease forwards;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.option-item:nth-child(1) {
  background: linear-gradient(135deg, var(--opt-a) 0%, #c73852 100%);
  animation-delay: 0.05s;
}
.option-item:nth-child(2) {
  background: linear-gradient(135deg, var(--opt-b) 0%, #2980b9 100%);
  animation-delay: 0.15s;
}
.option-item:nth-child(3) {
  background: linear-gradient(135deg, var(--opt-c) 0%, #e67e22 100%);
  animation-delay: 0.25s;
}
.option-item:nth-child(4) {
  background: linear-gradient(135deg, var(--opt-d) 0%, #27ae60 100%);
  animation-delay: 0.35s;
}

@keyframes optionReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Option letter labels */
.option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.option-text {
  flex: 1;
}

/* ─── Progress Bar ─── */
.progress-bar {
  margin-top: 20px;
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-fuchsia), var(--neon-pink));
  border-radius: 50px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(255, 45, 120, 0.4);
}

.progress-label {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  min-width: fit-content;
}

/* ═══════════════════════════════════════════════════════════
   REVEAL
   ═══════════════════════════════════════════════════════════ */
#screen-reveal {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.reveal-layout {
  text-align: center;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reveal-subtitle {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.reveal-card {
  background: rgba(78, 205, 196, 0.08);
  border: 2px solid rgba(78, 205, 196, 0.35);
  border-radius: 24px;
  padding: 40px 64px;
  box-shadow:
    0 0 40px rgba(78, 205, 196, 0.15),
    inset 0 0 30px rgba(78, 205, 196, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: revealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: scale(0.85);
}

@keyframes revealPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.reveal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: var(--bg);
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 24px rgba(78, 205, 196, 0.5);
}

.reveal-correct-text {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--success);
  margin: 0;
  text-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
  line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   RANKING TABLE (4th place and below)
   ═══════════════════════════════════════════════════════════ */
.ranking-table-wrapper {
  width: 100%;
  max-width: 700px;
  position: relative;
  z-index: 2;
  margin-bottom: 8px;
}

.ranking-table-header {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rt-col-rank  { width: 80px; text-align: center; }
.rt-col-name  { flex: 1; text-align: center; }
.rt-col-score { width: 160px; text-align: center; }

.ranking-table { width: 100%; }

.ranking-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  font-size: 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(12px);
  animation: rankRowIn 0.4s ease forwards;
  transition: background 0.2s;
}

.ranking-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ranking-row .rank {
  width: 80px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  font-size: 1.2rem;
}

.ranking-row .name {
  flex: 1;
  font-weight: 600;
  text-align: center;
  color: var(--neon-blue);
}

.ranking-row .score {
  width: 160px;
  font-weight: 700;
  color: var(--neon-pink);
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 45, 120, 0.3);
}

@keyframes rankRowIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   MINIGAME (Horse Race)
   ═══════════════════════════════════════════════════════════ */
.minigame-title { font-size: 2.5rem; font-weight: 700; color: var(--gold); margin-bottom: 32px; }

.horse-track {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.horse-lane {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
}

.horse-name {
  width: 100px;
  text-align: right;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.horse-rail {
  flex: 1;
  background: var(--surface);
  border-radius: 25px;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.horse-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  transition: left 0.4s ease-out;
}

.horse-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.horse-winner {
  background: rgba(78, 205, 196, 0.1);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

.horse-winner .horse-name {
  color: var(--success);
  text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

/* ─── Horse Bonus Overlay ─── */
.horse-bonus-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 21, 43, 0.85);
  z-index: 10;
  animation: bonusFadeIn 0.4s ease;
}

.horse-bonus-overlay.hidden {
  display: none;
}

.horse-bonus-card {
  text-align: center;
  animation: bonusPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: scale(0.5);
}

.horse-bonus-trophy {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: trophyBounce 0.8s ease 0.3s infinite alternate;
}

.horse-bonus-name {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.horse-bonus-points {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--success);
  text-shadow: 0 0 30px rgba(78, 205, 196, 0.6);
  animation: pointsPulse 0.6s ease 0.4s infinite alternate;
}

@keyframes bonusFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bonusPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes trophyBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

@keyframes pointsPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ═══════════════════════════════════════════════════════════
   PODIUM — 3D Party Style
   ═══════════════════════════════════════════════════════════ */
.podium-section {
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

.podium-trophy {
  text-align: center;
  font-size: 4.5rem;
  margin-bottom: -8px;
  animation: trophyFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 20px rgba(255, 215, 0, 0.5));
  position: relative;
  z-index: 3;
}

@keyframes trophyFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); }
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  min-height: 240px;
  perspective: 600px;
}

.podium-place {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(40px);
  animation: podiumRise 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.podium-place:nth-child(1) { animation-delay: 0.3s; }
.podium-place:nth-child(2) { animation-delay: 0.1s; }
.podium-place:nth-child(3) { animation-delay: 0.5s; }

@keyframes podiumRise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.podium-rank-badge {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.podium-name {
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.podium-score {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
}

/* 3D podium blocks */
.podium-bar {
  width: 160px;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  font-size: 2.8rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.15);
  position: relative;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.4);
}


/* ─── 2nd place (left — silver) ─── */
.podium-place:nth-child(1) .podium-rank-badge { color: var(--silver); }
.podium-place:nth-child(1) .podium-name { color: #e0e0e0; }
.podium-place:nth-child(1) .podium-score { color: var(--silver); }
.podium-place:nth-child(1) .podium-bar {
  background: linear-gradient(180deg, #d4d4d8 0%, #a1a1aa 40%, #78788c 100%);
  height: 130px;
}

/* ─── 1st place (center — gold) ─── */
.podium-place:nth-child(2) .podium-rank-badge {
  color: var(--gold);
  font-size: 1.3rem;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
}
.podium-place:nth-child(2) .podium-name {
  color: var(--gold);
  font-size: 1.6rem;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}
.podium-place:nth-child(2) .podium-score {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}
.podium-place:nth-child(2) .podium-bar {
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 30%, #d97706 70%, #b45309 100%);
  height: 170px;
  width: 180px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 0 40px rgba(255, 215, 0, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ─── 3rd place (right — bronze, darker for contrast vs gold) ─── */
.podium-place:nth-child(3) .podium-rank-badge { color: #b06a28; }
.podium-place:nth-child(3) .podium-name { color: #d4a87a; }
.podium-place:nth-child(3) .podium-score { color: #b06a28; }
.podium-place:nth-child(3) .podium-bar {
  background: linear-gradient(180deg, #b06a28 0%, #8b4513 40%, #5c2d0e 100%);
  height: 95px;
}

/* Crown sparkle for 1st place */
.podium-crown {
  font-size: 2.2rem;
  animation: crownBounce 1s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.6));
  margin-bottom: -4px;
}

@keyframes crownBounce {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-6px) rotate(3deg); }
}

/* ─── Game Over screen ─── */
#screen-gameover {
  position: relative;
  overflow: hidden;
  overflow-y: auto;
  padding: 28px 40px 40px;
  gap: 0;
}

.gameover-title {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, #ff2d78 0%, #ff6b6b 30%, #fbbf24 60%, #ff2d78 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
  letter-spacing: 2px;
  text-transform: uppercase;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gameover-buttons {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  z-index: 2;
  position: relative;
}

.btn-rematch {
  padding: 16px 48px;
  font-size: 1.3rem;
}

.btn-back-to-lobby {
  padding: 16px 36px;
  font-size: 1.3rem;
  background: linear-gradient(180deg, #2a2650 0%, #1e1b38 100%) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.05),
    0 4px 0 #111,
    0 6px 12px rgba(0, 0, 0, 0.4) !important;
}

.btn-back-to-lobby:hover {
  box-shadow:
    0 0 20px rgba(255, 255, 255, 0.1),
    0 4px 0 #111,
    0 8px 16px rgba(0, 0, 0, 0.5) !important;
}

/* ═══════════════════════════════════════════════════════════
   REMATCH
   ═══════════════════════════════════════════════════════════ */
#screen-rematch {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.rematch-layout {
  text-align: center;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.rematch-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--neon-pink);
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255, 45, 120, 0.4);
}

.rematch-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.rematch-players {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.rematch-player {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  animation: slideIn 0.3s ease;
}

.rematch-player.confirmed {
  border-color: rgba(78, 205, 196, 0.35);
  background: rgba(78, 205, 196, 0.08);
}

.rematch-player.declined {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  opacity: 0.6;
}

.rematch-status {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.rematch-player.confirmed .rematch-status { color: var(--success); }
.rematch-player.declined .rematch-status { color: var(--danger); }
.rematch-player.pending .rematch-status { color: var(--text-muted); }

.rematch-count {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 20px;
}

.btn-start-rematch {
  padding: 18px 56px;
  font-size: 1.4rem;
}
