/* =============================================================
   ClarityNCLEX — Quiz Component Styles
   Builds on nclex.css (indigo) + base styles.css
   ============================================================= */

/* ── Quiz shell ───────────────────────────────────────────── */
#nclex-app,
.nclex-app {
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font-body);
}

/* ── Start screen ─────────────────────────────────────────── */
#start-screen,
.nclex-start {
  max-width: 600px;
  margin: 0 auto;
  padding: 80px 24px;
  text-align: center;
}

.nclex-start h1 {
  font-family: var(--font-heading);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.nclex-start .subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 40px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Quiz mode selector ───────────────────────────────────── */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 32px;
  text-align: left;
}

.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 22px 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.mode-card:hover {
  border-color: #4f46e5;
  background: rgba(79,70,229,0.03);
  transform: translateY(-1px);
}

.mode-card.selected {
  border-color: #4f46e5;
  background: rgba(79,70,229,0.05);
}

.mode-card-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.mode-card h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mode-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Question count picker ────────────────────────────────── */
.count-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.count-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.count-btn:hover,
.count-btn.active {
  border-color: #4f46e5;
  color: #4f46e5;
  background: rgba(79,70,229,0.05);
}

/* ── Start button ─────────────────────────────────────────── */
#start-btn,
.btn-start {
  background: #4f46e5;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 40px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

#start-btn:hover,
.btn-start:hover {
  background: #3730a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,70,229,0.3);
}

/* ── Quiz active view ─────────────────────────────────────── */
#quiz-view,
.quiz-view {
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

/* ── Top bar: progress + controls ────────────────────────── */
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.quiz-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.quiz-progress {
  flex: 1;
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

.quiz-score-live {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Question card ────────────────────────────────────────── */
.nclex-question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 40px 40px 32px;
  margin-bottom: 16px;
}

.nclex-question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.nclex-q-number {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
}

.nclex-q-category {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: #e0e7ff;
  color: #4f46e5;
  letter-spacing: 0.03em;
}

.nclex-question-text {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 28px;
}

/* ── Answer options ───────────────────────────────────────── */
.nclex-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nclex-answer {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text-primary);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, border-left 0.08s;
  line-height: 1.55;
}

.nclex-answer:hover {
  border-color: #4f46e5;
  border-left: 4px solid #4f46e5;
  padding-left: 15px;
  background: rgba(79,70,229,0.03);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.nclex-answer.selected {
  border-color: #4f46e5;
  border-left: 4px solid #4f46e5;
  padding-left: 15px;
  background: rgba(79,70,229,0.05);
}

.nclex-answer.correct {
  border-color: #86efac;
  border-left: 4px solid #16a34a;
  padding-left: 15px;
  background: #f0fdf4;
  color: #166534;
}

.nclex-answer.incorrect {
  border-color: #fca5a5;
  border-left: 4px solid #dc2626;
  padding-left: 15px;
  background: #fef2f2;
  color: #991b1b;
}

.nclex-answer.disabled {
  pointer-events: none;
  opacity: 0.65;
}

.nclex-answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
  transition: background 0.15s, color 0.15s;
}

.nclex-answer.correct .nclex-answer-letter {
  background: #16a34a;
  color: #fff;
}

.nclex-answer.incorrect .nclex-answer-letter {
  background: #dc2626;
  color: #fff;
}

.nclex-answer.selected .nclex-answer-letter {
  background: #4f46e5;
  color: #fff;
}

/* ── Rationale panel ──────────────────────────────────────── */
.nclex-rationale {
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 24px 28px;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  animation: fadeSlideIn 0.2s ease;
}

.nclex-rationale-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.nclex-rationale.correct-rationale {
  border-left: 3px solid #16a34a;
  background: #f0fdf4;
}

.nclex-rationale.incorrect-rationale {
  border-left: 3px solid #dc2626;
  background: #fef2f2;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Action row ───────────────────────────────────────────── */
.nclex-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 20px;
  gap: 12px;
}

.nclex-btn-submit,
.nclex-btn-next {
  background: #4f46e5;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.nclex-btn-submit:hover,
.nclex-btn-next:hover {
  background: #3730a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}

.nclex-btn-skip {
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 9999px;
  border: 1.5px solid rgba(0,0,0,0.12);
  transition: all 0.15s;
}

.nclex-btn-skip:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

/* ── Results screen ───────────────────────────────────────── */
#results-screen,
.nclex-results {
  max-width: 560px;
  margin: 60px auto;
  padding: 0 24px 80px;
  text-align: center;
}

.nclex-score-ring {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  position: relative;
}

.nclex-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.nclex-score-ring .ring-bg {
  fill: none;
  stroke: rgba(0,0,0,0.08);
  stroke-width: 8;
}

.nclex-score-ring .ring-fill {
  fill: none;
  stroke: #4f46e5;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4,0,0.2,1);
}

.nclex-score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nclex-score-pct {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.nclex-score-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nclex-results-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.nclex-results-sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

.nclex-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 32px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.nclex-result-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nclex-stat-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
}

.nclex-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nclex-results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .nclex-question-card  { padding: 24px 20px; }
  .quiz-view, #quiz-view { padding: 24px 16px 60px; }
  .nclex-question-text  { font-size: 18px; }
  .mode-grid            { grid-template-columns: 1fr; }

  /* Start screen */
  #start-screen, .nclex-start { padding: 48px 16px; }

  /* Top bar — allow wrap so counter/score don't overflow */
  .quiz-topbar { flex-wrap: wrap; gap: 8px; }
  .quiz-counter, .quiz-score-live { font-size: 12px; }

  /* Game bar wrap */
  #game-bar { flex-wrap: wrap; gap: 10px; }

  .nclex-results-actions { flex-direction: column; }
  .nclex-results-actions .btn,
  .nclex-results-actions button { width: 100%; }
}

@media (max-width: 480px) {
  /* Start screen */
  #start-screen, .nclex-start { padding: 32px 16px; }

  /* Question card */
  .nclex-question-card { padding: 18px 16px; }
  .nclex-question-text { font-size: 17px; }
  .nclex-rationale     { padding: 18px 16px; }

  /* Results */
  .nclex-results-title { font-size: 26px; }
  /* Stack stats to single column on narrow phones */
  .nclex-result-stats  { grid-template-columns: 1fr; gap: 12px; text-align: center; }

  /* Action buttons full-width */
  .nclex-actions { flex-direction: column; }
  .nclex-btn-submit,
  .nclex-btn-next,
  .nclex-btn-skip { width: 100%; justify-content: center; }

  /* Game bar stack */
  #game-bar    { flex-direction: column; align-items: flex-start; gap: 8px; }
  #xp-bar-wrap { width: 100%; }
}

/* === GAMIFICATION LAYER === */
#game-bar { display:flex; align-items:center; gap:16px; padding:8px 0; margin-bottom:12px; }
#streak-counter { font-family:'JetBrains Mono',monospace; font-size:14px; color:#8b949e; transition:color .3s; }
#streak-counter.streak-hot { color:#f59e0b; text-shadow:0 0 12px #f59e0b; }
#streak-counter.streak-fire { color:#ef4444; animation:streakPulse .6s ease infinite alternate; }
#xp-bar-wrap { flex:1; }
#level-label { font-size:11px; color:#8b949e; text-transform:uppercase; letter-spacing:.08em; margin-bottom:4px; display:block; }
#xp-bar-fill { height:4px; border-radius:2px; background:linear-gradient(90deg,#00d4ff,#7c3aed); transition:width .4s ease; }
.diff-chip { font-size:10px; font-family:'JetBrains Mono',monospace; padding:2px 8px; border-radius:10px; text-transform:uppercase; letter-spacing:.06em; }
.diff-chip.diff-easy { background:rgba(16,185,129,.15); color:#10b981; border:1px solid rgba(16,185,129,.3); }
.diff-chip.diff-medium { background:rgba(245,158,11,.15); color:#f59e0b; border:1px solid rgba(245,158,11,.3); }
.diff-chip.diff-hard { background:rgba(239,68,68,.15); color:#ef4444; border:1px solid rgba(239,68,68,.3); }
.badge-card { padding:24px; border-radius:16px; text-align:center; margin-top:24px; background:rgba(255,255,255,.04); }
.badge-card.gold { border:2px solid #f59e0b; box-shadow:0 0 24px rgba(245,158,11,.3); }
.badge-card.cyan { border:2px solid #00d4ff; box-shadow:0 0 24px rgba(0,212,255,.3); }
.badge-card.green { border:2px solid #10b981; box-shadow:0 0 16px rgba(16,185,129,.2); }
.badge-card.amber { border:1px solid rgba(245,158,11,.4); }
.badge-icon { font-size:48px; display:block; margin-bottom:8px; }
.badge-title { font-size:20px; font-weight:700; color:#f0f6fc; }
.badge-score { font-family:'JetBrains Mono',monospace; font-size:14px; color:#8b949e; margin-top:4px; }
@keyframes streakPulse { from { text-shadow:0 0 8px #ef4444; } to { text-shadow:0 0 20px #ef4444; } }
@keyframes levelUp { 0%,100% { box-shadow:none; } 50% { box-shadow:0 0 20px rgba(0,212,255,.8); } }
