/* A+ Quest — styles.css */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0d1117;
  --surface: #161d2e;
  --surface2: #1d2640;
  --surface3: #243050;
  --border: #263060;
  --border2: #344080;
  --primary: #e9a820;
  --primary2: #c4881a;
  --primary-light: rgba(233,168,32,.12);
  --primary-glow: rgba(233,168,32,.28);
  --green: #00c4a0;
  --green-light: rgba(0,196,160,.1);
  --green-dark: #009e80;
  --red: #ff4d6a;
  --red-light: rgba(255,77,106,.1);
  --blue: #5b8dff;
  --blue-light: rgba(91,141,255,.1);
  --purple: #9b6eff;
  --purple-light: rgba(155,110,255,.1);
  --amber: var(--primary);
  --amber-light: var(--primary-light);
  --text: #dde3f8;
  --text2: #7b8cb8;
  --text3: #3d4d78;
  --sans: 'Plus Jakarta Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --sh: 0 4px 24px rgba(0,0,0,.35);
  --sh2: 0 8px 40px rgba(0,0,0,.45);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 76px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

/* ===================== SHELL LAYOUT ===================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 16px;
  gap: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 8px 20px;
  width: 100%;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #000;
  box-shadow: 0 0 16px var(--primary-glow);
  letter-spacing: -0.5px;
}

.logo-text {
  font-size: 9px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.nav-btn {
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text2);
  transition: all 0.2s ease;
  position: relative;
  font-family: var(--sans);
}

.nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-btn.active {
  background: var(--primary-light);
  color: var(--amber);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 9px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }

.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 12px 8px 0;
  width: 100%;
  border-top: 1px solid var(--border);
}

.streak-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.streak-fire { font-size: 18px; }
.streak-count { font-size: 15px; font-weight: 800; color: var(--amber); }
.streak-label { font-size: 8px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }

/* ===================== CONTENT AREA ===================== */
.content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===================== TOPBAR ===================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.lv-orb {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow), 0 0 0 3px var(--primary-light);
  flex-shrink: 0;
  cursor: default;
}

.lv-num {
  font-size: 16px;
  font-weight: 900;
  color: #000;
}

.xp-wrap { flex: 1; max-width: 260px; }

.xp-label {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
}

.xp-label #xpCurrent { color: var(--text); font-size: 13px; font-weight: 700; }
.xp-sep { color: var(--text3); }
.xp-unit { color: var(--text3); font-size: 10px; }

.xp-bar {
  height: 8px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  overflow: hidden;
}

.xp-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  to { left: 100%; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hearts-row {
  display: flex;
  gap: 4px;
}

.heart-icon {
  font-size: 18px;
  transition: transform 0.2s ease;
}

.heart-icon.empty { filter: grayscale(1) opacity(0.3); }
.heart-icon.pulse { animation: hpulse 0.3s ease; }

@keyframes hpulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

/* ===================== MAIN SCROLL AREA ===================== */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 64px;
  position: relative;
}

.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ===================== PAGES ===================== */
.page { display: none; animation: fadeUp 0.3s ease; }
.page.active { display: block; }

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

.page-header { margin-bottom: 28px; }
.page-title { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.page-sub { font-size: 14px; color: var(--text2); margin-top: 4px; }
.section-heading { font-size: 16px; font-weight: 700; color: var(--text); margin: 28px 0 16px; }

/* ===================== SKILL PATH ===================== */
.skill-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 500px;
  margin: 0 auto;
}

.sp-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: center;
  position: relative;
}

.sp-connector {
  width: 2px;
  height: 32px;
  background: var(--border2);
  margin: 0 auto;
}

.sp-connector.done { background: var(--green); }

.sp-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--sans);
}

.sp-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 3px solid var(--border2);
  background: var(--surface2);
  transition: all 0.3s ease;
  position: relative;
}

.sp-node.done .sp-orb {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: 0 0 20px rgba(0,196,160,.2);
}

.sp-node.active .sp-orb {
  border-color: var(--amber);
  background: var(--primary-light);
  box-shadow: 0 0 24px var(--primary-glow);
  animation: pulse 2s infinite;
}

.sp-node.locked .sp-orb {
  opacity: 0.4;
  filter: grayscale(1);
}

