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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Screen management */
.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  text-align: center;
}

.col-layout {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Typography */
.game-title {
  font-size: 4rem;
  font-weight: bold;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%,
  100% {
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.5);
  }
  50% {
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 215, 0, 0.8);
  }
}

.tagline {
  font-size: 1.2rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

/* Session Info */
.session-info {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.session-status h2 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.countdown {
  font-size: 3rem;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 25px;
}

.join-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.name-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.player-name-display {
  padding: 12px 20px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  border: 2px solid rgba(255, 215, 0, 0.5);
}

.btn-change-name {
  padding: 8px 20px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-change-name:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

#playerName {
  width: 100%;
  max-width: 300px;
  padding: 12px 20px;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-align: center;
  outline: none;
  transition: all 0.3s;
}

#playerName::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#playerName:focus {
  border-color: #ffd700;
  background: rgba(255, 255, 255, 0.3);
}

.btn-primary {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #333;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.player-count {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Leaderboard */
.leaderboard-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.leaderboard-section h2 {
  font-size: 2rem;
  margin-bottom: 20px;
}

.leaderboard {
  overflow-y: auto;
}

.leaderboard-entry,
.result-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  transition: all 0.3s;
}

.result-entry.highlight {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.3),
    rgba(255, 165, 0, 0.3)
  );
  border: 2px solid #ffd700;
}

.rank {
  font-size: 1.5rem;
  font-weight: bold;
  min-width: 50px;
}

.name {
  flex: 1;
  text-align: left;
  padding: 0 20px;
  font-size: 1.1rem;
}

.score {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
}

.empty-message {
  padding: 40px;
  opacity: 0.6;
  font-style: italic;
}

/* Tips Section */
.tips-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 500px;
}

.tips-section h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  text-align: center;
}

.tips-list {
  list-style: none;
  text-align: left;
  overflow-y: auto;
  padding: 0;
}

.tips-list li {
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.tips-list li strong {
  color: #ffd700;
}

/* Game Rules */
.game-rules {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 25px;
  text-align: left;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  margin-top: 1rem;
}

.game-rules h3 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.game-rules ul {
  list-style: none;
  margin-bottom: 15px;
}

.game-rules li {
  padding: 8px 0;
  font-size: 1rem;
}

.game-rules p {
  text-align: center;
  font-style: italic;
  opacity: 0.9;
}

/* Game Screen */
#gameScreen {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.game-layout {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  align-items: flex-start;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 250px;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scoreboard-panel {
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}

.scoreboard-panel h3 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: #ffd700;
  text-align: center;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 900px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  margin-bottom: 20px;
}

.btn-exit {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: bold;
  background: rgba(255, 69, 0, 0.8);
  color: #fff;
  border: 2px solid rgba(255, 69, 0, 1);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

.btn-exit:hover {
  background: rgba(255, 69, 0, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.5);
}

.timer-section {
  font-size: 1.5rem;
  font-weight: bold;
}

.timer {
  color: #ffd700;
  font-size: 2rem;
  margin-left: 10px;
}

.players-score {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-score {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.3s;
}

.player-score:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: translateX(3px);
}

.player-name {
  margin-right: 8px;
}

/* Game Container */
.game-container {
  position: relative;
  display: inline-block;
  padding: 40px; /* Add padding for names outside canvas */
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
}

.player-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.player-label {
  position: absolute;
  font-weight: bold;
  font-size: 16px;
  white-space: nowrap;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

#gameCanvas {
  border: 5px solid #ffd700;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: block;
}

.hook-tip-text {
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.5);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translateX(-50%) scale(1.05);
    opacity: 1;
  }
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin-top: 15px;
  font-size: 1.1rem;
  gap: 15px;
}

.treasure-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 8px;
}

.game-status {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 8px;
}

/* End Screen */
.results-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.results-section h2 {
  font-size: 2rem;
  margin-bottom: 20px;
}

.session-results {
  max-height: 300px;
  overflow-y: auto;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-title {
    font-size: 2.5rem;
  }

  .countdown {
    font-size: 2rem;
  }

  #gameCanvas {
    width: 100%;
    height: auto;
  }

  .game-header {
    flex-direction: column;
    gap: 15px;
  }

  .players-score {
    justify-content: center;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen.active > * {
  animation: fadeIn 0.5s ease-out;
}
