/* ==========================================================================
   Quiz Game Styles
   ========================================================================== */

:root {
  --primary-color: #f59e0b;
  --secondary-color: #ef4444;
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --success-color: #22c55e;
  --error-color: #ef4444;
  --gold-color: #fbbf24;
  --correct-bg: #166534;
  --wrong-bg: #991b1b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
}

#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Screens
   ========================================================================== */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   Title Screen
   ========================================================================== */

.title-content {
  text-align: center;
  max-width: 420px;
}

.title-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.title-content p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.quiz-info {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 1.5rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.info-icon {
  font-size: 1.5rem;
}

.info-item span:last-child {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.category-select {
  margin-bottom: 1.5rem;
}

.category-select > span {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.category-btn {
  background: var(--surface-color);
  color: var(--text-color);
  border: 2px solid transparent;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.category-btn:hover {
  border-color: var(--primary-color);
}

.category-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-color: transparent;
}

/* ==========================================================================
   Question Screen
   ========================================================================== */

#question-screen {
  justify-content: flex-start;
  padding: 20px;
}

.question-header {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.progress-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.timer-container {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--surface-color);
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.1s linear;
}

.timer-bar.warning {
  background: var(--error-color);
}

.timer-text {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--text-color);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.score-display {
  text-align: center;
  font-size: 1rem;
}

.score-display span:last-child {
  font-weight: 700;
  color: var(--gold-color);
}

.question-content {
  flex: 1;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.question-category {
  font-size: 0.85rem;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.question-text {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  margin-bottom: 2rem;
  min-height: 80px;
}

.answers-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-btn {
  width: 100%;
  padding: 16px 20px;
  background: var(--surface-color);
  border: 2px solid transparent;
  border-radius: 12px;
  color: var(--text-color);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary-color);
  transform: translateX(5px);
}

.answer-btn:disabled {
  cursor: not-allowed;
}

.answer-btn.selected {
  border-color: var(--primary-color);
  background: rgba(245, 158, 11, 0.2);
}

.answer-btn.correct {
  background: var(--correct-bg);
  border-color: var(--success-color);
}

.answer-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--error-color);
}

.answer-letter {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.answer-text {
  flex: 1;
}

/* ==========================================================================
   Feedback Overlay
   ========================================================================== */

.feedback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.2s ease;
}

.feedback-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.feedback-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.feedback-icon.correct {
  color: var(--success-color);
  animation: bounce 0.5s ease;
}

.feedback-icon.wrong {
  color: var(--error-color);
  animation: shake 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.feedback-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.points-earned {
  font-size: 1.1rem;
  color: var(--gold-color);
}

/* ==========================================================================
   Result Screen
   ========================================================================== */

.result-content {
  text-align: center;
  max-width: 400px;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.result-content h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--gold-color);
}

.score-summary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin-bottom: 1.5rem;
}

.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.correct-count {
  font-size: 3rem;
  font-weight: 800;
  color: var(--success-color);
}

.correct-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.final-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-color);
  padding: 15px 25px;
  border-radius: 12px;
}

.final-score span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.final-score strong {
  font-size: 2rem;
  color: var(--gold-color);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-color);
  padding: 10px 15px;
  border-radius: 10px;
  min-width: 70px;
}

.stat-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-item strong {
  font-size: 1.1rem;
}

.prize-section {
  background: var(--surface-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.prize-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.5rem;
}

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

.prize-name {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-color), #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.prize-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.prize-code span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.discount-code {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 2px;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 280px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--surface-color);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

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

/* ==========================================================================
   Overlay
   ========================================================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.overlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 400px) {
  .title-content h1 {
    font-size: 2rem;
  }
  
  .question-text {
    font-size: 1.2rem;
  }
  
  .answer-btn {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
  
  .quiz-info {
    gap: 12px;
  }
  
  .stats-row {
    flex-wrap: wrap;
  }
}
