/* Display Page Styles - Optimized for TV (1920x1080) and Mobile */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&display=swap");

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

/* Updated body.display-page to allow scrolling on mobile */
body.display-page {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
  color: #e0e0e0;
  min-height: 100vh;
  padding: 20px;
  overflow: hidden;
}

/* Added max-width and max-height constraints for 1920x1080 displays */
/* Removed max-height constraint to allow full content display on display.php */
.display-container {
  max-width: 1920px;
  margin: 0 auto;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

/* Compact header optimized for TV */
.display-header {
  text-align: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.display-header h1 {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.display-header h1 .emoji {
  font-size: 42px;
  filter: drop-shadow(0 0 15px rgba(6, 182, 212, 0.5));
}

.display-header h1 .title-text {
  background: linear-gradient(135deg, #06b6d4 0%, #a855f7 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.display-header p {
  font-size: 18px;
  color: #94a3b8;
}

/* Grid layout - QR code on the side */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.highscore-section {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(6, 182, 212, 0.2);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.highscore-section h2 {
  font-size: 28px;
  margin-bottom: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
}

.highscore-section h2 .emoji {
  font-size: 28px;
  filter: drop-shadow(0 0 12px rgba(6, 182, 212, 0.5));
}

.highscore-section h2 .title-text {
  color: #06b6d4;
}

/* Optimized score list to fit exactly 15 entries */
.score-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow: hidden;
  padding-right: 4px;
}

/* Compact score items - optimized for 15 entries on 1080p */
.score-item {
  display: grid;
  grid-template-columns: 45px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  min-height: 50px;
}

.score-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateX(4px);
}

.score-item.top-1 {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(234, 179, 8, 0.05));
  border-color: #eab308;
}

.score-item.top-2 {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0.05));
  border-color: #94a3b8;
}

.score-item.top-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.05));
  border-color: #cd7f32;
}

.rank {
  font-size: 22px;
  font-weight: 800;
  color: #06b6d4;
  text-align: center;
}

.top-1 .rank {
  color: #eab308;
}
.top-2 .rank {
  color: #94a3b8;
}
.top-3 .rank {
  color: #cd7f32;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-name {
  font-size: 17px;
  font-weight: 700;
  color: #e0e0e0;
  line-height: 1.2;
}

.player-team {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.2;
}

.score-value {
  font-size: 22px;
  font-weight: 800;
  color: #06b6d4;
}

.level-badge {
  padding: 5px 10px;
  background: rgba(168, 85, 247, 0.2);
  border: 2px solid #a855f7;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #a855f7;
  white-space: nowrap;
}

/* Compact QR section */
.qr-section {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100%;
}

.qr-section h3 {
  font-size: 18px;
  color: #a855f7;
  text-align: center;
}

.qr-code {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  background: white;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: #94a3b8;
  text-align: center;
  font-size: 13px;
}

.play-now {
  font-size: 15px;
  color: #e0e0e0;
  text-align: center;
  line-height: 1.4;
}

.no-scores {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 18px;
}

/* Added weekly highscore styles for Top 3 all-time and Top 10 weekly */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.highscore-section.weekly {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(168, 85, 247, 0.03));
  border-color: rgba(168, 85, 247, 0.3);
  flex: 1;
  min-height: 0;
}

.highscore-section.weekly h2 .title-text {
  color: #a855f7;
}

.week-info {
  text-align: center;
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(168, 85, 247, 0.2);
  flex-shrink: 0;
}

.week-info strong {
  color: #a855f7;
  font-weight: 700;
}

.top3-section {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(234, 179, 8, 0.03));
  border: 2px solid rgba(234, 179, 8, 0.3);
  border-radius: 12px;
  padding: 12px;
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.top3-section h2 {
  font-size: 18px;
  margin-bottom: 10px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #eab308;
}

.top3-section h2 .emoji {
  font-size: 18px;
  filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.5));
}

.top3-cards {
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: space-between;
}

.top3-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 0;
}

.top3-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.top3-card.place-1 {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.05));
  border-color: #eab308;
}

.top3-card.place-2 {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.05));
  border-color: #94a3b8;
}

.top3-card.place-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.05));
  border-color: #cd7f32;
}

.top3-medal {
  font-size: 20px;
  flex-shrink: 0;
}

.top3-rank {
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  min-width: 24px;
}

.place-1 .top3-rank {
  color: #eab308;
}

.place-2 .top3-rank {
  color: #94a3b8;
}

.place-3 .top3-rank {
  color: #cd7f32;
}

