@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Teko:wght@600;700&family=Montserrat:wght@700;800;900&display=swap');

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

body {
  background-color: #050811;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
}

/* Container de proporção 9:16 vertical (1080x1920) */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: calc(100vh * (9 / 16));
  aspect-ratio: 9 / 16;
  background: #000;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* Canvas de renderização 60 FPS */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlay da Interface (HUD) */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px;
}

/* =========================================
   TOPO: TÍTULO, STATUS E GUIA DE PODERES
   ========================================= */
.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  z-index: 10;
}

.title-badge {
  background: linear-gradient(180deg, #111827 0%, #030712 100%);
  border: 2.5px solid #00f5d4;
  border-radius: 14px;
  padding: 8px 20px;
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.35), 0 8px 16px rgba(0,0,0,0.7);
  text-align: center;
  width: 100%;
}

.game-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 17px;
  color: #ffd700;
  text-shadow: 2px 2px 0 #ff0055, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.game-subtitle {
  font-family: 'Teko', sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: #00f5d4;
  letter-spacing: 2px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  margin-bottom: 4px;
}

.status-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e63946;
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

.phase-badge {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  background: rgba(34, 197, 94, 0.25);
  border: 1px solid #22c55e;
  color: #4ade80;
}

.phase-badge.racing {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #f87171;
}

.phase-badge.podium {
  background: rgba(255, 215, 0, 0.25);
  border-color: #ffd700;
  color: #ffd700;
}

.count-badge {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid #3b82f6;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

/* =========================================
   BANNER DE INTERATIVIDADE E PODERES
   ========================================= */
.guide-banner {
  width: 100%;
  background: rgba(13, 20, 36, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}

.guide-banner.compact {
  padding: 5px 10px;
  gap: 0;
}

.guide-banner.compact .join-callout {
  display: none;
}

.join-callout {
  font-size: 12px;
  color: #f1f5f9;
  text-align: center;
  font-weight: 700;
}

.join-callout b {
  color: #00f5d4;
  text-decoration: underline;
}

.powers-row {
  display: flex;
  justify-content: space-around;
  gap: 6px;
}

.power-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 10px;
}

.power-pill b {
  color: #ffd700;
}

.power-emoji {
  font-size: 13px;
}

/* =========================================
   PLACAR DE LÍDERES EM TEMPO REAL (TOP 5)
   ========================================= */
.live-leaderboard {
  width: 100%;
  background: rgba(10, 16, 32, 0.94);
  border: 2px solid #ffd700;
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7), 0 0 15px rgba(255, 215, 0, 0.25);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.live-leaderboard.active {
  display: flex;
}

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

.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 4px;
}

.lb-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-trophy {
  font-size: 14px;
}

.lb-status-pill {
  font-size: 9px;
  font-weight: 900;
  background: #e63946;
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: pulse 1.2s infinite;
}

.lb-chips {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: space-between;
}

.lb-chip {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}

.lb-chip.p1 {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.28) 0%, rgba(180, 83, 9, 0.38) 100%);
  border: 1.5px solid #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.lb-chip.p2 {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.22) 0%, rgba(71, 85, 105, 0.32) 100%);
  border: 1.5px solid #cbd5e1;
}

.lb-chip.p3 {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.22) 0%, rgba(154, 52, 18, 0.32) 100%);
  border: 1.5px solid #f97316;
}

.lb-chip.p4, .lb-chip.p5 {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lb-rank-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 2px;
  white-space: nowrap;
}

