/* ============================================================
   LEARNIX — Master Stylesheet
   Multi-language coding learning platform
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Accent tokens (amber). Redefined per-theme in css/app-theme.css;
     these are the fallbacks for anything loading styles.css standalone. */
  --accent:        #fbbf24;
  --accent-hover:  #f59e0b;
  --accent-rgb:    251,191,36;
  --accent-soft:   rgba(var(--accent-rgb),0.12);
  --accent-glow:   rgba(var(--accent-rgb),0.30);
  --violet:        #7c3aed;
  --success:       #10b981;
  --success-soft:  rgba(16,185,129,0.12);
  --warning:       #f59e0b;
  --warning-soft:  rgba(245,158,11,0.12);
  --danger:        #ef4444;
  --danger-soft:   rgba(239,68,68,0.12);
  --info:          #0ea5e9;
  --info-soft:     rgba(14,165,233,0.12);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-w: 260px;
  --topbar-h:  60px;

  --transition: 180ms cubic-bezier(.4,0,.2,1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.12);
  --shadow:    0 4px 12px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.14);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.3);
}

/* Dark theme (default) */
[data-theme="dark"], :root {
  --bg:          #080f1e;
  --bg-2:        #0d1832;
  --bg-card:     #112040;
  --bg-elevated: #1a2d55;
  --bg-input:    #0d1832;
  --border:      rgba(255,255,255,.07);
  --border-2:    rgba(255,255,255,.13);
  --text:        #f1f5f9;
  --text-2:      #94a3b8;
  --text-3:      #7c8aa0;
  --scrollbar-bg:   #0d1832;
  --scrollbar-thumb:#1e3a6e;
  --code-bg:     #050b14;
  --editor-bg:   #080f1e;
  /* legacy aliases used in old CSS */
  --surface:     #112040;
  --surface2:    #0d1832;
  --text-primary:#f1f5f9;
  --text-s:      #94a3b8;
  --error:       #ef4444;
}

/* Light theme */
[data-theme="light"] {
  --bg:          #f8fafc;
  --bg-2:        #f1f5f9;
  --bg-card:     #ffffff;
  --bg-elevated: #ffffff;
  --bg-input:    #f8fafc;
  --border:      rgba(0,0,0,.07);
  --border-2:    rgba(0,0,0,.13);
  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;
  --scrollbar-bg:   #f1f5f9;
  --scrollbar-thumb:#cbd5e1;
  --code-bg:     #1e2030;
  --editor-bg:   #1e2030;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.12);
  /* legacy aliases */
  --surface:     #ffffff;
  --surface2:    #f1f5f9;
  --text-primary:#0f172a;
  --text-s:      #475569;
  --error:       #ef4444;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
img, svg { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 1.25rem;font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem;   font-weight: 600; }
p  { color: var(--text-2); line-height: 1.75; }
code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-elevated);
  padding: .15em .4em;
  border-radius: 4px;
  color: var(--accent);
}
pre {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  position: relative;
}
pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
  font-size: .875rem;
  line-height: 1.7;
}

/* ── Utility ───────────────────────────────────────────────── */
.sr-only { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }   .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.w-full { width: 100%; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.125rem; }
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.hidden { display: none !important; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }   .mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }   .mb-6 { margin-bottom: 1.5rem; }
.truncate { overflow:hidden;white-space:nowrap;text-overflow:ellipsis; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-card); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: .5rem .75rem;
}
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; font-weight: 600; }
.btn-icon { padding: .55rem; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .45; pointer-events: none; }

/* Loading spinner on button */
.btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn.loading .btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-2); }
.card-hover:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-accent  { background: var(--accent-soft);  color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-muted   { background: var(--bg-elevated);  color: var(--text-3); }

/* ── Progress bar ──────────────────────────────────────────── */
.progress-bar {
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
  height: 6px;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-bar.thin { height: 4px; }
.progress-bar.thick { height: 10px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .5rem; }
.form-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
}
.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  color: var(--text);
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--text-3); }
.form-error {
  font-size: .8rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* ── Toast notifications ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  pointer-events: all;
  animation: slideInRight .25s ease forwards;
  max-width: 360px;
}
.toast.hiding { animation: slideOutRight .25s ease forwards; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }

/* ── Layout ────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
}
.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-text {
  display: flex; flex-direction: column;
  line-height: 1;
}
.sidebar-logo-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.sidebar-logo-sub {
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: .75rem .75rem .35rem;
  margin-top: .5rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none !important;
  position: relative;
}
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: pointer;
}
.sidebar-user:hover { background: var(--accent-soft); }
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .875rem; font-weight: 600; color: var(--text); }
.sidebar-user-xp   { font-size: .75rem; color: var(--text-3); }

/* ── Main content ──────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--text-3);
}
.breadcrumb-sep { color: var(--text-3); }
.breadcrumb-item { color: var(--text-2); }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }

#search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: .45rem .9rem;
  flex: 1;
  max-width: 320px;
  margin-left: auto;
  transition: border-color var(--transition);
}
#search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .875rem;
  width: 100%;
}
#search-input::placeholder { color: var(--text-3); }
.search-icon { color: var(--text-3); width: 16px; height: 16px; flex-shrink: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Page content ──────────────────────────────────────────── */
#page-view {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn .2s ease;
}

/* ── Login Page ────────────────────────────────────────────── */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: .25;
}
.login-bg-orb-1 {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -200px; left: -200px;
}
.login-bg-orb-2 {
  width: 400px; height: 400px;
  background: var(--violet);
  bottom: -150px; right: -150px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: scaleIn .3s ease;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 2rem;
}
.login-logo-mark {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 1.4rem;
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.login-logo-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-logo-text p {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: 2px;
}
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .4rem; }
.login-subtitle { color: var(--text-3); font-size: .9rem; margin-bottom: 2rem; }
.login-divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── Dashboard ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 { margin-bottom: .35rem; }
.page-header p { color: var(--text-2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--accent); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}
.stat-icon.accent  { background: var(--accent-soft);  }
.stat-icon.success { background: var(--success-soft); }
.stat-icon.warning { background: var(--warning-soft); }
.stat-icon.violet  { background: rgba(139,92,246,.15); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-3); margin-top: .3rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1.1rem; font-weight: 700; }

/* ── Course catalog card ───────────────────────────────────── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none !important;
  display: block;
  color: var(--text);
}
.course-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.course-banner {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  position: relative;
  overflow: hidden;
}
.course-banner-java {
  background: linear-gradient(135deg, #1a1a3e, #2d1b69);
}
.course-banner-python {
  background: linear-gradient(135deg, #1a2e1a, #1b4d2d);
}
.course-banner-locked {
  background: var(--bg-elevated);
  filter: grayscale(1);
}
.course-body { padding: 1.25rem; }
.course-title { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.course-desc  { font-size: .825rem; color: var(--text-2); margin-bottom: 1rem; line-height: 1.5; }
.course-meta  {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .78rem;
  color: var(--text-3);
}
.course-progress-wrap { margin-top: 1rem; }
.course-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--text-3);
  margin-bottom: .35rem;
}

/* ── Unit overview ─────────────────────────────────────────── */
.unit-list { display: flex; flex-direction: column; gap: .75rem; }
.unit-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.unit-row:hover { border-color: var(--border-2); }
.unit-row.locked { opacity: .55; pointer-events: none; }
.unit-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
}
.unit-number {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.unit-number.done { background: var(--success-soft); color: var(--success); }
.unit-number.locked { background: var(--bg-elevated); color: var(--text-3); }
.unit-info { flex: 1; min-width: 0; }
.unit-name { font-weight: 600; font-size: .95rem; }
.unit-sub  { font-size: .78rem; color: var(--text-3); margin-top: .2rem; }
.unit-progress-inline {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 140px;
}
.unit-expand-btn {
  color: var(--text-3);
  transition: transform var(--transition);
}
.unit-expand-btn.open { transform: rotate(180deg); }

.lesson-list {
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height .35s cubic-bezier(.4,0,.2,1);
}
.lesson-list.open { max-height: 1000px; }
.lesson-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1.5rem .8rem 3.5rem;
  font-size: .875rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
  color: var(--text);
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--accent-soft); }
.lesson-item.active { background: var(--accent-soft); color: var(--accent); }
.lesson-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.lesson-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.lesson-check.active { border-color: var(--accent); }
.lesson-type-tag {
  margin-left: auto;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 99px;
}

/* ── Lesson page ───────────────────────────────────────────── */
.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
.lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lesson-content-header {
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.lesson-content-body {
  padding: 2rem;
  line-height: 1.8;
}
.lesson-content-body h2 {
  font-size: 1.35rem;
  margin: 2rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.lesson-content-body h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 .5rem;
  color: var(--accent);
}
.lesson-content-body p { margin-bottom: .9rem; }
.lesson-content-body ul,
.lesson-content-body ol {
  margin: .5rem 0 .9rem 1.5rem;
  color: var(--text-2);
}
.lesson-content-body li { margin-bottom: .35rem; line-height: 1.65; }
.lesson-content-body pre { margin: 1rem 0; }
.lesson-content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .875rem;
}
.lesson-content-body th {
  background: var(--bg-elevated);
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.lesson-content-body td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.lesson-content-body tr:last-child td { border-bottom: none; }
.lesson-content-body tr:hover td { background: var(--accent-soft); }
.lesson-content-body .tip,
.lesson-content-body .warning,
.lesson-content-body .danger-note,
.lesson-content-body .info-note {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  border-left: 3px solid;
}
.lesson-content-body .tip       { background: var(--success-soft); border-color: var(--success); color: var(--text-2); }
.lesson-content-body .warning   { background: var(--warning-soft); border-color: var(--warning); color: var(--text-2); }
.lesson-content-body .danger-note{ background: var(--danger-soft); border-color: var(--danger); color: var(--text-2); }
.lesson-content-body .info-note { background: var(--info-soft);    border-color: var(--info);   color: var(--text-2); }
.lesson-content-body .tip strong,
.lesson-content-body .warning strong,
.lesson-content-body .danger-note strong,
.lesson-content-body .info-note strong { color: var(--text); display: block; margin-bottom: .25rem; }

.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* ── Lesson sidebar (notes + bookmark) ─────────────────────── */
.lesson-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.lesson-sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lesson-sidebar-card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: .9rem;
}
.notes-textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .85rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  resize: none;
  min-height: 160px;
  font-family: var(--font);
}

