/* ============= GLOBAL STYLES ============= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

:root {
  /* Main Colors */
  --primary-color: #FF8C00;
  --primary-color-dark: #E67E00;
  --primary-color-light: #FFA533;
  --accent-color: #FFD700;

  /* Dark Theme Colors (Default) */
  --bg-color: #121212;
  --bg-color-secondary: #1E1E1E;
  --text-color: #FFFFFF;
  --text-color-secondary: #BBBBBB;
  --card-bg: #2A2A2A;
  --card-border: #3A3A3A;

  /* Button Colors */
  --btn-success: #4CAF50;
  --btn-warning: #FF9800;
  --btn-danger: #F44336;

  /* Other Variables */
  --border-radius: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition-speed: 0.3s;
}

/* Light Theme Variables */
body.light-theme {
  --bg-color: #F5F5F5;
  --bg-color-secondary: #EEEEEE;
  --text-color: #333333;
  --text-color-secondary: #666666;
  --card-bg: #FFFFFF;
  --card-border: #DDDDDD;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color var(--transition-speed), color var(--transition-speed);
  min-height: 100vh;
  position: relative;
}

.hidden {
  display: none !important;
}

/* ============= LOADING SCREEN ============= */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  z-index: 1000;
  transition: opacity 0.5s;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-icon {
  font-size: 4rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  animation: pulse 1.5s infinite;
}

.loading-screen h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--primary-color);
}

.loading-bar {
  width: 250px;
  height: 6px;
  background-color: var(--bg-color-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  width: 0;
  background-color: var(--primary-color);
  animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
  0% { width: 0; }
  100% { width: 100%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* ============= APP CONTAINER ============= */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 15px;
  min-height: 100vh;
}

/* ============= GAME HEADER ============= */
.game-header {
  text-align: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  position: relative;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-right: 10px;
}

.game-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.tagline {
  font-size: 1rem;
  color: var(--text-color-secondary);
  font-weight: 300;
}

.header-controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.8rem;
}

.theme-toggle, .score-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform var(--transition-speed);
}

.theme-toggle:hover, .score-btn:hover {
  transform: scale(1.1);
}

/* ============= GAME SCREENS ============= */
.game-screen {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.game-screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============= WELCOME SCREEN ============= */
#welcomeScreen {
  text-align: center;
  padding: 1.5rem 0;
}

#welcomeScreen h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.welcome-text {
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.welcome-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 250px;
  margin: 0 auto;
}

