:root {
  --primary: #4a69bd;
  --secondary: #6a89cc;
  --background: #1e272e;
  --text: #d2dae2;
  --card-bg: rgba(255, 255, 255, 0.05);
  --success: #05c46b;
  --error: #ff3f34;
  --gradient-1: linear-gradient(45deg, #4a69bd, #6a89cc);
  --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

body {
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow-x: hidden;
}

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeOut 0.5s ease-out 2s forwards;
}

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

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

.loading-title {
  color: var(--primary);
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(74, 105, 189, 0.3);
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

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

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .loading-icon {
    font-size: 3rem;
  }

  .loading-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .loading-icon {
    font-size: 2.5rem;
  }

  .loading-title {
    font-size: 1.8rem;
  }
}

.container {
  max-width: 800px;
  width: 100%;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

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


.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.category-btn {
  padding: 1.5rem;
  border: none;
  border-radius: 15px;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.category-btn i {
  font-size: 1.5rem;
}

.category-btn:hover {
  transform: translateY(-5px);
  background: var(--secondary);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.question-container {
  position: relative;
  margin-bottom: 2rem;
}

.question {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.options {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.option {
  padding: 1.2rem;
  border: 2px solid var(--primary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-size: 1.1rem;
}

.option:hover {
  background: var(--primary);
  transform: translateX(5px);
}

.controls {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  gap: 1rem;
}

.control-btn {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
  background: var(--secondary);
  transform: translateY(-3px);
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
}

.progress {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.result-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  max-width: 600px;
  height: 30vh;
  padding: 1.5rem;
  background: var(--gradient-1);
  color: white;
  text-align: center;
  border-radius: 20px;
  box-shadow: var(--box-shadow);
}

.result-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  margin: 1rem 0;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.8rem;
  flex: 1;
  max-width: 120px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-message {
  font-size: 1rem;
  margin: 1rem auto;
  max-width: 80%;
  line-height: 1.3;
  text-align: center;
}

#play-again-btn {
  background: white;
  color: var(--primary);
  border: none;
  padding: 0.7rem 1.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 1rem auto;
  display: block;
}

#play-again-btn:hover {
  background: var(--secondary);
  color: white;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .result-screen {
    height: 30vh;
    padding: 1rem;
  }

  .result-title {
    font-size: 1.5rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .result-message {
    font-size: 0.9rem;
  }

  #play-again-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .result-screen {
    height: 40vh;
  }

  .result-title {
    font-size: 1.3rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  .result-message {
    font-size: 0.8rem;
    max-width: 90%;
  }

  #play-again-btn {
    padding: 0.5rem 1.2rem;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
    background: none;
    box-shadow: none;
    border: none;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .question {
    font-size: 1.1rem;
    padding: 1rem;
  }

  .option {
    padding: 1rem;
    font-size: 1rem;
  }

  .controls {
    bottom: 1rem;
    right: 1rem;
  }

  .result-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

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

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

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

.popup {
  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;
}

.popup-content {
  background: var(--gradient-1);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: var(--box-shadow);
  max-width: 90%;
  width: 350px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.popup h2 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.popup p {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.popup-buttons button {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#restart-confirm {
  background-color: var(--success);
  color: white;
}

#restart-cancel {
  background-color: var(--error);
  color: white;
}

.popup-buttons button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#restart-confirm:hover {
  background-color: #06d6a0;
}

#restart-cancel:hover {
  background-color: #ff6b6b;
}

.mute-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  z-index: 1200vh;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mute-button:hover {
  background: var(--secondary);
  transform: scale(1.1);
}

.mute-button.muted i::before {
  content: "\f6a9";
}
