@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap");

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-elevated: #1c1c28;
  --accent-primary: #6c63ff;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(108, 99, 255, 0.15);
  --text-primary: #f0eff8;
  --text-secondary: #9b99b8;
  --text-muted: #5c5a7a;
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(108, 99, 255, 0.3);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --locked: #3a3a4a;
  --font-display: "Playfair Display", serif;
  --font-body: "DM Sans", sans-serif;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-pill: 20px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-primary);
}

/* ── Landing ── */
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.landing-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.landing-nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.landing-nav-links a:hover {
  color: var(--text-primary);
}

.hero {
  position: relative;
  padding: 5rem 2rem 6rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      ellipse 80% 50% at 50% -20%,
      rgba(108, 99, 255, 0.25),
      transparent 55%
    ),
    radial-gradient(
      ellipse 60% 40% at 80% 60%,
      rgba(167, 139, 250, 0.08),
      transparent 50%
    );
  pointer-events: none;
}

.hero-grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--text-primary);
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

.section {
  padding: 4rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text-primary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 32px var(--accent-glow);
}

.feature-card .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  color: var(--accent-secondary);
}

.feature-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.step-card {
  text-align: center;
  padding: 1rem;
}

.step-num {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-primary);
}

.step-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.step-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.landing-footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.landing-footer strong {
  font-family: var(--font-display);
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.25rem;
}

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(
    ellipse at top,
    rgba(108, 99, 255, 0.12),
    transparent 50%
  );
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2rem;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.auth-card .sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.step-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.message-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-btn);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.message-banner.success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--success);
}

.message-banner.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

/* ── App layout (dashboard / learn) ── */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

.sidebar-left {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sidebar-left.collapsed {
  width: 60px;
}

.sidebar-left.collapsed .nav-label,
.sidebar-left.collapsed .brand-text {
  display: none;
}

.sidebar-top {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-primary);
  padding: 0.5rem 1rem;
  font-size: 1.1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-glow);
  color: var(--text-primary);
}

.nav-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.main-area {
  flex: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  padding: 1.5rem 2rem;
  overflow: auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 1.5rem;
}

.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-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.course-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0;
  color: var(--accent-secondary);
}

.course-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar-wrap {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

.progress-ring {
  width: 180px;
  height: 180px;
}

.progress-ring circle {
  fill: none;
  stroke-width: 10;
}

.progress-ring .bg {
  stroke: var(--bg-elevated);
}

.progress-ring .fg {
  stroke: var(--accent-primary);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s ease;
}

.finish-date {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.ai-insight {
  max-width: 560px;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.timeline-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.timeline-options button {
  text-align: left;
}

/* ── Learn page ── */
.learn-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.learn-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.learn-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.learn-sidebar-mini {
  width: 60px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
  gap: 1rem;
}

.learn-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 200px;
}

.lesson-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
}

.lesson-content {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 720px;
  margin: 0 auto;
  color: var(--text-primary);
}

.lesson-content h2 {
  font-family: var(--font-display);
  color: var(--accent-secondary);
  margin-top: 2rem;
  font-size: 1.35rem;
}

.lesson-content pre,
.lesson-content code {
  font-family: ui-monospace, monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2em 0.4em;
  font-size: 0.9em;
}

.lesson-content pre {
  padding: 1rem;
  overflow-x: auto;
}

.section-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background: var(--bg-card);
}

.section-block header {
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--text-primary);
}

.section-block .body {
  padding: 0 1rem 1rem;
  color: var(--text-secondary);
}

.section-block.collapsed .body {
  display: none;
}

.chat-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  z-index: 50;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.chat-messages {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message-user,
.message-ai {
  max-width: 85%;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.message-user {
  background: var(--accent-primary);
  color: white;
  margin-left: auto;
  border-radius: 16px 16px 4px 16px;
}

.message-ai {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  color: var(--text-primary);
}

.message-ai strong {
  color: var(--accent-secondary);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  resize: none;
}

.typing-dot {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.lesson-list-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 100vw);
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 150;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 1rem;
}

.lesson-list-panel.open {
  transform: translateX(0);
}

.lesson-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-btn);
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  cursor: default;
  border-left: 3px solid transparent;
}

.lesson-item.completed {
  opacity: 0.75;
  cursor: pointer;
}

.lesson-item.completed:hover {
  opacity: 1;
}