.sp-node.active .sp-orb::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  opacity: 0.4;
  animation: pulseRing 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.4); opacity: 0; }
}

.sp-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  max-width: 70px;
  line-height: 1.3;
}

.sp-node.active .sp-label { color: var(--amber); }
.sp-node.done .sp-label { color: var(--green); }

.sp-check {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--green);
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* Core 2 Teaser */
.core2-teaser {
  max-width: 500px;
  margin: 24px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.c2-lock-icon { font-size: 28px; flex-shrink: 0; }
.c2-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.c2-desc { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.c2-progress-wrap { display: flex; align-items: center; gap: 8px; }
.c2-progress-bar { flex: 1; height: 6px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.c2-progress-fill { height: 100%; background: var(--amber); border-radius: 99px; transition: width 0.5s ease; }
.c2-progress-label { font-size: 11px; font-weight: 700; color: var(--amber); }

/* ===================== TOPIC GRID ===================== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.tc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-family: var(--sans);
  text-align: left;
  position: relative;
}

.tc::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--tc-color, var(--primary));
}

.tc:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh2);
  border-color: var(--border2);
}

.tc-inner { padding: 14px; }
.tc-icon { font-size: 24px; margin-bottom: 8px; display: block; }
.tc-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.tc-count { font-size: 11px; color: var(--text2); }

.tc-mastery {
  margin-top: 8px;
  height: 4px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}

.tc-mastery-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--tc-color, var(--green));
  transition: width 0.5s ease;
}

/* ===================== MODE CARDS ===================== */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.mode-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  font-family: var(--sans);
}

.mode-card:hover { border-color: var(--border2); background: var(--surface2); }

.mode-card.active {
  border-color: var(--amber);
  background: var(--primary-light);
}

.mode-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.mode-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.mode-desc { font-size: 11px; color: var(--text2); }

/* ===================== BUTTONS ===================== */
.q-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px var(--primary-glow);
  letter-spacing: 0.2px;
}

.q-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--primary-glow);
}

.q-btn:active { transform: translateY(0); }

.q-btn-sec {
  background: var(--surface2);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--border2);
}

.q-btn-sec:hover {
  background: var(--surface3);
  box-shadow: none;
}

.exam-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 15px;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover { background: var(--surface2); color: var(--text); }

/* ===================== QUIZ LAYOUT ===================== */
.quiz-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.quiz-progress-wrap { flex: 1; display: flex; align-items: center; gap: 12px; }

.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-progress-label { font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }

.quiz-timer {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--text);
  min-width: 40px;
  text-align: center;
}

.quiz-timer.warning { color: var(--red); animation: blink 0.5s infinite; }

@keyframes blink {
  50% { opacity: 0.5; }
}

/* ===================== QUIZ CARD ===================== */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--sh);
  position: relative;
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto;
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
}

.qc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.qc-topic {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.qc-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  font-family: var(--mono);
}

.qc-question {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 24px;
}

.opts { display: flex; flex-direction: column; gap: 10px; }

.opt {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}

.opt::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  transition: left 0.3s ease;
}

.opt:hover::after { left: 100%; }

.opt:hover:not(.correct):not(.wrong):not(.disabled) {
  border-color: var(--border2);
  background: var(--surface3);
  transform: translateX(3px);
}

.opt .opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--mono);
}