/* ── Code Exercise ─────────────────────────────────────────── */
.exercise-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1.5rem 0;
}
.exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.exercise-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  font-size: .9rem;
}
.exercise-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 99px;
}
.exercise-prompt {
  padding: 1rem 1.25rem;
  font-size: .875rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.exercise-prompt strong { color: var(--text); }
.exercise-editor-wrap {
  position: relative;
}
.monaco-wrap {
  border-bottom: 1px solid var(--border);
}
.exercise-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.exercise-output {
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: .82rem;
  color: #e2e8f0;
  min-height: 48px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.exercise-output.success { border-top: 2px solid var(--success); }
.exercise-output.error   { border-top: 2px solid var(--danger);  }
.exercise-output.running { opacity: .7; }
.exercise-result {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
}
.exercise-result.pass { background: var(--success-soft); color: var(--success); }
.exercise-result.fail { background: var(--danger-soft);  color: var(--danger); }

/* Hint/solution reveal */
.hint-btn {
  font-size: .8rem;
  color: var(--text-3);
  padding: .3rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.hint-btn:hover { color: var(--warning); border-color: var(--warning); }
.hint-panel {
  padding: .9rem 1.25rem;
  background: var(--warning-soft);
  border-top: 1px solid rgba(245,158,11,.2);
  font-size: .85rem;
  color: var(--text-2);
}
.hint-panel code { color: var(--warning); }

/* ── Quiz & Test ───────────────────────────────────────────── */
.quiz-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.quiz-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 8px 20px var(--accent-glow);
}
.quiz-title { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.quiz-meta  { font-size: .85rem; color: var(--text-3); }
.quiz-timer {
  margin-left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: .5rem 1rem;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  min-width: 80px;
  text-align: center;
}
.quiz-timer.warning { color: var(--warning); border-color: var(--warning); }
.quiz-timer.danger  { color: var(--danger);  border-color: var(--danger);  animation: pulse 1s infinite; }

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: border-color var(--transition);
}
.question-card.answered { border-color: var(--border-2); }
.question-number {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: .6rem;
}
.question-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.question-text code { font-size: .9em; }
.options-list { display: flex; flex-direction: column; gap: .5rem; }
.option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  cursor: pointer;
  transition: all var(--transition);
  font-size: .9rem;
}
.option:hover { border-color: var(--accent); background: var(--accent-soft); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.option.correct  { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.option.wrong    { border-color: var(--danger);  background: var(--danger-soft);  color: var(--danger); }
.option-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.option.selected .option-radio { border-color: var(--accent); background: var(--accent); }
.option.correct .option-radio  { border-color: var(--success); background: var(--success); }
.option.wrong .option-radio    { border-color: var(--danger);  background: var(--danger); }
.option-radio-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
}
.question-explanation {
  margin-top: .75rem;
  padding: .75rem 1rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-2);
  border-left: 3px solid var(--info);
  display: none;
}
.question-explanation.show { display: block; }

.quiz-progress-bar {
  background: var(--bg-elevated);
  border-radius: 99px;
  height: 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  border-radius: 99px;
  transition: width .4s ease;
}

.quiz-results {
  text-align: center;
  padding: 3rem 2rem;
}
.quiz-score-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 6px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  background: var(--accent-soft);
  box-shadow: 0 0 40px var(--accent-glow);
}
.quiz-score-number { font-size: 2.5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.quiz-score-label  { font-size: .75rem; color: var(--text-3); }
.quiz-results h2   { font-size: 1.75rem; margin-bottom: .5rem; }
.quiz-results p    { color: var(--text-2); margin-bottom: 2rem; }

/* ── Project page ──────────────────────────────────────────── */
.project-header {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.project-header::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 200px; height: 200px;
  background: var(--accent);
  border-radius: 50%;
  opacity: .05;
}
.project-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: .5rem;
}
.project-title { font-size: 1.5rem; font-weight: 800; margin-bottom: .5rem; }
.project-desc  { color: var(--text-2); font-size: .925rem; line-height: 1.7; }
.project-requirements {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.req-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .5rem 0;
  font-size: .9rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.req-item:last-child { border-bottom: none; }
.req-check { color: var(--success); flex-shrink: 0; margin-top: 2px; }

.project-editor-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
}
.project-editor-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.editor-topbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.editor-dot { width: 12px; height: 12px; border-radius: 50%; }
.editor-dot-red    { background: #ef4444; }
.editor-dot-yellow { background: #f59e0b; }
.editor-dot-green  { background: #10b981; }
.editor-filename {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-3);
  margin-left: .25rem;
}

.project-output-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.output-header {
  padding: .7rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.output-terminal {
  flex: 1;
  padding: 1rem;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.7;
  color: #e2e8f0;
  overflow-y: auto;
  min-height: 200px;
  white-space: pre-wrap;
}
.output-line-success { color: var(--success); }
.output-line-error   { color: var(--danger); }
.output-line-info    { color: var(--info); }
.output-controls {
  padding: .7rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
}

/* ── Leaderboard ───────────────────────────────────────────── */
.leaderboard-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0 2rem;
}
.podium-item {
  flex: 1;
  max-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.25rem 1rem;
  text-align: center;
  position: relative;
}
.podium-item.first  { background: linear-gradient(180deg, rgba(245,158,11,.1), var(--bg-card)); border-color: var(--warning); }
.podium-item.second { background: linear-gradient(180deg, rgba(148,163,184,.1), var(--bg-card)); }
.podium-item.third  { background: linear-gradient(180deg, rgba(205,127,50,.1), var(--bg-card)); }
.podium-rank  { font-size: 1.75rem; margin-bottom: .5rem; }
.podium-name  { font-weight: 700; font-size: .9rem; margin-bottom: .25rem; }
.podium-xp    { font-size: .8rem; color: var(--text-3); }
.podium-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  margin: 0 auto .75rem;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.leaderboard-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--accent-soft); }
.lb-row.me { background: var(--accent-soft); }
.lb-rank { width: 28px; font-weight: 700; color: var(--text-3); font-size: .9rem; text-align: center; }
.lb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .8rem;
}
.lb-name { flex: 1; font-weight: 500; font-size: .9rem; }
.lb-xp   { font-weight: 700; font-size: .9rem; color: var(--accent); }
.lb-level { color: var(--text-3); font-size: .8rem; margin-left: .25rem; }

/* ── Certificate ───────────────────────────────────────────── */
.certificate-page {
  text-align: center;
  padding: 2rem;
}
.certificate-wrap {
  display: inline-block;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: 4rem 5rem;
  max-width: 740px;
  width: 100%;
  box-shadow: 0 0 60px var(--accent-glow);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.certificate-corner {
  position: absolute;
  width: 120px; height: 120px;
  border: 3px solid var(--accent);
  opacity: .3;
}
.certificate-corner.tl { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.certificate-corner.tr { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.certificate-corner.bl { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.certificate-corner.br { bottom: 20px; right: 20px; border-left: none; border-top: none; }
.cert-logo   { font-size: 3.5rem; margin-bottom: .5rem; } /* fallback */
.cert-logo-img {
  width: 72px;
  height: 72px;
  margin: 0 auto .75rem;
  display: block;
  filter: drop-shadow(0 4px 16px rgba(var(--accent-rgb),0.4));
}
.cert-issued { font-size: .75rem; text-transform: uppercase; letter-spacing: .15em; color: var(--text-3); }
.cert-title  { font-size: 1rem; color: var(--text-3); margin: .5rem 0; }
.cert-name   { font-size: 2.5rem; font-weight: 800; background: linear-gradient(135deg, var(--text), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin: .5rem 0; }
.cert-course { font-size: 1.25rem; font-weight: 600; color: var(--text); margin: 1rem 0 .5rem; }
.cert-date   { font-size: .85rem; color: var(--text-3); }
.cert-divider { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); margin: 1.5rem 0; }
.cert-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: .5rem 1.25rem;
  border-radius: 99px;
  font-weight: 700;
  font-size: .9rem;
  margin-top: 1rem;
}

/* ── Settings ──────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover { background: var(--accent-soft); color: var(--text); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent); }

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-section-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.settings-section-title { font-size: 1rem; font-weight: 700; }
.settings-section-desc  { font-size: .8rem; color: var(--text-3); margin-top: .2rem; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { font-size: .9rem; font-weight: 500; }
.settings-row-desc  { font-size: .8rem; color: var(--text-3); margin-top: .2rem; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid var(--border-2);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* Theme picker */
.theme-options {
  display: flex;
  gap: .75rem;
}
.theme-option {
  width: 60px; height: 42px;
  border-radius: var(--radius);
  border: 2px solid var(--border-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition);
  display: flex;
  flex-direction: column;
}
.theme-option.active { border-color: var(--accent); }
.theme-option .to-top { flex: 1; }
.theme-option .to-bottom { height: 14px; }
.theme-dark .to-top    { background: #12121e; }
.theme-dark .to-bottom { background: #0a0a12; }
.theme-light .to-top    { background: #ffffff; }
.theme-light .to-bottom { background: #f1f5f9; }

/* ── XP / Level ─────────────────────────────────────────────── */
.xp-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.xp-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-3);
}
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff;
  padding: .25rem .75rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* ── Cheat Sheet ────────────────────────────────────────────── */
#cheat-sheet-panel {
  position: fixed;
  top: 0; right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  z-index: 200;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.3);
}
#cheat-sheet-panel.open { right: 0; }
.cheat-sheet-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
}
.cheat-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.cheat-section { margin-bottom: 1.25rem; }
.cheat-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: .5rem;
}
.cheat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  margin-bottom: .35rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-2);
}
.cheat-item span { color: var(--accent); }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn      { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn     { from { opacity: 0; transform: scale(.95) } to { opacity: 1; transform: scale(1) } }
@keyframes slideInRight{ from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: translateX(0) } }
@keyframes slideOutRight{ to  { opacity: 0; transform: translateX(20px) } }
@keyframes spin        { to  { transform: rotate(360deg) } }
@keyframes pulse       { 0%,100% { opacity: 1 } 50% { opacity: .5 } }
@keyframes shimmer     { from { background-position: -200% 0 } to { background-position: 200% 0 } }
@keyframes bounceIn    { 0% { transform: scale(.3); opacity: 0 } 50% { transform: scale(1.05) } 70% { transform: scale(.9) } 100% { transform: scale(1); opacity: 1 } }
@keyframes xpGain {
  0%   { transform: translateY(0); opacity: 1 }
  100% { transform: translateY(-60px); opacity: 0 }
}

.xp-popup {
  position: fixed;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--warning);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  z-index: 9999;
  animation: xpGain 1.5s ease forwards;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

