/* Live Display Leaderboard Stylesheet */

/* Compact header override for spectator display */
header {
  padding: 12px 25px !important;
}

.display-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 25px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 75px);
  gap: 15px;
}

/* Leaderboard Layout */
.leaderboard-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Crucial: stops the wrapper from expanding beyond viewport */
  margin-bottom: 10px;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 70px 1fr 120px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
}

.leaderboard-scroll-area {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* Crucial: allows flex container to shrink scroll area on small viewports */
  max-height: 472px; /* Exact height for 8 rows (8 * 52px + 7 * 8px) */
}

.leaderboard-list {
  position: relative;
  width: 100%;
}

/* Hide scrollbars for clean auto-scrolling digital signage */
.leaderboard-scroll-area::-webkit-scrollbar {
  display: none;
}

/* Absolutely positioned rows for smooth reordering transitions */
.leaderboard-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 52px; /* Reduced from 75px */
  display: grid;
  grid-template-columns: 70px 1fr 120px;
  align-items: center;
  padding: 0 20px; /* Reduced from 30px */
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease, border-color 0.3s ease;
  will-change: transform;
}

/* Podiums styling */
.leaderboard-row.rank-1 {
  background: rgba(245, 158, 11, 0.14) !important;
  border: 1px solid rgba(245, 158, 11, 0.6) !important;
  box-shadow: var(--shadow-lg), 0 0 15px rgba(245, 158, 11, 0.2);
}
.leaderboard-row.rank-1 .rank-badge {
  background: linear-gradient(135deg, #fef08a 0%, #fbbf24 100%);
  color: #78350f;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.leaderboard-row.rank-2 {
  background: rgba(148, 163, 184, 0.12) !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
}
.leaderboard-row.rank-2 .rank-badge {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  color: #334155;
}

.leaderboard-row.rank-3 {
  background: rgba(180, 83, 9, 0.1) !important;
  border: 1px solid rgba(180, 83, 9, 0.35) !important;
}
.leaderboard-row.rank-3 .rank-badge {
  background: linear-gradient(135deg, #ffedd5 0%, #ca8a04 100%);
  color: #7c2d12;
}

.rank-badge {
  width: 32px; /* Reduced from 40px */
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-display-name {
  font-size: 1.25rem; /* Reduced from 1.5rem */
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.crown-icon {
  font-size: 1.2rem;
  animation: float 2s ease-in-out infinite;
}

.score-display-value {
  font-size: 1.6rem; /* Reduced from 2rem */
  font-weight: 800;
  color: var(--accent-cyan);
  text-align: right;
  padding-right: 10px;
}

.score-display-value.pulse {
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2;
  color: var(--accent-pink);
}

/* Event Ticker / Live Logs */
.ticker-container {
  height: 65px; /* Reduced from 100px */
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.ticker-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.ticker-content {
  font-size: 1rem; /* Reduced from 1.2rem */
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-item {
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ticker-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
}

.ticker-badge.lead-change {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  animation: pulseGlow 1.5s infinite;
}

/* Fullscreen Meme Popup Overlay */
.meme-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.meme-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.meme-card {
  max-width: 600px;
  width: 90%;
  background: var(--bg-card);
  border: 2px solid var(--border-glow);
  padding: 20px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 102, 0, 0.4);
  transform: scale(0.7) rotate(-3deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.meme-overlay.active .meme-card {
  transform: scale(1) rotate(0deg);
}

/* Meme Image */
.meme-image-container {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.meme-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Classic Meme Font Text overlay */
.meme-text {
  font-family: Impact, "Arial Black", sans-serif;
  text-transform: uppercase;
  color: white;
  text-align: center;
  font-size: 2.2rem;
  letter-spacing: 1px;
  line-height: 1.2;
  margin-top: 20px;
  text-shadow: 
    -2px -2px 0 #000,  
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0px  4px 8px rgba(0,0,0,0.6);
  word-wrap: break-word;
  max-width: 95%;
}

.meme-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 10px;
  text-align: center;
}

/* Particle Canvas Overlay */
.particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10000;
}

@media (max-width: 1024px) {
  .display-container {
    padding: 10px 20px;
  }
  .team-display-name {
    font-size: 1.25rem;
  }
  .score-display-value {
    font-size: 1.7rem;
  }
}

[data-theme="dark"] .leaderboard-row.rank-1 {
  background: rgba(245, 158, 11, 0.08) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  box-shadow: var(--shadow-lg), 0 0 15px rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .leaderboard-row.rank-2 {
  background: rgba(148, 163, 184, 0.06) !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

[data-theme="dark"] .leaderboard-row.rank-3 {
  background: rgba(180, 83, 9, 0.05) !important;
  border: 1px solid rgba(180, 83, 9, 0.2) !important;
}

[data-theme="dark"] .meme-overlay {
  background: rgba(5, 3, 12, 0.9);
}
