/* Shared stylesheet for every CCE 114 self-check quiz. One file, so a fix here reaches
   every quiz at once. Pages are generated by tools/build_quiz.py from tools/quizzes/*.py. */
:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --primary: #002e5d;          /* BYU navy, the course site's primary */
  --primary-hover: #001f3f;
  --accent: #0062b8;
  --success: #0f7b3f;
  --success-bg: #f0faf4;
  --success-text: #0b4f29;
  --danger: #b3261e;
  --danger-bg: #fdf2f1;
  --danger-text: #7a1a15;
  --border: #dde3ea;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

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

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

h1 { font-size: 1.6rem; margin-bottom: 0.5rem; color: var(--primary); }

p.subtitle { color: var(--muted); font-size: 0.95rem; line-height: 1.45; }

.score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.quiz-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.section-badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.prompt {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  color: #10243a;
}

.setup {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
  line-height: 1.45;
}

.options { display: grid; gap: 0.7rem; margin-bottom: 1.25rem; }

button.opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 500;
  border: 2px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

button.opt-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--primary);
  background: #eef5fc;
}

button.opt-btn:disabled { cursor: default; }

.opt-letter {
  flex: 0 0 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

button.correct {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

button.incorrect {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #ffffff !important;
}

button.correct .opt-letter,
button.incorrect .opt-letter { color: #ffffff; }

.feedback {
  display: none;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.feedback.visible { display: block; }

.feedback.correct-box {
  background-color: var(--success-bg);
  border-left: 4px solid var(--success);
  color: var(--success-text);
}

.feedback.incorrect-box {
  background-color: var(--danger-bg);
  border-left: 4px solid var(--danger);
  color: var(--danger-text);
}

.feedback strong { display: block; margin-bottom: 0.25rem; }

.controls { display: flex; justify-content: flex-end; }

button.next-btn {
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: none;
}

button.next-btn:hover { background: var(--primary-hover); }

.final-screen { display: none; text-align: center; padding: 2rem 1rem; }

.final-screen h2 { font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--primary); }

.final-score {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1rem;
}

.checklist {
  text-align: left;
  display: inline-block;
  margin: 0.5rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

button.restart-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 1.5rem;
}

footer.page-foot {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

footer.page-foot a { color: var(--muted); }

/* Phones: this quiz is meant to be scanned off a slide and answered on a handset. */
@media (max-width: 480px) {
  body { padding: 1rem 0.75rem; }
  h1 { font-size: 1.25rem; }
  .quiz-card { padding: 1.1rem; }
  .prompt { font-size: 1.05rem; }
  .options { gap: 0.55rem; }
  button.opt-btn { padding: 0.9rem 0.7rem; font-size: 0.95rem; }
  .controls { justify-content: stretch; }
  button.next-btn { width: 100%; padding: 0.8rem 1rem; }
}

/* The course site has a dark scheme and a lecture hall is a dark room, so follow the phone's
   setting rather than firing a white page at someone in the back row. Same tokens, redefined. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1c2129;
    --text: #e3e8ee;
    --muted: #9aa7b6;
    --primary: #7aa9dc;
    --primary-hover: #93bbe8;
    --accent: #7aa9dc;
    --success: #2f9e63;
    --success-bg: #14291d;
    --success-text: #9fe0bb;
    --danger: #e0685f;
    --danger-bg: #2c1817;
    --danger-text: #f3b5b0;
    --border: #2d343e;
  }

  .prompt { color: var(--text); }
  button.opt-btn { background: #232932; color: var(--text); }
  button.opt-btn:hover:not(:disabled) { background: #2b3440; color: #cfe0f2; }
  button.next-btn, button.restart-btn { color: #0f1419; font-weight: 700; }
}

/* Keyboard: the buttons are reachable with Tab, so make the focus ring obvious. */
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* The end-of-quiz list of what you got wrong. */
.review {
  text-align: left;
  margin: 1.25rem 0 0;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.review h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.review li {
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 0.7rem;
  color: var(--text);
}

.review li span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}
