/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}
body {
  min-height: 100dvh;
  font-family: 'General Sans', 'Inter', sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== DESIGN TOKENS ===== */
:root, [data-theme="dark"] {
  --bg: #0f1117;
  --surface: #181a22;
  --surface-2: #1e2130;
  --surface-3: #262a3a;
  --border: #2e3348;
  --border-active: #4a5070;
  --text: #e4e5ea;
  --text-muted: #8b8fa3;
  --text-faint: #5c6078;
  --accent-bio: #34d399;
  --accent-bio-bg: rgba(52,211,153,0.12);
  --accent-chem: #60a5fa;
  --accent-chem-bg: rgba(96,165,250,0.12);
  --accent-phys: #f97316;
  --accent-phys-bg: rgba(249,115,22,0.12);
  --accent-cs: #c084fc;
  --accent-cs-bg: rgba(192,132,252,0.12);
  --accent-maths: #f472b6;
  --accent-maths-bg: rgba(244,114,182,0.12);
  --accent-enlang: #fbbf24;
  --accent-enlang-bg: rgba(251,191,36,0.12);
  --accent-enlit: #a78bfa;
  --accent-enlit-bg: rgba(167,139,250,0.12);
  --accent-btec: #fb923c;
  --accent-btec-bg: rgba(251,146,60,0.12);
  --accent-food: #4ade80;
  --accent-food-bg: rgba(74,222,128,0.12);
  --accent-geo: #38bdf8;
  --accent-geo-bg: rgba(56,189,248,0.12);
  --accent-art: #f43f5e;
  --accent-art-bg: rgba(244,63,94,0.12);
  --accent-combined: #a3e635;
  --accent-combined-bg: rgba(163,230,53,0.12);
  --correct: #34d399;
  --correct-bg: rgba(52,211,153,0.15);
  --wrong: #f87171;
  --wrong-bg: rgba(248,113,113,0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.12);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --surface-3: #e6e8ed;
  --border: #d4d7e0;
  --border-active: #a0a5b8;
  --text: #1a1d2a;
  --text-muted: #6b7085;
  --text-faint: #9da2b5;
  --correct-bg: rgba(52,211,153,0.18);
  --wrong-bg: rgba(248,113,113,0.18);
  --warning-bg: rgba(251,191,36,0.15);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ===== TYPOGRAPHY ===== */
.font-display { font-family: 'Chillax', 'General Sans', sans-serif; }

/* ===== LAYOUT ===== */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  min-height: 100dvh;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.header h1 {
  font-family: 'Chillax', sans-serif;
  font-weight: 600;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  letter-spacing: -0.02em;
}
.header-actions { display: flex; gap: 0.5rem; align-items: center; }
.btn-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.active { background: var(--surface-3); color: var(--text); border-color: var(--border-active); }
.btn-icon .badge-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 7px; height: 7px;
  background: var(--wrong);
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

/* ===== HOME ===== */
.home-title {
  font-family: 'Chillax', sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.home-sub {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
}

/* ===== WEAK SPOTS BANNER ===== */
.weak-spots-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--wrong);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.weak-spots-banner:hover { border-color: var(--border-active); border-left-color: var(--wrong); }
.weak-spots-banner-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
}
.weak-spots-banner-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.weak-spots-count {
  font-size: 0.75rem;
  background: var(--wrong-bg);
  color: var(--wrong);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  font-weight: 600;
}
.weak-spots-preview {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 0.5rem;
}
.weak-tag {
  font-size: 0.75rem;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ===== SUBJECT GRID ===== */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}
.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.subject-card:hover { border-color: var(--border-active); transform: translateY(-2px); box-shadow: var(--shadow); }
.subject-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.subject-card[data-subject="Biology"]::before { background: var(--accent-bio); }
.subject-card[data-subject="Chemistry"]::before { background: var(--accent-chem); }
.subject-card[data-subject="Physics"]::before { background: var(--accent-phys); }
.subject-card[data-subject="Computer Science"]::before { background: var(--accent-cs); }
.subject-card[data-subject="Maths"]::before { background: var(--accent-maths); }
.subject-card[data-subject="English Language"]::before { background: var(--accent-enlang); }
.subject-card[data-subject="English Literature"]::before { background: var(--accent-enlit); }
.subject-card[data-subject="BTec Sport"]::before { background: var(--accent-btec); }
.subject-card[data-subject="Food Technology"]::before { background: var(--accent-food); }
.subject-card[data-subject="Geography"]::before { background: var(--accent-geo); }
.subject-card[data-subject="Art & Design"]::before { background: var(--accent-art); }
.subject-card[data-subject="Combined Science"]::before { background: var(--accent-combined); }

.subject-icon {
  width: 40px; height: 40px; border-radius: 0.625rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; margin-bottom: 0.875rem;
}
.subject-card[data-subject="Biology"] .subject-icon { background: var(--accent-bio-bg); }
.subject-card[data-subject="Chemistry"] .subject-icon { background: var(--accent-chem-bg); }
.subject-card[data-subject="Physics"] .subject-icon { background: var(--accent-phys-bg); }
.subject-card[data-subject="Computer Science"] .subject-icon { background: var(--accent-cs-bg); }
.subject-card[data-subject="Maths"] .subject-icon { background: var(--accent-maths-bg); }
.subject-card[data-subject="English Language"] .subject-icon { background: var(--accent-enlang-bg); }
.subject-card[data-subject="English Literature"] .subject-icon { background: var(--accent-enlit-bg); }
.subject-card[data-subject="BTec Sport"] .subject-icon { background: var(--accent-btec-bg); }
.subject-card[data-subject="Food Technology"] .subject-icon { background: var(--accent-food-bg); }
.subject-card[data-subject="Geography"] .subject-icon { background: var(--accent-geo-bg); }
.subject-card[data-subject="Art & Design"] .subject-icon { background: var(--accent-art-bg); }
.subject-card[data-subject="Combined Science"] .subject-icon { background: var(--accent-combined-bg); }

.subject-card h3 {
  font-family: 'Chillax', sans-serif; font-weight: 600; font-size: 1.05rem; margin-bottom: 0.2rem;
}
.subject-card .topic-count { color: var(--text-muted); font-size: 0.85rem; }
.subject-card .q-count { color: var(--text-faint); font-size: 0.78rem; margin-top: 0.15rem; }
.subject-card .weak-indicator {
  position: absolute; top: 1rem; right: 1rem;
  font-size: 0.7rem; font-weight: 600;
  background: var(--wrong-bg); color: var(--wrong);
  padding: 0.15rem 0.45rem; border-radius: 0.375rem;
}

/* ===== BACK BUTTON ===== */
.back-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text-muted); font-size: 0.9rem; cursor: pointer;
  background: none; border: none; font-family: inherit;
  margin-bottom: 1.25rem; transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }

/* ===== TOPIC LIST ===== */
.topic-header { margin-bottom: 1.5rem; }
.topic-header h2 {
  font-family: 'Chillax', sans-serif; font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); margin-bottom: 0.25rem;
}
.topic-header .paper-info { color: var(--text-muted); font-size: 0.9rem; }

.topic-list { display: flex; flex-direction: column; gap: 0.5rem; }
.topic-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.875rem 1.125rem;
  cursor: pointer; transition: all 0.18s ease;
}
.topic-item:hover { border-color: var(--border-active); background: var(--surface-2); }
.topic-item .topic-name { font-weight: 500; font-size: 0.9rem; }
.topic-item .topic-meta { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; }
.topic-item .topic-q-count { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.topic-item .topic-weak { font-size: 0.7rem; font-weight: 600; background: var(--wrong-bg); color: var(--wrong); padding: 0.15rem 0.4rem; border-radius: 0.375rem; }
.topic-item .arrow { color: var(--text-faint); font-size: 1.1rem; }

.start-all-btn {
  display: block; width: 100%; margin-top: 1rem; padding: 0.875rem;
  font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.95rem;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: all 0.18s ease; color: #fff;
}
.start-all-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.start-all-btn[data-subject="Biology"] { background: #059669; }
.start-all-btn[data-subject="Chemistry"] { background: #2563eb; }
.start-all-btn[data-subject="Physics"] { background: #ea580c; }
.start-all-btn[data-subject="Computer Science"] { background: #9333ea; }
.start-all-btn[data-subject="Maths"] { background: #db2777; }
.start-all-btn[data-subject="English Language"] { background: #d97706; }
.start-all-btn[data-subject="English Literature"] { background: #7c3aed; }
.start-all-btn[data-subject="BTec Sport"] { background: #ea580c; }
.start-all-btn[data-subject="Food Technology"] { background: #16a34a; }
.start-all-btn[data-subject="Geography"] { background: #0284c7; }
.start-all-btn[data-subject="Art & Design"] { background: #be123c; }
.start-all-btn[data-subject="Combined Science"] { background: #65a30d; }

/* ===== QUIZ SETUP ===== */
.mode-selector { display: flex; flex-direction: column; gap: 0.625rem; margin-top: 1rem; }
.mode-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 1rem 1.25rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-family: inherit;
  font-size: 0.95rem; color: var(--text); text-align: left; transition: all 0.18s ease;
}
.mode-btn:hover { border-color: var(--border-active); background: var(--surface-2); }
.mode-btn.mode-weak { border-color: rgba(248,113,113,0.35); }
.mode-btn.mode-weak:hover { border-color: var(--wrong); }
.mode-label { font-weight: 600; }
.mode-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.mode-count { color: var(--text-faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mode-count.mode-count-warn { color: var(--wrong); }

/* ===== QUIZ VIEW ===== */
.quiz-top-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem;
}
.subject-badge {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.3rem 0.65rem; border-radius: var(--radius);
}
.badge-Biology { background: var(--accent-bio-bg); color: var(--accent-bio); }
.badge-Chemistry { background: var(--accent-chem-bg); color: var(--accent-chem); }
.badge-Physics { background: var(--accent-phys-bg); color: var(--accent-phys); }
.badge-Computer-Science { background: var(--accent-cs-bg); color: var(--accent-cs); }
.badge-Maths { background: var(--accent-maths-bg); color: var(--accent-maths); }
.badge-English-Language { background: var(--accent-enlang-bg); color: var(--accent-enlang); }
.badge-English-Literature { background: var(--accent-enlit-bg); color: var(--accent-enlit); }
.badge-BTec-Sport { background: var(--accent-btec-bg); color: var(--accent-btec); }
.badge-Food-Technology { background: var(--accent-food-bg); color: var(--accent-food); }
.badge-Geography { background: var(--accent-geo-bg); color: var(--accent-geo); }
.badge-Art-\&-Design { background: var(--accent-art-bg); color: var(--accent-art); }
.badge-Combined-Science { background: var(--accent-combined-bg); color: var(--accent-combined); }

.progress-bar { height: 5px; background: var(--surface-3); border-radius: 3px; margin-bottom: 1.25rem; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s cubic-bezier(0.16,1,0.3,1); }
.progress-fill[data-subject="Biology"] { background: var(--accent-bio); }
.progress-fill[data-subject="Chemistry"] { background: var(--accent-chem); }
.progress-fill[data-subject="Physics"] { background: var(--accent-phys); }
.progress-fill[data-subject="Computer Science"] { background: var(--accent-cs); }
.progress-fill[data-subject="Maths"] { background: var(--accent-maths); }
.progress-fill[data-subject="English Language"] { background: var(--accent-enlang); }
.progress-fill[data-subject="English Literature"] { background: var(--accent-enlit); }
.progress-fill[data-subject="BTec Sport"] { background: var(--accent-btec); }
.progress-fill[data-subject="Food Technology"] { background: var(--accent-food); }
.progress-fill[data-subject="Geography"] { background: var(--accent-geo); }
.progress-fill[data-subject="Art & Design"] { background: var(--accent-art); }
.progress-fill[data-subject="Combined Science"] { background: var(--accent-combined); }

.score-display { font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.question-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 1.6rem 1.4rem; margin-bottom: 0.875rem;
}
.question-topic { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.625rem; font-weight: 500; }
.question-text { font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); font-weight: 500; line-height: 1.55; margin-bottom: 1.375rem; }
.difficulty-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem; border-radius: 0.375rem; margin-left: 0.4rem; vertical-align: middle;
}
.difficulty-Foundation { background: rgba(96,165,250,0.15); color: #60a5fa; }
.difficulty-Higher { background: rgba(249,115,22,0.15); color: #f97316; }

/* ===== OPTIONS ===== */
.options { display: flex; flex-direction: column; gap: 0.5rem; }
.option-btn {
  display: flex; align-items: flex-start; gap: 0.75rem;
  width: 100%; padding: 0.875rem 1rem;
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: 0.92rem; line-height: 1.5; color: var(--text); text-align: left;
  transition: all 0.18s ease;
}
.option-btn:hover:not(.answered) { border-color: var(--border-active); background: var(--surface-3); }
.option-letter {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; min-width: 28px; border-radius: 0.4375rem;
  background: var(--surface-3); font-weight: 700; font-size: 0.8rem; color: var(--text-muted);
  transition: all 0.18s ease;
}
.option-text { padding-top: 0.15rem; }
.option-btn.correct { border-color: var(--correct); background: var(--correct-bg); }
.option-btn.correct .option-letter { background: var(--correct); color: #fff; }
.option-btn.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.option-btn.wrong .option-letter { background: var(--wrong); color: #fff; }
.option-btn.answered { cursor: default; opacity: 0.65; }
.option-btn.correct.answered, .option-btn.wrong.answered { opacity: 1; }

/* Calm mode overrides for wrong answers */
.calm-mode-active .option-btn.wrong {
  border-color: #F59E0B !important;
  background: rgba(245,158,11,0.12) !important;
}
.calm-mode-active .option-btn.wrong .option-letter {
  background: #F59E0B !important;
}
.calm-mode-active .explanation.wrong-exp {
  border-left-color: #F59E0B !important;
}
.calm-mode-active .mascot-wrong {
  background: rgba(245,158,11,0.08) !important;
  border-color: rgba(245,158,11,0.25) !important;
}

/* ===== EXPLANATION ===== */
.explanation {
  margin-top: 0.875rem; padding: 0.875rem 1.125rem;
  background: var(--surface-2); border-radius: var(--radius);
  border-left: 3px solid var(--correct);
  font-size: 0.88rem; line-height: 1.6; color: var(--text-muted);
  animation: fadeIn 0.3s ease;
}
.explanation.wrong-exp { border-left-color: var(--wrong); }
.explanation strong { color: var(--text); }
.explanation .concept-tag {
  display: inline-block; margin-top: 0.5rem;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-3); color: var(--text-muted);
  padding: 0.2rem 0.5rem; border-radius: 0.375rem;
}

/* Deep Diver extra context card */
.deep-diver-card {
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.25);
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.deep-diver-card .deep-diver-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #60a5fa;
  margin-bottom: 0.4rem;
}

/* Visual learner highlight boxes */
.visual-highlight {
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.visual-topic-emoji {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  display: block;
}

/* Builder knowledge bar */
.knowledge-bar-wrap {
  margin-bottom: 1rem;
  padding: 0.625rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.knowledge-bar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
}
.knowledge-bar-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.knowledge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #60a5fa);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.16,1,0.3,1);
}

/* Fighter personal best */
.personal-best-bar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  background: linear-gradient(135deg, rgba(251,191,36,0.1), rgba(249,115,22,0.1));
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: var(--radius);
  margin-bottom: 0.875rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fbbf24;
}

/* Trophy animation */
@keyframes trophyPop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.trophy-burst {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  z-index: 9999;
  animation: trophyPop 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: none;
}

.next-btn {
  display: block; width: 100%; margin-top: 1rem; padding: 0.85rem;
  font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.95rem;
  border: none; border-radius: var(--radius); cursor: pointer;
  background: var(--surface-3); color: var(--text); transition: all 0.18s ease;
}
.next-btn:hover { background: var(--border); }

/* ===== STREAK ===== */
.streak { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--accent-bio); font-variant-numeric: tabular-nums; }
.streak.hot { color: #f97316; animation: pulse 0.5s ease; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* Calm mode gentle pulse instead of shake */
@keyframes gentlePulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.015); opacity: 0.9; }
}

/* ===== SHIELD BADGE ===== */
.shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
}

/* Shield used toast */
.shield-toast {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: linear-gradient(135deg, #1e3a5f, #1a2a4a);
  border: 2px solid #60a5fa;
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  font-weight: 700;
  font-size: 0.875rem;
  color: #60a5fa;
  box-shadow: var(--shadow);
  z-index: 9998;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
  opacity: 0;
}
.shield-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== CALM MODE BANNER ===== */
.calm-banner {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #F59E0B;
  text-align: center;
  margin-bottom: 0.875rem;
}

/* ===== TTS BUTTON ===== */
.tts-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 0.5rem;
}
.tts-btn:hover { background: var(--border); color: var(--text); }
.tts-btn.speaking { color: #34d399; border-color: #34d399; background: rgba(52,211,153,0.1); }

/* ===== SPACED REVIEW BANNER ===== */
.spaced-review-banner {
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.3);
  border-top: 3px solid #60a5fa;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Question card with spaced-review blue tint */
.question-card.spaced-review {
  border-color: rgba(96,165,250,0.4);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.15);
}

/* ===== GRADE BADGE ===== */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-family: 'Chillax', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  margin: 0.75rem auto;
  border: 3px solid currentColor;
}
.grade-badge.grade-9 { color: #fbbf24; background: rgba(251,191,36,0.15); }
.grade-badge.grade-8 { color: #34d399; background: rgba(52,211,153,0.15); }
.grade-badge.grade-7 { color: #34d399; background: rgba(52,211,153,0.12); }
.grade-badge.grade-6 { color: #60a5fa; background: rgba(96,165,250,0.15); }
.grade-badge.grade-5 { color: #60a5fa; background: rgba(96,165,250,0.12); }
.grade-badge.grade-4 { color: #f97316; background: rgba(249,115,22,0.15); }
.grade-badge.grade-3 { color: #f87171; background: rgba(248,113,113,0.15); }
.grade-badge.grade-2 { color: #f87171; background: rgba(248,113,113,0.12); }
.grade-badge.grade-1 { color: #f87171; background: rgba(248,113,113,0.1); }

.predicted-grade-section {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.predicted-grade-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}
.predicted-grade-note {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
  line-height: 1.5;
  font-style: italic;
}

/* ===== RESULTS ===== */
.results-card {
  text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2.25rem 1.5rem;
}
.results-emoji { font-size: 3rem; margin-bottom: 0.875rem; }
.results-title {
  font-family: 'Chillax', sans-serif; font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.875rem); margin-bottom: 0.4rem;
}
.results-score {
  font-size: clamp(2.25rem, 1.8rem + 1.8vw, 3.5rem); font-weight: 700;
  font-variant-numeric: tabular-nums; margin: 0.875rem 0;
  font-family: 'Chillax', sans-serif;
}
.results-detail { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }
.results-actions { display: flex; gap: 0.625rem; justify-content: center; flex-wrap: wrap; }
.results-btn {
  padding: 0.7rem 1.375rem; font-family: 'General Sans', sans-serif; font-weight: 600;
  font-size: 0.875rem; border: none; border-radius: var(--radius); cursor: pointer; transition: all 0.18s ease;
}
.results-btn.primary { background: var(--text); color: var(--bg); }
.results-btn.primary:hover { opacity: 0.85; }
.results-btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.results-btn.secondary:hover { background: var(--surface-3); }
.results-btn.danger { background: var(--wrong-bg); color: var(--wrong); border: 1px solid rgba(248,113,113,0.3); }
.results-btn.danger:hover { background: rgba(248,113,113,0.2); }

/* ===== REVIEW SECTION ===== */
.review-section { margin-top: 1.75rem; }
.review-section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.875rem;
}
.review-section h3 { font-family: 'Chillax', sans-serif; font-weight: 600; font-size: 1.1rem; }
.review-item {
  background: var(--surface-2); border-radius: var(--radius); padding: 0.875rem 1.125rem;
  margin-bottom: 0.5rem; border-left: 3px solid var(--wrong);
}
.review-item.was-correct { border-left-color: var(--correct); }
.review-q { font-weight: 500; font-size: 0.875rem; margin-bottom: 0.35rem; }
.review-answer { font-size: 0.78rem; color: var(--text-muted); }
.review-answer span.right { color: var(--correct); font-weight: 600; }
.review-answer span.picked-wrong { color: var(--wrong); font-weight: 600; }
.review-item .review-exp { margin-top: 0.4rem; font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* ===== WEAK SPOTS VIEW ===== */
.weak-spots-view-header { margin-bottom: 1.5rem; }
.weak-spots-view-header h2 {
  font-family: 'Chillax', sans-serif; font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); margin-bottom: 0.25rem;
}
.weak-spots-view-header p { color: var(--text-muted); font-size: 0.9rem; }

.weak-subject-group { margin-bottom: 1.75rem; }
.weak-subject-label {
  display: flex; align-items: center; gap: 0.625rem;
  font-family: 'Chillax', sans-serif; font-weight: 600; font-size: 1rem;
  margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.weak-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 0.625rem; overflow: hidden;
}
.weak-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  padding: 1rem 1.125rem; cursor: pointer;
}
.weak-card-header:hover { background: var(--surface-2); }
.weak-card-q { font-weight: 500; font-size: 0.875rem; line-height: 1.45; flex: 1; }
.weak-card-chevron { color: var(--text-faint); font-size: 0.85rem; flex-shrink: 0; margin-top: 0.15rem; transition: transform 0.2s ease; }
.weak-card.open .weak-card-chevron { transform: rotate(180deg); }
.weak-card-body {
  display: none; padding: 0 1.125rem 1rem; border-top: 1px solid var(--border);
}
.weak-card.open .weak-card-body { display: block; }
.weak-card-concept {
  margin-top: 0.75rem; padding: 0.75rem 1rem;
  background: var(--surface-2); border-radius: 0.5rem;
  font-size: 0.85rem; line-height: 1.6; color: var(--text-muted);
  border-left: 3px solid var(--wrong);
}
.weak-card-concept strong { color: var(--text); }
.weak-card-answers { margin-top: 0.75rem; font-size: 0.82rem; }
.weak-card-answers .wa-row { margin-bottom: 0.2rem; color: var(--text-muted); }
.weak-card-answers .wa-correct { color: var(--correct); font-weight: 600; }
.weak-card-answers .wa-wrong { color: var(--wrong); }
.weak-card-actions { display: flex; gap: 0.5rem; margin-top: 0.875rem; }
.weak-card-retest {
  padding: 0.45rem 0.875rem; font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.8rem;
  border: none; border-radius: 0.5rem; cursor: pointer; transition: all 0.18s ease;
  background: var(--surface-3); color: var(--text);
}
.weak-card-retest:hover { background: var(--border); }
.weak-card-dismiss {
  padding: 0.45rem 0.875rem; font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.8rem;
  border: 1px solid var(--border); border-radius: 0.5rem; cursor: pointer; transition: all 0.18s ease;
  background: none; color: var(--text-muted);
}
.weak-card-dismiss:hover { color: var(--text); background: var(--surface-2); }

.weak-retest-mini {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.5rem 0.75rem; margin-top: 0.75rem;
}
.weak-retest-mini-q { font-size: 0.82rem; font-weight: 500; flex: 1; }
.retest-opts { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.retest-opt {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; font-family: inherit; font-size: 0.82rem;
  background: var(--surface-3); border: 1.5px solid var(--border); border-radius: 0.5rem;
  cursor: pointer; text-align: left; color: var(--text); transition: all 0.15s ease;
}
.retest-opt:hover:not(.answered) { border-color: var(--border-active); }
.retest-opt.correct { border-color: var(--correct); background: var(--correct-bg); }
.retest-opt.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.retest-opt.answered { cursor: default; opacity: 0.7; }
.retest-opt.correct.answered, .retest-opt.wrong.answered { opacity: 1; }
.retest-letter { width: 22px; height: 22px; min-width: 22px; display: flex; align-items: center; justify-content: center; background: var(--surface); border-radius: 0.35rem; font-weight: 700; font-size: 0.75rem; color: var(--text-muted); }
.retest-opt.correct .retest-letter { background: var(--correct); color: #fff; }
.retest-opt.wrong .retest-letter { background: var(--wrong); color: #fff; }
.retest-result { margin-top: 0.5rem; padding: 0.5rem 0.75rem; background: var(--surface-2); border-radius: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.retest-result.pass { color: var(--correct); }
.retest-result.fail { color: var(--wrong); }

.empty-weak {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted); font-size: 0.95rem;
}
.empty-weak .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ===== MINI RETEST IN WEAK CARD ===== */
.retest-section { margin-top: 0.75rem; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.35s ease; }
.slide-up { animation: slideUp 0.35s cubic-bezier(0.16,1,0.3,1); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  #app { padding: 1rem 0.75rem 2.5rem; }
  .question-card { padding: 1.125rem 0.875rem; }
  .option-btn { padding: 0.75rem 0.875rem; }
  .results-card { padding: 1.75rem 0.875rem; }
  .subject-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== XP SYSTEM ===== */
.xp-chip {
  font-size: 0.72rem; font-weight: 700;
  padding: 0.3rem 0.65rem; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(249,115,22,0.18));
  color: #fbbf24; border: 1px solid rgba(251,191,36,0.3);
  cursor: default; white-space: nowrap;
}
.xp-bar-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
.xp-level-info {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.xp-level-badge {
  font-weight: 700; font-size: 0.88rem; color: #fbbf24;
}
.xp-total {
  font-size: 0.75rem; color: var(--text-muted);
}
.xp-track {
  height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16,1,0.3,1);
}

/* XP gained indicator in quiz */
.explanation-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
}
.xp-gained {
  font-size: 0.78rem; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,0.15); border: 1px solid rgba(251,191,36,0.3);
  padding: 0.2rem 0.5rem; border-radius: 0.375rem;
  animation: xpPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes xpPop {
  0% { transform: scale(0.6) translateY(6px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===== CONFETTI ===== */
@keyframes confettiBurst {
  0% { transform: translate(0,0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx),var(--ty)) rotate(var(--rot)) scale(0.3); opacity: 0; }
}
.confetti-piece { pointer-events: none; }

/* ===== MASCOT REACTIONS ===== */
.mascot-reaction {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.875rem 1rem; border-radius: var(--radius);
  margin-top: 0.875rem; margin-bottom: -0.25rem;
  animation: mascotPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.mascot-correct {
  background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3);
}
.mascot-wrong {
  background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.25);
}
.mascot-face {
  font-size: 2.2rem; line-height: 1; flex-shrink: 0;
  animation: faceBounce 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.mascot-bubble { flex: 1; }
.mascot-say {
  font-weight: 700; font-size: 0.92rem; line-height: 1.3;
  color: var(--text); margin-bottom: 0.2rem;
}
.mascot-sub {
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.4;
}
@keyframes mascotPop {
  0% { transform: scale(0.8) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes faceBounce {
  0% { transform: scale(0.5) rotate(-15deg); }
  60% { transform: scale(1.2) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ===== FUN FACT CARD ===== */
.fun-fact-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 2px solid var(--border-active); border-radius: var(--radius-xl);
  padding: 1.75rem 1.5rem; text-align: center;
  margin-top: 1.5rem;
}
.fun-fact-emoji { font-size: 3rem; margin-bottom: 1rem; animation: spin180 0.6s ease; }
@keyframes spin180 {
  0% { transform: rotate(-20deg) scale(0.5); }
  100% { transform: rotate(0deg) scale(1); }
}
.fun-fact-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); margin-bottom: 0.75rem;
}
.fun-fact-text {
  font-size: clamp(1rem, 0.9rem + 0.3vw, 1.15rem);
  font-weight: 500; line-height: 1.6; color: var(--text); margin-bottom: 1.5rem;
}
.fun-fact-next {
  display: inline-block; padding: 0.75rem 1.5rem;
  background: var(--text); color: var(--bg);
  border: none; border-radius: var(--radius); font-family: inherit;
  font-weight: 600; font-size: 0.92rem; cursor: pointer;
  transition: opacity 0.18s ease;
}
.fun-fact-next:hover { opacity: 0.85; }

/* ===== OPTION ANIMATIONS ===== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
@keyframes bounce {
  0%,100% { transform: scale(1); }
  30% { transform: scale(1.04); }
  60% { transform: scale(0.98); }
  80% { transform: scale(1.02); }
}
.option-btn.shake { animation: shake 0.5s ease; }
.option-btn.calm-pulse { animation: gentlePulse 0.8s ease; }
.option-btn.bounce { animation: bounce 0.5s ease; }

/* ===== MILESTONE TOAST ===== */
.milestone-toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--correct); border-radius: var(--radius);
  padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.92rem; color: var(--text);
  box-shadow: var(--shadow); z-index: 9998; white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
  opacity: 0;
}
.milestone-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== LEVEL UP TOAST ===== */
.level-up-toast {
  position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%) translateY(-120px);
  z-index: 9999; transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s ease;
  opacity: 0;
}
.level-up-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.level-up-inner {
  display: flex; align-items: center; gap: 1rem;
  background: linear-gradient(135deg, #1a1500, #2a2000);
  border: 2px solid #fbbf24; border-radius: var(--radius-xl);
  padding: 1rem 1.5rem; box-shadow: 0 0 40px rgba(251,191,36,0.3);
}
.level-up-emoji { font-size: 2.25rem; animation: faceBounce 0.5s ease; }
.level-up-title { font-weight: 800; font-size: 1rem; color: #fbbf24; letter-spacing: 0.04em; }
.level-up-sub { font-size: 0.82rem; color: rgba(251,191,36,0.75); margin-top: 0.15rem; }

/* ===== SCIENCE NOTE ON HOME ===== */
.science-note {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid #60a5fa;
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-top: 0.5rem; margin-bottom: 1.5rem;
}
.science-note-title {
  font-weight: 600; font-size: 0.88rem; color: var(--text); margin-bottom: 0.75rem;
}
.science-note-facts {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.science-note-facts span {
  font-size: 0.75rem; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0.3rem 0.7rem; border-radius: var(--radius);
}

/* ===== RESULTS EXTRAS ===== */
.results-message {
  font-size: 0.92rem; color: var(--text-muted); line-height: 1.6;
  max-width: 480px; margin: 0 auto 0.875rem; padding: 0 0.5rem;
}
.results-level-note {
  font-size: 0.82rem; color: var(--text-muted); margin: 0.5rem 0 1.25rem;
}

/* ===== REPORT ACTIONS (results screen) ===== */
.report-actions {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 3px solid var(--accent-enlang);
}
.report-label {
  font-weight: 600; font-size: 0.88rem; color: var(--text);
  margin-bottom: 0.75rem;
}
.report-btn-row {
  display: flex; gap: 0.625rem; flex-wrap: wrap;
}
.report-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.875rem;
  border-radius: var(--radius); cursor: pointer; border: none;
  transition: all 0.18s ease; flex: 1; min-width: 140px; justify-content: center;
}
.report-btn.download {
  background: var(--text); color: var(--bg);
}
.report-btn.download:hover { opacity: 0.85; transform: translateY(-1px); }
.report-btn.share {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border);
}
.report-btn.share:hover { background: var(--border); }
.report-hint {
  margin-top: 0.625rem; font-size: 0.75rem; color: var(--text-muted);
  line-height: 1.5;
}

/* ===== PRINT HOME BUTTON ===== */
.print-home-btn {
  display: flex; align-items: center; gap: 0.625rem;
  width: 100%; padding: 0.875rem 1.25rem;
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.925rem;
  color: var(--text); cursor: pointer;
  transition: all 0.18s ease;
  margin: 0.75rem 0;
}
.print-home-btn:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  color: var(--accent);
}
.print-home-btn svg { flex-shrink: 0; opacity: 0.75; }
.print-home-badge {
  margin-left: auto; font-size: 0.72rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
  padding: 0.2rem 0.55rem; border-radius: 20px; border: 1px solid var(--border);
}

/* ===== PRINT TOPIC WORKSHEET BUTTON (in topics view) ===== */
.print-topic-worksheet-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin-top: 0.625rem; padding: 0.75rem 1rem;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-family: 'General Sans', sans-serif; font-weight: 600; font-size: 0.875rem;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.18s ease;
}
.print-topic-worksheet-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}
.print-topic-worksheet-btn svg { flex-shrink: 0; }

/* ===== PRINT SETUP CARD ===== */
.print-setup-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
}
.print-section-label {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent);
  margin-bottom: 0.625rem;
}
.print-subject-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.print-subj-btn {
  padding: 0.45rem 0.875rem;
  font-family: 'General Sans', sans-serif; font-size: 0.82rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease;
}
.print-subj-btn:hover {
  border-color: var(--accent); color: var(--text);
}
.print-subj-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.print-topic-list {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.print-topic-btn {
  padding: 0.35rem 0.75rem;
  font-family: 'General Sans', sans-serif; font-size: 0.78rem; font-weight: 500;
  background: var(--surface-3); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease;
}
.print-topic-btn:hover { border-color: var(--accent); color: var(--text); }
.print-topic-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.print-mode-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.print-mode-btn {
  padding: 0.4rem 0.9rem;
  font-family: 'General Sans', sans-serif; font-size: 0.82rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease;
}
.print-mode-btn:hover { border-color: var(--accent); color: var(--text); }
.print-mode-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.print-count-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.print-preview-row {
  margin-top: 1rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface-3); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.print-preview-info {
  display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap;
}
.print-preview-badge {
  background: var(--accent); color: #fff;
  font-size: 0.78rem; font-weight: 700;
  padding: 0.2rem 0.6rem; border-radius: 20px;
  white-space: nowrap;
}
.print-actions {
  margin-top: 1.25rem;
}
.print-go-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--accent); color: #fff;
  font-family: 'General Sans', sans-serif; font-weight: 700; font-size: 0.95rem;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: all 0.18s ease; width: 100%; justify-content: center;
}
.print-go-btn:hover:not(:disabled) {
  opacity: 0.88; transform: translateY(-1px);
}
.print-go-btn:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.print-go-hint {
  margin-top: 0.625rem; font-size: 0.75rem; color: var(--text-muted); line-height: 1.55;
}
.print-pick-prompt {
  text-align: center; padding: 2rem 1rem;
  font-size: 0.95rem; color: var(--text-muted);
}

/* ===== LEARNER PROFILE CARDS ===== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 600px) {
  .profile-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.75rem;
  min-height: 120px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.2s ease;
}
.profile-card:hover {
  border-color: #01b3bc;
  transform: translateY(-3px);
  box-shadow: 0 0 0 3px rgba(1,179,188,0.15), var(--shadow);
}
.profile-card.selected, .profile-card.profile-selected {
  border-color: #01b3bc;
  background: rgba(1,179,188,0.08);
  box-shadow: 0 0 0 3px rgba(1,179,188,0.2);
}
.profile-card-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.profile-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.profile-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== ESSAY TECHNIQUE TOOL ===== */
.essay-tool-card {
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(96,165,250,0.08));
  border: 1.5px solid rgba(167,139,250,0.35);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.essay-tool-card:hover {
  border-color: rgba(167,139,250,0.6);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.essay-tool-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.essay-tool-info h3 {
  font-family: 'Chillax', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #a78bfa;
  margin-bottom: 0.2rem;
}
.essay-tool-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* PEEL sections */
.peel-section {
  margin-bottom: 1rem;
}
.peel-label {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.peel-label span {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}
.peel-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.18s ease;
  outline: none;
}
.peel-textarea:focus {
  border-color: #a78bfa;
}

.peel-feedback {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-top: 0.375rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.peel-feedback.pass {
  background: var(--correct-bg);
  border: 1px solid rgba(52,211,153,0.3);
  color: var(--correct);
}
.peel-feedback.warn {
  background: var(--warning-bg);
  border: 1px solid rgba(251,191,36,0.3);
  color: var(--warning);
}
.peel-feedback.fail {
  background: var(--wrong-bg);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--wrong);
}

.sample-answer-toggle {
  width: 100%;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  margin-top: 1rem;
}
.sample-answer-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
}
.sample-answer-content {
  margin-top: 0.75rem;
  padding: 1rem 1.125rem;
  background: var(--surface-2);
  border: 1px solid rgba(167,139,250,0.3);
  border-left: 3px solid #a78bfa;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.sample-answer-content strong { color: var(--text); }

/* Essay text picker */
.essay-text-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.essay-text-btn {
  padding: 0.875rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.essay-text-btn:hover {
  border-color: #a78bfa;
  background: var(--surface-2);
}

/* Essay question picker */
.essay-question-item {
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
.essay-question-item:hover {
  border-color: #a78bfa;
  background: var(--surface-2);
}

/* ===== COLLABORATION ROOM BANNER ===== */
.room-banner {
  background: linear-gradient(135deg, rgba(52,211,153,0.12), rgba(96,165,250,0.08));
  border: 1.5px solid rgba(52,211,153,0.4);
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.room-banner .room-code-chip {
  background: rgba(52,211,153,0.2);
  border: 1px solid rgba(52,211,153,0.4);
  border-radius: 0.375rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  font-weight: 800;
}
.room-banner .room-copy-btn {
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  background: rgba(52,211,153,0.15);
  border: 1px solid rgba(52,211,153,0.4);
  border-radius: 0.375rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
  cursor: pointer;
  transition: all 0.15s ease;
}
.room-banner .room-copy-btn:hover {
  background: rgba(52,211,153,0.25);
}

/* Room modal */
.room-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.room-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.room-modal h2 {
  font-family: 'Chillax', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.room-modal p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}
.room-code-display {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'Chillax', sans-serif;
  letter-spacing: 0.15em;
  color: #34d399;
  background: rgba(52,211,153,0.08);
  border: 2px solid rgba(52,211,153,0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}
.room-modal-btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: 0.5rem;
}
.room-modal-btn.primary {
  background: #34d399;
  color: #0f1117;
}
.room-modal-btn.primary:hover { opacity: 0.88; }
.room-modal-btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.room-modal-btn.secondary:hover { background: var(--surface-3); }
.room-modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.15em;
  outline: none;
  margin-bottom: 0.75rem;
  transition: border-color 0.18s;
}
.room-modal-input:focus { border-color: #34d399; }

/* Study Together button */
.study-together-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: var(--surface-2);
  border: 1.5px dashed rgba(52,211,153,0.4);
  border-radius: var(--radius);
  font-family: 'General Sans', sans-serif;
  font-weight: 600;
  font-size: 0.925rem;
  color: #34d399;
  cursor: pointer;
  transition: all 0.18s ease;
  margin: 0.75rem 0;
}
.study-together-btn:hover {
  background: rgba(52,211,153,0.08);
  border-color: rgba(52,211,153,0.65);
}

/* ===== PYTHAGORAS DEMO ===== */
.pythagoras-demo {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 1.5rem 1rem 4rem;
}
.pythagoras-demo .demo-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 520px;
  margin-bottom: 1.5rem;
}
.pythagoras-demo .demo-back {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}
.pythagoras-demo .demo-back:hover { background: var(--surface-3); color: var(--text); }
.pythagoras-demo h2 {
  font-family: 'Chillax', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.pythagoras-svg-wrap {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.pythagoras-equation {
  font-family: 'Chillax', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin: 0.75rem 0 1.25rem;
  letter-spacing: 0.04em;
}
.pythag-practice {
  width: 100%;
  max-width: 520px;
}
.pythag-practice h3 {
  font-family: 'Chillax', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.875rem;
  color: var(--text);
}
.pythag-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 0.75rem;
}
.pythag-q-text {
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.pythag-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.pythag-opt {
  padding: 0.625rem 0.875rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.pythag-opt:hover:not(.answered) { border-color: var(--border-active); background: var(--surface-3); }
.pythag-opt.correct { border-color: var(--correct); background: var(--correct-bg); color: var(--correct); font-weight: 600; }
.pythag-opt.wrong { border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong); }
.pythag-opt.answered { cursor: default; }

/* SVG animation helpers */
.svg-line-anim {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: drawLine 1s ease forwards;
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}
.svg-square-anim {
  opacity: 0;
  animation: fadeInSq 0.5s ease forwards;
}
@keyframes fadeInSq {
  to { opacity: 1; }
}
.svg-label-anim {
  opacity: 0;
  animation: fadeInSq 0.4s ease forwards;
}

/* ===== PHASE 1 NEW STYLES ===== */

/* --- Calm Mode --- */
body.calm-mode-active {
  --wrong: #F59E0B;
  --wrong-bg: rgba(245,158,11,0.15);
}
.calm-banner {
  background: rgba(251,243,219,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: #F59E0B;
  margin-bottom: 1rem;
  text-align: center;
}
.calm-exp {
  border-left: 3px solid #F59E0B !important;
  background: rgba(245,158,11,0.08) !important;
}
@keyframes calmPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(245,158,11,0.25); }
  100% { transform: scale(1); }
}
.option-btn.wrong.calm-pulse {
  animation: calmPulse 0.8s ease;
}

/* --- Streak Shields --- */
.shield-display {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.25);
  border-radius: 0.5rem;
  padding: 0.25rem 0.625rem;
}

/* --- TTS Button --- */
.tts-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: all 0.18s;
  font-family: inherit;
}
.tts-btn:hover { background: var(--surface-3); color: var(--text); }

/* --- Predicted Grade Badge --- */
.grade-badge-wrap {
  margin: 1.25rem auto;
  text-align: center;
}
.grade-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  font-weight: 700;
}
.grade-num {
  font-size: 2.2rem;
  line-height: 1;
  font-family: 'Chillax', sans-serif;
}
.grade-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}
.grade-note {
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* --- Spaced Review Banner --- */
.spaced-review-banner {
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.3);
  border-left: 3px solid #60a5fa;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 1rem;
}
.question-card.spaced-card {
  border-color: rgba(96,165,250,0.35) !important;
}

/* --- Fighter Profile Personal Best --- */
.fighter-pb {
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #FFD700;
  margin-bottom: 0.75rem;
  text-align: center;
}

/* --- Builder Profile Progress Bar --- */
.builder-bar-wrap {
  margin-bottom: 0.75rem;
}
.builder-bar-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.builder-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.builder-fill {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #60a5fa);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* --- Deep Diver Extra Context --- */
.deep-diver-extra {
  margin-top: 0.875rem;
  padding: 0.875rem 1rem;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  border-left: 3px solid #a78bfa;
  border-radius: var(--radius);
}
.deep-diver-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.deep-diver-extra p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* --- Profile Chip on Home --- */
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #01b3bc;
  background: rgba(1,179,188,0.1);
  border: 1px solid rgba(1,179,188,0.25);
  border-radius: 1rem;
  padding: 0.15rem 0.6rem;
}

/* --- Profile Cards (lock screen) --- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  background: #0f1117;
  border: 1.5px solid #2a2d3a;
  border-radius: 12px;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}
.profile-card:hover {
  border-color: #01b3bc;
  background: #1a1d27;
  transform: translateY(-1px);
}
.profile-card.profile-selected {
  border-color: #01b3bc;
  background: rgba(1,179,188,0.08);
  box-shadow: 0 0 0 2px rgba(1,179,188,0.2);
}
.profile-card-emoji { font-size: 1.75rem; flex-shrink: 0; }
.profile-card-name { font-weight: 700; font-size: 0.95rem; color: #fff; margin-bottom: 0.2rem; }
.profile-card-desc { font-size: 0.78rem; color: #8b8fa8; line-height: 1.4; }

/* --- Essay Tool Card (Home) --- */
.essay-tool-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.essay-tool-card:hover {
  border-color: var(--border-active);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.essay-tool-icon { font-size: 1.5rem; flex-shrink: 0; }
.essay-tool-info { flex: 1; }
.essay-tool-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.essay-tool-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.essay-tool-arrow { color: var(--text-faint); font-size: 1.1rem; }

/* --- Essay Tool Views --- */
.essay-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}
.essay-subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.essay-subject-card:hover { border-color: #01b3bc; transform: translateY(-2px); }
.essay-subj-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.essay-subj-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem; }
.essay-subj-count { font-size: 0.78rem; color: var(--text-muted); }

.essay-question-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #01b3bc;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.essay-q-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #01b3bc;
  margin-bottom: 0.4rem;
}
.essay-q-text { font-size: 1rem; font-weight: 600; line-height: 1.5; }

.peel-instructions {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.peel-builder { display: flex; flex-direction: column; gap: 0.875rem; margin-bottom: 1.25rem; }
.peel-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.875rem; }
.peel-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.peel-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.p-p { background: rgba(52,211,153,0.2); color: #34d399; }
.p-e { background: rgba(96,165,250,0.2); color: #60a5fa; }
.p-e2 { background: rgba(249,115,22,0.2); color: #f97316; }
.p-l { background: rgba(167,139,250,0.2); color: #a78bfa; }
.peel-textarea {
  width: 100%; min-height: 80px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 0.5rem; color: var(--text);
  padding: 0.625rem 0.75rem; font-size: 0.88rem; font-family: inherit;
  line-height: 1.5; resize: vertical; outline: none; transition: border-color 0.18s;
}
.peel-textarea:focus { border-color: #01b3bc; }
.peel-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.peel-feedback-area { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.peel-fb-item {
  display: flex; align-items: flex-start; gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius); font-size: 0.85rem;
}
.fb-pass { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); }
.fb-fail { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); }
.fb-icon { flex-shrink: 0; }
.fb-tip { color: var(--text-muted); font-weight: 400; }
.peel-fb-success {
  padding: 0.875rem; text-align: center;
  background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3);
  border-radius: var(--radius); font-weight: 600; color: #34d399;
}
.peel-sample {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid #a78bfa; border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-top: 0.75rem;
}
.peel-sample-label {
  font-weight: 700; font-size: 0.85rem; color: #a78bfa; margin-bottom: 0.75rem;
}
.peel-sample-content p {
  font-size: 0.85rem; line-height: 1.55; margin-bottom: 0.625rem; color: var(--text-muted);
}
.peel-sample-content strong { color: var(--text); }

/* --- Pythagoras Demo --- */
.pythagoras-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.pyth-question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
}
.pyth-q-text { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.625rem; }
.pyth-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.pyth-opt {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.875rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 0.5rem;
  cursor: pointer; font-family: inherit; font-size: 0.88rem;
  color: var(--text); transition: all 0.15s; text-align: left;
}
.pyth-opt:hover:not(:disabled) { border-color: #01b3bc; background: var(--surface-3); }
.pyth-opt.correct { background: var(--correct-bg); border-color: var(--correct); color: var(--correct); }
.pyth-opt.wrong { background: var(--wrong-bg); border-color: var(--wrong); color: var(--wrong); }
.pyth-exp {
  margin-top: 0.625rem; padding: 0.625rem 0.875rem;
  background: var(--surface-2); border-radius: 0.5rem;
  font-size: 0.83rem; color: var(--text-muted); line-height: 1.5;
}

/* --- Room Banner --- */
.room-banner {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.3);
  border-radius: var(--radius); padding: 0.6rem 1rem;
  font-size: 0.85rem; margin-bottom: 0.75rem; color: #60a5fa;
}
.room-copy-btn {
  margin-left: auto; padding: 0.25rem 0.75rem;
  background: rgba(96,165,250,0.15); border: 1px solid rgba(96,165,250,0.3);
  border-radius: 0.4rem; color: #60a5fa; cursor: pointer;
  font-size: 0.78rem; font-family: inherit; transition: all 0.15s;
}
.room-copy-btn:hover { background: rgba(96,165,250,0.25); }
.room-quiz-tag {
  display: inline-flex; align-items: center;
  font-size: 0.75rem; color: #60a5fa; font-weight: 600;
  margin-bottom: 0.5rem;
}

/* --- Collaboration Room Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 2rem 1.75rem;
  max-width: 380px; width: 100%;
}

/* --- Profile Selected State --- */
.profile-card-info { flex: 1; }

/* ===== VISUAL IMPAIRMENT / AUDIO MODE ===== */
/* ===== VI AUDIO MODE PANEL ===== */
.vi-panel {
  background: linear-gradient(135deg, #1a1040, #2d1b69);
  border: 2px solid #7c3aed;
  border-radius: 14px;
  padding: 1rem 1rem 0.75rem;
  margin: 0 0 1.25rem;
  box-shadow: 0 0 24px rgba(124,58,237,0.25);
}
.vi-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}
.vi-mic-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #c4b5fd;
  min-width: 0;
  flex: 1;
}
.vi-mic-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  background: #22c55e;
  animation: vi-pulse 1.4s infinite;
  flex-shrink: 0;
}
@keyframes vi-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.vi-stop-btn {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.vi-stop-btn:hover { background: rgba(239,68,68,0.3); }

.vi-main-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.vi-big-btn {
  background: rgba(124,58,237,0.2);
  border: 1.5px solid rgba(124,58,237,0.5);
  border-radius: 10px;
  color: #e9d5ff;
  padding: 0.7rem 0.4rem 0.6rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.3;
  text-align: center;
  transition: all 0.18s;
}
.vi-big-btn:hover { background: rgba(124,58,237,0.4); border-color: #a78bfa; }
.vi-big-btn span { font-size: 0.72rem; color: #c4b5fd; }

.vi-explain-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.vi-explain-label {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
}
.vi-explain-pill {
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: 20px;
  color: #ddd6fe;
  padding: 0.25rem 0.7rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.vi-explain-pill:hover { background: rgba(139,92,246,0.35); }

.vi-hint {
  font-size: 0.73rem;
  color: #6b7280;
  line-height: 1.4;
  border-top: 1px solid rgba(124,58,237,0.2);
  padding-top: 0.5rem;
}
.vi-hint strong { color: #a78bfa; }


/* ===== SETTINGS VIEW ===== */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.settings-section-title {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.settings-row:first-of-type { border-top: none; }
.settings-row-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.settings-row-value {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: right;
}
.settings-row-hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.2rem;
  line-height: 1.4;
  max-width: 240px;
}
.settings-toggle-row {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.settings-toggle-opt {
  padding: 0.35rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.settings-toggle-opt.active {
  background: rgba(1,179,188,0.15);
  border-color: #01b3bc;
  color: #01b3bc;
  font-weight: 600;
}
.settings-toggle-opt:hover:not(.active) {
  border-color: var(--border-active);
  color: var(--text);
}
.settings-btn-danger {
  padding: 0.6rem 1.25rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  color: #f87171;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.settings-btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
}

/* ===== DASHBOARD VIEW ===== */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.dash-welcome {
  font-family: 'Chillax', sans-serif;
  font-weight: 700;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.75rem);
  margin-bottom: 0.2rem;
}
.dash-streak-badge {
  background: rgba(251,191,36,0.15);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 20px;
  padding: 0.4rem 0.875rem;
  color: #fbbf24;
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 500px) {
  .dash-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 0.875rem;
  text-align: center;
}
.dash-kpi-value {
  font-family: 'Chillax', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}
.dash-kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.dash-section-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text);
}
.dash-bar-row { margin-bottom: 0.875rem; }
.dash-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
  font-weight: 500;
}
.dash-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}
.dash-bar-sub {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 0.2rem;
}
.dash-weak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.dash-weak-row:first-of-type { border-top: none; }
.dash-weak-topic { font-weight: 600; font-size: 0.875rem; }
.dash-weak-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.dash-practise-btn {
  padding: 0.45rem 0.875rem;
  background: rgba(1,179,188,0.12);
  border: 1px solid rgba(1,179,188,0.3);
  border-radius: 8px;
  color: #01b3bc;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-practise-btn:hover {
  background: rgba(1,179,188,0.2);
  border-color: #01b3bc;
}
.dash-session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.dash-session-card:first-of-type { border-top: none; }
.dash-session-subject { font-weight: 600; font-size: 0.875rem; }
.dash-session-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.dash-session-score { font-weight: 700; font-size: 0.95rem; text-align: right; flex-shrink: 0; }
.dash-wrong-item {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.dash-wrong-item:first-of-type { border-top: none; }
.dash-wrong-q { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; }
.dash-wrong-answers { font-size: 0.8rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.dash-your-ans { color: var(--wrong); }
.dash-correct-ans { color: var(--correct); }
.dash-no-data {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 1rem;
}

/* ===== EXPLANATION simpleMode TOGGLE ===== */
.explanation-text {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
.explanation-lang-toggle {
  background: none;
  border: none;
  color: #01b3bc;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: block;
}
.explanation-lang-toggle:hover { color: #60a5fa; }

/* ===== HIGH CONTRAST MODE ===== */
body.high-contrast {
  --border: #5a6090;
  --border-active: #8090c0;
  --text-muted: #c0c4d8;
  --text-faint: #9098b8;
}
body.high-contrast .option-btn {
  border-width: 2px;
}

/* ===== PROFILE CARDS (lockscreen — legacy CSS support) ===== */
.profile-card {
  display: flex; align-items: center; gap: 0.875rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.18s;
}
.profile-card:hover { border-color: #01b3bc; }
.profile-card.profile-selected { border-color: #01b3bc; background: rgba(1,179,188,0.08); }
.profile-card-emoji { font-size: 1.5rem; }
.profile-card-name { font-weight: 600; font-size: 0.9rem; }
.profile-card-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ===== FLASHCARD MODE ===== */
.flashcard-scene {
  perspective: 1000px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  cursor: pointer;
}
.flashcard {
  width: 100%;
  min-height: 250px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.flashcard.flipped {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  width: 100%;
  min-height: 250px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}
.flashcard-front {
  background: #1a1a2e;
  border: 2px solid #00d4aa;
  box-shadow: 0 4px 24px rgba(0,212,170,0.12);
}
.flashcard-back {
  background: #0d1117;
  border: 2px solid #7c3aed;
  transform: rotateY(180deg);
  box-shadow: 0 4px 24px rgba(124,58,237,0.12);
}

/* ===== REVISION NOTES SEARCH RESULT ===== */
.rn-search-result {
  background: #1a1d27;
  border: 1.5px solid #2a2d3a;
  border-radius: 12px;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.18s;
}
.rn-search-result:hover {
  border-color: #01b3bc;
  background: rgba(1,179,188,0.07);
}