/* Code highlight colors (designed for dark backgrounds) */
.kw  { color: #c792ea; } /* keywords */
.str { color: #c3e88d; } /* strings */
.num { color: #f78c6c; } /* numbers */
.cmt { color: #546e7a; font-style: italic; } /* comments */
.typ { color: #ffcb6b; } /* types */
.fn  { color: #82aaff; } /* functions */
.op  { color: #89ddff; } /* operators */

/* ── Light-mode overrides for code readability ─────────────── */
/* In light mode, --bg-elevated is white, so the default inline-code
   rule produces invisible (white-on-white) backgrounds. Give inline
   code a clear chip-like background with stronger text contrast.    */
[data-theme="light"] code {
  background: #eef2f7;
  border: 1px solid rgba(0,0,0,.07);
  color: #1d4ed8;
}
[data-theme="light"] pre code,
[data-theme="light"] .quiz-code code,
[data-theme="light"] .sol-code code {
  background: none;
  border: none;
  color: inherit;
}
/* Quiz / test code blocks: use the same dark "code window" look as
   the lesson <pre> blocks so syntax-highlight colors stay readable. */
[data-theme="light"] .quiz-code {
  background: #1e2030;
  color: #e2e8f0;
  border-color: rgba(0,0,0,.1);
  border-left-color: var(--accent);
}
/* Inline code that appears inside exercise prompts (light cards) needs
   extra contrast — the prompt's own background is already very pale.  */
[data-theme="light"] .ex-prompt code,
[data-theme="light"] .exercise-prompt code,
[data-theme="light"] .lesson-content-body code {
  background: #e7edf5;
  border: 1px solid rgba(0,0,0,.08);
  color: #1d4ed8;
}
/* Anywhere inside a dark code block, neutralize the chip styling */
[data-theme="light"] pre code,
[data-theme="light"] pre .kw,
[data-theme="light"] pre .str,
[data-theme="light"] pre .num,
[data-theme="light"] pre .cmt,
[data-theme="light"] pre .typ,
[data-theme="light"] pre .fn,
[data-theme="light"] pre .op { background: transparent; border: 0; padding: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { display: none; }
  .project-editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  #sidebar { transform: translateX(-260px); --sidebar-w: 260px; }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  #page-view { padding: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .courses-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quiz-header { flex-wrap: wrap; }
  .quiz-timer { margin-left: 0; width: 100%; }
}

/* ============================================================
   SUPPLEMENTAL — app.js view styles
   ============================================================ */

/* ── App shell layout ──────────────────────────────────────── */
.main-shell {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-view {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn .2s ease;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.cheat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
}
#cheat-sheet-panel.open ~ .cheat-overlay,
.cheat-panel.open ~ .cheat-overlay { display: block; }
@media (max-width: 768px) {
  .main-shell { margin-left: 0; }
  #sidebar.open ~ .sidebar-overlay { display: block; }
}

/* ── Sidebar internals ─────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.5));
}
.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-tagline { font-size: .68rem; color: var(--text-3); margin-top: 2px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.25rem .4rem;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: .9rem;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}
.user-name { font-size: .875rem; font-weight: 600; color: var(--text); }
.user-meta { font-size: .72rem; color: var(--text-3); }

.sidebar-xp-wrap {
  height: 3px;
  background: var(--bg-elevated);
  margin: .5rem 1.25rem .25rem;
  border-radius: 99px;
  overflow: hidden;
}
.sidebar-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  border-radius: 99px;
  transition: width .6s ease;
}

.sidebar-nav { padding: .75rem .75rem 0; }

.sidebar-stats-row {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sstat {
  flex: 1;
  text-align: center;
  padding: .75rem .5rem;
  border-right: 1px solid var(--border);
}
.sstat:last-child { border-right: none; }
.sstat-val { font-size: 1rem; font-weight: 700; color: var(--accent); }
.sstat-lbl { font-size: .65rem; color: var(--text-3); margin-top: 2px; }

.sidebar-footer {
  padding: .75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}
.btn-signout {
  width: 100%;
  padding: .55rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-signout:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ── Topbar internals ──────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.25rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: var(--radius-sm);
  display: none;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 768px) { .sidebar-toggle { display: flex; } }

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}
.search-wrap {
  position: relative;
}
.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: .4rem .85rem;
  color: var(--text);
  font-size: .85rem;
  width: 220px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), width var(--transition);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  width: 280px;
}
.search-input::placeholder { color: var(--text-3); }
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.search-result {
  display: block;
  padding: .6rem .9rem;
  font-size: .85rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
  transition: background var(--transition);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--accent-soft); color: var(--accent); }
.search-empty { padding: .75rem .9rem; font-size: .85rem; color: var(--text-3); text-align: center; }

.icon-btn {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-2);
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn.bookmarked { color: var(--warning); }

/* ── Cheat sheet panel ─────────────────────────────────────── */
.cheat-panel {
  position: fixed;
  top: 0; right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--bg-2);
  border-left: 1px solid var(--border-2);
  z-index: 200;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.3);
}
.cheat-panel.open { right: 0; }
.cheat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .95rem;
}
.cheat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.cheat-body h4 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  margin: 1.1rem 0 .35rem;
}
.cheat-body h4:first-child { margin-top: 0; }
.cheat-body pre {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  font-size: .75rem;
  margin: 0 0 .2rem;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Loading screen ────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  gap: 1rem;
  color: var(--text-3);
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* Branded </> loader: < and > spread apart while \ spins, then close */
.lx-loader {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800; font-size: 3rem; line-height: 1;
  color: var(--accent, #8b5cf6); user-select: none;
}
.lx-loader span { display: inline-block; }
.lx-loader .lx-l { animation: lxL 1.5s cubic-bezier(.6,0,.4,1) infinite; }
.lx-loader .lx-r { animation: lxR 1.5s cubic-bezier(.6,0,.4,1) infinite; }
.lx-loader .lx-s {
  animation: lxS 1.5s cubic-bezier(.6,0,.4,1) infinite;
  margin: 0 .04em; color: var(--accent, #8b5cf6); opacity: .85;
}
@keyframes lxL { 0%,100% { transform: translateX(0); } 40%,60% { transform: translateX(-.55em); } }
@keyframes lxR { 0%,100% { transform: translateX(0); } 40%,60% { transform: translateX(.55em); } }
@keyframes lxS {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(360deg); }
  60%  { transform: rotate(360deg); }
  100% { transform: rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  .lx-loader .lx-l, .lx-loader .lx-r, .lx-loader .lx-s { animation-duration: 0s; }
}

/* ── Dashboard page ────────────────────────────────────────── */
.dashboard-page { display: flex; flex-direction: column; gap: 1.5rem; }

.dash-hero {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}
.dash-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: var(--accent);
  border-radius: 50%;
  opacity: .05;
}
.dash-hero-text h2 { font-size: 1.5rem; margin-bottom: .3rem; }
.dash-hero-text p  { color: var(--text-2); font-size: .9rem; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.accent-card { background: linear-gradient(135deg, var(--accent-soft), var(--bg-card)); border-color: rgba(var(--accent-rgb),.3); }
.stat-icon { font-size: 1.5rem; color: var(--accent); }
.stat-num  { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-lbl  { font-size: .75rem; color: var(--text-3); }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-head h3 { font-size: 1rem; font-weight: 700; }
.card-link { font-size: .8rem; color: var(--accent); text-decoration: none; }
.card-link:hover { text-decoration: none; opacity: .8; }

.level-prog-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.level-badge {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 24px var(--accent-glow);
}
.level-xp-label { font-size: .85rem; font-weight: 600; margin-bottom: .5rem; }
.level-next { font-size: .75rem; color: var(--text-3); margin-top: .4rem; }
.level-details { flex: 1; min-width: 0; }

.circle-prog-wrap { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.circle-svg { width: 120px; height: 120px; }
.circle-label { font-size: .85rem; color: var(--text-2); }

.recent-list { display: flex; flex-direction: column; gap: .4rem; }
.recent-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-2);
  text-decoration: none !important;
  transition: background var(--transition);
}
.recent-item:hover { background: var(--accent-soft); color: var(--accent); }
.recent-check {
  color: var(--success);
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.empty-state { color: var(--text-3); font-size: .875rem; text-align: center; padding: 1rem 0; }
.empty-state a { color: var(--accent); }

.unit-mini-list { display: flex; flex-direction: column; gap: .5rem; }
.unit-mini {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.unit-mini:hover { background: var(--accent-soft); }
.unit-mini-emoji { font-size: 1.25rem; flex-shrink: 0; }
.unit-mini-body { flex: 1; min-width: 0; }
.unit-mini-title { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar-wrap { height: 3px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; }
.unit-mini-count { font-size: .7rem; color: var(--text-3); margin-top: .2rem; }

.next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.next-badge-pill {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  padding: .2rem .6rem;
  border-radius: 99px;
  margin-bottom: .4rem;
}
.next-card h3 { margin-bottom: .25rem; }
.next-card p  { color: var(--text-3); font-size: .85rem; }

@media (max-width: 900px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
}

/* ── Courses page ──────────────────────────────────────────── */
.courses-page {}
.courses-hero {
  margin-bottom: 2rem;
}
.courses-hero h2 { margin-bottom: .5rem; }
.courses-hero p  { color: var(--text-2); }

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.unit-card:not(.unit-locked):hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.unit-card-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.unit-big-emoji { font-size: 2rem; }
.unit-num-badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--bg-elevated);
  padding: .2rem .6rem;
  border-radius: 99px;
}
.unit-card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .25rem; }
.unit-card-sub   { font-size: .75rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.unit-card-desc  { font-size: .85rem; color: var(--text-2); line-height: 1.6; margin-bottom: 1rem; }
.unit-card-meta  { display: flex; gap: 1rem; font-size: .78rem; color: var(--text-3); margin-bottom: .75rem; }
.unit-bar { height: 4px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; margin-bottom: .35rem; }
.unit-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; transition: width .6s ease; }
.unit-bar-label { font-size: .72rem; color: var(--text-3); }

/* Badges (extra) */
.badge-new     { background: var(--accent-soft);   color: var(--accent); }
.badge-info    { background: var(--info-soft);      color: var(--info); }
.badge-locked  { background: var(--bg-elevated);   color: var(--text-3); }
.badge-arrow   { background: var(--accent-soft);   color: var(--accent); }
.badge-error   { background: var(--danger-soft);   color: var(--danger); }
.badge-lg      { font-size: .85rem; padding: .35rem .85rem; }

/* ── Course detail page ────────────────────────────────────── */
.course-detail-page {}
.course-detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.cdh-emoji { font-size: 3rem; flex-shrink: 0; }
.cdh-num {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  padding: .25rem .65rem;
  background: var(--accent-soft);
  border-radius: 99px;
  margin-bottom: .75rem;
}
.cdh-phase { font-size: .75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.cdh-desc  { color: var(--text-2); font-size: .9rem; margin: .5rem 0 .75rem; }
.cdh-meta  { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-3); flex-wrap: wrap; }
.cdh-text h2 { font-size: 1.5rem; }

.course-detail-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
.course-lessons-col h3 { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.lessons-list { display: flex; flex-direction: column; gap: .4rem; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
}
.lesson-row:not(.lr-locked):hover { border-color: var(--accent); background: var(--accent-soft); }
.lesson-row.lr-done { border-color: rgba(16,185,129,.2); background: var(--success-soft); }
.lr-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--text-3);
  flex-shrink: 0;
}
.lr-done .lr-icon   { background: var(--success); color: #fff; }
.lr-locked .lr-icon { background: var(--bg-elevated); }
.lr-body { flex: 1; min-width: 0; }
.lr-title { font-size: .9rem; font-weight: 600; color: var(--text); }
.lr-meta  { font-size: .75rem; color: var(--text-3); margin-top: .15rem; }
.lr-badge { flex-shrink: 0; }

.course-aside-col { display: flex; flex-direction: column; gap: 1rem; }
.meta-line { font-size: .85rem; color: var(--text-2); margin: .5rem 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.btn-block { width: 100%; justify-content: center; margin-top: .5rem; }
.btn-disabled { opacity: .5; pointer-events: auto !important; cursor: not-allowed !important; }
.btn-error { background: var(--danger); color: #fff; }
.btn-error:hover { filter: brightness(1.1); }

.reward-card { text-align: center; }
.reward-xp-display { font-size: 1.75rem; font-weight: 800; color: var(--accent); margin: .5rem 0; }
.reward-note { font-size: .82rem; color: var(--text-3); }

@media (max-width: 900px) {
  .course-detail-body { grid-template-columns: 1fr; }
  .course-detail-hero { flex-direction: column; }
}

/* ── Lesson page ───────────────────────────────────────────── */
.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}
.lesson-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.lesson-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.lesson-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.ldot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-2);
  transition: background var(--transition);
}
.ldot.ldot-active { background: var(--accent); }
.ldot.ldot-done   { background: var(--success); }

.lesson-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.lesson-crumb { font-size: .78rem; color: var(--text-3); margin-bottom: .5rem; }
.lesson-header h1 { font-size: 1.6rem; margin-bottom: .75rem; }
.lesson-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  background: var(--bg-elevated);
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-3);
}
.pill-success { background: var(--success-soft); color: var(--success); }

.lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  padding: 2rem;
  line-height: 1.8;
}
.lesson-content h2 {
  font-size: 1.3rem; font-weight: 700;
  margin: 2rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.lesson-content h3 { font-size: 1.1rem; color: var(--accent); margin: 1.5rem 0 .5rem; }
.lesson-content h4 { font-size: .95rem; margin: 1rem 0 .4rem; }
.lesson-content p  { margin-bottom: .9rem; }
.lesson-content ul, .lesson-content ol { margin: .5rem 0 .9rem 1.5rem; color: var(--text-2); }
.lesson-content li { margin-bottom: .3rem; }
.lesson-content pre { margin: 1rem 0; position: relative; }
.copy-code-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
  padding: .25rem .7rem;
  font-size: .72rem;
  font-weight: 600;
  background: var(--bg-elevated, #1e293b);
  color: var(--text-3, #94a3b8);
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s;
  z-index: 2;
}
.lesson-content pre:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover { color: var(--accent, #6366f1); border-color: var(--accent, #6366f1); }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .875rem; }
.lesson-content th { background: var(--bg-elevated); padding: .6rem 1rem; text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 1px solid var(--border); }
.lesson-content td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-2); }
.lesson-content tr:last-child td { border-bottom: none; }
.lesson-content tr:hover td { background: var(--accent-soft); }
.lesson-content kbd { background: var(--bg-elevated); border: 1px solid var(--border-2); border-radius: 4px; padding: .1rem .4rem; font-size: .8rem; font-family: var(--font-mono); }
.lesson-content .tip, .lesson-content .info-note, .lesson-content .warning, .lesson-content .danger-note {
  display: flex; gap: .75rem; padding: 1rem 1.25rem;
  border-radius: var(--radius); margin: 1rem 0; border-left: 3px solid;
}
.lesson-content .tip       { background: var(--success-soft); border-color: var(--success); }
.lesson-content .info-note { background: var(--info-soft);    border-color: var(--info); }
.lesson-content .warning   { background: var(--warning-soft); border-color: var(--warning); }
.lesson-content .danger-note{ background: var(--danger-soft); border-color: var(--danger); }
.lesson-content .tip > div, .lesson-content .info-note > div,
.lesson-content .warning > div, .lesson-content .danger-note > div { color: var(--text-2); }
.lesson-content .tip > div strong, .lesson-content .info-note > div strong,
.lesson-content .warning > div strong, .lesson-content .danger-note > div strong { color: var(--text); display: block; margin-bottom: .2rem; }

.section-divider {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 1.5rem 0 .75rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.exercises-section, .quiz-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  padding: 1.5rem 2rem;
}

/* Exercise block */
.exercise-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1rem 0;
  background: var(--bg-2);
}
.exercise-block.ex-passed { border-color: var(--success); }
.ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.ex-head h3 { font-size: .9rem; font-weight: 600; }
.ex-status {}
.ex-prompt {
  padding: .85rem 1.25rem;
  font-size: .875rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.ex-editor { height: 220px; border-bottom: 1px solid var(--border); }
.ex-controls {
  display: flex;
  gap: .5rem;
  padding: .6rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ex-hint {
  padding: .8rem 1.25rem;
  background: var(--warning-soft);
  border-top: 1px solid rgba(245,158,11,.2);
  font-size: .85rem;
  color: var(--text-2);
}
.ex-solution {
  padding: .8rem 1.25rem;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.sol-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-3); margin-bottom: .4rem; }
.sol-code { background: var(--code-bg); padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .8rem; border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; color: #e2e8f0; font-family: var(--font-mono); }
.ex-output { border-top: 1px solid var(--border); padding: .75rem 1.25rem; background: var(--code-bg); font-family: var(--font-mono); font-size: .8rem; }
.out-running { color: var(--text-3); font-family: inherit; }
.out-ok pre, .out-pass pre { color: var(--success); white-space: pre-wrap; word-break: break-word; }
.out-err pre, .out-fail pre { color: var(--danger); white-space: pre-wrap; word-break: break-word; }
.out-pass { color: var(--success); }
.out-fail { color: var(--danger); }
.out-pass pre, .out-fail pre { margin-top: .4rem; color: var(--text-2); }

/* Lesson footer nav */
.pill-success-lg {
  display: inline-flex;
  align-items: center;
  background: var(--success-soft);
  color: var(--success);
  padding: .5rem 1rem;
  border-radius: 99px;
  font-size: .875rem;
  font-weight: 600;
}

/* Lesson sidebar */
.lesson-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--topbar-h) + 2rem); }
.lsb-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
}
.lsb-section h4 { font-size: .875rem; font-weight: 700; margin-bottom: .75rem; color: var(--text); }
.notes-area {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  color: var(--text);
  font-size: .82rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 140px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.notes-area:focus { border-color: var(--accent); }
.note-status { font-size: .72rem; color: var(--success); margin-top: .3rem; height: 16px; }

.unit-lesson-nav { display: flex; flex-direction: column; gap: 2px; }
.uln-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--text-2);
  text-decoration: none !important;
  transition: background var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uln-item:hover { background: var(--accent-soft); color: var(--text); }
.uln-item.uln-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.uln-item.uln-done   { color: var(--success); }
.uln-icon { width: 16px; flex-shrink: 0; font-size: .75rem; }
.uln-test, .uln-project { margin-top: 4px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: .6rem; }

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

/* Inline quiz */
.quiz-intro { font-size: .9rem; color: var(--text-2); margin-bottom: 1.25rem; }
.quiz-q { margin-bottom: 1.25rem; }
.quiz-q-text { font-size: .95rem; font-weight: 600; margin-bottom: .7rem; color: var(--text); }
.quiz-code {
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.18);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin: .25rem 0 .9rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .85rem;
  line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.quiz-code code { font-family: inherit; background: none; padding: 0; }
.quiz-opts { display: flex; flex-direction: column; gap: .45rem; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .9rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  color: var(--text-2);
  transition: border-color var(--transition), background var(--transition);
}
.quiz-opt:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.quiz-opt input[type=radio] { accent-color: var(--accent); flex-shrink: 0; }
.quiz-actions { padding-top: .5rem; }

.quiz-result-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.qr-pass { background: var(--success-soft); border: 1px solid rgba(16,185,129,.25); }
.qr-fail { background: var(--danger-soft);  border: 1px solid rgba(239,68,68,.25); }
.qr-score { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.qr-pct { font-size: 1rem; font-weight: 600; color: var(--text-2); }
.qr-verdict { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.qr-xp { font-size: .85rem; color: var(--text-3); margin-top: .25rem; }
.quiz-review { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.review-item {
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: .875rem;
}
.ri-right { border-color: rgba(16,185,129,.3); background: var(--success-soft); }
.ri-wrong { border-color: rgba(239,68,68,.3);  background: var(--danger-soft); }
.review-item p { margin-bottom: .3rem; color: var(--text-2); }
.review-item p:first-child { font-weight: 600; color: var(--text); }
.ri-correct { color: var(--success) !important; }
.ri-explain { color: var(--text-3) !important; font-style: italic; }

/* ── Unit test page ────────────────────────────────────────── */
.test-page {}
.test-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
}
.test-page-head h2 { margin: .35rem 0 .25rem; }
.test-page-head p  { color: var(--text-2); font-size: .875rem; }
.test-timer {
  background: var(--bg-elevated);
  border: 2px solid var(--border-2);
  border-radius: var(--radius);
  padding: .6rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 90px;
  text-align: center;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition);
}
.timer-warn { color: var(--danger) !important; border-color: var(--danger) !important; animation: pulse 1s infinite; }
.test-q { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-bottom: .75rem; }
.test-foot { display: flex; gap: .75rem; align-items: center; padding: 1rem 0; }

.test-result-wrap {}
.tr-score-block {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tr-ring { width: 130px; height: 130px; flex-shrink: 0; }
.tr-info h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.tr-info p  { color: var(--text-2); font-size: .925rem; margin-bottom: .75rem; }
.tr-xp { display: inline-block; background: var(--accent-soft); color: var(--accent); padding: .3rem .8rem; border-radius: 99px; font-size: .875rem; font-weight: 700; margin-bottom: .75rem; }
.tr-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ── Project page ──────────────────────────────────────────── */
.project-page {}
.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.project-top-left h2 { font-size: 1.4rem; margin: .4rem 0 .35rem; }
.project-top-left p  { color: var(--text-2); font-size: .9rem; }
.project-top-right { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.ar-tag { font-size: .7rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.ar-tag-red   { background: rgba(239,68,68,.13); color: #ef4444; }
.ar-tag-amber { background: rgba(245,158,11,.15); color: #f59e0b; }
.cmp-bar { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.cmp-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.hm-grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: column; grid-template-rows: repeat(7, 1fr);
  gap: 3px; max-width: 360px;
}
.hm-cell { width: 100%; aspect-ratio: 1; border-radius: 2px; background: var(--bg-2); }
.hm-l0 { background: var(--bg-2); }
.hm-l1 { background: rgba(139,92,246,.35); }
.hm-l2 { background: rgba(139,92,246,.65); }
.hm-l3 { background: var(--accent); }
.stu-list { display: flex; flex-direction: column; gap: .4rem; }
.stu-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .75rem 1rem; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); transition: border-color .12s, transform .12s;
}
.stu-row:hover { border-color: var(--accent); transform: translateX(2px); }
.stu-av {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stu-more-wrap { position: relative; flex-shrink: 0; }
.stu-more-btn {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 1.25rem; padding: .25rem .4rem; border-radius: 6px;
  line-height: 1; transition: background .12s, color .12s;
}
.stu-more-btn:hover, .stu-more-wrap.stu-menu-open .stu-more-btn {
  background: var(--bg-hover); color: var(--text);
}
.stu-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 120;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .35rem; min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.stu-more-wrap.stu-menu-open .stu-menu { display: flex; flex-direction: column; }
.stu-menu-item {
  background: none; border: none; cursor: pointer; text-align: left;
  padding: .5rem .75rem; border-radius: 8px; font-size: .875rem; color: var(--text);
  transition: background .1s;
}
.stu-menu-item:hover { background: var(--bg-hover); }
.stu-menu-danger { color: #ef4444 !important; }
.stu-menu-danger:hover { background: rgba(239,68,68,.1) !important; }
.proj-desc-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: .95rem;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-line;
}

.project-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  align-items: start;
}
.project-editor-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.project-editor { height: 560px; }

.project-sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* ── Fullscreen project workspace ──────────────────────────
   When .project-fullscreen is on .project-page, the page escapes the
   app shell and fills the viewport with a real IDE layout: top bar,
   editor + output stacked on the left, requirements + help on the
   right. Resizable rows on the editor/output split. */
body:has(.project-page.project-fullscreen) { overflow: hidden; }
.project-page.project-fullscreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  /* Stop short of the app's left sidebar so it doesn't hide behind it. */
  left: var(--sidebar-w);
  z-index: 50;
  background: var(--bg);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--border);
}
@media (max-width: 900px) {
  /* On mobile the sidebar is hidden (transformed off-screen) and
     --sidebar-w drops to 0, so the project-fullscreen fills the
     viewport edge-to-edge automatically. */
  .project-page.project-fullscreen { left: 0; border-left: none; }
}
.project-page.project-fullscreen .project-top {
  background: var(--bg-card);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  padding: .75rem 1.25rem;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 0;
}
.project-page.project-fullscreen .project-top-left {
  flex: 1; min-width: 0;
  display: flex; flex-direction: row; align-items: center; gap: .75rem;
  flex-wrap: wrap;
}
.project-page.project-fullscreen .project-top-left h2 {
  font-size: 1rem; margin: 0; white-space: nowrap;
  text-overflow: ellipsis; overflow: hidden; max-width: 32ch;
}
.project-page.project-fullscreen .assign-desc-header,
.project-page.project-fullscreen .project-top-left > p {
  display: none;   /* moved to the right-hand panel */
}
.project-page.project-fullscreen .project-top-right { gap: .4rem; }
.project-page.project-fullscreen .project-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 1fr;
  gap: 0;
  min-height: 0;
  align-items: stretch;
}
/* Project layout now has 3 rows: topbar / instructions strip / body */
.project-page.project-fullscreen { grid-template-rows: auto auto 1fr; }
.proj-instructions-strip {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.25rem 1rem;
  display: flex; align-items: flex-start; gap: .85rem;
  margin-bottom: 1.25rem;   /* breathing room between instructions and editor */
}
.proj-instructions-strip .pis-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
  padding: .25rem .55rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 99px;
  white-space: nowrap; flex-shrink: 0;
}
.proj-instructions-strip p {
  margin: 0; font-size: .9rem; line-height: 1.55;
  color: var(--text-2); white-space: pre-line;
  max-height: 4.65em;       /* about 3 lines, scroll if longer */
  overflow-y: auto;
}
/* When the strip is present, give the body its own border-top so the
   1.25rem margin reads visually as a real gap, not collapsed padding. */
.project-page.project-fullscreen .proj-instructions-strip + .project-body {
  border-top: 1px solid var(--border);
}
.req-soft-pill {
  margin-left: .55rem;
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  padding: .15rem .5rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 99px;
}
.req-soft-note {
  margin: -.25rem 0 .85rem;
  font-size: .78rem; color: var(--text-3); line-height: 1.5;
}
.project-page.project-fullscreen .project-main-col {
  display: grid;
  grid-template-rows: 1fr 220px;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--border);
}
.project-page.project-fullscreen .project-editor-wrap {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  min-height: 0;
  display: flex;
}
.project-page.project-fullscreen .project-editor {
  height: auto;
  flex: 1;
  min-height: 0;
}
.project-page.project-fullscreen .proj-output-wrap {
  border: none;
  border-radius: 0;
  display: flex; flex-direction: column;
  min-height: 0;
}
.project-page.project-fullscreen .proj-output {
  flex: 1;
  min-height: 0;
  border-radius: 0;
  overflow-y: auto;
}
.project-page.project-fullscreen .project-sidebar {
  border-left: 0;
  padding: 1rem 1.25rem;
  overflow-y: auto;
  gap: .75rem;
  background: var(--bg);
  min-height: 0;
}
.project-page.project-fullscreen .project-sidebar .card {
  padding: 1rem 1.1rem;
}
/* Compact button look in the fullscreen topbar */
.project-page.project-fullscreen .btn-ghost.btn-sm,
.project-page.project-fullscreen .btn-primary,
.project-page.project-fullscreen .btn-ghost {
  height: 34px; padding-top: 0; padding-bottom: 0;
}
@media (max-width: 1000px) {
  .project-page.project-fullscreen .project-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .project-page.project-fullscreen .project-main-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .project-page.project-fullscreen .project-sidebar {
    max-height: 45vh;
  }
}
.req-list { list-style: none; padding: 0; }
.req-item {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text-2);
}
.req-item:last-child { border-bottom: none; }
.req-check { color: var(--text-3); flex-shrink: 0; margin-top: 1px; }

