:root {
  --bg: #eef3ff;
  --bg-soft: #f7f9ff;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: #ffffff;
  --text: #162033;
  --text-soft: #475467;
  --muted: #667085;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --accent: #7c3aed;
  --accent-soft: #f5f3ff;
  --border: #dbe2ea;
  --border-strong: #cfd8e3;
  --success: #16a34a;
  --success-dark: #14532d;
  --success-bg: #effcf3;
  --danger: #dc2626;
  --danger-dark: #7f1d1d;
  --danger-bg: #fef2f2;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 20px 45px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 28px 60px rgba(79, 70, 229, 0.14);
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.1), transparent 24%),
    linear-gradient(180deg, #edf2ff 0%, var(--bg) 42%, #f7f9ff 100%);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  width: min(980px, 92%);
  margin: 34px auto 48px;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.brand-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), transparent 55%);
  pointer-events: none;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.topbar-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.stat-box {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(219, 226, 234, 0.95);
  border-radius: 18px;
  padding: 13px 18px;
  min-width: 126px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  font-size: 0.79rem;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
}

.quiz-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 30px;
  border: 1px solid rgba(219, 226, 234, 0.9);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.quiz-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.progress-section {
  margin-bottom: 28px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 14px;
  background: linear-gradient(180deg, #e6ebf4, #dde6f2);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.35);
}

.question-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.question-tag,
.question-difficulty {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1;
  font-weight: 700;
}

.question-tag {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #d9ddff;
}

.question-difficulty {
  background: #f3f4f6;
  color: #344054;
  border: 1px solid #e5e7eb;
}

.question-wrapper {
  margin-bottom: 24px;
}

.question-statement {
  font-size: 1.08rem;
  line-height: 1.78;
  margin: 0 0 16px;
  color: var(--text);
}

.question-code {
  margin: 0;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent),
    var(--code-bg);
  color: var(--code-text);
  font-size: 0.98rem;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: "Consolas", "Courier New", monospace;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.answers {
  display: grid;
  gap: 14px;
}

.answer-btn {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.answer-btn:hover {
  transform: translateY(-2px);
  border-color: #bfc9ff;
  background: linear-gradient(180deg, #ffffff, #f8faff);
  box-shadow: 0 14px 26px rgba(79, 70, 229, 0.09);
}

.answer-btn:active {
  transform: translateY(0);
}

.option-label {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-dark);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.answer-btn pre {
  margin: 0;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.93rem;
  line-height: 1.65;
  text-align: left;
  white-space: pre-wrap;
  color: inherit;
}

.answer-btn.correct {
  border-color: #b7efc5;
  background: linear-gradient(180deg, #f4fff7, var(--success-bg));
  color: var(--success-dark);
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.12);
}

.answer-btn.correct .option-label {
  background: #dcfce7;
  color: var(--success-dark);
}

.answer-btn.incorrect {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff7f7, var(--danger-bg));
  color: var(--danger-dark);
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(220, 38, 38, 0.1);
}

.answer-btn.incorrect .option-label {
  background: #fee2e2;
  color: var(--danger-dark);
}

.answer-btn.disabled {
  cursor: not-allowed;
  opacity: 0.98;
}

.feedback-box {
  display: none;
  margin-top: 24px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow-sm);
}

.feedback-box.show {
  display: block;
}

.feedback-box h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.feedback-box p {
  margin: 0;
  color: #334155;
  line-height: 1.65;
}

.actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(79, 70, 229, 0.28);
}

.btn-primary:disabled,
.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.hidden {
  display: none;
}

.result-content {
  text-align: center;
  padding: 34px 8px 10px;
}

.result-icon {
  font-size: 3.4rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 10px 18px rgba(79, 70, 229, 0.18));
}

.result-content h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.result-score {
  font-size: 1.18rem;
  margin-bottom: 12px;
  color: var(--text);
}

.result-message {
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 26px;
  line-height: 1.75;
  font-size: 1rem;
}

.result-actions {
  display: flex;
  justify-content: center;
}

#startQuizBtn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  padding: 16px 28px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#startQuizBtn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.35);
}

#startQuizBtn:active {
  transform: scale(0.97);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.2);
}

#startQuizBtn:focus {
  outline: 3px solid rgba(124, 58, 237, 0.4);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .quiz-card {
    padding: 22px;
    border-radius: 22px;
  }

  .brand h1 {
    font-size: 1.55rem;
  }

  .question-statement {
    font-size: 1rem;
  }

  .question-code {
    font-size: 0.92rem;
    padding: 18px;
  }

  .answer-btn {
    padding: 15px 15px;
  }

  .option-label {
    min-width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(96%, 96%);
    margin-top: 18px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar-stats {
    width: 100%;
  }

  .stat-box {
    flex: 1 1 120px;
  }

  .quiz-card {
    padding: 18px;
  }

  .question-code {
    line-height: 1.58;
  }

  .answer-btn pre {
    font-size: 0.88rem;
  }

  .btn {
    width: 100%;
  }

  .actions {
    justify-content: stretch;
  }
}


.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1f2a44;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(79, 70, 229, 0.16);
  padding: 12px 18px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.98rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
  transition: all 0.22s ease;
  width: fit-content;
  margin-bottom: 18px;
}

.back-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(79, 70, 229, 0.32);
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.14);
}

.back-btn:active {
  transform: translateY(0) scale(0.98);
}

.back-btn:focus {
  outline: 3px solid rgba(124, 58, 237, 0.25);
  outline-offset: 3px;
}

.back-btn__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  color: #3730a3;
  font-size: 1rem;
  font-weight: 900;
  flex-shrink: 0;
}

.back-btn__text {
  line-height: 1;
}