* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: #10141c;
  color: #eee;
  overflow: hidden;
}

.screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.login-box {
  background: #1b2130;
  padding: 32px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.subtitle {
  color: #8a93a8;
  margin: 0 0 20px;
  font-size: 13px;
}

#name-input {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #333c4f;
  background: #10141c;
  color: #eee;
  margin-bottom: 16px;
  font-size: 14px;
}

#color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
}

.color-swatch.selected {
  border-color: #fff;
}

#play-button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 6px;
  background: #4c7ef3;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#play-button:hover {
  background: #3a6ce0;
}

.error {
  color: #f36b6b;
  font-size: 13px;
  min-height: 16px;
}

#game-screen {
  display: block;
  position: relative;
}

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  z-index: 5;
  font-size: 13px;
  color: #cdd4e0;
  pointer-events: none;
}

#game-canvas {
  display: block;
  background: #0b0e14;
  cursor: pointer;
}

#challenge-panel {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1b2130;
  padding: 20px;
  border-radius: 10px;
  width: 280px;
  text-align: center;
  z-index: 10;
}

#challenge-panel h3 {
  margin: 0 0 12px;
}

#challenge-selection-count {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0;
}

.hint {
  font-size: 12px;
  color: #8a93a8;
  margin: 0 0 14px;
}

.guess-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.guess-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #2b3348;
  color: #eee;
  cursor: pointer;
  font-size: 14px;
}

.guess-btn:hover {
  background: #3a4462;
}

#challenge-cancel {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

#toast {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #1b2130;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 20;
}

#toast.show {
  opacity: 1;
}

#leaderboard {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 200px;
  background: rgba(27, 33, 48, 0.9);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 5;
  max-height: 60vh;
  overflow-y: auto;
}

#leaderboard h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #8a93a8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

#leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

#leaderboard-list li.me {
  color: #ffdd33;
  font-weight: 600;
}

#leaderboard-list .rank {
  width: 18px;
  color: #8a93a8;
  flex-shrink: 0;
}

#leaderboard-list .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

#leaderboard-list .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaderboard-list .count {
  color: #cdd4e0;
  flex-shrink: 0;
}

#leaderboard-list li.offline {
  opacity: 0.4;
}

#reset-vote {
  position: absolute;
  bottom: 24px;
  right: 12px;
  background: rgba(27, 33, 48, 0.9);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

#reset-vote-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #2b3348;
  color: #eee;
  cursor: pointer;
  font-size: 13px;
}

#reset-vote-btn:hover {
  background: #3a4462;
}

#reset-vote-btn.voted {
  background: #d9534f;
}

#reset-vote-count {
  font-size: 12px;
  color: #8a93a8;
}
