/* ========================================================
   CAMBRIDGE B1 PRELIMINARY (PET) MASTER - STYLESHEET
   Design System: Modern Glassmorphic, Deep Indigo & Cyan Theme
   ======================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.35);

  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.35);

  --accent: #f59e0b;
  --accent-light: #fef3c7;

  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --error-light: #fee2e2;

  --bg-main: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-hover: rgba(51, 65, 85, 0.9);
  --border: rgba(148, 163, 184, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --border: rgba(203, 213, 225, 0.8);
  --border-focus: #4f46e5;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

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

html, body {
  overflow-x: clip;
  max-width: 100vw;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Ambient Lighting */
.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.18) 0%, rgba(6, 182, 212, 0.12) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header & Navigation */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

[data-theme="light"] header.app-header {
  background: rgba(255, 255, 255, 0.9);
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-text h1 {
  background: linear-gradient(135deg, #1e1b4b 30%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Nav Tabs */
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

[data-theme="light"] nav.main-nav {
  background: #f1f5f9;
}

.nav-btn {
  background: transparent;
  border: none;
  outline: none;
  padding: 0.5rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Container */
main#app-root {
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

/* Section Containers */
.view-section {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
  display: block;
}

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

/* Common UI Components */
.hero-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .hero-banner {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 50%, #eff6ff 100%);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.08);
}

.hero-content {
  max-width: 780px;
  position: relative;
  z-index: 2;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(79, 70, 229, 0.2);
  border: 1px solid rgba(79, 70, 229, 0.4);
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

[data-theme="light"] .badge-tag {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.3);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  letter-spacing: -0.02em;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  border: none;
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 18px var(--primary-glow);
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, var(--primary));
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.35rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-val {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Module Grid */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: var(--transition);
}

.module-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.module-card:hover::before {
  opacity: 1;
}

.module-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.module-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
}

.module-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.module-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
}

/* ========================================================
   GAMIFIED EDTECH DASHBOARD (STYLE 2: JOURNEY & 3D SKILL CARDS)
   ======================================================== */
.journey-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

[data-theme="light"] .journey-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
}

.journey-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.journey-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.journey-title-group p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.gamify-stats-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.gamify-stat-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.gamify-stat-badge:hover {
  transform: translateY(-2px);
}

.gamify-stat-badge.streak-badge {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.08);
}

.gamify-stat-badge.xp-badge {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.08);
}

.gamify-stat-icon {
  font-size: 1.55rem;
  line-height: 1;
}

.gamify-stat-value {
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}

.streak-badge .gamify-stat-value {
  color: #f97316;
}

.xp-badge .gamify-stat-value {
  color: #eab308;
}

.gamify-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Journey Track & Milestones */
.journey-track-scroll {
  width: 100%;
  overflow-x: auto;
  padding: 1rem 0.5rem 0.85rem;
  scrollbar-width: thin;
}

.journey-track-scroll::-webkit-scrollbar {
  height: 6px;
}

.journey-track-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

.journey-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 820px;
  position: relative;
  padding: 0 1rem;
}

.journey-track-line {
  position: absolute;
  top: 24px;
  left: 28px;
  right: 28px;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  z-index: 1;
}

[data-theme="light"] .journey-track-line {
  background: #e2e8f0;
}

.journey-track-fill {
  position: absolute;
  top: 24px;
  left: 28px;
  height: 6px;
  background: linear-gradient(90deg, #10b981, #06b6d4, #4f46e5);
  border-radius: 999px;
  z-index: 2;
  transition: width 0.5s ease;
}

.journey-node {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.journey-node:hover {
  transform: translateY(-4px);
}

.node-pin {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--bg-surface);
  border: 3px solid var(--border);
  color: var(--text-muted);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

[data-theme="light"] .node-pin {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
}

.journey-node.completed .node-pin {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.journey-node.active .node-pin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fbbf24;
  color: #ffffff;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.25), 0 4px 16px rgba(245, 158, 11, 0.4);
  animation: pulseActive 2s infinite ease-in-out;
}

@keyframes pulseActive {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25), 0 4px 16px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.12), 0 4px 20px rgba(245, 158, 11, 0.6); }
}

.node-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.journey-node.completed .node-label {
  color: #10b981;
}

