/* ============================
   ROOT & RESET
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0f1a;
  --surface: #141624;
  --surface2: #1c1f33;
  --border: rgba(255,255,255,0.07);
  --text: #f0f2ff;
  --text-muted: #8b90b5;
  --correct: #22d38a;
  --correct-bg: rgba(34,211,138,0.12);
  --wrong: #ff5a7e;
  --wrong-bg: rgba(255,90,126,0.12);
  --accent1: #6C63FF;
  --accent2: #FF6584;
  --accent3: #43E8D8;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 8px 40px rgba(0,0,0,0.45);
  --transition: all 0.28s cubic-bezier(.4,0,.2,1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, textarea {
  font-family: inherit;
  color: inherit;
}

/* ============================
   SCREENS
   ============================ */
.screen {
  display: none;
  min-height: 100vh;
  position: relative;
}
.screen.active { display: flex; }

/* ============================
   ANIMATED ORBS
   ============================ */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.orb1 { width: 520px; height: 520px; background: var(--accent1); top: -180px; left: -120px; animation: drift1 12s ease-in-out infinite alternate; }
.orb2 { width: 400px; height: 400px; background: var(--accent2); bottom: -100px; right: -80px; animation: drift2 14s ease-in-out infinite alternate; }
.orb3 { width: 300px; height: 300px; background: var(--accent3); top: 40%; left: 50%; transform: translate(-50%,-50%); animation: drift3 10s ease-in-out infinite alternate; }

@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.08); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(-30px,-40px) scale(1.1); } }
@keyframes drift3 { from { transform: translate(-50%,-50%) scale(1); } to { transform: translate(-50%,-50%) scale(1.15); } }

/* ============================
   SELECT SCREEN
   ============================ */
#screen-select {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.select-bg { position: fixed; inset: 0; z-index: 0; }

.select-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  text-align: center;
}

.logo-area {
  margin-bottom: 3.5rem;
}

.logo-icon {
  font-size: 3.5rem;
  display: inline-block;
  animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(6deg); }
}

.logo-title {
  font-size: clamp(2.4rem, 6vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #6C63FF, #43E8D8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  margin-top: 0.4rem;
}

.logo-sub {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.select-heading {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2rem;
  letter-spacing: 0.01em;
}

/* Utility */
.hidden { display: none !important; }

/* Step transitions */
#step-subject, #step-exam {
  animation: fadeSlide 0.35s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Subject Cards ── */
.subject-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.subject-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.subject-card-icon {
  font-size: 3.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}
.subject-card:hover .subject-card-icon { transform: scale(1.15) rotate(-4deg); }

.subject-card-label {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.subject-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.subject-card-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.subject-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}

/* ── Exam Breadcrumb ── */
.exam-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.8rem;
  justify-content: center;
}

.btn-back-subject {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-back-subject svg { width: 16px; height: 16px; }
.btn-back-subject:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }

.breadcrumb-label {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 1rem;
  border-radius: 99px;
  border: 1.5px solid;
}

/* ── No Exams placeholder ── */
.no-exams-msg {
  grid-column: 1/-1;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
  line-height: 1.7;
}

/* ── Unit Cards ── */
.unit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 0 0.5rem;
}

.unit-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1.2rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.unit-week-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.unit-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.unit-card-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.unit-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}

/* ── Next Unit Button ── */
.btn-next-unit {
  flex: 1;
  min-width: 150px;
  padding: 0.9rem 1.5rem;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #FF6584, #F97316);
  color: #fff;
  transition: var(--transition);
}
.btn-next-unit:hover { transform: scale(1.03); box-shadow: 0 6px 24px rgba(255,101,132,0.45); }

/* ── Exam Cards ── */
.exam-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 0 0.5rem;
}

.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.exam-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius);
}

.exam-card:hover { transform: translateY(-6px); box-shadow: 0 20px 60px rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.15); }
.exam-card:hover::before { opacity: 1; }

.exam-card-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  display: block;
}

.exam-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.exam-card-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.exam-card-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
}

