/* Quiz-specific styles. Loaded after /assets/shared.css. */

/* ---------- Local color tokens ---------- */
:root {
  --green: #2f6e3f;
  --green-soft: #e2ecdc;
  --red: #8b1a1a;
  --red-soft: #efd9d3;
}

/* ---------- Quiz-page container (slightly slimmer than shared .page) ---------- */
.quiz-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}
.quiz-page-wide { max-width: 880px; margin: 0 auto; padding: 56px 32px 96px; }

.page-head {
  text-align: center;
  margin-bottom: 36px;
}
.page-head .section-label {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.page-head h1 {
  font-family: var(--serif-cn);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}
.page-head .subtitle {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15.5px;
  color: var(--muted);
  margin-bottom: 0;
}

.intro {
  font-family: var(--serif-en);
  font-size: 16px;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 30px;
  text-align: center;
}
.intro a { color: var(--accent); border-bottom: 1px dotted var(--accent-soft); }
.intro a:hover { color: var(--ink); }

/* ---------- Tag pills ---------- */
.tag-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tag {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  border: 1px solid var(--gold);
  padding: 3px 10px;
  border-radius: 2px;
  background: transparent;
  display: inline-block;
}
.tag.type {
  color: var(--ink-soft);
  border-color: var(--line);
}

/* ---------- Quiz title (per-question page) ---------- */
h1.title {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.25;
}
.subtitle {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 32px;
}
.page-head .subtitle { margin-bottom: 0; }

/* ---------- Question body ---------- */
.question {
  font-family: var(--serif-en);
  font-size: 18.5px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg-soft);
  border-left: 3px solid var(--gold);
  padding: 22px 26px;
  margin-bottom: 32px;
}
.question .image { margin: 16px 0 4px; text-align: center; }
.question .image img { max-width: 100%; border: 1px solid var(--line); }
.question code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg);
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

/* ---------- Choices ---------- */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.choice {
  font-family: var(--serif-en);
  font-size: 17px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 14px 20px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-radius: 2px;
}
.choice:hover:not(:disabled) { border-color: var(--ink); background: var(--bg-soft); }
.choice .letter {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.choice .body { flex: 1; }
.choice:disabled { cursor: default; }
.choice.correct { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.choice.correct .letter { color: var(--green); }
.choice.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.choice.wrong .letter { color: var(--red); }
.choice.dim { opacity: 0.5; }

/* ---------- Input ---------- */
.input-area {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.text-input {
  flex: 1;
  min-width: 200px;
  font-family: var(--serif-en);
  font-size: 17px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
  border-radius: 2px;
  transition: border-color .15s;
}
.text-input:focus { border-color: var(--ink); }
.text-input.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.text-input.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.input-hint {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 18px;
}

/* ---------- Passive ---------- */
.passive-prompt {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  padding: 18px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin-bottom: 22px;
}

/* ---------- Feedback ---------- */
.feedback {
  font-family: var(--serif-cn);
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 24px;
  min-height: 24px;
}
.feedback.correct { color: var(--green); }
.feedback.wrong { color: var(--red); }

/* ---------- Action row ---------- */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  align-items: center;
}
.actions .spacer { flex: 1 1 0; min-width: 0; }

/* shared.css uses .btn-ghost; alias .btn.ghost so the engine markup keeps working */
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--bg-soft); border-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Anchor-styled buttons (Back/Next) */
.btn-link {
  font-family: var(--serif-cn);
  font-size: 15px;
  letter-spacing: 0.06em;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border-radius: 2px;
  border-bottom: none;
  transition: background .2s, border-color .2s, color .2s;
}
.btn-link.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-link.ghost:hover { background: var(--bg-soft); border-color: var(--ink); border-bottom: 1px solid var(--ink); }
.btn-link.solid {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}
.btn-link.solid:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- Explanation ---------- */
.explanation {
  background: #fff;
  border: 1px solid var(--line);
  padding: 24px 28px;
  font-family: var(--serif-en);
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink-soft);
  border-radius: 2px;
}
.explanation h3 {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0 0 14px;
  text-transform: uppercase;
}
.explanation p { margin: 0 0 12px; }
.explanation p:last-child { margin-bottom: 0; }
.explanation strong { color: var(--ink); font-weight: 500; }

/* ---------- Source attribution ---------- */
.source {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--serif-en);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
}
.source a { color: var(--accent); border-bottom: 1px dotted var(--accent-soft); }
.source a:hover { color: var(--ink); }

/* ---------- Index page: progress card ---------- */
.progress-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 22px 26px;
  margin-bottom: 36px;
  border-radius: 2px;
}
.progress-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.progress-card-title {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
}
.progress-card-stat {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
}
.progress-bar {
  height: 6px;
  background: var(--bg-soft);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  transition: width .3s ease;
}
.reset-link {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
  text-align: right;
}
.reset-link a {
  color: var(--muted);
  border-bottom: 1px dotted var(--line);
  text-decoration: none;
  cursor: pointer;
}
.reset-link a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Quiz list (grouped by tag) ---------- */
.tag-section { margin-bottom: 36px; }
.tag-section h2 {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--ink);
  text-transform: uppercase;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.quiz-list { display: flex; flex-direction: column; }
.quiz-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
  transition: background .15s;
  border-bottom-color: var(--line-soft);
}
.quiz-item:hover { background: var(--bg-soft); border-bottom-color: var(--line-soft); }
.quiz-item .status {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 11px;
  background: #fff;
}
.quiz-item .status.correct { border-color: var(--green); background: var(--green); color: #fff; }
.quiz-item .status.wrong { border-color: var(--red); background: var(--red); color: #fff; }
.quiz-item .status.viewed { border-color: var(--gold); background: var(--gold); color: #fff; }
.quiz-item .name {
  font-family: var(--serif-en);
  font-size: 17.5px;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.quiz-item .name .num {
  font-family: var(--display);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.quiz-item .meta {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.quiz-item .meta .badge {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 2px;
}

.empty-state {
  font-family: var(--serif-en);
  font-style: italic;
  color: var(--muted);
  padding: 18px 0;
}

/* ---------- KaTeX size adjustment ---------- */
.katex { font-size: 1em; }
[hidden] { display: none !important; }