.top3-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top3-name {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top3-team-separator {
  color: #64748b;
  font-size: 14px;
  flex-shrink: 0;
}

.top3-team {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.top3-score {
  font-size: 16px;
  font-weight: 800;
  color: #06b6d4;
  flex-shrink: 0;
}

.top3-level {
  padding: 3px 6px;
  background: rgba(168, 85, 247, 0.2);
  border: 2px solid #a855f7;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #a855f7;
  flex-shrink: 0;
}

.top3-empty {
  text-align: center;
  padding: 20px 10px;
  color: #94a3b8;
  font-size: 14px;
}

/* Mobile optimization - Stack layout */
@media (max-width: 1200px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .qr-section {
    height: auto;
    flex-direction: row;
    justify-content: center;
    padding: 16px;
  }

  .qr-code {
    max-width: 150px;
  }

  .top3-cards {
    flex-direction: row;
    gap: 8px;
  }
}

/* Added 900px breakpoint for medium tablets */
@media (max-width: 900px) {
  .top3-cards {
    flex-direction: column !important;
    gap: 10px;
  }

  .top3-card {
    width: 100%;
    padding: 12px 14px;
  }

  .top3-name {
    font-size: 16px;
  }

  .top3-team {
    font-size: 14px;
  }

  .top3-score {
    font-size: 18px;
  }
}

/* Updated tablet styles with overflow-y: auto for scrolling */
@media (max-width: 768px) {
  body.display-page {
    padding: 12px;
    overflow-y: auto;
  }

  .display-container {
    height: auto;
    min-height: calc(100vh - 24px);
    max-height: none;
  }

  .display-header {
    margin-bottom: 12px;
  }

  .display-header h1 {
    font-size: 32px;
  }

  .display-header h1 .emoji {
    font-size: 32px;
  }

  .display-header p {
    font-size: 15px;
  }

  .highscore-section {
    padding: 16px;
    height: auto;
  }

  .highscore-section h2 {
    font-size: 22px;
  }

  .highscore-section h2 .emoji {
    font-size: 22px;
  }

  .score-list {
    gap: 8px;
    overflow-y: auto;
    max-height: 60vh;
  }

  .score-item {
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    padding: 10px 12px;
    min-height: 60px;
  }

  .rank {
    font-size: 18px;
  }

  .player-name {
    font-size: 15px;
  }

  .player-team {
    font-size: 12px;
  }

  .score-value {
    font-size: 18px;
  }

  .level-badge {
    grid-column: 3;
    grid-row: 1;
    font-size: 11px;
    padding: 4px 8px;
  }

  .qr-section {
    flex-direction: column;
    padding: 16px;
  }

  .qr-section h3 {
    font-size: 16px;
  }

  .qr-code {
    max-width: 180px;
  }

  .play-now {
    font-size: 14px;
  }

  .top3-section {
    padding: 12px;
  }

  .top3-section h2 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .top3-cards {
    flex-direction: column;
    gap: 8px;
  }

  .top3-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .top3-medal {
    font-size: 24px;
  }

  .top3-rank {
    font-size: 16px;
  }

  .top3-name {
    font-size: 15px;
  }

  .top3-team {
    font-size: 13px;
  }

  .top3-score {
    font-size: 16px;
  }

  .top3-level {
    font-size: 11px;
    padding: 4px 7px;
  }
}

/* Completely redesigned small mobile styles with better readability */
@media (max-width: 480px) {
  body.display-page {
    padding: 8px;
    overflow-y: auto;
  }

  .display-container {
    max-height: none;
  }

  .display-header h1 {
    font-size: 24px;
    gap: 8px;
  }

  .display-header h1 .emoji {
    font-size: 24px;
  }

  .display-header p {
    font-size: 13px;
  }

  .highscore-section {
    padding: 12px;
  }

  .highscore-section h2 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .highscore-section h2 .emoji {
    font-size: 18px;
  }

  .score-item {
    grid-template-columns: 32px 1fr auto;
    gap: 8px;
    padding: 8px 10px;
    min-height: auto;
  }

  .rank {
    font-size: 15px;
  }

  .player-info {
    gap: 1px;
  }

  .player-name {
    font-size: 13px;
  }

  .player-team {
    font-size: 11px;
  }

  .score-value {
    font-size: 15px;
    grid-column: 3;
    grid-row: 1;
  }

  .level-badge {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    font-size: 9px;
    padding: 2px 5px;
  }

  .qr-section {
    padding: 12px;
  }

  .qr-section h3 {
    font-size: 14px;
  }

  .qr-code {
    max-width: 140px;
  }

  .play-now {
    font-size: 12px;
  }

  .top3-section {
    padding: 10px;
  }

  .top3-section h2 {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .top3-section h2 .emoji {
    font-size: 15px;
  }

  .top3-cards {
    gap: 6px;
  }

  .top3-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .top3-medal {
    font-size: 20px;
  }

  .top3-rank {
    font-size: 14px;
    min-width: 20px;
  }

  .top3-player-info {
    gap: 5px;
    flex-wrap: wrap;
  }

  .top3-name {
    font-size: 13px;
  }

  .top3-team-separator {
    font-size: 12px;
  }

  .top3-team {
    font-size: 11px;
  }

  .top3-score {
    font-size: 14px;
  }

  .top3-level {
    font-size: 9px;
    padding: 3px 5px;
  }

  .week-info {
    font-size: 12px;
    padding: 6px 10px;
    margin-bottom: 8px;
  }

  .main-content {
    gap: 12px;
  }
}

/* Added extra small mobile optimization for very narrow screens */
@media (max-width: 360px) {
  body.display-page {
    padding: 6px;
  }

  .display-header h1 {
    font-size: 20px;
    gap: 6px;
  }

  .display-header h1 .emoji {
    font-size: 20px;
  }

  .display-header p {
    font-size: 12px;
  }

  .score-item {
    grid-template-columns: 28px 1fr auto;
    gap: 6px;
    padding: 6px 8px;
  }

  .rank {
    font-size: 14px;
  }

  .player-name {
    font-size: 12px;
  }

  .player-team {
    font-size: 10px;
  }

  .score-value {
    font-size: 14px;
  }

  .level-badge {
    font-size: 8px;
    padding: 2px 4px;
  }

  .top3-card {
    padding: 6px 8px;
    gap: 6px;
  }

  .top3-medal {
    font-size: 18px;
  }

  .top3-rank {
    font-size: 12px;
  }

  .top3-name {
    font-size: 12px;
  }

  .top3-team {
    font-size: 10px;
  }

  .top3-score {
    font-size: 13px;
  }

  .top3-level {
    font-size: 8px;
    padding: 2px 4px;
  }
}
