:root {
  --bg-primary: #f4f6f9;
  --surface-color: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --border-color: #e5e7eb;
  --success-color: #059669;
  --error-color: #dc2626;
  --warning-color: #d97706;
  --radius-lg: 16px;
  --radius-md: 8px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --surface-color: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-color: #3b82f6;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Accessibility Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.app-container {
  width: 100%;
  max-width: 680px;
}

.quiz-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.quiz-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

/* Mode Toggle Styles */
.mode-toggle {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border: none;
  background: var(--surface-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.mode-toggle label {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Progress Bar */
.progress-container {
  background-color: var(--border-color);
  height: 8px;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

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

/* Card Container */
.card {
  background-color: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.badge {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Explicitly control the h2 question text so it doesn't default to massive */
#questionText {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.option-btn:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.05);
}

.option-btn.selected {
  border-color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.15);
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.btn {
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s;
  min-height: 48px;
}

.btn.primary {
  background-color: var(--primary-color);
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.secondary {
  background-color: var(--border-color);
  color: var(--text-main);
}

/* Instant Feedback Box */
.feedback-box {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.feedback-box.correct {
  background-color: rgba(5, 150, 105, 0.1);
  border: 1px solid var(--success-color);
  color: var(--success-color);
}

.feedback-box.incorrect {
  background-color: rgba(220, 38, 38, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

/* Results Panel */
.hidden {
  display: none;
}

.score-visual-wrapper {
  position: relative;
  margin: 1.5rem 0;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.score-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  background-image: repeating-linear-gradient(45deg,
      transparent,
      transparent 15px,
      var(--warning-color) 15px,
      var(--warning-color) 30px);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-badge {
  position: relative;
  z-index: 1;
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--text-main);
  background-color: var(--surface-color);
  padding: 0.25rem 1.25rem;
  border-radius: 999px;
  border: 3px solid var(--border-color);
  box-shadow: var(--shadow);
}

.feedback-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.feedback-block {
  padding: 1rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--border-color);
}

.strengths {
  background: rgba(5, 150, 105, 0.08);
  border-color: var(--success-color);
}

.improvements {
  background: rgba(217, 119, 6, 0.08);
  border-color: var(--warning-color);
}

/* Past Scores */
.past-scores {
  background: rgba(37, 99, 235, 0.05);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.past-scores h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.past-scores ul {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.past-scores li {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid;
}

.past-scores li.score-fail {
  background: rgba(220, 38, 38, 0.1);
  border-color: var(--error-color);
  color: var(--error-color);
}

.past-scores li.score-pass-low {
  background: rgba(217, 119, 6, 0.1);
  border-color: var(--warning-color);
  color: var(--warning-color);
}

.past-scores li.score-pass-high {
  background: rgba(5, 150, 105, 0.1);
  border-color: var(--success-color);
  color: var(--success-color);
}

/* Resources Section */
.resources-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.resources-section h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

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

.resource-tile {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.resource-tile:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  background-color: rgba(37, 99, 235, 0.03);
}

.resource-tile h4 {
  font-size: 0.95rem;
  color: var(--primary-color);
  margin-bottom: 0.35rem;
}

.resource-tile p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}


/* ==========================================================================
   MOBILE RESPONSIVE BREAKPOINTS (AGGRESSIVE VERTICAL COMPRESSION)
   ========================================================================== */

@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: flex-start;
    /* Prevents tiny screens from cutting off the top header */
  }

  .app-container {
    padding: 0.5rem;
  }

  /* Compress Header */
  .quiz-header {
    margin-bottom: 0.5rem;
  }

  .quiz-header h1 {
    font-size: 1.25rem;
  }

  .quiz-header p {
    font-size: 0.8rem;
    margin-bottom: 0;
  }

  /* Compress Mode Toggle */
  .mode-toggle {
    flex-direction: row;
    /* Keep side-by-side to save vertical space if it fits */
    justify-content: center;
    padding: 0.4rem 0.5rem;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .mode-toggle label {
    font-size: 0.75rem;
  }

  /* Compress Progress Bar */
  .progress-container {
    height: 6px;
    margin-bottom: 0.75rem;
  }

  /* Compress Main Card */
  .card {
    padding: 1rem;
  }

  .question-header {
    margin-bottom: 0.5rem;
  }

  .badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
  }

  #questionCounter {
    font-size: 0.8rem;
  }

  /* Fix Massive Question Text */
  #questionText {
    font-size: 1.05rem;
    line-height: 1.35;
    margin-bottom: 0.75rem;
  }

  /* Compress Options */
  .options-grid {
    gap: 0.35rem;
    margin-bottom: 0.75rem;
  }

  .option-btn {
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
    min-height: 40px;
    /* Still touch-friendly but much shorter */
  }

  /* Compress Next Button & Feedback Box */
  .feedback-box {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
  }

  .btn {
    padding: 0.65rem;
    font-size: 0.95rem;
    min-height: 44px;
  }

  /* Compress Results Screen Elements for Mobile */
  .score-visual-wrapper {
    height: 60px;
    margin: 1rem 0;
  }

  .score-badge {
    font-size: 1.6rem;
    padding: 0.2rem 1rem;
  }

  .past-scores {
    padding: 0.75rem;
  }

  .past-scores li {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

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

/* END OF STYLE.CSS */