.hint-row { margin-bottom: .5rem; }
.hint-text { margin-top: .35rem; font-size: .85rem; color: var(--text-2); padding-left: .25rem; }

.proj-output {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}
.output-ph { color: var(--text-3); }

@media (max-width: 1000px) {
  .project-body { grid-template-columns: 1fr; }
  .project-editor { height: 360px; }
}

/* ── Leaderboard page ──────────────────────────────────────── */
.lb-page {}
.lb-page-head { margin-bottom: 2rem; }
.lb-page-head h2 { margin-bottom: .25rem; }
.lb-page-head p  { color: var(--text-2); }

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 2rem;
}
.podium-slot {
  flex: 1;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  text-align: center;
  position: relative;
}
.podium-1 { background: linear-gradient(180deg,rgba(245,158,11,.08),var(--bg-card)); border-color: rgba(245,158,11,.4); }
.podium-2 { background: linear-gradient(180deg,rgba(148,163,184,.06),var(--bg-card)); }
.podium-3 { background: linear-gradient(180deg,rgba(205,127,50,.06),var(--bg-card)); }
.podium-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem; color: #fff;
  margin-bottom: .6rem;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.podium-medal { font-size: 1.5rem; margin-bottom: .3rem; }
.podium-name  { font-weight: 700; font-size: .875rem; margin-bottom: .2rem; }
.podium-xp    { font-size: .75rem; color: var(--text-3); }
.podium-plinth { width: 100%; height: 6px; margin-top: 1rem; border-radius: 3px; }
.podium-plinth-1 { background: var(--warning); }
.podium-plinth-2 { background: var(--text-3); }
.podium-plinth-3 { background: #cd7f32; }
.podium-empty { background: none; border: none; }

.lb-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  font-size: .9rem;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--accent-soft); }
.lb-me { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.lb-rank { width: 28px; font-weight: 700; color: var(--text-3); text-align: center; flex-shrink: 0; }
.lb-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .8rem;
  flex-shrink: 0;
}
.lb-name { flex: 1; font-weight: 500; }
.you-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 99px;
  margin-left: .35rem;
  vertical-align: middle;
}
.lb-lv { color: var(--text-3); font-size: .8rem; flex-shrink: 0; }
.lb-xp { font-weight: 700; color: var(--accent); flex-shrink: 0; }

