:root {
  --bg-color: #eef4ff;
  --bg-glow: rgba(37, 99, 235, 0.08);
  --panel-color: rgba(255, 255, 255, 0.9);
  --soft-border: rgba(148, 163, 184, 0.28);
  --soft-text: #475569;
  --strong-text: #0f172a;
  --muted-text: #64748b;
  --accent-color: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #e2ebff;
  --success-color: #1d9b6c;
  --danger-color: #dc2626;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, var(--bg-glow), transparent 35%),
    linear-gradient(135deg, #f8fbff 0%, var(--bg-color) 100%);
  color: var(--strong-text);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.active {
  display: flex;
}

.panel {
  background: var(--panel-color);
  border: 1px solid var(--soft-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-panel {
  padding: 54px 44px 48px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(226, 235, 255, 0.5));
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.hero-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-color);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.hero-panel h1 {
  margin: 0 0 12px;
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  line-height: 1.08;
  position: relative;
  z-index: 1;
  font-weight: 800;
  background: linear-gradient(135deg, #050303 0%, #184ad1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  margin: 12px 0 24px;
  font-size: 1.1rem;
  color: #64748b;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.primary-btn,
.secondary-btn,
.option-btn {
  transition: all 0.2s ease;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 14px;
  padding: 1rem 1.7rem;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
  color: white;
  min-width: 170px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.primary-btn:hover,
.secondary-btn:hover,
.option-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:hover {
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.secondary-btn {
  background: var(--panel-color);
  border: 1px solid var(--soft-border);
  color: var(--strong-text);
}

.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.quiz-panel,
.result-panel {
  padding: 30px 28px 24px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.quiz-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent-color);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

.question-counter {
  font-size: 0.95rem;
  color: var(--soft-text);
  font-weight: 600;
}

.progress-wrap {
  width: 100%;
  height: 12px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 26px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-color);
  transition: width 0.25s ease;
}

.question-card {
  background: #f9fafb;
  border: 1px solid var(--soft-border);
  border-radius: 18px;
  padding: 24px 22px;
}

.question-card h2 {
  margin: 0 0 22px;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.5;
}

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

.option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-color);
  border: 1px solid var(--soft-border);
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  color: var(--strong-text);
}

.option-btn.selected {
  border-color: var(--accent-color);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--strong-text);
  font-weight: 700;
  flex-shrink: 0;
}

.option-btn.selected .option-letter {
  background: var(--accent-color);
  color: white;
}

.option-text {
  line-height: 1.5;
}

.navigation-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
}

.result-panel {
  text-align: center;
  max-width: 920px;
  width: min(100%, 920px);
  margin: 0 auto;
}

.result-badge {
  margin: 0 0 18px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--success-color);
}

.result-panel h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
}

.score-display {
  margin: 22px 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--strong-text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid var(--soft-border);
  border-radius: 16px;
  padding: 18px 10px;
}

.stat-box p {
  margin: 0 0 8px;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.stat-box strong {
  font-size: 1.3rem;
}

.performance-message {
  margin: 24px auto 30px;
  max-width: 360px;
  color: var(--soft-text);
  line-height: 1.6;
}

.review-toggle {
  margin: 0 auto 18px;
  display: block;
}

.review-section {
  margin-top: 0;
  text-align: left;
  display: block;
}

.review-section.hidden {
  display: none;
}

.review-section h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.review-list {
  display: grid;
  gap: 14px;
}

.review-item {
  background: #f9fafb;
  border: 1px solid var(--soft-border);
  border-left: 5px solid var(--soft-border);
  border-radius: 16px;
  padding: 18px 18px 16px;
}

.review-item.correct {
  border-left-color: var(--success-color);
  background: #f3fbf8;
}

.review-item.incorrect {
  border-left-color: var(--danger-color);
  background: #fff7f7;
}

.review-item.unanswered {
  border-left-color: #9ca3af;
  background: #f3f4f6;
}

.review-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.review-question-number {
  font-weight: 700;
  color: var(--strong-text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-badge.correct {
  background: rgba(29, 155, 108, 0.12);
  color: var(--success-color);
}

.status-badge.incorrect {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger-color);
}

.status-badge.unanswered {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
}

.review-question {
  margin: 0 0 10px;
  line-height: 1.55;
  color: var(--strong-text);
}

.review-answer-row {
  display: grid;
  gap: 8px;
  color: var(--soft-text);
}

.review-answer-row p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 18px;
  }

  .hero-panel,
  .quiz-panel,
  .result-panel {
    padding: 22px 18px;
  }

  .quiz-header,
  .navigation-row {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

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