/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  -ms-touch-action: none;
  touch-action: none;
}

/* Prevent page scrolling */
html, body {
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Screen Management */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}

.screen.hidden {
  display: none;
  opacity: 0;
}

.overlay {
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
}

/* Container */
.container {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 600px;
  max-height: 96vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,107,53,0.3) transparent;
  animation: fadeIn 0.5s ease;
}

.container::-webkit-scrollbar {
  width: 4px;
}
.container::-webkit-scrollbar-track {
  background: transparent;
}
.container::-webkit-scrollbar-thumb {
  background: rgba(255,107,53,0.3);
  border-radius: 2px;
}

/* Loading Screen */
.loading-content {
  text-align: center;
  color: white;
}

.loader {
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-content p {
  font-size: 1.2rem;
  font-weight: 500;
}

/* Game Title */
.game-title {
  font-size: 2.5rem;
  color: #FF6B35;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Menu Options */
.menu-options {
  margin-bottom: 2rem;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1.1rem;
}

.filter-select {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:hover {
  border-color: #FF6B35;
}

.filter-select:focus {
  outline: none;
  border-color: #FF6B35;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #6c757d;
  color: white;
  margin-top: 1rem;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-booster {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-booster:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s ease;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-sound {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  padding: 0.5rem;
}

.btn-sound:hover {
  transform: scale(1.1);
}

/* Stats Display */
.stats-display {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.stat-item:last-child {
  margin-bottom: 0;
}

.stat-label {
  font-weight: 600;
  color: #555;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #FF6B35;
}

/* Game Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e0e0e0;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
}

.streak-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.streak-label {
  font-weight: 600;
  color: #555;
  font-size: 1.1rem;
}

.streak-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #e74c3c;
  min-width: 40px;
  text-align: center;
}

/* Question */
.question-container {
  margin-bottom: 1.5rem;
}

.question-number {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.question-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  line-height: 1.5;
}

/* Boosters */
.boosters-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.booster-btn {
  padding: 0.8rem 1.5rem;
  border: 2px solid #f39c12;
  border-radius: 10px;
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(243, 156, 18, 0.3);
}

.booster-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(243, 156, 18, 0.5);
}

.booster-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #95a5a6;
  border-color: #95a5a6;
}

.booster-icon {
  font-size: 1.2rem;
}

.booster-label {
  font-size: 1rem;
}

/* Keep the Streak */
.keep-streak-container {
  background: #fff3cd;
  border: 2px solid #f39c12;
  padding: 1.5rem;
  border-radius: 10px;
  margin: 1.5rem 0;
  text-align: center;
}

.keep-streak-text {
  font-size: 1.1rem;
  color: #856404;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-btn {
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: white;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.option-btn:hover:not(:disabled) {
  border-color: #FF6B35;
  background: #f8f9fa;
  transform: translateX(5px);
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.option-btn.correct {
  border-color: #28a745;
  background: #d4edda;
  animation: correctPulse 0.5s ease;
}

.option-btn.incorrect {
  border-color: #dc3545;
  background: #f8d7da;
  animation: incorrectShake 0.5s ease;
}

.option-btn.hidden-option {
  opacity: 0.3;
  pointer-events: none;
  background: #f0f0f0;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Modal */
.modal {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 500px;
  width: 90%;
  max-height: 96vh;
  overflow-y: auto;
  text-align: center;
}

.modal h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 1.5rem;
}

.current-streak-info {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: #555;
}

.current-streak-info span {
  font-weight: 700;
  color: #FF6B35;
  font-size: 1.5rem;
}

/* Game Over */
.game-over-message {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

.final-stats {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.new-record {
  color: #ffc107;
  font-weight: 700;
  font-size: 1.3rem;
  animation: recordBlink 1s infinite;
}

@keyframes recordBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.game-over-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Mobile Controls */
.mobile-controls-info {
  margin-top: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 10px;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

.mobile-only {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }

  .game-title {
    font-size: 2rem;
  }

  .container {
    padding: 1.5rem;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .btn {
    padding: 0.9rem;
    font-size: 1rem;
  }

  .option-btn {
    padding: 0.9rem;
  }

  .boosters-container {
    flex-direction: column;
  }

  .booster-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .game-title {
    font-size: 1.6rem;
  }

  .container {
    padding: 1rem;
    max-height: 96vh;
  }

  .question-text {
    font-size: 1rem;
  }

  .streak-value {
    font-size: 1.5rem;
  }

  .modal h2 {
    font-size: 1.6rem;
  }
}

/* Small iframe: max-height 520px or small width */
@media (max-height: 520px) {
  .container {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    max-height: 98vh;
  }

  .game-title {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
  }

  .filter-group {
    margin-bottom: 0.75rem;
  }

  .filter-group label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }

  .filter-select {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.6rem;
    font-size: 0.9rem;
  }

  .stats-display {
    padding: 0.75rem;
  }

  .game-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .streak-label {
    font-size: 0.9rem;
  }

  .streak-value {
    font-size: 1.3rem;
  }

  .question-container {
    margin-bottom: 0.75rem;
  }

  .question-text {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .boosters-container {
    margin-bottom: 0.75rem;
  }

  .booster-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .options-container {
    gap: 0.5rem;
  }

  .option-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }

  .modal {
    padding: 1rem;
  }

  .modal h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
  }

  .current-streak-info {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .keep-streak-container {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  .final-stats {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.container {
  animation: fadeIn 0.5s ease;
}