.opt.correct {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}
.opt.correct .opt-letter { background: var(--green); border-color: var(--green); color: #000; }

.opt.wrong {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
  opacity: 0.7;
}
.opt.wrong .opt-letter { background: var(--red); border-color: var(--red); color: #fff; }

.opt.disabled { cursor: default; }

.fb {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  animation: slideUp 0.25s ease;
}

.fb.correct {
  background: var(--green-light);
  border: 1px solid var(--green);
  color: var(--green);
}

.fb.wrong {
  background: var(--red-light);
  border: 1px solid var(--red);
  color: var(--red);
}

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

.next-btn { margin-top: 20px; }

/* ===================== FLASHCARDS ===================== */
.flash-counter { font-size: 13px; font-weight: 600; color: var(--text2); }

.flash-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0 24px;
  perspective: 1200px;
}

.flash-card {
  width: 100%;
  max-width: 600px;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
}

.flash-card.flipped { transform: rotateY(180deg); }

.flash-front, .flash-back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.flash-front {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  box-shadow: var(--sh);
}

.flash-back {
  background: linear-gradient(135deg, #1a2f1a, #1a2018);
  border: 2px solid var(--green);
  color: var(--green);
  transform: rotateY(180deg);
  box-shadow: 0 0 32px rgba(0,196,160,.15);
}

.flash-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 20px;
}

.flash-rating { text-align: center; }
.rating-label { font-size: 13px; color: var(--text2); display: block; margin-bottom: 12px; }
.rating-btns { display: flex; gap: 10px; justify-content: center; }

.rating-btn {
  padding: 10px 24px;
  border-radius: var(--radius);
  border: 1.5px solid;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.2s ease;
}

.rating-bad { background: var(--red-light); border-color: var(--red); color: var(--red); }
.rating-ok { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
.rating-great { background: var(--green-light); border-color: var(--green); color: var(--green); }

.rating-btn:hover { opacity: 0.85; transform: translateY(-2px); }

/* ===================== VISUAL QUIZ ===================== */
.visual-diagram {
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: #5eead4;
  white-space: pre;
  line-height: 1.5;
  margin-bottom: 20px;
  overflow-x: auto;
}

/* ===================== SR REVIEW ===================== */
.review-content { max-width: 700px; }

.review-empty {
  text-align: center;
  padding: 60px 20px;
}

.review-empty-icon { font-size: 48px; margin-bottom: 16px; }
.review-empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.review-empty-sub { font-size: 14px; color: var(--text2); }

.sr-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sr-count {
  font-size: 14px;
  color: var(--text2);
}

.sr-count strong { color: var(--amber); }

/* ===================== COMPLETE SCREEN ===================== */
.complete-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 0;
}

.complete-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--sh2);
  animation: popIn 0.4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.complete-medal {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  animation: medalBounce 0.6s 0.3s ease both;
}

@keyframes medalBounce {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.2) rotate(5deg); }
  80% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}

.complete-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}

.complete-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-num { font-size: 28px; font-weight: 900; }
.stat-label { font-size: 11px; color: var(--text2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-num.green { color: var(--green); }
.stat-num.red { color: var(--red); }
.stat-num.amber { color: var(--amber); }

.complete-xp {
  font-size: 16px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 24px;
}

.complete-btns { display: flex; gap: 12px; justify-content: center; }

/* ===================== PROGRESS PAGE ===================== */
.progress-content { max-width: 800px; }

.progress-section { margin-bottom: 32px; }

.progress-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mastery-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s ease;
}

.mastery-row:hover { border-color: var(--border2); }

.mastery-icon { font-size: 22px; flex-shrink: 0; }

.mastery-info { flex: 1; }
.mastery-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.mastery-bar-wrap { display: flex; align-items: center; gap: 10px; }

.mastery-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}

.mastery-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.mastery-pct { font-size: 12px; font-weight: 700; color: var(--text2); min-width: 36px; text-align: right; }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.achievement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.achievement-card.unlocked {
  border-color: var(--amber);
  background: var(--primary-light);
}

.achievement-card.locked { opacity: 0.4; filter: grayscale(0.8); }

.ach-icon { font-size: 28px; margin-bottom: 8px; }
.ach-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ach-desc { font-size: 11px; color: var(--text2); line-height: 1.4; }

/* HEATMAP */
.heatmap {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 3px;
}

.hm-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--surface2);
}

.hm-cell[data-level="1"] { background: rgba(0,196,160,.2); }
.hm-cell[data-level="2"] { background: rgba(0,196,160,.4); }
.hm-cell[data-level="3"] { background: rgba(0,196,160,.6); }
.hm-cell[data-level="4"] { background: rgba(0,196,160,.8); }
.hm-cell[data-level="5"] { background: var(--green); }

/* ===================== DEBUG PANEL ===================== */
.debug-content { max-width: 900px; }

.dbg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.dbg-panel {
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.dbg-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-family: var(--mono);
}

.dbg-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s;
  margin: 2px;
}

.dbg-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.dbg-btn.danger { border-color: var(--red); color: var(--red); }
.dbg-btn.success { border-color: var(--green); color: var(--green); }

.dbg-state {
  font-family: var(--mono);
  font-size: 11px;
  color: #5eead4;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  word-break: break-all;
}