.lb-chip.p1 .lb-rank-badge { color: #ffd700; }
.lb-chip.p2 .lb-rank-badge { color: #e2e8f0; }
.lb-chip.p3 .lb-rank-badge { color: #fdba74; }
.lb-chip.p4 .lb-rank-badge, .lb-chip.p5 .lb-rank-badge { color: #94a3b8; }

.lb-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.lb-waiting {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  width: 100%;
  padding: 4px;
}

/* =========================================
   FEED DE ATIVIDADES AO VIVO
   ========================================= */
.activity-feed-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.feed-item {
  background: rgba(15, 23, 42, 0.88);
  border-left: 3.5px solid #00f5d4;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.feed-icon {
  font-size: 14px;
}

.feed-text {
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-text b {
  color: #ffffff;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =========================================
   RODAPÉ
   ========================================= */
.footer-section {
  width: 100%;
  z-index: 10;
}

.bottom-bar {
  background: rgba(13, 20, 36, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-hint {
  font-size: 11px;
  font-weight: 800;
  color: #ffd700;
}

.tiktok-status-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 5px;
}

.tiktok-status-pill.connected {
  background: rgba(46, 204, 113, 0.25);
  color: #2ecc71;
  border: 1px solid #2ecc71;
}

.tiktok-status-pill.offline {
  background: rgba(231, 76, 60, 0.25);
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

/* =========================================
   MODAL DE PÓDIO (FINAL DA RODADA)
   ========================================= */
.podium-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 16px;
}

.podium-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.podium-box {
  background: linear-gradient(180deg, #111827 0%, #030712 100%);
  border: 3px solid #ffd700;
  border-radius: 22px;
  padding: 24px 16px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.4), 0 20px 40px rgba(0,0,0,0.9);
  animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes bounceIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.trophy-icon {
  font-size: 54px;
  filter: drop-shadow(0 0 16px #ffd700);
  line-height: 1;
}

.podium-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  color: #ffd700;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 1px;
}

.podium-cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.podium-card {
  border-radius: 14px;
  padding: 12px 6px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.6);
  position: relative;
}

.podium-card.gold {
  background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
  border: 2.5px solid #ffd700;
  order: 2;
  flex: 1.25;
  padding-top: 16px;
  padding-bottom: 18px;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
}

.podium-card.silver {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border: 2px solid #cbd5e1;
  order: 1;
}

.podium-card.bronze {
  background: linear-gradient(180deg, #7c2d12 0%, #431407 100%);
  border: 2px solid #ea580c;
  order: 3;
}

.crown {
  font-size: 26px;
  margin-bottom: 2px;
  animation: floatCrown 1.5s infinite alternate ease-in-out;
}

@keyframes floatCrown {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

.medal {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 10px;
  margin-bottom: 6px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.podium-card.gold .medal {
  color: #ffd700;
  font-size: 11px;
}

.podium-avatar-wrap {
  margin-bottom: 6px;
}

.avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-badge.gold-bg {
  background: rgba(234, 179, 8, 0.3);
  border-color: #ffd700;
}

.avatar-badge.silver-bg {
  background: rgba(148, 163, 184, 0.3);
  border-color: #cbd5e1;
}

.avatar-badge.bronze-bg {
  background: rgba(234, 88, 12, 0.3);
  border-color: #ea580c;
}

/* NOME NOS PEDESTAIS: Sem corte duro de 100px! Quebra de linha limpa em 2 linhas */
.podium-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 4px;
}

.podium-card.gold .podium-name {
  font-size: 16px;
  color: #ffd700;
}

/* TABELA DE VENCEDORES: Nomes 100% visíveis em linha completa */
.podium-full-list {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.full-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.full-row.gold {
  background: rgba(234, 179, 8, 0.15);
  border-left: 3.5px solid #ffd700;
}

.full-row.silver {
  background: rgba(148, 163, 184, 0.12);
  border-left: 3.5px solid #cbd5e1;
}

.full-row.bronze {
  background: rgba(234, 88, 12, 0.12);
  border-left: 3.5px solid #ea580c;
}

.full-rank {
  font-weight: 900;
  font-size: 13px;
  min-width: 40px;
  text-align: left;
}

.full-row.gold .full-rank { color: #ffd700; }
.full-row.silver .full-rank { color: #e2e8f0; }
.full-row.bronze .full-rank { color: #fdba74; }

.full-name {
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  flex: 1;
  text-align: left;
  word-break: break-all;
}

.full-tag {
  font-size: 9px;
  font-weight: 900;
  background: #ffd700;
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
}

.countdown-restart {
  font-size: 13px;
  font-weight: 800;
  color: #94a3b8;
}
