/* ===== CSS Variables ===== */
:root {
  --pictionary-green: #2E7D32;
  --pictionary-green-light: #4CAF50;
  --pictionary-green-dark: #1B5E20;
  --white: #FFFFFF;
  --black: #000000;
  --gray: #666666;
  --gray-light: #CCCCCC;
  --gray-dark: #333333;
  --correct-green: #28a745;
  --wrong-red: #dc3545;
  --gold: #D4A843;

  --font-logo: 'Michroma', sans-serif;
  --font-sans: 'Open Sans', sans-serif;

  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-heavy: 0 8px 16px rgba(0, 0, 0, 0.4);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: var(--white);
}

/* ===== Testing Mode Badge ===== */
.testing-mode-badge {
  position: fixed;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.testing-mode-badge.hidden {
  display: none;
}

/* ===== Screen Management ===== */
.screen {
  display: none;
  min-height: 100vh;
  padding: 1rem;
}

.screen.active {
  display: block;
}

/* ===== Container ===== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

/* ===== Back Link ===== */
.back-link {
  color: var(--gray-light);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--white);
}

/* ===== Title ===== */
.title {
  font-family: var(--font-logo);
  font-size: 2.5rem;
  color: var(--pictionary-green-light);
  text-align: center;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  color: var(--gray-light);
  margin-bottom: 2rem;
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary {
  background: var(--pictionary-green);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--pictionary-green-light);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--gray);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--white);
}

.btn-large {
  font-size: 1.25rem;
  padding: 1rem 2rem;
  width: 100%;
  margin-top: 1rem;
}

/* ===== Setup Section ===== */
.setup-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.setup-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--pictionary-green-light);
}

.setup-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--gray-light);
}

/* ===== Player Inputs ===== */
.player-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.player-input {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.player-input:focus {
  outline: none;
  border-color: var(--pictionary-green-light);
}

/* ===== Radio Options ===== */
.word-source-options,
.difficulty-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.radio-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.radio-option input[type="radio"] {
  accent-color: var(--pictionary-green-light);
}

/* ===== Word Options ===== */
.word-options {
  margin-top: 1rem;
}

.word-options.hidden {
  display: none;
}

#custom-words {
  width: 100%;
  height: 150px;
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 1rem;
  border: 2px solid var(--gray);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  resize: vertical;
}

#custom-words:focus {
  outline: none;
  border-color: var(--pictionary-green-light);
}

/* ===== Settings ===== */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.setting-row label {
  color: var(--gray-light);
}

.setting-row select {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--gray);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.setting-row select:focus {
  outline: none;
  border-color: var(--pictionary-green-light);
}

/* ===== Lobby Screen ===== */
.room-code-section {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.room-code {
  font-family: var(--font-logo);
  font-size: 4rem;
  color: var(--pictionary-green-light);
  letter-spacing: 0.5rem;
  margin: 1rem 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.room-code:hover {
  transform: scale(1.05);
}

.room-code-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pictionary-green-dark);
  border: 2px solid var(--pictionary-green-light);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  gap: 0.5rem;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.room-code-menu.hidden {
  display: none;
}

.room-code-menu .menu-btn {
  background: var(--pictionary-green);
  color: var(--white);
  border: 1px solid var(--pictionary-green-light);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.room-code-menu .menu-btn:hover {
  background: var(--pictionary-green-light);
  color: var(--pictionary-green-dark);
}

.room-instructions {
  color: var(--gray-light);
}

.room-instructions strong {
  color: var(--white);
}

.players-section {
  margin: 2rem 0;
}

.players-section h2 {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--pictionary-green-light);
}

.player-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 4px solid var(--gray);
}

.player-status.connected {
  border-left-color: var(--correct-green);
}

.player-status .name {
  font-weight: 600;
}

.player-status .status {
  font-size: 0.875rem;
  color: var(--gray);
}

.player-status.connected .status {
  color: var(--correct-green);
}

.waiting-message {
  text-align: center;
  color: var(--gray);
  margin-top: 1rem;
}

/* ===== Game Screen ===== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.round-info {
  font-size: 1.25rem;
  color: var(--gray-light);
}

.timer {
  font-family: var(--font-logo);
  font-size: 2rem;
  color: var(--pictionary-green-light);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
}

.timer.urgent {
  color: var(--wrong-red);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.game-content {
  text-align: center;
}

.drawer-info {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.drawer-info span {
  color: var(--pictionary-green-light);
  font-weight: 600;
}

.word-display {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.word-label {
  font-size: 0.875rem;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

.word {
  font-family: var(--font-logo);
  font-size: 2rem;
  letter-spacing: 0.25rem;
  color: var(--gold);
}

.scoreboard {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.score-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 120px;
}

.score-card.drawing {
  border: 2px solid var(--pictionary-green-light);
}

.score-card .player-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.score-card .player-score {
  font-size: 1.5rem;
  color: var(--pictionary-green-light);
}

.game-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ===== Round Result Screen ===== */
#result-content {
  text-align: center;
  margin: 3rem 0;
}

.result-title {
  font-family: var(--font-logo);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.result-title.correct {
  color: var(--correct-green);
}

.result-title.timeout {
  color: var(--wrong-red);
}

.result-word {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.result-word span {
  color: var(--gold);
  font-weight: 600;
}

.result-points {
  color: var(--gray-light);
  margin-bottom: 2rem;
}

/* ===== Winner Screen ===== */
.winner-title {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--gold);
  text-align: center;
  margin: 2rem 0 1rem;
}

.winner-name {
  font-family: var(--font-logo);
  font-size: 2.5rem;
  text-align: center;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.winner-score {
  font-size: 1.5rem;
  text-align: center;
  color: var(--pictionary-green-light);
  margin-bottom: 2rem;
}

.final-scores {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.final-score-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.final-score-row:last-child {
  border-bottom: none;
}

.final-score-row.winner {
  color: var(--gold);
  font-weight: 600;
}

.winner-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.winner-actions .btn {
  min-width: 150px;
}

/* ===== Utilities ===== */
.hidden {
  display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .title {
    font-size: 2rem;
  }

  .room-code {
    font-size: 3rem;
  }

  .word {
    font-size: 1.5rem;
  }

  .scoreboard {
    gap: 1rem;
  }

  .score-card {
    min-width: 100px;
    padding: 0.75rem 1rem;
  }

  .game-controls {
    flex-direction: column;
  }

  .game-controls .btn {
    width: 100%;
  }
}