/* ============= PLAYERS SCREEN ============= */
#playersScreen h2 {
  text-align: center;
  margin-bottom: 1.2rem;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.player-form {
  margin-bottom: 1rem;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  max-width: calc(100% - 50px); /* Prevent overflow on mobile */
  padding: 10px 12px;
  border: 2px solid var(--card-border);
  background-color: var(--bg-color);
  color: var(--text-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  transition: border-color var(--transition-speed);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-add {
  min-width: 40px;
  padding: 8px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color var(--transition-speed);
}

.btn-add:hover {
  background-color: var(--primary-color-dark);
}

.player-list-container {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.player-list-container h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.player-list {
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.player-list li {
  padding: 8px 12px;
  background-color: var(--bg-color);
  margin-bottom: 6px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.player-list li:last-child {
  margin-bottom: 0;
}

.player-list .player-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.player-list .player-name i {
  color: var(--primary-color);
}

.delete-btn {
  background: none;
  border: none;
  color: var(--btn-danger);
  cursor: pointer;
  font-size: 1rem;
  transition: transform var(--transition-speed);
}

.delete-btn:hover {
  transform: scale(1.2);
}

/* ============= SETUP SCREEN ============= */
#setupScreen h2 {
  text-align: center;
  margin-bottom: 1.2rem;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.setup-section {
  margin-bottom: 1.5rem;
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.setup-section h3 {
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.setup-section h4 {
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mode-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.mode-option {
  position: relative;
}

.mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
  background-color: var(--bg-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.mode-label:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.mode-option input[type="radio"]:checked + .mode-label {
  border-color: var(--primary-color);
  background-color: var(--bg-color-secondary);
}

.mode-icon {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.mode-icon.adult {
  color: #FF4500;
}

.mode-label span {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.mode-label small {
  font-size: 0.8rem;
  color: var(--text-color-secondary);
}

.setup-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ============= GAME PLAY SCREEN ============= */
.game-card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  background-color: var(--primary-color);
  color: white;
  padding: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.round-info {
  font-weight: 500;
  font-size: 1rem;
}

.mode-indicator {
  font-weight: 600;
  font-size: 0.9rem;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 20px;
}

.card-body {
  padding: 1.2rem;
}

.player-turn {
  display: flex;
  align-items: center;
  margin-bottom: 1.2rem;
}

.avatar-container {
  position: relative;
  margin-right: 15px;
}

.avatar {
  width: 45px;
  height: 45px;
  background-color: var(--bg-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.player-animation-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.player-info {
  flex: 1;
}

.player-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.player-score {
  color: var(--text-color-secondary);
  font-size: 0.85rem;
}

.question-container {
  background-color: var(--bg-color);
  border-radius: var(--border-radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
  position: relative;
}

.question-container::before {
  content: '"';
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--primary-color);
  opacity: 0.3;
}

.question-container::after {
  content: '"';
  position: absolute;
  bottom: 5px;
  right: 10px;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--primary-color);
  opacity: 0.3;
}

.question-text {
  font-size: 1.1rem;
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
  position: relative;
  z-index: 1;
}

.card-footer {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.answer-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.game-options {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

/* ============= SCORES SCREEN ============= */
#scoresScreen {
  text-align: center;
  padding: 1.5rem 0;
}

#scoresScreen h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.scores-controls {
  margin-top: 1.5rem;
}

/* ============= GAME OVER SCREEN ============= */
#gameOverScreen {
  text-align: center;
  padding: 1.5rem 0;
}

#gameOverScreen h2 {
  font-size: 1.8rem;
  margin-bottom: 1.2rem;
  color: var(--primary-color);
}

.final-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.stat-item i {
  font-size: 1.8rem;
  color: var(--primary-color);
}

.player-scores-container {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.player-scores-container h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.player-scores-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.player-score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: var(--bg-color);
  border-radius: 8px;
}

.player-score-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.player-score-name i {
  color: var(--primary-color);
}

.player-score-value {
  font-weight: 600;
  background-color: var(--primary-color);
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.player-score-item.winner {
  border: 2px solid var(--primary-color);
  background-color: var(--bg-color-secondary);
}

.winner-badge {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 3px 6px;
  border-radius: 20px;
  font-size: 0.7rem;
  margin-left: 8px;
}

#winnerConfetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.end-game-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 250px;
  margin: 0 auto;
}

/* ============= RULES SCREEN ============= */
#rulesScreen {
  padding: 1.5rem 0;
}

#rulesScreen h2 {
  text-align: center;
  margin-bottom: 1.2rem;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.rules-content {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.rules-list {
  padding-left: 1.5rem;
}

.rules-list li {
  margin-bottom: 0.8rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.rules-list li:last-child {
  margin-bottom: 0;
}

/* =============================
   PREMIUM CREDITS SECTION
   Dark Theme / Orange Accent
============================= */

.credits {
  /* Layout & Spacing */
  margin: 2rem auto;
  padding: 1.5rem;
  max-width: 340px;
  
  /* A subtle dark background that stands out slightly from main BG */
  background: #1f1f1f;
  border-radius: 10px;
  text-align: center;

  /* Visual Elevation */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.credits:hover {
  /* Slight hover lift for a premium feel */
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Title / Project Name */
.project-title {
  color: #ffa500; /* Eye-catching orange */
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* Version Info */
.version {
  color: #ffffff; /* Light text on dark background */
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Copyright */
.copyright {
  color: #aaaaaa; /* Subtle gray for less emphasis */
  font-size: 0.8rem;
  border-top: 1px solid #333;
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .credits {
    margin: 1.5rem auto;
    padding: 1rem;
    max-width: 90%;
  }

  .project-title {
    font-size: 0.95rem;
  }

  .version {
    font-size: 0.85rem;
  }
  
  .copyright {
    font-size: 0.75rem;
  }
}

/* ============= BUTTONS ============= */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 10px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-speed), background-color var(--transition-speed);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn i {
  font-size: 1rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-color-dark);
}

.btn-secondary {
  background-color: var(--bg-color-secondary);
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: var(--card-border);
}

.btn-success {
  background-color: var(--btn-success);
  color: white;
}

.btn-success:hover {
  background-color: #3d8b40;
}

.btn-warning {
  background-color: var(--btn-warning);
  color: white;
}

.btn-warning:hover {
  background-color: #e68900;
}

.btn-danger {
  background-color: var(--btn-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #d32f2f;
}

.btn:disabled {
  background-color: var(--card-border);
  color: var(--text-color-secondary);
  cursor: not-allowed;
  transform: none;
}

/* ============= MODAL ============= */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 350px;
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--primary-color);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-color-secondary);
  cursor: pointer;
  transition: color var(--transition-speed);
}

.close-btn:hover {
  color: var(--btn-danger);
}

.modal-body {
  padding: 1.2rem;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

/* ============= PLAYER ANIMATION ============= */
@keyframes randomPlayerRotate {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(10deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.player-spotlight {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,140,0,0.4) 0%, rgba(255,140,0,0) 70%);
  animation: pulse 1.5s infinite;
}

.typing:after {
  content: '|';
  animation: blink 1s infinite;
}

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

/* ============= ANIMATIONS ============= */
.thanos-dust {
  animation: thanosDust 1s forwards;
}

@keyframes thanosDust {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.5);
    filter: blur(4px);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.correct-answer {
  animation: correctAnswerPulse 0.5s;
}

@keyframes correctAnswerPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* ============= RESPONSIVE ADJUSTMENTS ============= */
@media (min-width: 480px) {
  .app-container {
    padding: 20px;
  }

  .game-header {
    padding: 1.5rem 0;
    margin-bottom: 2rem;
  }

  .logo-icon {
    font-size: 2rem;
  }

  .game-header h1 {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 1.1rem;
  }

  #welcomeScreen h2,
  #gameOverScreen h2,
  #setupScreen h2,
  #rulesScreen h2,
  #scoresScreen h2,
  #playersScreen h2 {
    font-size: 2.2rem;
  }

  .welcome-text {
    font-size: 1.1rem;
  }

  .setup-section {
    padding: 1.5rem;
  }

  .btn {
    padding: 12px 20px;
    font-size: 1rem;
  }

  .setup-section h3 {
    font-size: 1.4rem;
  }

  .question-text {
    font-size: 1.3rem;
  }

  .player-name {
    font-size: 1.5rem;
  }

  .mode-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .mode-option {
    flex: 1;
    min-width: 180px;
    max-width: 250px;
  }

  .player-list-container {
    padding: 1.5rem;
  }

  .btn-add {
    min-width: 50px;
    padding: 10px 12px;
  }
}

/* For very small mobile screens */
@media (max-width: 350px) {
  .game-header h1 {
    font-size: 1.8rem;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .answer-buttons {
    flex-direction: column;
  }

  .input-group input {
    max-width: calc(100% - 42px);
  }

  .btn-add {
    min-width: 36px;
    padding: 6px;
  }
}
