:root {
  color-scheme: dark;
  --bg: #07152f;
  --card: #0f2350;
  --green: #18d39b;
  --yellow: #f7c948;
  --purple: #8a5cf5;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --shadow: 0 18px 40px rgba(4, 12, 28, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Cairo", "Noto Kufi Arabic", system-ui, sans-serif;
}

body {
  background: radial-gradient(circle at top, #102a5e, var(--bg));
  color: var(--white);
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  padding: 40px 20px 10px;
}

.hero-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.hero p {
  color: var(--muted);
  font-size: clamp(16px, 2.3vw, 20px);
}

.container {
  width: min(1100px, 92%);
  margin: 20px auto 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view {
  display: none;
  animation: fade 0.35s ease;
}

.view.active {
  display: block;
}

.section-title {
  font-size: clamp(20px, 3vw, 28px);
  margin-bottom: 18px;
}

.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.part-card {
  background: linear-gradient(135deg, rgba(24, 211, 155, 0.2), rgba(138, 92, 245, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 22px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.part-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 45px rgba(4, 12, 28, 0.45);
}

.part-card .part-title {
  font-size: 20px;
}

.part-card .part-desc {
  color: var(--muted);
  font-size: 14px;
}

.quiz-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-text {
  color: var(--muted);
}

.progress-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 10px;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--purple));
  transition: width 0.3s ease;
}

.question-card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-text {
  font-size: clamp(18px, 2.8vw, 22px);
  line-height: 1.8;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--white);
  text-align: right;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-btn:hover {
  border-color: var(--yellow);
  transform: translateY(-2px);
}

.option-btn.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(138, 92, 245, 0.25);
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(24, 211, 155, 0.18);
}

.option-btn.incorrect {
  border-color: var(--purple);
  background: rgba(138, 92, 245, 0.15);
}

.answer-box {
  background: rgba(7, 21, 47, 0.7);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.answer-box.hidden {
  display: none;
}

.answer-label {
  color: var(--yellow);
  font-weight: 600;
}

.answer-text,
.explanation-text {
  color: var(--muted);
  line-height: 1.7;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.btn {
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  background: var(--green);
  color: #0b1c2e;
  font-weight: 600;
}

.btn.secondary {
  background: var(--yellow);
  color: #1f1a02;
  font-weight: 600;
}

.btn.accent {
  background: var(--purple);
  color: var(--white);
  font-weight: 600;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-card {
  background: var(--card);
  padding: 24px;
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.results-summary {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 18px;
}

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

@media (max-width: 700px) {
  .question-card {
    padding: 18px;
  }

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