.journey-node.active .node-label {
  color: #f59e0b;
  font-weight: 800;
}

.node-status-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  white-space: nowrap;
}

/* Gamified Skill Cards Grid (Style 2 - Duolingo / ELSA) */
.gamify-skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.35rem;
  margin-bottom: 2.5rem;
}

.gamify-skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

[data-theme="light"] .gamify-skill-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.gamify-skill-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .gamify-skill-card:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
}

/* Color Accent Caps for Skill Cards */
.gamify-skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
}

.gamify-skill-card.theme-blue::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.gamify-skill-card.theme-orange::before { background: linear-gradient(90deg, #ea580c, #f97316); }
.gamify-skill-card.theme-green::before { background: linear-gradient(90deg, #059669, #10b981); }
.gamify-skill-card.theme-rose::before { background: linear-gradient(90deg, #e11d48, #f43f5e); }
.gamify-skill-card.theme-purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.gamify-skill-card.theme-indigo::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }

.skill-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.skill-3d-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease;
}

.gamify-skill-card:hover .skill-3d-icon {
  transform: scale(1.08) rotate(-4deg);
}

.theme-blue .skill-3d-icon { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.theme-orange .skill-3d-icon { background: rgba(234, 88, 12, 0.12); color: #ea580c; }
.theme-green .skill-3d-icon { background: rgba(5, 150, 105, 0.12); color: #059669; }
.theme-rose .skill-3d-icon { background: rgba(225, 29, 72, 0.12); color: #e11d48; }
.theme-purple .skill-3d-icon { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.theme-indigo .skill-3d-icon { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }

.skill-badge-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-blue .skill-badge-tag { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.theme-orange .skill-badge-tag { background: rgba(234, 88, 12, 0.12); color: #ea580c; }
.theme-green .skill-badge-tag { background: rgba(5, 150, 105, 0.12); color: #059669; }
.theme-rose .skill-badge-tag { background: rgba(225, 29, 72, 0.12); color: #e11d48; }
.theme-purple .skill-badge-tag { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.theme-indigo .skill-badge-tag { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }

.gamify-skill-card h3 {
  font-size: 1.22rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.gamify-skill-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

/* Mini Progress Bar in Card */
.skill-card-progress {
  margin-bottom: 1.25rem;
}

.skill-prog-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.skill-prog-track {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

[data-theme="light"] .skill-prog-track {
  background: #e2e8f0;
}

.skill-prog-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.theme-blue .skill-prog-fill { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.theme-orange .skill-prog-fill { background: linear-gradient(90deg, #ea580c, #f97316); }
.theme-green .skill-prog-fill { background: linear-gradient(90deg, #059669, #10b981); }
.theme-rose .skill-prog-fill { background: linear-gradient(90deg, #e11d48, #f43f5e); }
.theme-purple .skill-prog-fill { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.theme-indigo .skill-prog-fill { background: linear-gradient(90deg, #4f46e5, #818cf8); }

/* Duolingo-style 3D Chunky Action Button */
.btn-gamify-cta {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: none;
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all 0.15s ease-out;
  position: relative;
  outline: none;
}

.theme-blue .btn-gamify-cta {
  background: #0284c7;
  box-shadow: 0 4px 0 #0369a1;
}
.theme-blue .btn-gamify-cta:hover {
  background: #0369a1;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #075985;
}
.theme-blue .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0369a1;
}

.theme-orange .btn-gamify-cta {
  background: #ea580c;
  box-shadow: 0 4px 0 #c2410c;
}
.theme-orange .btn-gamify-cta:hover {
  background: #c2410c;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #9a3412;
}
.theme-orange .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c2410c;
}

.theme-green .btn-gamify-cta {
  background: #059669;
  box-shadow: 0 4px 0 #047857;
}
.theme-green .btn-gamify-cta:hover {
  background: #047857;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #065f46;
}
.theme-green .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #047857;
}

.theme-rose .btn-gamify-cta {
  background: #e11d48;
  box-shadow: 0 4px 0 #be123c;
}
.theme-rose .btn-gamify-cta:hover {
  background: #be123c;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #9f1239;
}
.theme-rose .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #be123c;
}

.theme-purple .btn-gamify-cta {
  background: #7c3aed;
  box-shadow: 0 4px 0 #6d28d9;
}
.theme-purple .btn-gamify-cta:hover {
  background: #6d28d9;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #5b21b6;
}
.theme-purple .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #6d28d9;
}

.theme-indigo .btn-gamify-cta {
  background: #4f46e5;
  box-shadow: 0 4px 0 #4338ca;
}
.theme-indigo .btn-gamify-cta:hover {
  background: #4338ca;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #3730a3;
}
.theme-indigo .btn-gamify-cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4338ca;
}

/* Exam / Practice Workspace Layout */
.test-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .test-layout {
    grid-template-columns: 1fr;
  }
}

.test-main-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.test-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.85rem;
}

.test-title-group h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.test-title-group p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.timer-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mode-toggle-group {
  display: flex;
  background: var(--bg-surface);
  padding: 0.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 0.2rem;
}

.mode-toggle-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.mode-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Question Items - High Contrast & Prominent Card Styling */
.q-container {
  scroll-margin-top: 85px;
  background: #1e293b;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
  position: relative;
}

[data-theme="light"] .q-container {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.q-container:hover {
  border-color: rgba(99, 102, 241, 0.85);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.18);
}

.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .q-header {
  border-bottom: 1px solid #e2e8f0;
}

.q-num-badge {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
}

.q-person-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 800;
}

[data-theme="light"] .q-person-badge {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #6d28d9;
}

/* Notice / Context Box - Signboard Appearance */
.q-context-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(6, 182, 212, 0.4);
  border-left: 4px solid #06b6d4;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin: 0.5rem 0 0.65rem 0;
  white-space: pre-line;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.55;
  color: #f8fafc;
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .q-context-box {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-left: 4px solid #0284c7;
  color: #0c4a6e;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.05);
}

.q-context-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #38bdf8;
  margin-bottom: 0.3rem;
}

[data-theme="light"] .q-context-label {
  color: #0284c7;
}

.q-context-body {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.55;
}

/* Prompt Text */
.q-prompt-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0.5rem 0 0.65rem 0;
  line-height: 1.45;
  letter-spacing: -0.01em;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.q-prompt-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.35;
}

[data-theme="light"] .q-prompt-text {
  color: #0f172a;
}

/* Options */
.options-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="light"] .option-item {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
}

.option-item:hover {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
  transform: translateX(3px);
}

[data-theme="light"] .option-item:hover {
  border-color: var(--primary);
  background: #f5f3ff;
}

.option-item.selected {
  border-color: #6366f1;
  background: rgba(79, 70, 229, 0.25);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .option-item.selected {
  border-color: var(--primary);
  background: #ede9fe;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.18);
}

.option-item.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.option-item.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* Review Mode - Disable changing answers after grading */
.review-mode .option-item {
  cursor: default !important;
  pointer-events: none !important;
}

.review-mode .option-item:hover {
  transform: none !important;
  box-shadow: none !important;
}

.review-mode .input-gap-fill {
  pointer-events: none !important;
  cursor: default !important;
  opacity: 0.95;
}

.option-key {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: var(--transition);
}

[data-theme="light"] .option-key {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #334155;
}

.option-item.selected .option-key {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.option-item.correct .option-key {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.option-item.wrong .option-key {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.option-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Explanation Box (Revealed only upon grading) */
.explanation-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-left: 4px solid #10b981;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.55;
  animation: fadeIn 0.3s ease;
}

[data-theme="light"] .explanation-box {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #16a34a;
}

.explanation-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #10b981;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

[data-theme="light"] .explanation-title {
  color: #15803d;
}

/* ========================================================
   CBT SPLIT-SCREEN & COMPACT EXAM SYSTEM
   ======================================================== */
.cbt-banner-compact {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

[data-theme="light"] .cbt-banner-compact {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.cbt-part-block {
  margin-bottom: 1.75rem;
}

.cbt-part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  border-bottom: 2px solid rgba(79, 70, 229, 0.25);
  padding-bottom: 0.35rem;
}

.cbt-part-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #818cf8;
}

[data-theme="light"] .cbt-part-title {
  color: var(--primary);
}

.cbt-part-instruction {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Part 1 Split Layout: Notice on Left, Prompt + Options on Right */
.cbt-q-split {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1.15rem;
  align-items: start;
}

.cbt-q-left {
  min-width: 0;
}

.cbt-q-right {
  min-width: 0;
}

/* 2-Column Split CBT Layout for Parts with Reading Passage or Place matching */
.cbt-reading-split-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.cbt-passage-column {
  position: sticky;
  top: 75px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 0.35rem;
}

.cbt-passage-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .cbt-passage-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.cbt-passage-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.cbt-section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  letter-spacing: 0.03em;
}

[data-theme="light"] .cbt-section-tag {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #c4b5fd;
}

.cbt-passage-title {
  color: var(--secondary);
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 0.45rem;
  line-height: 1.4;
}

[data-theme="light"] .cbt-passage-title {
  color: #0369a1;
}

.cbt-passage-body {
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--text-main);
  max-height: none;
}

.cbt-questions-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

/* Part 2 Place cards inside left column */
.cbt-places-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.cbt-place-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

[data-theme="light"] .cbt-place-card {
  background: #f8fafc;
}

.cbt-place-title {
  font-weight: 800;
  color: #818cf8;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

[data-theme="light"] .cbt-place-title {
  color: var(--primary);
}

.cbt-place-code {
  background: #4f46e5;
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.cbt-place-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.cbt-options-grid-4 {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 0.45rem !important;
}

/* Sidebar Navigation Drawer */
.test-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 85px;
  align-self: start;
  z-index: 30;
  max-height: calc(100vh - 95px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1rem;
  box-shadow: var(--shadow-sm);
}

.test-sidebar::-webkit-scrollbar {
  width: 5px;
}

.test-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.q-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.grid-num-btn {
  aspect-ratio: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.grid-num-btn:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.grid-num-btn.answered {
  background: rgba(79, 70, 229, 0.2);
  border-color: var(--primary);
  color: #818cf8;
}

.grid-num-btn.flagged {
  border-color: var(--accent);
  color: var(--accent);
  position: relative;
}

.grid-num-btn.flagged::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Audio Player Dock */
.audio-player-dock {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

.audio-track-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-disk {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 14px var(--secondary-glow);
}

.audio-disk.spinning {
  animation: spin 3s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-play-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: var(--transition);
}

.btn-play-lg:hover {
  transform: scale(1.06);
  background: var(--primary-hover);
}

.speed-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

/* Flashcards */
.flashcard-wrap {
  perspective: 1000px;
  max-width: 620px;
  margin: 0 auto 2rem;
  height: 340px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

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

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1.5px solid var(--border);
}

.card-front {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
}

.card-back {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  transform: rotateY(180deg);
  border-color: var(--primary);
}

/* Modal Scorecard */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex;
}

body.modal-open #ai-chat-bubble,
.modal-overlay.active ~ #ai-chat-bubble {
  display: none !important;
}

.scorecard-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 660px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 30px rgba(99, 102, 241, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-sizing: border-box;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.scorecard-modal::-webkit-scrollbar {
  width: 5px;
}

.scorecard-modal::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.scorecard-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.scorecard-close:hover {
  color: #fff;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.scorecard-header {
  text-align: left;
  padding-right: 2.2rem;
}

.scorecard-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

.scorecard-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
}

.scorecard-grid {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 580px) {
  .scorecard-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.scorecard-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
}

.score-circle-compact {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 18px var(--primary-glow);
  color: #fff;
  margin: 0.1rem 0;
}

.score-circle-compact .score-num {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.score-circle-compact .score-total {
  font-size: 0.68rem;
  opacity: 0.85;
}

.scorecard-band-tag {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  display: inline-block;
  line-height: 1.25;
}

.scorecard-stat {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.scorecard-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
}

.scorecard-breakdown-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #22d3ee;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: 0.15rem;
}

.scorecard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
}

.scorecard-row-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.scorecard-row-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.8rem;
}

.scorecard-row-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.scorecard-row-score {
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.scorecard-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.scorecard-actions button {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 0.5rem;
    align-items: center;
  }

  .scorecard-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    padding: 1.1rem 0.85rem;
    border-radius: 16px;
    gap: 0.75rem;
    margin: 0;
  }

  .scorecard-header {
    padding-right: 2.2rem;
  }

  .scorecard-header h2 {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  .scorecard-header p {
    font-size: 0.72rem;
  }

  .scorecard-close {
    top: 0.65rem;
    right: 0.65rem;
    width: 32px;
    height: 32px;
  }

  .scorecard-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .scorecard-hero {
    padding: 0.7rem 0.6rem;
    gap: 0.3rem;
  }

  .score-circle-compact {
    width: 66px;
    height: 66px;
    margin: 0;
  }

  .score-circle-compact .score-num {
    font-size: 1.6rem;
  }

  .scorecard-band-tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
  }

  .scorecard-stat {
    font-size: 0.75rem;
  }

  .scorecard-breakdown {
    padding: 0.55rem 0.65rem;
    gap: 0.35rem;
  }

  .scorecard-breakdown-title {
    font-size: 0.75rem;
    padding-bottom: 0.2rem;
  }

  .scorecard-row {
    padding: 0.4rem 0.55rem;
    gap: 0.5rem;
  }

  .scorecard-row-name {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .scorecard-row-sub {
    font-size: 0.68rem;
  }

  .scorecard-row-score {
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .scorecard-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    width: 100%;
    padding-top: 0.5rem;
  }

  .scorecard-actions button {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 !important;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
  }

  #ai-chat-bubble {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  #ai-chat-window {
    bottom: 72px;
    right: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 90px);
    max-width: 100vw;
  }
}

/* Book Viewer Grid */
.book-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.book-page-thumb {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}

.book-page-thumb:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.book-page-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.book-page-info {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
}

/* Responsive Footer */
footer.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  background: rgba(15, 23, 42, 0.6);
}

/* ========================================================
   12 UNITS ROADMAP & PROGRESS TRACKER STYLES
   ======================================================== */

.roadmap-summary-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

[data-theme="light"] .roadmap-summary-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.roadmap-progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.85rem;
}

[data-theme="light"] .roadmap-progress-bar-wrap {
  background: #e2e8f0;
}

.roadmap-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 0.45rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.unit-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.unit-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.unit-card.completed {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), var(--bg-card));
}

.unit-card.in-progress {
  border-color: rgba(245, 158, 11, 0.5);
}

.unit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.unit-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.4);
}

.unit-status-tag {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.unit-status-tag.not-started {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.unit-status-tag.in-progress {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.unit-status-tag.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.unit-title {
  font-size: 1.18rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
  line-height: 1.35;
}

.unit-theme {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.unit-skills-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.skill-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.unit-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.unit-card-actions .btn-primary,
.unit-card-actions .btn-secondary {
  flex: 1;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  justify-content: center;
  text-align: center;
}

/* Exam Split Screen / Reference Page Modal */
.book-ref-floating-btn {
  background: linear-gradient(135deg, var(--secondary), #0284c7);
  color: #fff;
  border: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 14px var(--secondary-glow);
  transition: var(--transition);
}

.book-ref-floating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--secondary-glow);
}

/* CBT Dual-Pane Split Layout (Standard Cambridge Computer-Based Exam) */
.cbt-dual-pane {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 1100px) {
  .cbt-dual-pane {
    grid-template-columns: 1fr;
  }
}

.cbt-book-viewer-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 85px;
  height: calc(100vh - 115px);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1100px) {
  .cbt-book-viewer-pane {
    position: relative;
    top: 0;
    height: 650px;
    margin-bottom: 1.5rem;
  }
}

.cbt-book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cbt-page-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.cbt-page-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.cbt-page-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.cbt-page-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.cbt-book-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cbt-ctrl-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.cbt-ctrl-btn:hover {
  background: var(--primary);
  color: #fff;
}

.cbt-book-viewport {
  flex: 1;
  overflow: auto;
  background: #090d16;
  padding: 1.25rem;
  text-align: center;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.cbt-book-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transform-origin: top center;
  transition: transform 0.2s ease;
}

.cbt-questions-scroll-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-height: calc(100vh - 115px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 1100px) {
  .cbt-questions-scroll-pane {
    max-height: none;
    overflow-y: visible;
  }
}

/* Roadmap Grid & Stat Cards */
.roadmap-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.roadmap-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.roadmap-metric-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.roadmap-metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.roadmap-metric-val {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

.roadmap-metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ========================================================
   RESPONSIVE DESIGN SYSTEM (DESKTOP, TABLET, MOBILE)
   ======================================================== */

/* Responsive Grid Utilities */
.responsive-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.options-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.options-grid-3 {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.options-grid-4 {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

@media (min-width: 769px) {
  .options-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }

  .options-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
  }
}

/* Sentence transformation input */
.input-trans {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  background: var(--bg-main);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  min-width: 160px;
  max-width: 100%;
  box-sizing: border-box;
  transition: var(--transition);
}

.input-trans:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.btn-toggle-sample {
  transition: all 0.2s ease;
  user-select: none;
}

.btn-toggle-sample:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  transform: translateY(-1px);
}

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

/* 1. TABLET LANDSCAPE & LAPTOPS (max-width: 1100px) */
@media (max-width: 1100px) {
  .header-container {
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }

  nav.main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    justify-content: flex-start;
    gap: 0.35rem;
  }

  nav.main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
    flex-shrink: 0;
  }

  .test-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .test-sidebar {
    position: static;
    margin-top: 1.5rem;
  }

  .cbt-reading-split-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .cbt-passage-column {
    position: static;
    max-height: 400px;
    margin-bottom: 0.75rem;
  }

  .cbt-questions-scroll-pane {
    max-height: none;
    overflow-y: visible;
  }

  .tests-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 2. TABLET PORTRAIT (max-width: 900px) */
@media (max-width: 900px) {
  .responsive-2col-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .options-grid-3,
  .options-grid-4 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.65rem !important;
  }

  .hero-banner {
    padding: 1.75rem 1.5rem;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .roadmap-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .flashcard-wrap {
    max-width: 100%;
    height: 340px;
  }
}

/* 3. MOBILE DEVICES (max-width: 768px) */
@media (max-width: 768px) {
  main#app-root {
    padding: 1.25rem 0.85rem 5rem;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .header-container {
    padding: 0.65rem 0.85rem 0.4rem;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .brand {
    gap: 0.5rem;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
    border-radius: var(--radius-sm);
  }

  .brand-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
  }

  .brand-text p {
    display: none;
  }

  nav.main-nav {
    order: 3;
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.2rem 0.1rem 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    gap: 0.45rem;
  }

  nav.main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .status-badge {
    display: none;
  }

  .hero-banner {
    padding: 1.5rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
  }

  .hero-title {
    font-size: 1.45rem;
    line-height: 1.25;
  }

  .hero-subtitle {
    font-size: 0.88rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
  }

  .hero-actions button {
    width: 100%;
    justify-content: center;
  }

  .test-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
  }

  .test-title-group h2 {
    font-size: 1.2rem;
  }

  .test-header-bar > div:last-child {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
  }

  .speed-select, #exam-unit-selector {
    width: 100%;
  }

  .mode-toggle-group {
    width: 100%;
    display: flex;
  }

  .mode-toggle-btn {
    flex: 1;
    text-align: center;
  }

  .timer-box {
    justify-content: center;
  }

  .btn-primary, .btn-secondary {
    padding: 0.65rem 1.1rem;
    font-size: 0.88rem;
  }

  /* Force override excessive desktop padding on cards & containers on mobile */
  div[style*="padding: 2rem"],
  div[style*="padding: 1.75rem"],
  div[style*="padding:2rem"] {
    padding: 1rem 0.75rem !important;
  }

  .test-main-pane {
    padding: 1rem 0.75rem !important;
    border-radius: var(--radius-md);
  }

  .q-container {
    padding: 1rem 0.75rem !important;
    border-radius: var(--radius-md);
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .q-container img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }

  .q-context-box {
    padding: 0.85rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .option-item {
    padding: 0.75rem 1rem !important;
    min-height: 48px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.85rem !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .option-key {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    flex-shrink: 0 !important;
    font-size: 0.9rem !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .option-text {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    font-size: 0.94rem !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Force multi-option containers to stack vertically so option text never wraps into 1 word or overlaps */
  .options-grid-3,
  .options-grid-4,
  .cbt-options-grid-4,
  .options-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.65rem !important;
  }

  /* 2-option grids (YES/NO or True/False) */
  .options-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }

  .input-trans {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0.5rem 0 !important;
    font-size: 16px !important;
    padding: 0.6rem 0.85rem !important;
  }

  .cbt-q-split {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .cbt-passage-column {
    max-height: 320px;
  }

  .cbt-banner-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  /* Prevent iOS zoom on form inputs */
  input[type="text"],
  textarea,
  select {
    font-size: 16px !important;
  }

  textarea {
    min-height: 150px;
    padding: 0.85rem;
  }

  .tests-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .roadmap-metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .flashcard-wrap {
    height: 320px;
  }

  .flashcard .card-face {
    padding: 1.25rem 1rem;
  }

  .flashcard-controls {
    flex-wrap: wrap;
    gap: 0.65rem;
    width: 100%;
  }

  .flashcard-controls button {
    flex: 1 1 45%;
    justify-content: center;
  }

  .book-ref-floating-btn {
    width: 100%;
    justify-content: center;
  }
}

/* 4. EXTRA SMALL SCREENS (max-width: 480px) */
@media (max-width: 480px) {
  .brand-text p {
    display: none;
  }

  .nav-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.35rem;
  }

  .q-container {
    padding: 1rem 0.75rem;
  }

  .q-num-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
  }

  .options-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .q-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
  }

  .grid-num-btn {
    font-size: 0.8rem;
  }

  .flashcard-wrap {
    height: 340px;
  }
}

/* ========================================================
   AUTH SYSTEM & HEADER PROFILE STYLES
   ======================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-auth-header {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 3px 12px var(--primary-glow);
  transition: var(--transition);
  text-decoration: none;
}

.btn-auth-header:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px var(--primary-glow);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.btn-logout-small {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-logout-small:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.admin-nav-link {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.admin-nav-link:hover {
  background: #f59e0b;
  color: #fff;
  transform: translateY(-2px);
}

/* Auth Modal */
.auth-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .auth-modal-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-main);
  padding: 0.3rem;
  border-radius: var(--radius-md);
}

.auth-tab-btn {
  flex: 1;
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .auth-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
}

.auth-form-group {
  margin-bottom: 1.15rem;
}

.auth-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.auth-form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  transition: var(--transition);
  outline: none;
}

.auth-form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

[data-theme="light"] .auth-form-group input {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.auth-notice-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: #f59e0b;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.btn-auth-submit {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: var(--transition);
}

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

/* ========================================================
   FLOATING AI CHAT ASSISTANT STYLES
   ======================================================== */
#ai-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

#ai-chat-bubble:hover {
  transform: scale(1.1) rotate(-6deg);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.6);
}

.ai-bubble-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #0284c7;
  animation: bubblePulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes bubblePulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}

#ai-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 530px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] #ai-chat-window {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

.ai-chat-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ai-chat-header-info h4 {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.ai-chat-header-info span {
  font-size: 0.72rem;
  opacity: 0.85;
}

.ai-chat-header-actions button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.ai-chat-header-actions button:hover {
  opacity: 1;
}

.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--bg-main);
}

[data-theme="light"] .ai-chat-body {
  background: #f8fafc;
}

.ai-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ai-msg.user {
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ai-msg.bot .ai-msg-avatar {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  color: #fff;
}

.ai-msg.user .ai-msg-avatar {
  background: #10b981;
  color: #fff;
}

.ai-msg-bubble {
  max-width: 80%;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  word-break: break-word;
}

.ai-msg.bot .ai-msg-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-top-left-radius: 2px;
}

[data-theme="light"] .ai-msg.bot .ai-msg-bubble {
  background: #ffffff;
  border-color: #e2e8f0;
}

.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #ffffff;
  border-top-right-radius: 2px;
}

.ai-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

[data-theme="light"] .ai-quick-prompts {
  background: #ffffff;
}

.ai-prompt-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.25);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.ai-prompt-chip:hover {
  background: var(--primary);
  color: #fff;
}

.ai-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

[data-theme="light"] .ai-chat-input-bar {
  background: #ffffff;
}

.ai-chat-input-bar input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

[data-theme="light"] .ai-chat-input-bar input {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.ai-chat-input-bar input:focus {
  border-color: var(--primary);
}

.btn-ai-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-ai-send:hover {
  transform: scale(1.08);
}