/* ── Settings page ─────────────────────────────────────────── */
.settings-page {}
.settings-wrap {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.settings-tabs {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stab {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem 1.1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.stab:last-child { border-bottom: none; }
.stab:hover { background: var(--accent-soft); color: var(--text); }
.stab.stab-active { background: var(--accent-soft); color: var(--accent); }

.settings-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.stab-panel h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; }
.stab-panel .form-group { margin-bottom: 1.1rem; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.sr-label { font-size: .9rem; font-weight: 600; }
.sr-desc  { font-size: .8rem; color: var(--text-3); margin-top: .15rem; }
.danger-row .sr-label { color: var(--danger); }

/* ── Account deletion-pending screen ──────────────────────────── */
/* Shown after a user has scheduled their account for deletion. The
   router short-circuits to this screen for every route until the
   user cancels the deletion or signs out. Sidebar + topbar links
   are hidden via the .deletion-pending body class. */
body.deletion-pending #sidebar,
body.deletion-pending .topbar-btn,
body.deletion-pending .search-wrap,
body.deletion-pending .sidebar-toggle,
body.deletion-pending .pricing-notice { display: none !important; }
body.deletion-pending #app-shell { grid-template-columns: 0 1fr; }
body.deletion-pending #page-view { padding: 0; }

.deletion-screen {
  min-height: calc(100vh - 4rem);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.deletion-card {
  max-width: 540px; width: 100%; text-align: center;
  padding: 2.5rem 2rem;
  background: var(--bg-2);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: 18px;
  box-shadow: 0 12px 40px -16px rgba(0,0,0,.4);
}
.deletion-icon { font-size: 3rem; line-height: 1; margin-bottom: 1rem; }
.deletion-card h1 {
  font-size: 1.5rem; font-weight: 800; color: var(--text-1);
  margin: 0 0 1rem; line-height: 1.25; letter-spacing: -.01em;
}
.deletion-sub {
  font-size: .95rem; color: var(--text-2); line-height: 1.6;
  margin: 0 0 1rem;
}
.deletion-actions {
  display: flex; flex-direction: column; gap: .65rem;
  margin: 1.75rem 0 1rem;
}
.deletion-fine {
  font-size: .78rem; color: var(--text-3);
  margin: 1rem 0 0;
}
.deletion-fine a { color: var(--accent); text-decoration: underline; }
@media (max-width: 480px) {
  .deletion-card { padding: 1.75rem 1.25rem; }
  .deletion-card h1 { font-size: 1.25rem; }
}

.theme-btns { display: flex; gap: .5rem; }
.theme-choice {
  padding: .45rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg-elevated);
  color: var(--text-2);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.theme-choice:hover { border-color: var(--accent); color: var(--accent); }
.theme-choice.tc-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.progress-breakdown { display: flex; flex-direction: column; gap: .6rem; }
.pb-lang-group { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.pb-lang-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .15rem; }
.pb-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
}
.pb-emoji { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.pb-name  { width: 160px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.pb-bar   { flex: 1; height: 5px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.pb-fill  { height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; transition: width .6s ease; }
.pb-pct   { width: 36px; text-align: right; color: var(--text-3); font-size: .78rem; flex-shrink: 0; }

@media (max-width: 700px) {
  .settings-wrap { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; overflow-x: auto; border-radius: var(--radius-lg); }
  .stab { border-bottom: none; border-right: 1px solid var(--border); white-space: nowrap; }
  .stab:last-child { border-right: none; }
  .pb-name { width: 100px; }
}

/* ── Certificate page ──────────────────────────────────────── */
.cert-page { display: flex; justify-content: center; padding: 1rem; }
.cert-outer { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; max-width: 720px; width: 100%; }

.certificate {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: 3.5rem 4rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px var(--accent-glow);
  text-align: center;
}
.cert-corner {
  position: absolute;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: .4;
}
.cert-tl { top: 16px; left: 16px; }
.cert-tr { top: 16px; right: 16px; }
.cert-bl { bottom: 16px; left: 16px; }
.cert-br { bottom: 16px; right: 16px; }
.cert-inner { position: relative; z-index: 1; }
.cert-logo { font-size: 3rem; margin-bottom: .5rem; }
.cert-title-text { font-size: 1rem; text-transform: uppercase; letter-spacing: .15em; color: var(--text-3); }
.cert-org { font-size: .85rem; color: var(--text-3); margin-top: .25rem; }
.cert-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); margin: 1.5rem auto; max-width: 400px; }
.cert-presents { font-size: .9rem; color: var(--text-3); margin-bottom: .5rem; }
.cert-recipient-name {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: .5rem 0;
  line-height: 1.2;
}
.cert-body-text { font-size: .9rem; color: var(--text-2); margin: .5rem 0; }
.cert-course-name { font-size: 1.25rem; font-weight: 700; color: var(--text); margin: .5rem 0; }
.cert-details { font-size: .82rem; color: var(--text-3); margin-top: .4rem; }
.cert-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.cert-date { font-size: .82rem; color: var(--text-3); }
.cert-seal { font-size: 1.5rem; color: var(--accent); }
.cert-sig  { font-size: .82rem; color: var(--text-3); font-style: italic; }

.cert-locked-card {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
}
.cert-lock-icon { font-size: 4rem; margin-bottom: 1rem; }
.cert-locked-card h2 { margin-bottom: .75rem; }
.cert-prog-wrap { margin: 1.5rem 0; }
.cert-prog-label { font-size: .85rem; color: var(--text-3); margin-top: .5rem; }

.cert-actions { display: flex; gap: .75rem; }

@media print {
  body > *:not(.cert-page) { display: none !important; }
  .cert-actions, .topbar, #sidebar { display: none !important; }
  .cert-page { padding: 0; }
  .certificate {
    box-shadow: none;
    border: 2px solid var(--accent);
    page-break-inside: avoid;
  }
  .cert-recipient-name {
    -webkit-text-fill-color: var(--accent);
    color: var(--accent);
  }
}

/* ── Toast show state (override original animation with transitions) ── */
.toast {
  animation: none !important;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }

/* ── XP popup ──────────────────────────────────────────────── */
.xp-popup {
  position: fixed;
  bottom: 6rem;
  right: 1.75rem;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--warning);
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  z-index: 9999;
  opacity: 0;
  transform: translateY(0);
  transition: none;
}
.xp-popup.show { opacity: 1; animation: xpRise 2s ease forwards; }
.xp-popup.fade { opacity: 0; }
@keyframes xpRise {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-70px); }
}

/* ── Misc text-center ──────────────────────────────────────── */
.text-center { text-align: center; }

/* ── Sidebar brand as link ─────────────────────────────────── */
a.sidebar-brand {
  text-decoration: none;
  color: inherit;
  transition: opacity .15s;
}
a.sidebar-brand:hover { opacity: .75; }

/* ── Topbar action buttons (replace icon-btn for cheat/theme) ─ */
.topbar-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.topbar-btn.topbar-btn-icon { padding: .4rem .55rem; }
.topbar-btn.topbar-btn-icon .topbar-btn-label { display: none; }

/* Pricing-changing notice pill (logged-in topbar) */
.pricing-notice {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .55rem .4rem .7rem;
  background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(99,102,241,.16));
  border: 1px solid rgba(139,92,246,.4);
  border-radius: 999px;
  color: var(--text); font-size: .76rem; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: all var(--transition);
}
.pricing-notice:hover { border-color: var(--accent); background: linear-gradient(135deg, rgba(139,92,246,.28), rgba(99,102,241,.28)); }
.pricing-notice u { color: #a78bfa; text-underline-offset: 2px; }
.pn-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,.25); flex-shrink: 0;
  animation: pnpulse 2s ease-in-out infinite;
}
@keyframes pnpulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.pn-x {
  background: transparent; border: none; color: var(--text-3);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 .15rem;
  display: flex; align-items: center;
}
.pn-x:hover { color: var(--text); }
@media (max-width: 900px) {
  .pricing-notice .pn-text { display: none; }
  .pricing-notice { padding: .4rem .5rem; }
}

