/* ══════════════════════════════════════
   Quiz screens — structural styles
   ══════════════════════════════════════ */

/* ── Screen header (back button + title) ── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 0.5px solid var(--border);
  background: none;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.back-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-dim);
}

.screen-header-title {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-primary);
}


/* ── Topic cards (sub-menu within a section) ── */
.topic-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.topic-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.topic-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-dim);
}

.topic-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.topic-card-title {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--text-primary);
}

.topic-card-desc {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* ── Detail screen ── */
.detail-wrap {
  max-width: 480px;
}

.detail-title {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.detail-desc {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.detail-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.detail-start {
  width: 100%;
}


/* ── Progress bar ── */
.progress-wrap {
  margin-bottom: 24px;
}

.progress-bar-bg {
  height: 3px;
  background: var(--bg-muted);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.3s ease;
}

.progress-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-tertiary);
}


/* ── Question card ── */
.question-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
}

.question-text {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 20px;
}


/* ── MC options ── */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

@media (hover: hover) {
  .option-btn:hover {
    background: var(--bg-overlay);
    border-color: var(--accent-dim);
    color: var(--text-primary);
  }
}

.option-btn.correct {
  background: var(--success-fill);
  border-color: var(--success-border);
  color: var(--success);
}

.option-btn.incorrect {
  background: var(--danger-fill);
  border-color: var(--danger-border);
  color: var(--danger);
}


/* ── Type-in input ── */
.type-input-wrap {
  display: flex;
  gap: 8px;
}

.type-input-wrap .inp {
  flex: 1;
}


/* ── Feedback strip ── */
.feedback {
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
}

.feedback-correct {
  background: var(--success-fill);
  border: 0.5px solid var(--success-border);
  color: var(--success);
}

.feedback-incorrect {
  background: var(--danger-fill);
  border: 0.5px solid var(--danger-border);
  color: var(--danger);
}


/* ── Setup screen (difficulty/chip selectors) ── */
.setup-wrap {
  max-width: 480px;
}

.setup-group {
  margin-bottom: 24px;
}

.setup-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.setup-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.setup-opt {
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 0.5px solid var(--border);
  background: var(--bg-elevated);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex: 1;
  text-align: center;
  min-width: fit-content;
}

@media (hover: hover) {
  .setup-opt:hover {
    background: var(--bg-overlay);
    border-color: var(--accent-dim);
    color: var(--text-primary);
  }
}

.setup-opt.selected {
  background: var(--accent-subtle);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.setup-start {
  width: 100%;
  margin-top: 8px;
}

/* ── Cheat sheet (collapsible) ── */
.cheat-sheet {
  margin-bottom: 16px;
}

.cheat-sheet-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.cheat-sheet-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-dim);
}

.cheat-sheet-icon {
  font-size: 14px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.cheat-sheet.open .cheat-sheet-icon {
  transform: rotate(90deg);
}

.cheat-sheet-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.cheat-sheet.open .cheat-sheet-content {
  max-height: 800px;
}

.cheat-sheet-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
}

.cheat-sheet-table th {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
  text-align: left;
  background: var(--bg-surface);
}

.cheat-sheet-table td {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
}

.cheat-sheet-table tr:last-child td {
  border-bottom: none;
}

.cheat-sheet-table td:last-child {
  font-family: var(--mono);
  color: var(--accent);
  text-align: right;
}

/* ── Multi-select options ── */
.setup-options-multi {
  flex-wrap: wrap;
}

.setup-options-multi .setup-opt {
  flex: 0 0 auto;
  min-width: 44px;
}

/* ── MC options ── */
.mc-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.mc-options .option-btn {
  text-align: center;
}


/* ── Live stats header ── */
.live-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}

.live-stats-score {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-primary);
}

.live-stats-score .stat-dim {
  color: var(--text-tertiary);
}

.live-stats-quit {
  padding: 5px 14px;
  border-radius: var(--r-md);
  border: 0.5px solid var(--border);
  background: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.live-stats-quit:hover {
  color: var(--text-primary);
  border-color: var(--accent-dim);
}

.live-stats-progress {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-tertiary);
}


/* ── Endless question display ── */
.question-prompt {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 300;
  color: var(--text-primary);
  text-align: center;
  padding: 32px 0 28px;
  letter-spacing: -.01em;
}

.question-prompt .prompt-highlight {
  color: var(--accent);
}

.answer-form {
  display: flex;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
}

.answer-form:has(.answer-fields) {
  flex-wrap: wrap;
  max-width: 380px;
}

.answer-form:has(.mc-options) {
  max-width: 100%;
}

.answer-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 18px;
  padding: 12px 16px;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.answer-input:focus {
  border-color: var(--accent-dim);
}

.answer-input::placeholder {
  color: var(--text-tertiary);
  font-size: 14px;
}

.answer-submit {
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 0.5px solid var(--accent);
  background: var(--accent);
  color: var(--bg-base);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.12s;
  flex-shrink: 0;
}

.answer-submit:hover { opacity: 0.82; }
.answer-submit:active { transform: scale(0.98); }


/* ── Multi-field answers ── */
.answer-fields {
  display: flex;
  gap: 8px;
  width: 100%;
}

.answer-field {
  flex: 1;
  min-width: 0;
}

.answer-field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-align: center;
}

.answer-field .answer-input {
  width: 100%;
}

.answer-submit-block {
  width: 100%;
  margin-top: 12px;
}


/* ── Inline feedback flash ── */
.answer-feedback {
  text-align: center;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 13px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

.question-card:has(.answer-fields) .answer-feedback {
  max-width: 380px;
}

.question-card:has(.mc-options) .answer-feedback {
  max-width: 400px;
}

.answer-feedback.visible {
  opacity: 1;
}

.answer-feedback.is-correct {
  background: var(--success-fill);
  border: 0.5px solid var(--success-border);
  color: var(--success);
}

.answer-feedback.is-incorrect {
  background: var(--danger-fill);
  border: 0.5px solid var(--danger-border);
  color: var(--danger);
}


/* ── Results stats grid ── */
.results-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  max-width: 360px;
  margin: 0 auto 32px;
}

.results-stat-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 10px;
}

.results-stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.results-stat-label {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-tertiary);
}


/* ── Results screen ── */
.results-wrap {
  text-align: center;
  padding-top: 32px;
}

.results-score {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.results-label {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  margin: 0 auto;
}
