* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a1420;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #eaf6ff;
}

.hidden {
  display: none !important;
}

#back-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 30;
  background: rgba(6, 14, 22, 0.65);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  color: #eaf6ff;
  text-decoration: none;
}

#back-link:hover {
  background: rgba(6, 14, 22, 0.85);
}

#lobby, #players-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(20, 40, 60, 0.6), rgba(4, 10, 16, 0.9));
}

.panel {
  background: rgba(8, 18, 28, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 420px;
  width: min(90vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
}

.panel h1 {
  margin: 0 0 0.5rem;
  background: linear-gradient(90deg, #34e89e, #3b9dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel h3 {
  margin: 1rem 0 0.25rem;
  font-size: 0.85rem;
  color: #a7bdd1;
  text-align: left;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.panel-header h2 {
  margin: 0;
}

.tagline {
  color: #a7bdd1;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.mode-hint {
  color: #6b8199;
  font-size: 0.85rem;
}

.player-list {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
}

.player-list .score {
  color: #a7bdd1;
  font-variant-numeric: tabular-nums;
}

button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #34e89e, #3b9dff);
  color: #04121c;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.small-btn {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#game {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#top-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  padding-left: 9rem;
  background: rgba(6, 14, 22, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 480px) {
  #top-bar {
    padding-left: 1rem;
    padding-top: 3rem;
    flex-wrap: wrap;
  }
}

#round-status {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#round-timer {
  font-variant-numeric: tabular-nums;
  color: #a7bdd1;
  font-size: 0.85rem;
}

#question-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

#question-category {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#question-text {
  margin: 0;
  font-size: 1.5rem;
  max-width: 640px;
}

#choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 0.75rem;
  width: 100%;
  max-width: 640px;
  margin-top: 0.5rem;
}

@media (max-width: 480px) {
  #choices-grid {
    grid-template-columns: 1fr;
  }
}

.choice-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #eaf6ff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
}

.choice-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.choice-btn.picked {
  border-color: #3b9dff;
  background: rgba(59, 157, 255, 0.2);
}

.choice-btn.correct {
  border-color: #34e89e;
  background: rgba(52, 232, 158, 0.25);
}

.choice-btn.wrong {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.25);
}

#answer-count {
  margin: 0;
}

#game-start-btn {
  margin: 1rem auto 2rem;
  display: block;
}

#players-overlay .player-list {
  max-height: 30vh;
  overflow-y: auto;
}