.exam-card-arrow {
  position: absolute;
  right: 1.8rem;
  bottom: 2rem;
  font-size: 1.4rem;
  opacity: 0.4;
  transition: var(--transition);
}

.exam-card:hover .exam-card-arrow { opacity: 1; transform: translateX(5px); }

/* ============================
   QUIZ HEADER
   ============================ */
#screen-quiz {
  flex-direction: column;
  align-items: stretch;
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(20,22,36,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-back svg { width: 16px; height: 16px; }
.btn-back:hover { color: var(--text); border-color: rgba(255,255,255,0.2); background: var(--surface); }

.quiz-meta { flex: 1; }

.exam-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.9rem;
  border-radius: 99px;
  background: rgba(108,99,255,0.2);
  color: #a78bfa;
  border: 1px solid rgba(108,99,255,0.3);
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 160px;
}

.q-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  min-width: 80px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent1), var(--accent3));
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

/* ============================
   QUIZ MAIN
   ============================ */
.quiz-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
  gap: 1.5rem;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

/* Score Panel */
.score-panel {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.4rem;
  flex: 1;
  max-width: 130px;
  transition: var(--transition);
}

.score-icon { font-size: 1rem; font-weight: 700; }
.score-item span:nth-child(2) { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.score-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.correct-score { border-color: rgba(34,211,138,0.2); }
.correct-score .score-icon { color: var(--correct); }
.correct-score span:nth-child(2) { color: var(--correct); }

.wrong-score { border-color: rgba(255,90,126,0.2); }
.wrong-score .score-icon { color: var(--wrong); }
.wrong-score span:nth-child(2) { color: var(--wrong); }

.remain-score span:nth-child(2) { color: var(--text-muted); }
.remain-score .score-icon { color: var(--text-muted); }

/* Question Card */
.question-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 2rem 0;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(.4,0,.2,1);
}

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

.question-number-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  background: rgba(108,99,255,0.15);
  color: #a78bfa;
  border: 1px solid rgba(108,99,255,0.2);
  margin-bottom: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.question-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 500;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 1.8rem;
  white-space: pre-wrap;
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(108,99,255,0.08), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.option-btn:hover:not(:disabled) {
  border-color: rgba(108,99,255,0.5);
  background: rgba(108,99,255,0.1);
  transform: translateX(4px);
}
.option-btn:hover:not(:disabled)::before { opacity: 1; }

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: var(--transition);
  border: 1px solid var(--border);
}

.option-text { flex: 1; line-height: 1.45; }

/* Option States */
.option-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: var(--correct);
}
.option-btn.correct .option-letter {
  background: var(--correct);
  color: #0d0f1a;
  border-color: var(--correct);
}

.option-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  color: var(--wrong);
}
.option-btn.wrong .option-letter {
  background: var(--wrong);
  color: #fff;
  border-color: var(--wrong);
}

.option-btn.reveal-correct {
  border-color: rgba(34,211,138,0.5);
  background: rgba(34,211,138,0.06);
}
.option-btn.reveal-correct .option-letter { border-color: var(--correct); color: var(--correct); }

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

/* Feedback Bar */
.feedback-bar {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  margin: 0 -2rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}

.feedback-bar.visible { display: flex; }
.feedback-bar.is-correct { background: rgba(34,211,138,0.08); }
.feedback-bar.is-wrong   { background: rgba(255,90,126,0.08); }

.feedback-icon { font-size: 1.4rem; }

