@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: #0d1117;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
}

/* Container que simula tela 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 50px rgba(0, 0, 0, 0.8);
}

/* Canvas da Pista de Corrida */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* =========================================
   OVERLAY DA TELA (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: 24px 20px;
}

/* TÍTULO PRINCIPAL ARCADE */
.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.title-badge {
  background: linear-gradient(180deg, #1b263b 0%, #0d1b2a 100%);
  border: 3px solid #ffcc00;
  border-radius: 14px;
  padding: 8px 26px;
  box-shadow: 0 6px 0 #b38600, 0 10px 20px rgba(0,0,0,0.6);
  text-align: center;
}

.game-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 20px;
  color: #ffffff;
  text-shadow: 3px 3px 0 #e63946, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

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

.live-dot {
  width: 8px;
  height: 8px;
  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); }
}

/* =========================================
   PLACAR DOS CORREDORES (LARGURA TOTAL)
   ========================================= */

/* PLACAR DOS CORREDORES */
.scoreboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-card {
  display: flex;
  align-items: center;
  background: rgba(18, 24, 38, 0.94);
  border-radius: 12px;
  padding: 6px 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.score-card.leader {
  border-color: #ffd700;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

.rank-badge {
  font-family: 'Press Start 2P', cursive;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #333;
  color: #fff;
  margin-right: 8px;
  min-width: 30px;
  text-align: center;
  border: 1.5px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.score-card.c1 .rank-badge {
  background: #b30000;
}

.score-card.c2 .rank-badge {
  background: #ffd700;
  color: #000;
}

.candidate-avatar-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-right: 10px;
  background: #222;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  object-fit: cover;
  flex-shrink: 0;
}

.score-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.score-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.candidate-name {
  font-family: 'Teko', sans-serif;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dist-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #ffd700;
  white-space: nowrap;
  text-align: right;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  transition: width 0.15s linear;
  position: relative;
}

.score-card.c1 .progress-fill {
  background: linear-gradient(90deg, #ff4d4d, #e60000);
}

.score-card.c2 .progress-fill {
  background: linear-gradient(90deg, #ffcc00, #1db954);
}

/* =========================================
   ÍCONES DISCRETOS DE PRESENTES (ANTI-BAN)
   ========================================= */
.name-icons-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.discrete-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gift-symbol {
  font-size: 15px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* =========================================
   FEED DE ATIVIDADES AO VIVO (ESQUERDA)
   ========================================= */
.activity-feed-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
  pointer-events: none;
}

.feed-item {
  background: rgba(18, 24, 38, 0.88);
  border-radius: 10px;
  padding: 7px 10px;
  border-left: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInLeft 0.35s ease forwards;
  font-size: 11px;
  line-height: 1.2;
}

.feed-item.c1 {
  border-left-color: #ff4d4d;
}

.feed-item.c2 {
  border-left-color: #ffd700;
}

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

.feed-content {
  flex: 1;
  overflow: hidden;
}

.feed-user {
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-action {
  font-size: 10px;
  color: #cbd5e1;
  margin-top: 2px;
}

@keyframes slideInLeft {
  0% { opacity: 0; transform: translateX(-30px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* =========================================
   RODAPÉ / STATUS INFERIOR
   ========================================= */
.footer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  z-index: 10;
}

.lead-margin-bar {
  background: rgba(13, 27, 42, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Teko', sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
}

.lead-text {
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tiktok-status-pill {
  font-size: 11px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.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;
}



/* =========================================
   TELA DE VITÓRIA / OVERLAY FINAL
   ========================================= */
.victory-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  text-align: center;
  padding: 24px;
}

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

.victory-box {
  background: linear-gradient(180deg, #1f2937, #111827);
  border: 4px solid #ffd700;
  border-radius: 24px;
  padding: 32px 24px;
  width: 85%;
  max-width: 420px;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.6);
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.trophy-icon {
  font-size: 70px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px #ffd700);
}

.victory-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 16px;
  color: #ffd700;
  margin-bottom: 8px;
}

.winner-name {
  font-family: 'Teko', sans-serif;
  font-size: 54px;
  line-height: 1;
  font-weight: 700;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
  margin-bottom: 12px;
}

.countdown-restart {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #cbd5e1;
  margin-top: 16px;
  font-weight: 700;
}
