/* QUIZ STYLES */

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

.quiz-choices {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.join-form {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.join-form #join-pin {
  text-transform: uppercase;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  text-align: center;
}

.join-form #join-name {
  text-transform: none;
  font-size: 1.25rem;
  text-align: center;
}

.error-text {
  color: var(--danger);
  font-weight: 600;
  margin-top: 0.5rem;
}

/* Host View Layouts */

.host-lobby-container, .host-game-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 768px) {
  .host-lobby-container {
    flex-direction: row;
  }
  .host-lobby-container > * {
    flex: 1;
  }
}

.lobby-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#lobby-pin {
  font-size: 3rem;
  letter-spacing: 0.2rem;
}

.qr-container canvas {
  max-width: 100%;
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.player-list li {
  background: var(--bg-modifier);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-weight: 500;
}

/* Host Game Screen */
.question-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  margin-bottom: 2rem;
}

.question-text {
  font-size: 2.5rem;
  line-height: 1.2;
}

.timer {
  font-size: 3rem;
  font-weight: 800;
  background: var(--clr-accent);
  color: var(--clr-primary);
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.accent {
  color: var(--clr-accent);
}

.host-options-grid {
  display: grid;
  gap: 1rem;
}

/* Dynamic Grids based on children count */
.host-options-grid:has(> :nth-child(2):last-child),
.host-options-grid:has(> :nth-child(4):last-child),
.host-options-grid:has(> :nth-child(6):last-child) {
  grid-template-columns: repeat(2, 1fr);
}
.host-options-grid:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 768px) {
    .host-options-grid:has(> :nth-child(3):last-child) {
        grid-template-columns: repeat(3, 1fr);
    }
}
.host-options-grid:has(> :nth-child(5):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

.option-card {
  padding: 2rem;
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  display: flex;
  align-items: center;
  word-break: break-word;
}
.option-card.correct {
  border: 4px solid var(--success);
}
.option-card.incorrect {
  opacity: 0.5;
}

.option-wrapper {
  display: flex;
  flex-direction: column;
}

.option-wrapper .option-card {
  flex-grow: 1;
}

.result-stats {
  margin-top: 10px;
}

.result-stats-bar {
  width: 100%;
  height: 10px;
  background: var(--border-strong, #ccc);
  border-radius: 5px;
  overflow: hidden;
}

.result-stats-fill {
  height: 100%;
  background: var(--text, #333);
  transition: width 0.5s ease-out;
}

.result-stats-label {
  text-align: right;
  font-size: 0.9em;
  margin-top: 5px;
  font-weight: bold;
  color: var(--text);
}

/* Player Screen */
.player-container {
  height: calc(100vh - 100px); /* Fill screen minus header */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.player-answers {
  display: grid;
  gap: 1rem;
  height: 100%;
  padding: 1rem 0;
}

.player-answers:has(> :nth-child(2):last-child) { grid-template-rows: 1fr 1fr; grid-template-columns: 1fr; }
.player-answers:has(> :nth-child(3):last-child) { grid-template-rows: 1fr 1fr 1fr; grid-template-columns: 1fr; }
.player-answers:has(> :nth-child(4):last-child) { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.player-answers:has(> :nth-child(5):last-child) { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.player-answers:has(> :nth-child(6):last-child) { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }

.player-btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
}
.player-btn:active {
  transform: scale(0.95);
  filter: brightness(0.8);
}
.player-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Option Colors */
.color-0 { background-color: #e21b3c; } /* Red */
.color-1 { background-color: #1368ce; } /* Blue */
.color-2 { background-color: #d89e00; } /* Yellow */
.color-3 { background-color: #26890c; } /* Green */
.color-4 { background-color: #8e10d6; } /* Purple */
.color-5 { background-color: #0c8289; } /* Teal */

.scoreboard {
  max-width: 600px;
  margin: 2rem auto;
  text-align: left;
}

.score-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.25rem;
}
.score-row:last-child {
  border-bottom: none;
}
.score-name {
  font-weight: bold;
}

.podium {
    max-width: 600px;
    margin: 2rem auto;
}

/* Extra styles for Polls & Multiple Select */
.player-btn.selected {
  outline: 4px solid #fff;
  outline-offset: -8px;
  box-shadow: inset 0 0 0 200px rgba(0,0,0,0.2) !important;
}

.option-card.neutral {
  border-color: #ccc !important;
  background-color: var(--card-bg) !important;
  color: inherit !important;
  opacity: 0.8;
}