.feedback-msg {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.feedback-bar.is-correct .feedback-msg { color: var(--correct); }
.feedback-bar.is-wrong   .feedback-msg { color: var(--wrong); }

.btn-next {
  background: linear-gradient(135deg, var(--accent1), #8B83FF);
  color: #fff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-next:hover { transform: scale(1.04); box-shadow: 0 4px 20px rgba(108,99,255,0.5); }

/* Shake Animation */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.shake { animation: shake 0.38s ease; }

/* Pop Animation */
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.pop { animation: pop 0.3s ease; }

/* ============================
   RESULTS SCREEN
   ============================ */
#screen-results {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.results-bg { position: fixed; inset: 0; z-index: 0; }

.results-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.results-trophy {
  font-size: 4rem;
  animation: trophy-bounce 1s cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes trophy-bounce {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.results-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #43E8D8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* SVG Ring */
.results-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
}

.results-ring {
  width: 160px;
  height: 160px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface2);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1);
}

.ring-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}

.results-stats {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.stat-box {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem 0.8rem;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.correct-box { border-color: rgba(34,211,138,0.25); }
.correct-box .stat-num { color: var(--correct); }
.wrong-box   { border-color: rgba(255,90,126,0.25); }
.wrong-box   .stat-num { color: var(--wrong); }
.total-box   .stat-num { color: var(--text); }

.results-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.btn-primary, .btn-secondary, .btn-warning {
  flex: 1;
  min-width: 150px;
  padding: 0.9rem 1.5rem;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent1), #8B83FF);
  color: #fff;
}
.btn-primary:hover { transform: scale(1.03); box-shadow: 0 6px 24px rgba(108,99,255,0.5); }

.btn-warning {
  background: linear-gradient(135deg, var(--wrong), #FF3355);
  color: #fff;
}
.btn-warning:hover { transform: scale(1.03); box-shadow: 0 6px 24px rgba(255,90,126,0.5); }

.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.2); background: var(--surface2); }

/* ============================
   TOGGLE SWITCH
   ============================ */
.shuffle-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface2);
  transition: .3s;
  border-radius: 34px;
  border: 1.5px solid var(--border);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 2.5px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}
.toggle-switch input:checked + .slider {
  background-color: var(--correct-bg);
  border-color: var(--correct);
}
.toggle-switch input:checked + .slider:before {
  transform: translateX(19px);
  background-color: var(--correct);
}
.toggle-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
}
.shuffle-toggle-wrap:has(input:checked) .toggle-label {
  color: var(--text);
}

/* ============================
   WRONG ANSWERS SECTION
   ============================ */
.wrong-answers-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: left;
  animation: fadeIn 0.8s ease backwards;
}
.wrong-answers-title {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wrong-answers-title::before {
  content: "📋";
}
.wrong-answers-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.wrong-q-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
}
.wrong-q-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}
.wrong-q-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wrong-opt {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wrong-opt.user-wrong {
  background: var(--wrong-bg);
  border: 1px solid var(--wrong);
  color: var(--wrong);
}
.wrong-opt.actual-correct {
  background: var(--correct-bg);
  border: 1px solid var(--correct);
  color: var(--correct);
}
/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 600px) {
  .quiz-main { padding: 1.2rem 0.75rem 3rem; }
  .question-card { padding: 1.5rem 1.2rem 0; }
  .feedback-bar { margin: 0 -1.2rem; padding: 0.9rem 1rem; }
  .score-panel { gap: 0.6rem; }
  .score-item { padding: 0.7rem 0.8rem; }
  .quiz-header { padding: 0.75rem 1rem; }
  .exam-cards { grid-template-columns: 1fr; }
  .subject-cards { grid-template-columns: 1fr; }
}

/* ============================
   FLASHCARD MODE
   ============================ */
#screen-flashcard {
  flex-direction: column;
  align-items: stretch;
}

.fc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.fc-container {
  width: 100%;
  aspect-ratio: 4/3;
  perspective: 1000px;
  margin-top: 1rem;
}

.flashcard {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.fc-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .fc-inner {
  transform: rotateY(180deg);
}

.fc-front, .fc-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.fc-front {
  background-color: var(--surface);
  background-image: linear-gradient(145deg, transparent, rgba(108,99,255,0.1));
}

.fc-back {
  background-color: var(--surface);
  background-image: linear-gradient(145deg, transparent, rgba(67,232,216,0.1));
  transform: rotateY(180deg);
}

.fc-label {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255,255,255,0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
}

#fc-term {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--accent1);
  margin: 0;
}

#fc-def {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

.fc-hint {
  position: absolute;
  bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.fc-controls {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.fc-controls button {
  flex: 1;
}