/* Always show sidebar toggle on desktop too */
/* ── Lesson flow: quiz page ─────────────────────────────────── */
.quiz-page {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 4rem;
}
.quiz-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.qph-center { flex: 1; }
.qph-crumb { font-size: .78rem; color: var(--text-3); margin-bottom: .25rem; }
.qph-title { font-size: 1.4rem; font-weight: 700; }
.qph-meta { font-size: .82rem; color: var(--text-2); align-self: flex-end; }

.quiz-progress-track {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2rem;
}
.quiz-progress-track .quiz-progress-bar { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.quiz-progress-track .quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; transition: width .4s ease; }
.quiz-prog-label { font-size: .78rem; color: var(--text-3); white-space: nowrap; }

.quiz-questions-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.quiz-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition);
}
.quiz-question-card:has(input:checked) { border-color: var(--border-2); }
.qqc-header { margin-bottom: .75rem; }
.qqc-num { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.qqc-total { color: var(--text-3); font-weight: 400; }
.qqc-text { font-size: 1rem; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 1rem; }
.qqc-opts { display: flex; flex-direction: column; gap: .5rem; }
.qqc-opt {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: .9rem; color: var(--text-2);
}
.qqc-opt input[type="radio"] { display: none; }
.qqc-opt-indicator {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-2);
  flex-shrink: 0;
  transition: all var(--transition);
}
.qqc-opt.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.qqc-opt.selected .qqc-opt-indicator { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.qqc-opt:hover:not(.selected) { border-color: var(--accent); background: var(--accent-soft); }
.qqc-opt-text { flex: 1; }

/* Multi-line output options (e.g. "what does this print?") */
.quiz-opt-pre {
  flex: 1;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.15);
  border-radius: 6px;
  padding: .35rem .6rem;
  color: var(--text);
  overflow-x: auto;
}
[data-theme="light"] .quiz-opt-pre {
  background: rgba(139,92,246,.05);
  color: #1e1b4b;
}

.quiz-submit-row { display: flex; justify-content: center; padding: 1rem 0; }

/* ── Quiz result page ───────────────────────────────────────── */
.quiz-result-page { padding-top: 1rem; }
.qrp-score-block {
  display: flex; flex-direction: column; align-items: center;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 1.5rem;
  text-align: center;
}
.qrp-score-block.qrp-pass { border-color: var(--success); background: var(--success-soft); }
.qrp-score-block.qrp-fail { border-color: var(--danger);  background: var(--danger-soft); }
.qrp-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--bg-elevated);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin-bottom: 1.25rem;
  border: 4px solid currentColor;
}
.qrp-pass .qrp-circle { color: var(--success); background: rgba(16,185,129,.1); }
.qrp-fail .qrp-circle { color: var(--danger);  background: rgba(239,68,68,.1); }
.qrp-pct { font-size: 2rem; font-weight: 800; line-height: 1; }
.qrp-fraction { font-size: .78rem; color: var(--text-3); margin-top: .2rem; }
.qrp-verdict { font-size: 1.35rem; font-weight: 700; margin-bottom: .4rem; }
.qrp-xp { font-size: .9rem; color: var(--text-2); }

.qrp-actions { display: flex; flex-direction: column; align-items: center; gap: .75rem; margin-bottom: 2.5rem; }
.qrp-continue { min-width: 280px; justify-content: center; font-size: 1rem; }

/* Review items */
.quiz-review { margin-top: 1rem; }
.quiz-review h3 { font-size: 1rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1rem; }
.review-item {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--border-2);
  background: var(--bg-card);
  margin-bottom: .75rem;
  font-size: .875rem;
}
.review-item.ri-right { border-left-color: var(--success); }
.review-item.ri-wrong  { border-left-color: var(--danger); }
.ri-head { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .4rem; }
.ri-head svg { flex-shrink: 0; margin-top: 2px; }
.ri-right .ri-head svg { color: var(--success); }
.ri-wrong .ri-head  svg { color: var(--danger); }
.ri-your { color: var(--text-2); margin-bottom: .2rem; }
.ri-correct { color: var(--success); font-weight: 500; }
.ri-explain { color: var(--text-3); font-style: italic; margin-top: .35rem; border-top: 1px solid var(--border); padding-top: .35rem; }

/* ── Lesson footer (new flow) ───────────────────────────────── */
.lesson-footer-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.lfn-left, .lfn-right { flex: 1; }
.lfn-right { display: flex; justify-content: flex-end; }
.lfn-center { display: flex; align-items: center; }
.lesson-completed-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .9rem;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
}

/* ── Lesson meta pills (no emojis) ─────────────────────────── */
.meta-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .7rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .78rem; color: var(--text-2);
}
.meta-pill.pill-success { background: var(--success-soft); color: var(--success); border-color: transparent; }


