@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@400;700&display=swap');

/* base */
* { box-sizing: border-box; }
body {
  margin:0; padding:20px;
  font-family: sans-serif;
  background:#eef6fb; color:#333;
  text-align:center;
}
h1 { font-size:2.5rem; margin:.5em 0 .2em; }
h3 { margin-bottom:20px; }

/* hidden helper */
.hidden { display:none; }

/* form/layout */
#setupScreen { max-width:600px; margin:auto; text-align:left; }
#setupForm label { display:block; margin:10px 0; }
#setupForm input, #setupForm select, #setupForm textarea {
  width:100%; padding:8px; margin-top:4px;
}
#setupForm textarea { height:120px; font-family:inherit; }
#setupForm button {
  margin-top:20px; padding:10px 20px;
  font-size:1rem; cursor:pointer;
}

/* inline radios */
.inline-radio {
  display:flex; gap:1.5em; margin:1em 0;
}
.inline-radio label {
  display:flex; align-items:center; gap:.5em;
  font-weight:500;
}
.inline-radio input { margin:0; }

/* game screen */
.scoreboard {
  display:flex; justify-content:center; gap:50px;
  margin-bottom:20px;
}
.team {
  background:#fff; padding:10px 20px;
  border-radius:12px;
  box-shadow:0 2px 8px rgba(0,0,0,0.1);
  min-width:140px;
}
.announcement { min-height:1.4em; font-weight:600; margin-bottom:6px; }
.team h2 { margin:0; }
.team p { font-size:2rem; margin:.2em 0 0; }

#questionContainer {
  display:flex; align-items:center; justify-content:center; gap:10px;
  margin-bottom:20px;
}
#question { font-weight:600; max-width:300px; text-align:left; }
#answer { font-style:italic; margin-top:4px; }

/* grid */
#grid {
  display: grid;
  gap: 10px;
  padding: 20px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}
#grid button {
  aspect-ratio: 1;
  font-size: 1.2rem;
  border: none;
  border-radius: 8px;
  background: #add8e6;
  cursor: pointer;
  transition: background .2s;
}
#grid button:hover { background:#87ceeb; }
#grid button:disabled {
  background:#ccc; cursor:default;
}

/* turn/reset */
#resetBtn, #passBtn, #skipBtn, #revealBtn {
  padding:8px 16px; font-weight:600; cursor:pointer;
}

/* color variables */
:root {
  --teamA: #e74c3c;
  --teamB: #3498db;
  --faction1: #e74c3c; /* Red */
  --faction2: #3498db; /* Blue */
  --faction3: #f39c12; /* Orange */
  --faction4: #2ecc71; /* Green */
}
#nameA { color: var(--teamA); }
#annA { color: var(--teamA); }
#turnDisplay { font-size:1.25rem; }

/* Multi-faction grid layouts */
.faction-3 {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.faction-4 {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px;
}

/* Faction-specific button styling */
.faction-1 {
  background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
  color: white;
  border: 2px solid #a93226;
}

.faction-2 {
  background: linear-gradient(135deg, #3498db, #2980b9) !important;
  color: white;
  border: 2px solid #1f618d;
}

.faction-3 {
  background: linear-gradient(135deg, #f39c12, #e67e22) !important;
  color: white;
  border: 2px solid #d68910;
}

.faction-4 {
  background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
  color: white;
  border: 2px solid #1e8449;
}

/* Hover effects for faction buttons */
.faction-1:hover {
  background: linear-gradient(135deg, #c0392b, #a93226) !important;
  transform: scale(1.05);
}

.faction-2:hover {
  background: linear-gradient(135deg, #2980b9, #1f618d) !important;
  transform: scale(1.05);
}

.faction-3:hover {
  background: linear-gradient(135deg, #e67e22, #d68910) !important;
  transform: scale(1.05);
}

.faction-4:hover {
  background: linear-gradient(135deg, #27ae60, #1e8449) !important;
  transform: scale(1.05);
}

/* Disabled faction buttons */
.faction-1:disabled {
  background: #a93226 !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.faction-2:disabled {
  background: #1f618d !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.faction-3:disabled {
  background: #d68910 !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.faction-4:disabled {
  background: #1e8449 !important;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Multi-faction scoreboard */
.multi-faction-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.faction-score {
  background: #fff;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
  border-left: 5px solid;
}

.faction-score.faction-1 {
  border-left-color: var(--faction1);
}

.faction-score.faction-2 {
  border-left-color: var(--faction2);
}

.faction-score.faction-3 {
  border-left-color: var(--faction3);
}

.faction-score.faction-4 {
  border-left-color: var(--faction4);
}

.faction-score h3 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
}

.faction-score .score {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0;
}

/* Responsive design for multi-faction layouts */
@media (max-width: 768px) {
  .faction-3 {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
  }
  
  .faction-4 {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 4px;
  }
  
  .multi-faction-scoreboard {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .faction-score {
    padding: 10px 15px;
  }
  
  .faction-score h3 {
    font-size: 1rem;
  }
  
  .faction-score .score {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .multi-faction-scoreboard {
    grid-template-columns: 1fr;
  }
  
  .faction-3,
  .faction-4 {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 3px;
  }
}

/* Library section improvements */
.library-section {
  max-width: 95vw !important;
  margin: 2rem auto 0 auto !important;
  padding: 0 1rem !important;
  overflow-x: auto;
}

.library-section h2 {
  margin-bottom: 1.5rem;
  color: #333;
}

.library-section .quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.library-section .quiz-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.library-section .quiz-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.library-section .quiz-card h3 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.2rem;
}

.library-section .quiz-card p {
  margin: 0 0 1rem 0;
  color: #666;
  font-size: 0.9rem;
}

.library-section .quiz-card button {
  width: 100%;
  padding: 0.75rem;
  background: #6f5c91;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.library-section .quiz-card button:hover {
  background: #5a4a7a;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .library-section {
    padding: 0 0.5rem !important;
  }
  
  .library-section .quiz-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .library-section .quiz-card {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .library-section {
    margin: 1rem auto 0 auto !important;
    padding: 0 0.25rem !important;
  }
}

/* Auth Modal Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.auth-form input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.auth-form button {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    background-color: #6F5C91;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-form button:hover {
    background-color: #59487a;
}

.auth-status {
    margin: 1rem 0;
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.auth-status.error {
    background-color: #ffebee;
    color: #c62828;
}

.auth-status.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background-color: #ccc;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

#googleLoginBtn {
    background-color: #4285f4;
}

#googleLoginBtn:hover {
    background-color: #357abd;
}

#signUpBtn {
    background-color: #28a745;
}

#signUpBtn:hover {
    background-color: #218838;
}

/* Apply Lexend Deca to the grid numbers/buttons */
.grid-btn, .grid-number, .game-grid button {
  font-family: 'Lexend Deca', Arial, sans-serif !important;
}

/* If the grid numbers are just buttons inside the game grid, target them directly */
.game-grid button {
  font-family: 'Lexend Deca', Arial, sans-serif !important;
}