.lesson-item.current {
  border-left-color: var(--accent-primary);
  background: var(--accent-glow);
}

.lesson-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: var(--bg-card);
  border-top: 1px solid var(--border-accent);
  border-radius: 16px 16px 0 0;
  z-index: 160;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  overflow-y: auto;
}

.quiz-panel.open {
  transform: translateY(0);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  gap: 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 768px) {
  .sidebar-left {
    position: fixed;
    z-index: 90;
    height: 100%;
  }

  .main-area {
    padding: 1rem;
  }

  .learn-main {
    padding-bottom: 220px;
  }
}




/* ════════════════════════════════════════════
   PASTE THIS ENTIRE BLOCK AT THE BOTTOM OF
   frontend/static/style.css
   ════════════════════════════════════════════ */

/* ── Button base + hover fixes ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, color 0.2s ease,
              border-color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff !important;
}
.btn-primary:hover {
  background: #5a52e0;
  color: #ffffff !important;
  opacity: 1;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary) !important;
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-accent);
  color: var(--text-primary) !important;
  background: var(--bg-card);
}

/* Force white text on primary buttons always */
a.btn-primary,
a.btn-primary:hover,
a.btn-primary:visited,
button.btn-primary,
button.btn-primary:hover {
  color: #ffffff !important;
  text-decoration: none;
}

/* ── Landing page mobile ── */
@media (max-width: 768px) {

  /* Navbar */
  .landing-nav {
    padding: 0.85rem 1rem;
  }

  /* Hero */
  .hero {
    padding: 3rem 1.25rem 4rem;
    text-align: center;
  }
  .hero h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  .tagline {
    font-size: 1rem;
  }
  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .hero-ctas .btn {
    width: 100%;
    text-align: center;
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }
  .hero-bullets {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  /* Stats */
  .stats-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  /* Features */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* How it works - THE FIX for ugly stacking */
  .steps-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .step-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
  }
  .step-num {
    flex-shrink: 0;
    margin: 0;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  .step-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
  }
  .step-card p {
    margin: 0;
    font-size: 0.88rem;
  }

  /* Principles */
  .principles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* CTA band */
  .cta-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .cta-actions .btn {
    width: 100%;
    text-align: center;
  }
  .cta-title {
    font-size: 1.5rem;
  }

  /* FAQ */
  .faq-list {
    padding: 0 0.25rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    text-align: center;
  }
  .footer-col {
    align-items: center;
  }

  /* Sections padding */
  .section {
    padding: 3rem 1.25rem;
  }
  .section-head h2 {
    font-size: 1.65rem;
  }
}

/* ── Dashboard mobile ── */
@media (max-width: 768px) {

  /* Stack sidebar on mobile — hide it, show toggle */
  .app-layout {
    flex-direction: column;
  }
  .sidebar-left {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100%;
    z-index: 200;
    transition: left 0.3s ease;
  }
  .sidebar-left.mobile-open {
    left: 0;
  }

  /* Main area full width */
  .main-area {
    padding: 1rem;
    width: 100%;
  }

  /* Course cards single column */
  .courses-grid {
    grid-template-columns: 1fr;
  }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    gap: 1rem;
  }
  .page-header-actions {
    width: 100%;
  }
  .page-header-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* Modal full width */
  .modal-box {
    padding: 1.25rem;
    max-height: 95vh;
  }
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Profile grid single column */
  .profile-grid {
    grid-template-columns: 1fr;
  }

  /* Achievements ring row stack */
  .achievements-ring-row {
    flex-direction: column;
    align-items: center;
  }

  /* Add mobile top bar for dashboard */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-topbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1.1rem;
  }
  .mobile-menu-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-btn);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
  }
  .sidebar-backdrop.open {
    display: block;
  }
}

/* Hide mobile topbar on desktop */
.mobile-topbar {
  display: none;
}
@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }
}

/* ── Learn page mobile ── */
@media (max-width: 768px) {
  .learn-rail {
    display: none !important;
  }
  .learn-main {
    padding: 0.75rem 0.75rem 2rem;
  }
  .lesson-hero {
    padding: 1rem;
  }
  .lesson-hero-title {
    font-size: 1.3rem;
  }
  .lesson-content {
    padding: 1rem;
    font-size: 0.95rem;
  }
  .learn-topbar {
    padding: 0.5rem 0.75rem;
  }
  .learn-back-text {
    display: none;
  }
}