.dbg-state::-webkit-scrollbar { width: 4px; }
.dbg-state::-webkit-scrollbar-thumb { background: var(--border2); }

.dbg-console {
  font-family: var(--mono);
  font-size: 11px;
  max-height: 200px;
  overflow-y: auto;
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.dbg-log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.dbg-log-entry.info { color: #5eead4; }
.dbg-log-entry.warn { color: var(--amber); }
.dbg-log-entry.error { color: var(--red); }
.dbg-log-entry.xp { color: var(--green); }
.dbg-log-ts { color: var(--text3); margin-right: 6px; }

/* ===================== XP TOAST ===================== */
#toastContainer {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.xp-pop {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #000;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 20px var(--primary-glow);
  animation: xpSlideIn 0.4s cubic-bezier(.34,1.56,.64,1) forwards,
             xpFadeOut 0.4s 1.8s ease forwards;
}

@keyframes xpSlideIn {
  from { opacity: 0; transform: translateX(60px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes xpFadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

.ach-pop {
  background: linear-gradient(135deg, #1a1400, var(--surface));
  border: 2px solid var(--amber);
  color: var(--amber);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 20px var(--primary-glow);
  animation: xpSlideIn 0.4s cubic-bezier(.34,1.56,.64,1) forwards,
             xpFadeOut 0.4s 2.8s ease forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===================== CONFETTI ===================== */
#confettiContainer {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}

.confetto {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: cfall linear forwards;
}

@keyframes cfall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

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

[hidden] { display: none !important; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 600px) {
  :root { --sidebar-w: 56px; }

  body { overflow: hidden; }

  .main { padding: 16px 12px 48px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar-left { gap: 8px; }
  .xp-wrap { max-width: 140px; }
  .xp-label { font-size: 10px; }

  .quiz-card { padding: 16px; }
  .qc-question { font-size: 15px; }
  .opt { padding: 11px 14px; font-size: 13px; }

  .mode-cards { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }

  .complete-stats { grid-template-columns: 1fr 1fr; }
  .complete-card { padding: 24px 16px; }

  .flash-card { height: 220px; }
  .flash-front, .flash-back { font-size: 15px; padding: 20px; }

  .nav-label { display: none; }
  .nav-icon { font-size: 18px; }

  .skill-path { max-width: 100%; }
  .sp-orb { width: 52px; height: 52px; font-size: 20px; }

  .visual-diagram { font-size: 11px; padding: 16px; }
  .dbg-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  :root { --sidebar-w: 48px; }
  .topbar { padding: 8px 10px; }
  .lv-orb { width: 36px; height: 36px; }
  .lv-num { font-size: 13px; }
  .xp-wrap { display: none; }
  .nav-btn { padding: 6px 2px; }
}

/* ── TOPBAR ACCOUNT ─────────────────────────────────────── */
.topbar-account {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: default;
}
.topbar-avatar { font-size: 18px; line-height: 1; }
.topbar-name { font-size: 12px; font-weight: 700; color: var(--text); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── SQUIRREL ───────────────────────────────────────────── */
.squirrel-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.squirrel-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.squirrel-wrap { display: block; }

.squirrel-idle svg { animation: sqIdle 3s ease-in-out infinite; }
.squirrel-correct svg { animation: sqCorrect 0.5s cubic-bezier(.34,1.56,.64,1); }
.squirrel-wrong svg { animation: sqWrong 0.4s ease; }
.squirrel-thinking svg { animation: sqThink 1s ease-in-out infinite; }

@keyframes sqIdle {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes sqCorrect {
  0% { transform: scale(1) rotate(0); }
  40% { transform: scale(1.3) rotate(-10deg); }
  70% { transform: scale(0.95) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes sqWrong {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-5deg); }
  40% { transform: translateX(6px) rotate(5deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes sqThink {
  0%,100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* ── MICRO-QUEST BANNER ─────────────────────────────────── */
.mq-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--surface);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 0 1px var(--primary-glow);
  animation: slideDown 0.35s cubic-bezier(.34,1.56,.64,1);
  max-width: 460px;
  width: calc(100vw - 40px);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.mq-icon { font-size: 22px; flex-shrink: 0; }
.mq-text { flex: 1; }
.mq-text strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.mq-text span { font-size: 12px; color: var(--text2); }
.mq-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--sans);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.mq-dismiss {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  flex-shrink: 0;
  font-family: var(--sans);
}
.mq-dismiss:hover { color: var(--text); }

/* ── SETTINGS PANEL ─────────────────────────────────────── */
.settings-panel {
  position: fixed;
  top: 68px;
  right: 20px;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 320px;
  box-shadow: var(--sh2);
  animation: fadeUp 0.2s ease;
  overflow: hidden;
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.settings-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  font-family: var(--sans);
  padding: 2px 6px;
  border-radius: 4px;
}
.settings-close:hover { background: var(--surface2); color: var(--text); }
.settings-body { padding: 8px 0; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}
.settings-row:hover { background: var(--surface2); }
.settings-label { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.settings-label span:first-child { font-size: 13px; font-weight: 600; color: var(--text); }
.settings-hint { font-size: 11px; color: var(--text3); line-height: 1.4; }
.settings-divider { height: 1px; background: var(--border); margin: 4px 0; }
.toggle-btn {
  background: var(--surface3);
  border: 1.5px solid var(--border2);
  border-radius: 99px;
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  padding: 4px 12px;
  cursor: pointer;
  min-width: 48px;
  text-align: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.toggle-btn.on {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}

/* ── ONBOARDING OVERLAY ─────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.onboard-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--sh2);
  animation: popIn 0.4s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}
.onboard-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: #000;
  margin: 0 auto 20px;
  box-shadow: 0 0 24px var(--primary-glow);
}
.onboard-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}
.onboard-sub {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 28px;
}
.onboard-sub em { color: var(--green); font-style: normal; font-weight: 600; }
.onboard-field { margin-bottom: 20px; text-align: left; }
.onboard-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.onboard-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s ease;
}
.onboard-input:focus { border-color: var(--amber); }
.onboard-input.shake { animation: inputShake 0.35s ease; }
@keyframes inputShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.onboard-submit { width: 100%; justify-content: center; margin-top: 4px; }
.onboard-privacy {
  font-size: 11px;
  color: var(--text3);
  margin-top: 14px;
  line-height: 1.5;
}

/* ── AVATAR PICKER ──────────────────────────────────────── */
.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avatar-opt {
  width: 44px;
  height: 44px;
  font-size: 22px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-family: var(--sans);
}
.avatar-opt:hover { border-color: var(--border2); background: var(--surface3); transform: scale(1.1); }
.avatar-opt.active { border-color: var(--amber); background: var(--primary-light); box-shadow: 0 0 12px var(--primary-glow); }

/* ── DIAGNOSTIC OVERLAY ─────────────────────────────────── */
.diag-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--sh2);
  animation: popIn 0.35s cubic-bezier(.34,1.56,.64,1);
}
.diag-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.diag-badge {
  background: var(--primary-light);
  color: var(--amber);
  border: 1px solid var(--primary-glow);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.diag-desc { font-size: 13px; color: var(--text2); }
.diag-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.diag-progress {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  margin-bottom: 20px;
  overflow: hidden;
}
.diag-progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.diag-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}
.diag-opts { display: flex; flex-direction: column; gap: 8px; }
.diag-opt { cursor: pointer; }

/* ── SESSION RECAP ──────────────────────────────────────── */
.recap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.recap-stat {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.recap-num {
  display: block;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}
.recap-num.green { color: var(--green); }
.recap-num.red   { color: var(--red); }
.recap-num.amber { color: var(--amber); }
.recap-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}
.recap-improved {
  font-size: 12px;
  color: var(--green);
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
}
.recap-tomorrow {
  font-size: 12px;
  color: var(--text2);
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.recap-tomorrow strong { color: var(--amber); }

/* ── REDUCED MOTION ─────────────────────────────────────── */
html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}

/* ── MOBILE: new elements ───────────────────────────────── */
@media (max-width: 600px) {
  .squirrel-container { bottom: 12px; right: 12px; }
  .squirrel-wrap svg { width: 44px; height: 44px; }
  .topbar-name { display: none; }
  .topbar-account { padding: 4px 8px; }
  .settings-panel { right: 8px; left: 8px; width: auto; }
  .onboard-card { padding: 28px 20px; }
  .diag-card { padding: 24px 16px; }
  .recap-grid { grid-template-columns: repeat(2, 1fr); }
}