/* ── Error explanation button & box ─────────────────────────── */
.btn-explain-err {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .5rem; padding: .3rem .75rem;
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid var(--warning); border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-explain-err:hover { background: var(--warning); color: #fff; }
.error-explain-box {
  margin-top: .6rem; padding: .75rem 1rem;
  background: var(--bg-elevated); border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm); font-size: .87rem; line-height: 1.55;
  color: var(--text-1);
}
.error-explain-box code { background: var(--bg-card); padding: .1em .35em; border-radius: 4px; }

/* ── Project help system ─────────────────────────────────────── */
.proj-help-card { border: 1px dashed var(--border); }
.proj-help-desc { font-size: .83rem; color: var(--text-2); margin: .35rem 0 .75rem; }
.proj-help-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-danger-ghost { color: var(--danger) !important; border-color: var(--danger) !important; }
.btn-danger-ghost:hover { background: var(--danger-soft) !important; }
.proj-hint-box { margin-top: .75rem; }
.hint-reveal {
  padding: .65rem .9rem; background: var(--accent-soft);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  font-size: .87rem; line-height: 1.5; color: var(--text-1);
}
.hint-label {
  display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent); margin-bottom: .3rem;
}
.proj-solution-box { margin-top: .75rem; }
.proj-sol-confirm {
  padding: 1rem; background: var(--danger-soft);
  border: 1px solid var(--danger); border-radius: var(--radius);
  text-align: center;
}
.sol-confirm-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.sol-confirm-msg { font-size: .87rem; color: var(--text-1); margin-bottom: .85rem; line-height: 1.5; }
.sol-confirm-btns { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.sol-reveal-banner {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .6rem .9rem; background: var(--danger-soft);
  border-left: 3px solid var(--danger); border-radius: var(--radius-sm);
  margin-bottom: .6rem; font-size: .85rem; color: var(--danger);
}
.sol-reveal-banner small { color: var(--text-2); font-size: .78rem; }
.sol-code {
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  padding: .85rem 1rem; font-size: .82rem; overflow-x: auto;
  max-height: 320px; color: var(--text-1); white-space: pre;
}

/* ── Topbar home link (logo → landing page) ───────────────────── */
.topbar-home-link {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; flex-shrink: 0; margin-right: auto;
  padding: .25rem .5rem; border-radius: 8px;
  transition: opacity .15s;
}
.topbar-home-link:hover { opacity: .75; }
.topbar-home-logo { width: 26px; height: 26px; }
.topbar-home-name {
  font-size: .9375rem; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
@media (max-width: 480px) { .topbar-home-name { display: none; } }

/* ── User menu ────────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .625rem .3rem .3rem;
  border-radius: 8px; background: none;
  border: 1px solid var(--border); cursor: pointer;
  font-family: inherit; font-size: .8125rem; font-weight: 500;
  color: var(--text); transition: border-color .15s, background .15s;
}
.user-menu-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.user-avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-size: .6875rem; font-weight: 700; color: #fff;
}
.user-menu-name {
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 768px) { .user-menu-name { display: none; } }

.user-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 230px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.35);
  overflow: hidden; z-index: 300;
}
.user-menu-header {
  padding: .875rem 1rem; border-bottom: 1px solid var(--border);
}
.umd-name { font-size: .875rem; font-weight: 600; margin-bottom: .2rem; }
.umd-email {
  font-size: .75rem; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .625rem 1rem; font-size: .875rem; font-weight: 500;
  color: var(--text); background: none; border: none;
  text-decoration: none; width: 100%; text-align: left;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.user-menu-item:hover { background: var(--accent-soft); }
.user-menu-danger { color: var(--text-2); }
.user-menu-danger:hover { background: rgba(239,68,68,.08); color: #f87171; }

/* ── App footer ───────────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: .875rem 1.5rem;
  flex-shrink: 0;
}
.app-footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
  max-width: 100%;
}
.app-footer-copy { font-size: .75rem; color: var(--text-3); }
.app-footer-links {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.app-footer-links a {
  font-size: .75rem; color: var(--text-3); text-decoration: none;
  transition: color .15s;
}
.app-footer-links a:hover { color: var(--text-2); }

/* ── Settings page additions ──────────────────────────────────── */
.settings-divider {
  margin: 2rem 0 1.5rem;
  border: none; border-top: 1px solid var(--border);
}
.settings-sub-h {
  font-size: .9375rem; font-weight: 700; margin-bottom: 1rem; color: var(--text);
}
.settings-hint {
  font-size: .78rem; color: var(--text-2); margin-top: .5rem; line-height: 1.5;
}
.mt-1 { margin-top: .5rem; }

/* ── App modal overlay (used by in-app popup modals) ─────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 2.25rem;
  width: 100%; position: relative;
  transform: scale(.96) translateY(8px);
  transition: transform .2s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
.modal-card .modal-close { position: absolute; top: 1rem; right: 1rem; }
.modal-subtitle { font-size: .9rem; color: var(--text-2); margin-bottom: 1.5rem; }
.modal-error {
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  color: #f87171; border-radius: 8px; padding: .625rem .875rem;
  font-size: .85rem; margin-bottom: 1rem;
}
.btn-submit {
  width: 100%; padding: .75rem 1.5rem; margin-top: .5rem;
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: opacity .15s;
}
.btn-submit:hover { opacity: .88; }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Educator / Student classroom styles ─────────────────────── */
.educator-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.educator-page .page-head { margin-bottom: 2rem; }
.educator-page .page-head h2 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; }

.edu-section { margin-bottom: 2.5rem; }
.edu-section-title {
  font-size: .8125rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: .875rem;
}
.edu-table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.edu-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.edu-table th {
  text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); padding: .75rem 1rem;
  background: rgba(255,255,255,.025); border-bottom: 1px solid var(--border);
}
.edu-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.edu-table tbody tr:last-child td { border-bottom: none; }
.edu-table tbody tr:hover { background: rgba(255,255,255,.025); }
.lb-my-row td { background: rgba(139,92,246,.07); font-weight: 600; }

.edu-join-code {
  display: inline-flex; align-items: center; gap: .375rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 1rem; font-weight: 700;
  letter-spacing: .15em; color: var(--accent);
  background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.25);
  border-radius: 8px; padding: .3rem .75rem; cursor: pointer; transition: background .15s;
}
.edu-join-code:hover { background: rgba(139,92,246,.18); }

/* Student assignments section in dashboard */
.assign-section { margin-bottom: 2rem; }
.assign-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.assign-section-head h3 { font-size: 1rem; font-weight: 700; }
.assign-section-head a { font-size: .8125rem; color: var(--accent); text-decoration: none; }
.assign-list { display: flex; flex-direction: column; gap: .5rem; }
.assign-item {
  display: flex; align-items: center; gap: .875rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: .875rem 1rem; transition: border-color .15s;
}
.assign-item:hover { border-color: rgba(139,92,246,.35); }
.assign-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.assign-dot-overdue { background: #ef4444; }
.assign-dot-due-soon { background: #f59e0b; }
.assign-dot-pending { background: var(--text-3); }
.assign-dot-done { background: #22c55e; }
.assign-body { flex: 1; min-width: 0; }
.assign-title { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assign-meta { font-size: .775rem; color: var(--text-3); margin-top: .15rem; }
.assign-action a {
  font-size: .8125rem; font-weight: 600; color: var(--accent); text-decoration: none;
  white-space: nowrap;
}
.assign-done-label { font-size: .8125rem; font-weight: 600; color: #22c55e; white-space: nowrap; }

/* ── Assignment isolation — reuse real renderers, strip unit chrome ── */
.assign-isolate .lesson-sidebar { display: none !important; }
.assign-isolate .lesson-layout { display: block !important; max-width: 880px; margin: 0 auto; }
/* Single lesson/quiz/test/project assignments hide all unit nav.
   Full-unit assignments keep prev/next so students can move through it. */
.assign-isolate:not(.assign-unit) .lesson-footer-nav .lfn-left { display: none !important; }
.assign-isolate:not(.assign-unit) .lesson-footer-nav { justify-content: center !important; }
.assign-isolate .lesson-dots,
.assign-isolate #bookmark-btn { display: none !important; }
/* No revealing answers inside an assignment (student view AND preview) */
.assign-isolate .ex-sol-btn,
.assign-isolate .ex-solution,
.assign-isolate .proj-help-card { display: none !important; }
/* Retakes are off by default in assignments — teacher opts in per assignment */
.assign-isolate:not(.assign-allow-retake) .retake-btn { display: none !important; }
/* Educator preview — make it read-only: hide submit/complete actions */
.assign-preview .lesson-footer-nav .lfn-right,
.assign-preview #test-foot,
.assign-preview .project-top-right,
.assign-preview .as-footer,
.assign-preview .ex-controls .btn-primary { display: none !important; }

/* ── Bare/preview mode — strip app chrome in iframes ── */
body.bare-mode .lesson-topbar { display: none !important; }
body.bare-mode .lesson-sidebar { display: none !important; }
body.bare-mode .lesson-layout { display: block !important; max-width: 820px; margin: 0 auto; padding: 1.5rem; }
body.bare-mode .lesson-footer-nav .lfn-left { display: none !important; }
body.bare-mode .lesson-footer-nav .lfn-right .btn-ghost { display: none !important; }
body.bare-mode .course-detail-hero { border-radius: 0; }

/* ── Student dashboard ── */
.std-quickstart {
  background: var(--accent); color: #fff;
  border-radius: 16px; padding: 1.5rem 2rem;
  margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .4rem;
}
.std-qs-done { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-1); text-align: center; align-items: center; }
.std-qs-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.std-qs-title { font-size: 1.25rem; font-weight: 700; }
.std-qs-due   { font-size: .875rem; opacity: .85; }
.std-qs-btn   { margin-top: .75rem; align-self: flex-start; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); }
.std-qs-btn:hover { background: rgba(255,255,255,.3); }
.std-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 768px) { .std-dash-grid { grid-template-columns: 1fr; } }
.std-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem 1.5rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: .75rem; }
.cal-head { text-align: center; font-size: .7rem; font-weight: 700; color: var(--text-3); padding: .25rem 0; text-transform: uppercase; letter-spacing: .06em; }
.cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: .25rem 0; border-radius: 6px; position: relative; cursor: default; }
.cal-today { background: rgba(139,92,246,.15); }
.cal-today .cal-num { color: var(--accent); font-weight: 700; }
.cal-has-due { background: rgba(139,92,246,.08); }
.cal-num { font-size: .8rem; line-height: 1.4; }
.cal-dots { display: flex; gap: 2px; margin-top: 1px; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.feedback-list { display: flex; flex-direction: column; gap: .625rem; }
.std-classbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1rem 1.5rem; margin-bottom: 1.25rem;
}
.std-classbar-name { font-size: 1.15rem; font-weight: 800; }
.std-classbar-sub  { font-size: .85rem; color: var(--text-3); margin-top: .15rem; }
.cal-detail { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .875rem; }
.cal-detail-head { font-size: .8rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.cal-detail-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.cal-detail-row:last-child { border-bottom: none; }
.cal-detail-title { font-size: .9rem; font-weight: 600; }
.cal-cell.cal-has-due:hover { background: rgba(139,92,246,.18); }

/* ── Standalone assignment view (no unit chrome) ── */
.assignment-standalone { display: flex; flex-direction: column; min-height: 100%; }
.as-topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.5rem; background: var(--bg-card);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.as-type-pill {
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: rgba(139,92,246,.12);
  border: 1px solid rgba(139,92,246,.2); border-radius: 20px; padding: .2rem .65rem;
}
.as-body {
  max-width: 800px; width: 100%; margin: 0 auto;
  padding: 2rem 1.5rem 4rem; flex: 1;
}
.as-body-project { max-width: 100%; padding: 0; }
.assignment-project .as-body { max-width: 100%; padding: 0; }
.as-footer {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
}

/* Educator classroom tab in settings */
.class-code-display {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: monospace; font-size: 1.375rem; font-weight: 700; letter-spacing: .2em;
  color: var(--accent); background: rgba(139,92,246,.1);
  border: 1px solid rgba(139,92,246,.25); border-radius: 10px; padding: .5rem 1.25rem;
  cursor: pointer; transition: background .15s;
}
.class-code-display:hover { background: rgba(139,92,246,.18); }
.class-list-item {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem;
  padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.class-list-item:last-child { border-bottom: none; }

/* ── Bare mode (iframe preview strips chrome) ─────────────── */
body.bare-mode #sidebar,
body.bare-mode #topbar,
body.bare-mode .cheat-sheet-wrap,
body.bare-mode .app-footer {
  display: none !important;
}
body.bare-mode #page-view {
  margin-left: 0 !important;
  padding-top: 0 !important;
}

/* ── Assignment preview blur popup ───────────────────────── */
.preview-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  display: flex; align-items: center; justify-content: center;
  transition: background .3s ease, backdrop-filter .3s ease;
  pointer-events: none;
}
.preview-backdrop.preview-backdrop-open {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: all;
}
.preview-panel {
  width: min(1280px, calc(100vw - 3rem));
  height: calc(100vh - 3rem);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(16px); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
}
.preview-backdrop.preview-backdrop-open .preview-panel {
  transform: translateY(0); opacity: 1;
}
.preview-topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}

