@charset "utf-8";

/* ═══════════════════════════════════════
   CSS VARIABLES
═══════════════════════════════════════ */
:root {
  /* Brand */
  --red:         #E63946;
  --blue-dark:   #1D3557;
  --yellow:      #F1C40F;

  /* UI */
  --blue-soft:   #457B9D;
  --warm-light:  #F8F3E7;
  --gray-dark:   #2F3437;

  /* Feedback */
  --green:       #2ECC71;
  --orange:      #F39C12;

  /* Neutrals */
  --white:       #FFFFFF;
  --border:      rgba(29, 53, 87, 0.15);

  /* Typography */
  --font-body:    'Work Sans', 'Helvetica Neue', sans-serif;
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Fluid type */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(29,53,87,0.08);
  --shadow-md: 0 4px 12px rgba(29,53,87,0.12);

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--warm-light);
  color: var(--gray-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.quiz-header {
  background: var(--blue-dark);
  width: 100%;
}

.header-inner {
  max-width: 800px;
  margin-inline: auto;
  padding: var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-inner img {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.program-name {
  font-family: var(--font-display);
  color: rgba(255,255,255,0.8);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quiz-title {
  font-family: var(--font-display);
  color: var(--white);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.2;
}

/* ═══════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════ */
.quiz-main {
  max-width: 800px;
  margin-inline: auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ═══════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════ */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue-dark);
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue-soft);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ═══════════════════════════════════════
   QUESTION CARD
═══════════════════════════════════════ */
.question-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.question-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.question-badge {
  display: inline-block;
  background: var(--blue-dark);
  color: var(--white);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
  align-self: flex-start;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question-text {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--blue-dark);
  line-height: 1.4;
}

/* ═══════════════════════════════════════
   ANSWER OPTIONS
═══════════════════════════════════════ */
.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--warm-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--gray-dark);
  text-align: left;
  cursor: pointer;
  width: 100%;
  min-height: 44px;
  transition: background var(--transition), border-color var(--transition);
}

.option:hover:not(:disabled):not(.selected) {
  border-color: var(--blue-soft);
  background: rgba(69, 123, 157, 0.08);
}

.option.selected {
  border-color: var(--blue-soft);
  background: rgba(69, 123, 157, 0.08);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--blue-dark);
  color: var(--white);
  font-weight: 700;
  font-size: var(--text-xs);
  border-radius: 50%;
  transition: background var(--transition);
}

.option-text {
  flex: 1;
  line-height: 1.45;
}

.option.correct {
  background: rgba(46, 204, 113, 0.12);
  border-color: var(--green);
}

.option.correct .option-letter { background: var(--green); }

.option.incorrect {
  background: rgba(230, 57, 70, 0.12);
  border-color: var(--red);
}

.option.wrong {
  background: rgba(230, 57, 70, 0.12);
  border-color: var(--red);
}

.option.wrong .option-letter { background: var(--red); }

.option:disabled {
  cursor: default;
  pointer-events: none;
}

/* ═══════════════════════════════════════
   FEEDBACK BOX
═══════════════════════════════════════ */
.feedback-box {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feedback-box.correct {
  background: rgba(46, 204, 113, 0.1);
  border-left: 4px solid var(--green);
}

.feedback-box.incorrect {
  background: rgba(230, 57, 70, 0.1);
  border-left: 4px solid var(--red);
}

.feedback-result {
  font-weight: 600;
  color: var(--gray-dark);
  line-height: 1.5;
}

.feedback-text {
  color: var(--gray-dark);
  line-height: 1.6;
  margin: 0;
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn-row,
.nav-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.btn-submit,
.btn-next {
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  transition: background var(--transition), opacity var(--transition);
}

.btn-submit {
  background: var(--red);
  color: var(--white);
}

.btn-submit:hover:not(:disabled) { background: #c1121f; }

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-next {
  background: var(--blue-dark);
  color: var(--white);
}

.btn-next:hover { background: var(--blue-soft); }

.btn-prev {
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--blue-dark);
  border: none;
  color: var(--white);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  transition: background var(--transition);
}

.btn-prev:hover { background: var(--blue-soft); }

/* ═══════════════════════════════════════
   SCORE SCREEN
═══════════════════════════════════════ */
.score-screen {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-10) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.score-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--blue-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.score-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--blue-dark);
  line-height: 1;
}

.score-pct {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 600;
  line-height: 1;
}

.score-msg {
  font-size: var(--text-base);
  color: var(--gray-dark);
  max-width: 440px;
  line-height: 1.6;
}

.btn-retry {
  background: var(--blue-soft);
  color: var(--white);
  padding: var(--space-3) var(--space-8);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  margin-top: var(--space-2);
  transition: background var(--transition);
}

.btn-retry:hover { background: var(--blue-dark); }

/* ═══════════════════════════════════════
   FOCUS VISIBLE (ACCESSIBILITY)
═══════════════════════════════════════ */
.option:focus-visible,
.btn-submit:focus-visible,
.btn-next:focus-visible,
.btn-retry:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

/* FOOTER NAV */
.main-footer-nav {
  background-color: #1D3557;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.main-footer-nav-btn {
  display: inline-block;
  background-color: #F5B041;
  color: #2F3437;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 24px;
  border-radius: 4px;
  transition: background-color 0.2s;
  text-decoration: none;
}


/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════════════ */
@media (max-width: 480px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .question-card { padding: var(--space-4); gap: var(--space-4); }
  .score-screen { padding: var(--space-6) var(--space-4); }
  .btn-submit,
  .btn-next,
  .btn-retry { width: 100%; justify-content: center; }
  .btn-row { flex-direction: column; }
}

/* ═══════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
