/* reset & base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* css variables for themes */
:root {
  --bg-color: #e0f7fa;
  --container-bg: #ffffff;
  --primary-color: #0077b6;
  --primary-hover: #005a8d;
  --text-color: #1a1a1a;
  --text-secondary: #555555;
  --answer-bg: #b3e5fc;
  --answer-border: #81d4fa;
  --answer-hover-bg: #81d4fa;
  --answer-hover-border: #4fc3f7;
  --correct-bg: #c8f7dc;
  --correct-border: #06d6a0;
  --correct-text: #047857;
  --incorrect-bg: #ffe0e0;
  --incorrect-border: #ff6b6b;
  --incorrect-text: #dc2626;
  --progress-bg: #b3e5fc;
  --progress-fill: #00b4d8;
  --result-bg: #b3e5fc;
}

body.dark-mode {
  --bg-color: #1a1a2e;
  --container-bg: #16213e;
  --primary-color: #6c63ff;
  --primary-hover: #554cdb;
  --text-color: #e0e0e0;
  --text-secondary: #b0b0b0;
  --answer-bg: #0f1729;
  --answer-border: #2a3f5f;
  --answer-hover-bg: #1e2d4d;
  --answer-hover-border: #3d5a80;
  --correct-bg: #0d3d30;
  --correct-border: #10b981;
  --correct-text: #34d399;
  --incorrect-bg: #3d1a1a;
  --incorrect-border: #ef4444;
  --incorrect-text: #fca5a5;
  --progress-bg: #0f1729;
  --progress-fill: #00d4ff;
  --result-bg: #0f1729;
}

body {
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
  font-family: sans-serif;
  transition: background 0.3s;
}

.container {
  background-color: var(--container-bg);
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  position: relative;
  transition: background-color 0.3s;
}

.theme-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 10;
  transition: all 0.3s;
}

.theme-toggle:hover {
  background: var(--primary-hover);
  transform: rotate(20deg);
}

.screen {
  display: none;
  padding: 2rem;
  text-align: center;
}

.screen.active {
  display: block;
}

#start-screen h1,
#question-text,
.result-info p,
#result-message,
#result-screen h1 {
  transition: color 0.3s;
}

#start-screen p,
.quiz-info {
  color: var(--text-secondary);
  transition: color 0.3s;
}

.progress-bar,
.result-info {
  transition: background-color 0.3s;
}

#start-screen h1 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 2.5rem;
}

#start-screen p {
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.quiz-header {
  margin-bottom: 1rem;
  padding-right: 3rem;
}

#question-text {
  color: var(--text-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  max-width: calc(100% - 60px);
  margin-left: auto;
  margin-right: auto;
}

.quiz-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.answers-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.answer-btn {
  background-color: var(--answer-bg);
  color: var(--text-color);
  border: 2px solid var(--answer-border);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
}

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

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

.answer-btn.incorrect {
  background-color: var(--incorrect-bg);
  border-color: var(--incorrect-border);
  color: var(--incorrect-text);
}

.progress-bar {
  height: 10px;
  background-color: var(--progress-bg);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 20px;
}

.progress {
  height: 100%;
  background-color: var(--progress-fill);
  width: 0%;
  transition: width 0.3s, background-color 0.3s;
}

#result-screen h1 {
  color: var(--primary-color);
  margin-bottom: 30px;
}

.result-info {
  background-color: var(--result-bg);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
}

.result-info p {
  font-size: 1.2rem;
  color: var(--text-color);
  margin-bottom: 1rem;
}

#result-message {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 15px 30px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: var(--primary-hover);
}

@media (max-width: 500px) {
  .screen {
    padding: 1rem;
  }

  #start-screen h1 {
    font-size: 2rem;
  }

  #question-text {
    font-size: 1.3rem;
  }

  .answer-btn {
    padding: 12px;
  }

  button {
    padding: 12px 25px;
    font-size: 1rem;
  }

  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
}