/* ── Student dashboard ───────────────────────────────────────── */
.student-dash {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.announce-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(139,92,246,.1);
  border: 1px solid rgba(139,92,246,.25);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}
.announce-icon { font-size: 1.5rem; flex-shrink: 0; }
.announce-label { font-size: .75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.announce-text { font-size: .9375rem; font-weight: 500; margin-top: .2rem; }
.announce-time { font-size: .75rem; color: var(--text-3); margin-top: .35rem; }

.dash-stats-row {
  display: flex;
  gap: .75rem;
}
.dash-stat {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .875rem;
  text-align: center;
}
.dash-stat-val { font-size: 1.375rem; font-weight: 800; color: var(--accent); }
.dash-stat-lbl { font-size: .75rem; color: var(--text-3); margin-top: .2rem; }

.dash-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
}
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.dash-section-head h3 { font-size: 1rem; font-weight: 700; }
.dash-section-link { font-size: .8125rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.dash-section-link:hover { text-decoration: none; opacity: .8; }

/* Feedback list */
.feedback-list { display: flex; flex-direction: column; gap: .625rem; }
.feedback-item {
  padding: .625rem 0;
  border-bottom: 1px solid var(--border);
}
.feedback-item:last-child { border-bottom: none; }
.feedback-title { font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.feedback-meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; }
.feedback-score { font-weight: 700; color: var(--accent); }
.feedback-pass { color: #22c55e; font-weight: 600; }
.feedback-comment { color: var(--text-2); font-style: italic; }

/* Leaderboard mini */
.lb-mini { display: flex; flex-direction: column; gap: .5rem; }
.lb-mini-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .625rem;
  border-radius: 10px;
  background: var(--bg-2);
}
.lb-mini-me { background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.25); }
.lb-mini-medal { font-size: 1.125rem; flex-shrink: 0; min-width: 1.75rem; }
.lb-mini-name { flex: 1; font-size: .875rem; font-weight: 600; }
.lb-mini-xp { font-size: .8rem; color: var(--text-3); font-weight: 600; }

/* ── Grades page ─────────────────────────────────────────────── */
.grade-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}
.grade-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.grade-comment {
  font-size: .875rem;
  color: var(--text-2);
  font-style: italic;
  margin-top: .625rem;
  padding-top: .625rem;
  border-top: 1px solid var(--border);
}

/* ── Calendar page ───────────────────────────────────────────── */
.cal-group { margin-bottom: 1.5rem; }
.cal-group-label {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: .75rem;
}
.cal-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .875rem 1rem;
  margin-bottom: .625rem;
}
.cal-item.cal-urgent { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.06); }
.cal-item.cal-overdue { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.06); }
.cal-date-badge {
  flex-shrink: 0;
  text-align: center;
  width: 44px;
}
.cal-month { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
.cal-day { font-size: 1.375rem; font-weight: 800; color: var(--accent); line-height: 1; }
.cal-item-body { flex: 1; min-width: 0; }

/* ── Submissions page ────────────────────────────────────────── */
.sub-list { display: flex; flex-direction: column; gap: .625rem; }
.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.sub-item:hover { background: var(--bg-card); }
.sub-item-left { display: flex; align-items: center; gap: .75rem; }

/* ── Educator announcements ──────────────────────────────────── */
.announce-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.announce-item:last-of-type { border-bottom: none; }
.announce-item-text { font-size: .9rem; flex: 1; }
.announce-item-time { font-size: .75rem; color: var(--text-3); white-space: nowrap; }

/* ── Global "modern radius" sweep (site-wide consistency) ────────────
   Forces consistent rounding across every visible surface. Uses
   !important so any older rule with sharp/4px corners gets overridden.
   The .keep-sharp class + a small exclude list lets specific elements
   (heatmap cells, podium plinths, calendar cells, code/kbd, narrow
   progress fills) opt out — see EXCLUSIONS block below.                */

/* ── PILLS: any chip / badge / tag / status indicator ── */
.badge, .chip, .tag, .pill,
[class*="-badge"], [class*="-chip"], [class*="-pill"],
.prio-badge, .ad-status,
.role-badge, .status-badge, .lang-badge, .type-badge,
.login-badge, .topbar-badge {
  border-radius: 999px !important;
}

/* ── BUTTONS: 8px everywhere (calmer, Nov 2026) ── */
button, .btn,
.btn-primary, .btn-ghost, .btn-secondary, .btn-danger, .btn-success,
.btn-sm, .btn-lg, .btn-icon,
.btn-google, .btn-copy-fix, .btn-run-all, .btn-run-bot,
.btn-submit, .btn-logout,
input[type="button"], input[type="submit"], input[type="reset"] {
  border-radius: 8px !important;
}

/* ── FORM INPUTS: 8px ── */
input, textarea, select,
.form-input, .form-textarea, .form-select,
.pae-title-input, .pae-meta-input, .pae-req-input, .pae-desc-area {
  border-radius: 8px !important;
}

/* ── CARDS / PANELS / SURFACES: 10px ── */
.card, .panel, .surface,
[class*="-card"], [class*="-panel"],
.settings-card, .preview-panel,
.modal-card, .modal-content,
.inc-open, .bot-row, .cron-row {
  border-radius: 10px !important;
}

/* ── MODAL OVERLAYS' INNER CARDS: 12px ── */
.modal-card,
.modal-overlay > div:first-child,
.ssr-int-modal {
  border-radius: 12px !important;
}

/* ── TOOLBARS, TABS, SUBTABS, DROPDOWN MENUS, LIST CELLS: 8px ── */
.tab, .subtab, .edu-subtab, .nav-item,
[class*="-dropdown"], [class*="-menu"]:not(svg *),
[class*="-row"]:where(:not(.flex-row):not(.grid-row)),
[class*="-cell"]:where(.cal-cell, .hm-cell) {
  border-radius: 8px;
}
/* ↑ unscoped (no !important) so .cal-cell and .hm-cell from the
   EXCLUSIONS block below can override back to small values.        */

/* ── INPUTS / OUTPUT WELLS / EDITOR FRAMES: 8px ── */
.ssr-output-area, .pae-editor-box, .pae-output-wrap,
.proj-output-wrap, .playground-output-wrap,
.cheat-sheet-wrap,
pre {
  border-radius: 8px;
}
/* <code> inside <pre> is a code BLOCK — match its container; otherwise
   it's inline and stays at the small 4px set in the exclusions below. */
pre > code, pre code {
  border-radius: 8px;
}

/* ── BUTTONS WITH INLINE STYLE border-radius — JS often sets 8px or 4px.
   Catch any element whose tag could be a button-like control.        */
[role="button"], [onclick] {
  /* don't blanket-override <a onclick=…> nav etc. */
}

/* ── IMAGES (non-avatar / non-icon): 8px ── */
img:not([class*="avatar"]):not([class*="icon"]):not([class*="logo"]):not([class*="emoji"]) {
  border-radius: 8px;
}

/* ════════════════════════════════════════════════════════════════════
   EXCLUSIONS — elements that intentionally stay angular or pre-rounded
   ════════════════════════════════════════════════════════════════════ */

/* Geometric grid pieces (heatmap cells, progress sub-bars, plinths,
   tiny dots) — these are TILES, not surfaces. Forcing them to 12px
   makes them look like wobbly Tetris blocks. */
.hm-cell, .podium-plinth,
.pb-bar, .pb-bar > div,
.quiz-progress-track .quiz-progress-bar,
.ssr-int-bar, .ssr-int-bar-fill,
.bot-bar-wrap, .bot-bar-fill {
  border-radius: 2px !important;
}

/* Calendar day cells: subtle */
.cal-cell { border-radius: 8px !important; }

/* Inline code and kbd: tiny round, preserves text rhythm */
code, kbd, samp, var,
.lesson-content code, .lesson-content kbd,
.error-explain-box code {
  border-radius: 4px !important;
}
/* …but a code block inside a <pre> should be a soft container */
pre > code, pre code {
  border-radius: 8px !important;
}

/* Round icon-only buttons stay circular */
.btn-icon-circle, .btn-circle, .close-circle,
button[class*="round"], button[class*="circle"],
.modal-close, .ssr-close,
.copy-code-btn {
  border-radius: 999px !important;
}

/* Full pill containers like progress tracks should stay 99px */
.pb-bar, .quiz-progress-track,
[class*="progress-track"], [class*="progress-pill"] {
  border-radius: 999px !important;
}

/* Nav active-indicator slivers (3-4px wide) stay tiny */
.nav-item::before, .nav-item.active::before,
[class*="-indicator"]:where([class*="vertical"], [class*="bar"]) {
  border-radius: 2px;
}

/* Opt-out class for any future one-off */
.keep-sharp, .no-round { border-radius: 0 !important; }
.keep-small-round    { border-radius: 4px !important; }
