/* ============================================
   NAAD LEARNING PLATFORM — shadcn/ui Design System
   Gold + Matte Black | World-Class Aesthetic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============ DESIGN TOKENS (shadcn/ui pattern) ============ */
:root {
  /* Background layers */
  --background: #09090b;
  --foreground: #fafaf9;
  --card: #111113;
  --card-foreground: #fafaf9;
  --popover: #111113;
  --popover-foreground: #fafaf9;
  --muted: #1c1c1f;
  --muted-foreground: #8a8578;
  --accent-bg: rgba(212, 167, 69, 0.08);

  /* Gold accent system */
  --primary: #d4a745;
  --primary-light: #f0d078;
  --primary-dark: #b8920a;
  --primary-foreground: #09090b;
  --primary-rgb: 212, 167, 69;
  --accent: #5a9fd4;
  --accent-rgb: 90, 159, 212;

  /* Secondary */
  --secondary: #1c1c1f;
  --secondary-foreground: #fafaf9;

  /* Semantic */
  --destructive: #dc4545;
  --destructive-foreground: #fafaf9;
  --success: #4ead6b;
  --success-foreground: #09090b;
  --warning: #f59e0b;

  /* Borders & Inputs */
  --border: #1f1e22;
  --input: #1f1e22;
  --ring: rgba(212, 167, 69, 0.35);
  --card-bg: var(--card);
  --border-color: var(--border);
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius (shadcn defaults) */
  --radius: 0.75rem;

  /* Sidebar specific */
  --sidebar-bg: #0c0c0e;
  --sidebar-border: #1a1a1d;
  --sidebar-ring: rgba(212, 167, 69, 0.2);

  /* Chart colors */
  --chart-1: #d4a745;
  --chart-2: #4ead6b;
  --chart-3: #5a9fd4;
  --chart-4: #d45a7a;
  --chart-5: #a87cd4;
}

[data-theme="light"] {
  --background: #fafaf8;
  --foreground: #0c0a09;
  --card: #ffffff;
  --card-foreground: #0c0a09;
  --popover: #ffffff;
  --popover-foreground: #0c0a09;
  --muted: #f3f1ec;
  --muted-foreground: #6b6456;
  --accent-bg: rgba(184, 134, 11, 0.06);

  --primary: #b8860b;
  --primary-light: #d4a745;
  --primary-dark: #8b6508;
  --primary-foreground: #fafaf9;
  --primary-rgb: 184, 134, 11;
  --accent: #4f8fbe;
  --accent-rgb: 79, 143, 190;

  --secondary: #f3f1ec;
  --secondary-foreground: #0c0a09;

  --border: #e7e4dd;
  --input: #e7e4dd;
  --ring: rgba(184, 134, 11, 0.25);
  --warning: #d97706;
  --card-bg: var(--card);
  --border-color: var(--border);
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-bg: #f5f3ee;
  --sidebar-border: #e7e4dd;
  --sidebar-ring: rgba(184, 134, 11, 0.15);
}

/* ============ RESET ============ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* ============ LAYOUT ============ */
.app {
  display: flex;
  height: 100vh;
}

/* ============ SIDEBAR (shadcn sidebar pattern) ============ */
.sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-header:hover,
.sidebar-header:focus-visible {
  background: rgba(var(--primary-rgb), 0.05);
}

.sidebar-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  filter: drop-shadow(0 0 8px rgba(212, 167, 69, 0.3));
  transition: filter 0.3s ease;
}

.sidebar-header h1:hover {
  filter: drop-shadow(0 0 12px rgba(212, 167, 69, 0.6));
}

.sidebar-header p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 2px;
  letter-spacing: 0;
}

/* Progress */
.progress-bar-container {
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-bottom: 8px;
  font-weight: 500;
}

.progress-bar {
  height: 6px;
  background: var(--muted);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
  transition: height 0.3s ease;
}

.progress-bar-container:hover .progress-bar {
  height: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-light));
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 100px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

.unit-group {
  margin-bottom: 2px;
}

.unit-header {
  padding: 8px 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: block;
  border-radius: calc(var(--radius) - 4px);
  transition: all 0.15s ease;
  user-select: none;
}

.unit-header-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  width: 100%;
}

.unit-title {
  min-width: 0;
  display: block;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  text-wrap: pretty;
}

.unit-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  margin-left: 18px;
}

.unit-focus {
  margin-left: 0;
  margin-top: 0;
  color: var(--muted-foreground);
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  text-transform: none;
  line-height: 1.45;
  flex: 1;
  min-width: 0;
  text-wrap: pretty;
}

.lane-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.lane-badge svg {
  flex-shrink: 0;
}

.lane-core {
  color: var(--primary);
  background: rgba(212, 167, 69, 0.1);
  border: 1px solid rgba(212, 167, 69, 0.22);
}

.lane-operator {
  color: #6cc4ff;
  background: rgba(90, 159, 212, 0.12);
  border: 1px solid rgba(90, 159, 212, 0.24);
}

.lane-advanced {
  color: #d45a7a;
  background: rgba(212, 90, 122, 0.12);
  border: 1px solid rgba(212, 90, 122, 0.24);
}

.sidebar-lane {
  margin-left: 0;
  flex-shrink: 0;
}

.unit-header:hover {
  background: var(--muted);
  color: var(--foreground);
}

.unit-header .unit-arrow {
  font-size: 0.5rem;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.unit-header.collapsed .unit-arrow {
  transform: rotate(-90deg);
}

.unit-chapters {
  overflow: hidden;
}

.unit-header.collapsed+.unit-chapters {
  display: none;
}

.chapter-item {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 12px;
  margin: 1px 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  font-weight: 450;
  line-height: 1.4;
}

.chapter-item:hover {
  background: var(--muted);
  color: var(--foreground);
}

.chapter-item.active {
  background: var(--accent-bg);
  color: var(--primary);
  font-weight: 550;
}

.chapter-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 100px;
  box-shadow: 0 0 10px var(--primary);
  animation: pulse-border 2s infinite ease-in-out;
}

@keyframes pulse-border {
  0% {
    opacity: 0.5;
    height: 40%;
    top: 30%;
  }

  50% {
    opacity: 1;
    height: 70%;
    top: 15%;
  }

  100% {
    opacity: 0.5;
    height: 40%;
    top: 30%;
  }
}

.chapter-item.active {
  background: var(--accent-bg);
  color: var(--primary);
  font-weight: 550;
  animation: subtle-breath 3s infinite ease-in-out;
}

@keyframes subtle-breath {
  0% {
    background: var(--accent-bg);
  }

  50% {
    background: rgba(212, 167, 69, 0.15);
  }

  100% {
    background: var(--accent-bg);
  }
}

.chapter-item.completed {
  color: var(--foreground);
}

.chapter-item.completed .ch-icon {
  color: var(--success);
}

.chapter-item.completed .chapter-code {
  color: var(--foreground);
}

.chapter-item.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.chapter-item.locked:hover {
  background: transparent;
  color: var(--muted-foreground);
}

.chapter-item.active .chapter-code {
  color: var(--primary);
}

.ch-icon {
  font-size: 0.8rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.chapter-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
  white-space: nowrap;
  margin-top: 2px;
}

.sidebar-chapter-title {
  min-width: 0;
  display: block;
  color: inherit;
  text-wrap: pretty;
}

/* ============ MAIN CONTENT ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
}

/* Topbar (shadcn header pattern) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(12, 12, 14, 0.8);
  backdrop-filter: blur(16px) saturate(200%);
  -webkit-backdrop-filter: blur(16px) saturate(200%);
  height: 56px;
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(212, 167, 69, 0.2);
  box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(184, 134, 11, 0.15);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--foreground);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: calc(var(--radius) - 4px);
  transition: background 0.15s;
}

.menu-btn:hover {
  background: var(--muted);
}

.breadcrumb {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-weight: 450;
  cursor: pointer;
  transition: color 0.15s ease;
}

.breadcrumb:hover,
.breadcrumb:focus-visible {
  color: var(--foreground);
  outline: none;
}

.breadcrumb span {
  color: var(--foreground);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-nav-btn[hidden] {
  display: none !important;
}

/* shadcn ghost button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  padding: 6px 14px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--primary);
}

.sync-account-btn {
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  min-width: 210px;
}

.sync-account-btn.is-authenticated {
  border-color: rgba(78, 173, 107, 0.26);
  background: rgba(78, 173, 107, 0.08);
}

.sync-account-btn.is-saving {
  border-color: rgba(212, 167, 69, 0.34);
  background: rgba(212, 167, 69, 0.08);
}

.sync-account-btn.is-error {
  border-color: rgba(220, 69, 69, 0.28);
  background: rgba(220, 69, 69, 0.08);
}

.sync-account-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.2;
}

#syncAccountText {
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 700;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#syncAccountMeta {
  color: var(--muted-foreground);
  font-size: 0.67rem;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ask AI Button (Phase 4) */
.btn-ask-ai {
  background: rgba(212, 167, 169, 0.05);
  border: 1px solid rgba(212, 167, 69, 0.3);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(212, 167, 69, 0.1);
}

.btn-ask-ai:hover {
  background: var(--accent-bg);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(212, 167, 69, 0.25);
}

.btn-ask-ai i {
  color: var(--primary);
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 48px 40px;
  animation: contentFadeIn 0.5s ease;
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-area::-webkit-scrollbar {
  width: 5px;
}

.content-area::-webkit-scrollbar-track {
  background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 100px;
}

.content-area::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

body.auth-gated {
  overflow: hidden;
}

body.auth-gated .sidebar,
body.auth-gated .sidebar-overlay,
body.auth-gated .topbar,
body.auth-gated #aiChatWidget {
  display: none !important;
}

body.auth-gated .content-area {
  padding: 0;
  animation: none;
}

.auth-gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(circle at top left, rgba(212, 167, 69, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(78, 173, 107, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
}

.auth-gate-card {
  width: min(100%, 520px);
  padding: 30px;
  border-radius: 28px;
  border: 1px solid rgba(212, 167, 69, 0.16);
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.12), transparent 42%),
    rgba(17, 17, 19, 0.96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .auth-gate-card {
  background:
    radial-gradient(circle at top right, rgba(184, 134, 11, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
}

.auth-gate-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-gate-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-gate-brand h1 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.auth-gate-brand p,
.auth-gate-copy {
  color: var(--muted-foreground);
  line-height: 1.7;
  margin: 0;
}

.auth-gate-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.auth-gate-title {
  margin: 0 0 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.auth-gate-submit {
  width: 100%;
  justify-content: center;
  min-height: 48px;
}

/* ============ CHAPTER CONTENT (shadcn prose) ============ */
.chapter-content {
  max-width: 720px;
  margin: 0 auto;
}

.chapter-shell {
  max-width: 1080px;
  margin: 0 auto;
}

.chapter-shell .chapter-header-actions {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.chapter-head-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.chapter-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212, 167, 69, 0.18);
  background: rgba(212, 167, 69, 0.08);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chapter-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  color: var(--foreground);
}

.chapter-summary {
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted-foreground);
}

.chapter-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0 28px;
}

.chapter-meta-card,
.workspace-card {
  background:
    radial-gradient(circle at top left, rgba(212, 167, 69, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
}

[data-theme="light"] .chapter-meta-card,
[data-theme="light"] .workspace-card {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.chapter-meta-label,
.workspace-eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chapter-meta-value {
  display: block;
  color: var(--foreground);
  font-size: 0.95rem;
  line-height: 1.55;
}

.chapter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.chapter-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chapter-tab:hover {
  border-color: rgba(212, 167, 69, 0.32);
  color: var(--foreground);
  transform: translateY(-1px);
}

.chapter-tab.active {
  background: linear-gradient(135deg, rgba(212, 167, 69, 0.2), rgba(212, 167, 69, 0.08));
  border-color: rgba(212, 167, 69, 0.4);
  color: var(--foreground);
}

.chapter-panel {
  display: none;
}

.chapter-panel.active {
  display: block;
}

.practice-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.practice-status-card,
.practice-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.practice-status-top,
.practice-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.practice-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.practice-status-metric {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 167, 69, 0.16);
  background: rgba(255, 255, 255, 0.02);
}

.practice-mini-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-mini-chip,
.practice-section-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border);
}

.practice-mini-chip.is-complete,
.practice-section-status.is-complete {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.practice-mini-chip.is-pending,
.practice-section-status.is-next {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-foreground);
}

[data-theme="light"] .practice-status-metric {
  background: rgba(248, 250, 252, 0.9);
}

[data-theme="light"] .practice-mini-chip.is-complete,
[data-theme="light"] .practice-section-status.is-complete {
  color: #166534;
}

.practice-item-list {
  display: grid;
  gap: 14px;
}

.practice-item {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
}

.practice-item h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.5;
}

.practice-item p:last-child {
  margin-bottom: 0;
}

.practice-item-index {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.practice-item-subtle {
  color: var(--muted-foreground);
}

.practice-action-row,
.practice-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.practice-reveal,
.practice-feedback,
.practice-readiness-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(212, 167, 69, 0.18);
  background: rgba(212, 167, 69, 0.08);
}

.practice-feedback p,
.practice-reveal p,
.practice-readiness-note p {
  margin: 8px 0 0;
}

.practice-feedback.is-correct {
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.12);
}

.practice-feedback.is-incorrect,
.practice-feedback.is-warning {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.1);
}

.practice-option-list {
  display: grid;
  gap: 10px;
}

.practice-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.practice-option input {
  margin-top: 3px;
}

.practice-apply-section .workspace-panel {
  gap: 18px;
}

.chapter-guide {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.chapter-guide-hero {
  position: relative;
  overflow: hidden;
}

.chapter-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.chapter-guide-card {
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  min-height: 100%;
}

[data-theme="light"] .chapter-guide-card {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
}

.chapter-guide-label {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.chapter-guide-copy {
  margin: 0;
  color: var(--foreground);
  font-size: 0.95rem;
  line-height: 1.72;
}

.learn-hero,
.learn-recap-hero {
  position: relative;
  overflow: hidden;
}

.learn-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.learn-hero-chip {
  border: 1px solid rgba(212, 167, 69, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.learn-hero-label {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.learn-hero-chip strong {
  color: var(--foreground);
  line-height: 1.55;
}

.learn-body {
  margin: 22px 0 24px;
}

.learn-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.learn-main {
  margin: 0;
}

.learn-main > :first-child {
  margin-top: 0;
}

.learn-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 94px;
}

.learn-rail-card {
  color: var(--muted-foreground);
}

.learn-rail-title {
  margin: 0 0 8px;
  color: var(--foreground);
  font-size: 1.05rem;
}

.learn-rail-copy {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.learn-term-list,
.learn-rail-paths {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.learn-term-mini {
  padding: 14px 0 0;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
}

.learn-term-mini:first-child {
  padding-top: 0;
  border-top: 0;
}

.learn-term-mini-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.learn-term-mini-head h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 0.96rem;
}

.learn-term-mini p {
  margin: 0;
  line-height: 1.68;
}

.learn-term-mini-meta {
  margin-top: 8px !important;
  color: var(--muted-foreground);
}

.learn-rail-path {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.08), transparent 40%),
    rgba(255, 255, 255, 0.02);
}

.learn-rail-reassurance {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
  color: var(--foreground) !important;
}

.learn-recap {
  margin-top: 8px;
}

.beginner-guide {
  margin-bottom: 24px;
}

.beginner-guide-hero {
  border-color: rgba(212, 167, 69, 0.32);
}

.beginner-guide-section {
  margin-bottom: 0;
}

.beginner-term-grid,
.beginner-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.beginner-term-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
}

[data-theme="light"] .beginner-term-card {
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
}

.beginner-term-head,
.beginner-walkthrough-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.beginner-term-head h3,
.beginner-walkthrough-head h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.4;
}

.beginner-term-link {
  border: 1px solid rgba(212, 167, 69, 0.28);
  background: var(--accent-bg);
  color: var(--foreground);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.beginner-term-link:hover {
  border-color: rgba(212, 167, 69, 0.5);
  color: var(--primary);
}

.beginner-term-plain {
  margin: 0 0 12px;
  color: var(--foreground);
  line-height: 1.7;
}

.beginner-term-meta {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.beginner-term-meta p {
  margin: 6px 0 0;
}

.beginner-term-label,
.glossary-meta-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(212, 167, 69, 0.1);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.beginner-walkthrough-card {
  min-height: 100%;
}

.beginner-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #101418;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.beginner-step-list {
  margin-bottom: 16px;
}

.beginner-walkthrough-result {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 167, 69, 0.2);
  background: rgba(212, 167, 69, 0.08);
  color: var(--foreground) !important;
}

.beginner-reassurance-card {
  border-style: dashed;
}

.beginner-reassurance-card p {
  color: var(--foreground);
}

.chapter-guide-code .workspace-title {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.chapter-guide-visual .premium-diagram {
  margin: 0;
}

.chapter-guide-diagram .diagram-node {
  min-width: 210px;
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.workspace-card {
  color: var(--muted-foreground);
}

.workspace-card p {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.workspace-card-accent {
  border-color: rgba(212, 167, 69, 0.28);
}

.workspace-title {
  margin: 0 0 10px;
  color: var(--foreground);
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.workspace-list,
.workspace-checklist,
.workspace-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted-foreground);
  display: grid;
  gap: 10px;
}

.workspace-list li,
.workspace-checklist li,
.workspace-steps li {
  line-height: 1.65;
}

.workspace-checklist li::marker {
  color: var(--success);
}

.workspace-steps li::marker {
  color: var(--primary);
  font-weight: 700;
}

.workspace-callout {
  color: var(--foreground);
}

.workspace-callout strong {
  color: var(--primary);
}

.workspace-hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(212, 167, 69, 0.16);
  background: rgba(212, 167, 69, 0.07);
  color: var(--foreground);
}

.prompt-card {
  overflow: hidden;
}

.prompt-block {
  margin: 0;
  background: rgba(9, 9, 11, 0.9);
  border: 1px solid rgba(212, 167, 69, 0.14);
  border-radius: 16px;
  padding: 18px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--foreground);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
}

[data-theme="light"] .prompt-block {
  background: rgba(248, 248, 245, 0.95);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  margin-bottom: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-chip.is-pass {
  background: rgba(78, 173, 107, 0.12);
  border: 1px solid rgba(78, 173, 107, 0.28);
  color: var(--success);
}

.status-chip.is-live {
  background: rgba(212, 167, 69, 0.12);
  border: 1px solid rgba(212, 167, 69, 0.28);
  color: var(--primary);
}

.status-chip.is-soon {
  background: rgba(90, 159, 212, 0.12);
  border: 1px solid rgba(90, 159, 212, 0.28);
  color: #5a9fd4;
}

.verify-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.chapter-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  line-height: 1.15;
  color: var(--foreground);
}

.chapter-content .subtitle {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  margin-bottom: 40px;
  font-weight: 450;
  line-height: 1.5;
}

.chapter-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 48px 0 16px;
  letter-spacing: -0.02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.chapter-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.chapter-content p {
  margin-bottom: 16px;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.chapter-content strong {
  color: var(--foreground);
  font-weight: 600;
}

/* Blockquote (shadcn alert-like) */
.chapter-content blockquote {
  border-left: 3px solid var(--primary);
  background: var(--accent-bg);
  padding: 14px 18px;
  margin: 24px 0;
  border-radius: 0 calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0;
  font-style: italic;
  color: var(--foreground);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.chapter-content ul,
.chapter-content ol {
  margin: 12px 0 20px 20px;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.chapter-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ============ TABLES (shadcn table) ============ */
.chapter-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chapter-content th {
  background: var(--muted);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.chapter-content td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
  line-height: 1.5;
}

.chapter-content tr:last-child td {
  border-bottom: none;
}

.chapter-content tr:hover td {
  background: var(--accent-bg);
}

/* ============ CODE BLOCKS (shadcn code) ============ */
.chapter-content pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--foreground);
}

.chapter-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--muted);
  padding: 2px 6px;
  border-radius: calc(var(--radius) - 6px);
  font-size: 0.8125em;
  color: var(--primary);
}

.chapter-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

/* ============ CALLOUT (shadcn alert) ============ */
.callout {
  padding: 16px;
  border-radius: var(--radius);
  margin: 24px 0;
  font-size: 0.875rem;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.6;
}

.callout-title {
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout.important {
  background: rgba(90, 159, 212, 0.06);
  border-color: rgba(90, 159, 212, 0.2);
  color: var(--muted-foreground);
}

.callout.important .callout-title {
  color: #5a9fd4;
}

.callout.warning {
  background: rgba(212, 167, 69, 0.06);
  border-color: rgba(212, 167, 69, 0.2);
  color: var(--muted-foreground);
}

.callout.warning .callout-title {
  color: var(--primary);
}

.callout.danger {
  background: rgba(220, 69, 69, 0.06);
  border-color: rgba(220, 69, 69, 0.2);
  color: var(--muted-foreground);
}

.callout.danger .callout-title {
  color: var(--destructive);
}

.callout.tip {
  background: rgba(78, 173, 107, 0.06);
  border-color: rgba(78, 173, 107, 0.2);
  color: var(--muted-foreground);
}

.callout.tip .callout-title {
  color: var(--success);
}

/* ============ DIAGRAM ============ */
.premium-text-diagram {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 32px;
  margin: 32px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  color: var(--primary);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .premium-text-diagram {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.02), 0 8px 32px rgba(0, 0, 0, 0.05);
  color: var(--foreground);
}

.premium-diagram {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.diagram-node {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 24px;
  min-width: 260px;
  width: min(100%, 280px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 2;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.diagram-node[style*="min-width: 320px"],
.diagram-node[style*="min-width: 250px"] {
  min-width: min(220px, 100%) !important;
}

[data-theme="light"] .diagram-node {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.diagram-node:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.node-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-bg);
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border: 1px solid var(--ring);
}

.node-icon svg {
  width: 24px;
  height: 24px;
}

.node-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--foreground);
}

.node-desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}

.diagram-arrow {
  width: 2px;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--primary), transparent);
  position: relative;
  opacity: 0.6;
  flex-shrink: 0;
}

.diagram-arrow::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary);
}

.diagram-arrow.animated {
  background-size: 100% 200%;
  animation: flowDown 1.5s linear infinite;
}

.diagram-arrow[style*="height: 2px"] {
  background: linear-gradient(to right, transparent, var(--primary), transparent);
}

.diagram-arrow[style*="height: 2px"]::after {
  bottom: auto;
  left: auto;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 6px solid var(--primary);
  border-right: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

@keyframes flowDown {
  0% {
    background-position: 0% -100%;
  }

  100% {
    background-position: 0% 100%;
  }
}

.diagram-row {
  display: flex;
  gap: 32px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

.diagram-arrow-horizontal {
  height: 2px;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--primary), transparent);
  position: relative;
  opacity: 0.6;
  margin-top: 40px;
  flex-shrink: 0;
}

.diagram-arrow-horizontal::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid var(--primary);
}

.diagram-arrow-horizontal.reverse {
  transform: scaleX(-1);
}

.diagram-split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  width: 100%;
}

.diagram-center-divider {
  width: 1px;
  min-height: 180px;
  background: linear-gradient(to bottom, transparent, var(--border-color), transparent);
  opacity: 0.6;
  justify-self: center;
}

.diagram-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.diagram-stack-tight {
  gap: 10px;
}

.diagram-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  text-align: center;
}

.diagram-label-danger {
  color: var(--destructive);
}

.diagram-label-success {
  color: var(--success);
}

.diagram-caption {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.45;
  text-align: center;
}

.diagram-caption-success {
  color: var(--success);
  font-weight: 700;
}

.node-icon-primary {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.4);
  background: rgba(var(--primary-rgb), 0.1);
}

.node-icon-success {
  color: var(--success);
  border-color: rgba(78, 173, 107, 0.28);
  background: rgba(78, 173, 107, 0.1);
}

.node-icon-danger {
  color: var(--destructive);
  border-color: rgba(220, 69, 69, 0.28);
  background: rgba(220, 69, 69, 0.1);
}

.node-icon-accent {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.1);
}

.node-icon-muted {
  opacity: 0.55;
}

.diagram-inline-grid {
  display: grid;
  gap: 28px;
  align-items: start;
  width: 100%;
}

.diagram-inline-grid-three {
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) minmax(0, 1fr);
}

.diagram-inline-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diagram-link-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  min-width: 120px;
}

.diagram-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diagram-link-rule {
  flex: 1;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(to right, transparent, var(--border-color), transparent);
}

.diagram-link-row i {
  width: 14px;
  opacity: 0.65;
  color: var(--muted-foreground);
}

.diagram-node-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}

.diagram-node-primary {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

.diagram-node-success {
  border-color: var(--success);
  background: rgba(78, 173, 107, 0.05);
}

.diagram-node-accent {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.diagram-node-compact {
  min-width: min(180px, 100%);
  width: min(100%, 180px);
  padding: 14px 18px;
}

.diagram-sync-band {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.diagram-sync-band .diagram-arrow-horizontal,
.diagram-auth-steps .diagram-arrow-horizontal,
.diagram-branch-grid .diagram-arrow-horizontal {
  width: 96px;
  margin-top: 0;
}

.diagram-flow-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: stretch;
  width: 100%;
}

.diagram-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1 1 120px;
  max-width: 140px;
  text-align: center;
}

.diagram-flow-step .diagram-node {
  min-width: 0;
  width: 100%;
  padding: 14px 12px;
}

.diagram-step-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--foreground);
  text-transform: uppercase;
}

.diagram-step-desc {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}

.diagram-auth-flow {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.diagram-auth-steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.diagram-branch-grid {
  display: grid;
  grid-template-columns: auto 120px auto;
  gap: 22px 18px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.diagram-branch-spine {
  width: 2px;
  height: 74px;
  margin: 0 auto;
  border-radius: 999px;
  background: linear-gradient(to bottom, var(--border-color), var(--accent), transparent);
  opacity: 0.8;
}

.diagram-branch-line {
  position: relative;
  height: 2px;
  width: 120px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent), rgba(var(--accent-rgb), 0.25));
}

.diagram-branch-line::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid var(--accent);
}

.diagram-pie-grid {
  display: flex;
  justify-content: center;
  gap: 40px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.unit-definition {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0 28px;
}

.def-block {
  background:
    radial-gradient(circle at top left, rgba(212, 167, 69, 0.1), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .def-block {
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.def-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.def-text {
  color: var(--foreground);
  font-size: 0.95rem;
  line-height: 1.7;
}

.beginner-inline-primer .def-block:first-child {
  border-color: rgba(212, 167, 69, 0.3);
}


/* ============ EXAM SYSTEM (shadcn card pattern) ============ */
.exam-container {
  max-width: 720px;
  margin: 0 auto;
}

.exam-header {
  text-align: center;
  margin-bottom: 40px;
}

.exam-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.exam-header p {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.exam-rules {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.exam-rules strong {
  color: var(--primary);
}

/* Question Cards (shadcn card) */
.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-card:hover {
  border-color: rgba(212, 167, 69, 0.15);
}

.question-card.correct {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.question-card.incorrect {
  border-color: var(--destructive);
  box-shadow: 0 0 0 1px var(--destructive);
}

.question-number {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.feedback .fb-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-incorrect {
  color: var(--destructive);
}

.fb-correct {
  color: var(--success);
}

.fb-info {
  color: var(--info);
  margin-bottom: 12px;
}

.fb-response {
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.5;
}

.fb-model-reference {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.fb-reference-label {
  color: var(--muted-foreground);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 8px;
}

.fb-reference-text {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  line-height: 1.5;
  font-style: italic;
}

.fb-model-text {
  color: var(--muted-foreground);
  margin-top: 12px;
  line-height: 1.5;
}

/* Badges (shadcn badge) */
.question-type {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid;
}

.question-type.mc {
  background: rgba(90, 159, 212, 0.08);
  color: #5a9fd4;
  border-color: rgba(90, 159, 212, 0.2);
}

.question-type.scenario {
  background: rgba(212, 167, 69, 0.08);
  color: var(--primary);
  border-color: rgba(212, 167, 69, 0.2);
}

.question-type.reasoning {
  background: rgba(168, 124, 212, 0.08);
  color: #a87cd4;
  border-color: rgba(168, 124, 212, 0.2);
}

.question-text {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--foreground);
  line-height: 1.55;
}

/* Options (shadcn radio group card pattern) */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.option:hover {
  border-color: var(--primary);
  background: var(--accent-bg);
}

.option.selected {
  border-color: var(--primary);
  background: var(--accent-bg);
  color: var(--foreground);
  box-shadow: 0 0 0 1px var(--primary);
}

.option.correct-answer {
  border-color: var(--success);
  background: rgba(78, 173, 107, 0.06);
  box-shadow: 0 0 0 1px var(--success);
}

.option.wrong-answer {
  border-color: var(--destructive);
  background: rgba(220, 69, 69, 0.06);
  box-shadow: 0 0 0 1px var(--destructive);
}

.option.disabled {
  pointer-events: none;
}

.option-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.option.selected .option-letter {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.option.correct-answer .option-letter {
  background: var(--success);
  color: var(--success-foreground);
  border-color: var(--success);
}

.option.wrong-answer .option-letter {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

/* Textarea (shadcn textarea) */
.text-answer {
  width: 100%;
  min-height: 120px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  padding: 12px 14px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.15s ease;
}

.text-answer::placeholder {
  color: var(--muted-foreground);
}

.text-answer:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.text-answer:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Feedback (shadcn alert) */
.feedback {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem;
  line-height: 1.6;
  display: none;
}

.feedback.show {
  display: block;
}

.feedback.correct {
  background: rgba(78, 173, 107, 0.06);
  border: 1px solid rgba(78, 173, 107, 0.2);
  color: var(--success);
}

.feedback.incorrect {
  background: rgba(220, 69, 69, 0.06);
  border: 1px solid rgba(220, 69, 69, 0.2);
}

.feedback.incorrect .fb-text {
  color: var(--muted-foreground);
}

.feedback.model-answer {
  background: rgba(90, 159, 212, 0.06);
  border: 1px solid rgba(90, 159, 212, 0.2);
}

.feedback.ai-grading {
  background: rgba(168, 124, 212, 0.06);
  border: 1px solid rgba(168, 124, 212, 0.2);
  color: #a87cd4;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

.feedback .fb-label {
  font-weight: 600;
  margin-bottom: 4px;
}

/* ============ BUTTONS (shadcn button) ============ */
.exam-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: calc(var(--radius) - 2px);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(212, 167, 69, 0.25);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Ghost / Outline button */
.btn-secondary {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--muted);
  border-color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: var(--success-foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-success:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ============ SCORE (shadcn card) ============ */
.score-display {
  text-align: center;
  padding: 40px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 32px;
}

.score-number {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.score-number.pass {
  color: var(--success);
}

.score-number.fail {
  color: var(--destructive);
}

.score-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 24px;
}

/* ============ WELCOME SCREEN ============ */
.welcome {
  text-align: center;
  max-width: 480px;
  margin: 100px auto;
}

.welcome-shell {
  max-width: 1120px;
  margin: 56px auto 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
  text-align: left;
}

.home-shell {
  max-width: 1120px;
  margin: 36px auto 48px;
}

.home-tabs-shell,
.dashboard-card,
.mentor-routing-panel,
.mentor-rec-card,
.mentor-learn-card {
  background:
    radial-gradient(circle at top left, rgba(212, 167, 69, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
}

[data-theme="light"] .home-tabs-shell,
[data-theme="light"] .dashboard-card,
[data-theme="light"] .mentor-routing-panel,
[data-theme="light"] .mentor-rec-card,
[data-theme="light"] .mentor-learn-card {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.home-tabs-shell {
  padding: 12px;
  margin-bottom: 24px;
}

.home-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-tab {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.home-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 167, 69, 0.3);
  color: var(--foreground);
}

.home-tab.active {
  color: var(--foreground);
  background: rgba(212, 167, 69, 0.12);
  border-color: rgba(212, 167, 69, 0.35);
}

.home-panel.is-dashboard {
  display: grid;
  gap: 28px;
}

.dashboard-shell,
.dashboard-section {
  display: grid;
  gap: 22px;
}

.dashboard-section-head h2 {
  margin: 0 0 8px;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.55rem, 2.4vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--foreground);
}

.dashboard-section-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.dashboard-card {
  padding: 22px;
}

.dashboard-card-accent {
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 100%);
}

.dashboard-card-top,
.mentor-routing-head,
.mentor-rec-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-kicker,
.dashboard-mini-label,
.mentor-learn-head {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dashboard-card h2,
.dashboard-card h3,
.dashboard-mentor-card h3,
.mentor-learn-card h4 {
  margin: 6px 0 0;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.03em;
  color: var(--foreground);
}

.dashboard-stage-summary,
.dashboard-stage-block p,
.mentor-routing-head span,
.mentor-routing-note,
.mentor-rec-card p,
.mentor-learn-card p {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.dashboard-current-grid,
.dashboard-stage-grid,
.dashboard-router-grid,
.dashboard-prompt-list,
.mentor-rec-grid,
.mentor-learn-grid {
  display: grid;
  gap: 16px;
}

.dashboard-current-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 18px;
}

.dashboard-stage-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.dashboard-router-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.dashboard-prompt-list,
.mentor-learn-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.mentor-rec-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 14px;
}

.dashboard-info-tile {
  border: 1px solid rgba(212, 167, 69, 0.18);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.dashboard-info-label {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.dashboard-info-tile strong {
  color: var(--foreground);
  line-height: 1.55;
}

.dashboard-stage-status,
.coverage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid rgba(212, 167, 69, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--foreground);
  white-space: nowrap;
}

.dashboard-stage-status.is-done {
  border-color: rgba(78, 173, 107, 0.28);
  background: rgba(78, 173, 107, 0.12);
  color: var(--success);
}

.dashboard-stage-status.is-current {
  border-color: rgba(212, 167, 69, 0.32);
  background: rgba(212, 167, 69, 0.12);
  color: var(--primary);
}

.dashboard-stage-status.is-later {
  color: var(--muted-foreground);
}

.coverage-pill.is-full_solution {
  border-color: rgba(78, 173, 107, 0.28);
  background: rgba(78, 173, 107, 0.12);
  color: var(--success);
}

.coverage-pill.is-implementation_start {
  border-color: rgba(212, 167, 69, 0.32);
  background: rgba(212, 167, 69, 0.12);
  color: var(--primary);
}

.coverage-pill.is-mental_model {
  border-color: rgba(126, 141, 166, 0.3);
  background: rgba(126, 141, 166, 0.12);
  color: var(--foreground);
}

.coverage-pill.is-partial {
  border-color: rgba(235, 87, 87, 0.26);
  background: rgba(235, 87, 87, 0.12);
  color: #ff9b9b;
}

.dashboard-stage-progress {
  margin-top: 14px;
  color: var(--foreground);
  font-size: 0.86rem;
  font-weight: 700;
}

.dashboard-stage-block {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.dashboard-step-list,
.mentor-learn-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.dashboard-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.dashboard-chapter-list,
.dashboard-topic-list {
  display: grid;
  gap: 10px;
}

.dashboard-chapter-row,
.dashboard-topic-chapter {
  border: 1px solid rgba(212, 167, 69, 0.14);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.dashboard-chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-chapter-link,
.dashboard-topic-link,
.mentor-rec-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-chapter-link:hover,
.dashboard-topic-link:hover,
.mentor-rec-link:hover {
  color: var(--primary);
}

.dashboard-chapter-copy p,
.mentor-rec-meta {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  line-height: 1.65;
}

.dashboard-prompt-card {
  border: 1px solid rgba(212, 167, 69, 0.14);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.dashboard-prompt-block {
  margin: 10px 0 14px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(10, 10, 12, 0.72);
  color: var(--foreground);
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}

[data-theme="light"] .dashboard-prompt-block {
  background: rgba(248, 246, 240, 0.95);
}

.mentor-routing-panel {
  margin-top: 14px;
  padding: 16px;
  border-radius: 20px;
  width: 100%;
  max-width: 100%;
}

.mentor-routing-head strong {
  color: var(--foreground);
}

.mentor-routing-head span {
  font-size: 0.88rem;
}

.mentor-routing-note {
  margin-top: 10px;
  font-size: 0.88rem;
}

.mentor-rec-card,
.mentor-learn-card {
  padding: 16px;
  border-radius: 20px;
}

.mentor-rec-meta {
  margin-top: 10px;
  font-size: 0.84rem;
}

.mentor-learn-next {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.welcome-hero,
.guide-card,
.roadmap-card,
.roadmap-list-card {
  background:
    radial-gradient(circle at top left, rgba(212, 167, 69, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
}

[data-theme="light"] .welcome-hero,
[data-theme="light"] .guide-card,
[data-theme="light"] .roadmap-card,
[data-theme="light"] .roadmap-list-card {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.welcome-hero {
  padding: 32px;
}

.welcome-emoji {
  font-size: 3rem;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(212, 167, 69, 0.2));
}

.welcome h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}

.welcome p {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  margin-bottom: 28px;
  line-height: 1.6;
}

.welcome-shell .welcome-emoji {
  margin-bottom: 16px;
}

.welcome-shell .welcome-completed,
.welcome-shell .welcome-done {
  justify-content: flex-start;
}

.welcome-shell .btn + .btn {
  margin-left: 10px;
}

.welcome-resume-card {
  margin: 26px 0 22px;
  padding: 20px;
  border: 1px solid rgba(212, 167, 69, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.02);
}

.welcome-resume-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.welcome-kicker {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-resume-card h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.welcome-resume-copy {
  margin-bottom: 16px;
}

.progress-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 16px;
}

.progress-sync-banner.is-connected {
  border-color: rgba(78, 173, 107, 0.26);
  background:
    radial-gradient(circle at top left, rgba(78, 173, 107, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.02);
}

.progress-sync-banner.is-local {
  border-color: rgba(212, 167, 69, 0.22);
}

.progress-sync-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.progress-sync-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-sync-copy strong {
  color: var(--foreground);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.progress-sync-copy p {
  color: var(--muted-foreground);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0;
}

.welcome-lane-badge {
  flex-shrink: 0;
}

.welcome-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.welcome-stat-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.welcome-stat-label {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.welcome-stat-value {
  display: block;
  color: var(--foreground);
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.welcome-stat-meta {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  line-height: 1.55;
  margin-top: 8px;
}

.welcome-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.welcome-action-row .btn + .btn {
  margin-left: 0;
}

.welcome-guides {
  display: grid;
  gap: 16px;
}

.guide-card {
  padding: 20px;
}

.guide-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 167, 69, 0.1);
  color: var(--primary);
  border: 1px solid rgba(212, 167, 69, 0.2);
  margin-bottom: 14px;
}

.guide-card h3 {
  margin: 0 0 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  color: var(--foreground);
}

.guide-card p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.92rem;
  line-height: 1.7;
}

.roadmap-section {
  max-width: 1120px;
  margin: 0 auto 72px;
}

.roadmap-heading {
  margin-bottom: 22px;
}

.roadmap-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 14px;
  color: var(--primary);
  background: rgba(212, 167, 69, 0.08);
  border: 1px solid rgba(212, 167, 69, 0.18);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.roadmap-heading h2 {
  margin: 0 0 10px;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--foreground);
}

.roadmap-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.98rem;
  line-height: 1.7;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.roadmap-card {
  padding: 20px;
}

.roadmap-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.roadmap-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 167, 69, 0.1);
  color: var(--primary);
  border: 1px solid rgba(212, 167, 69, 0.2);
  flex-shrink: 0;
}

.roadmap-head-copy {
  flex: 1;
  min-width: 0;
}

.roadmap-overline {
  margin-bottom: 4px;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.roadmap-head-copy h3 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1.18rem;
  line-height: 1.25;
  color: var(--foreground);
}

.roadmap-summary {
  margin: 0 0 16px;
  color: var(--muted-foreground);
  font-size: 0.92rem;
  line-height: 1.7;
}

.roadmap-lists {
  display: grid;
  gap: 12px;
}

.roadmap-list-card {
  padding: 14px;
}

.roadmap-list-title {
  margin-bottom: 10px;
  color: var(--foreground);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roadmap-unit-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted-foreground);
  font-size: 0.88rem;
  line-height: 1.55;
}

.roadmap-unit-list.is-current li::marker {
  color: var(--success);
}

.roadmap-unit-list.is-planned li::marker {
  color: var(--primary);
}

.roadmap-empty {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.88rem;
}

.roadmap-outcome {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.roadmap-outcome-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roadmap-outcome p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* ============ CHAPTER NAV ============ */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

/* ============ LOCKED OVERLAY ============ */
.locked-overlay {
  text-align: center;
  padding: 80px 20px;
}

.locked-overlay .lock-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.locked-overlay h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  font-weight: 700;
}

.locked-overlay p {
  color: var(--muted-foreground);
  max-width: 400px;
  margin: 0 auto;
  font-size: 0.9375rem;
}

/* ============ MOBILE ============ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* ============ STUDY CENTER ============ */
.notification-toggle-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--destructive);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

body.study-drawer-open {
  overflow: hidden;
}

.study-drawer-shell {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1200;
}

.study-drawer-shell.is-open {
  display: block;
}

.study-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 18, 0.54);
  backdrop-filter: blur(4px);
}

.study-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(540px, 100%);
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s ease;
}

.study-drawer-shell.is-open .study-drawer {
  transform: translateX(0);
}

.study-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.study-drawer-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(212, 167, 69, 0.12);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.study-drawer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 0;
}

.study-chip,
.study-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--muted);
  color: var(--foreground);
  padding: 10px 14px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.study-chip {
  cursor: pointer;
}

.study-toggle input {
  margin: 0;
}

.study-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.study-panel {
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.02);
  padding: 18px;
}

.study-panel-accent {
  border-color: rgba(212, 167, 69, 0.28);
}

.study-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.study-panel-head h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 1.02rem;
}

.study-panel-meta {
  color: var(--muted-foreground);
  font-size: 0.78rem;
  font-weight: 700;
}

.study-list,
.study-history-list,
.study-coach-content,
.study-related-list,
.study-step-list,
.study-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.study-reminder-card,
.study-history-card,
.study-empty-card,
.study-related-card,
.study-step-card,
.study-schedule-card,
.study-stat-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
}

.study-reminder-card.is-due,
.study-schedule-card.is-due {
  border-color: rgba(212, 167, 69, 0.38);
}

.study-reminder-card.is-overdue,
.study-schedule-card.is-overdue {
  border-color: rgba(220, 69, 69, 0.36);
}

.study-reminder-card.is-snoozed,
.study-schedule-card.is-snoozed {
  border-color: rgba(96, 165, 250, 0.34);
}

.study-reminder-top,
.study-history-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.study-reminder-top strong,
.study-history-top strong,
.study-related-card strong,
.study-step-card strong,
.study-schedule-card strong,
.study-stat-card strong {
  color: var(--foreground);
}

.study-reminder-top span,
.study-history-top span,
.study-schedule-card span,
.study-stat-card span {
  color: var(--muted-foreground);
}

.study-reminder-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
}

.study-reminder-card p,
.study-history-card p,
.study-related-card p,
.study-summary-copy,
.study-rich-copy {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.65;
}

.study-reminder-meta {
  margin-top: 10px !important;
}

.study-reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.78rem;
}

.study-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.study-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.study-summary-copy {
  margin-top: 14px;
}

.study-rich-copy {
  white-space: normal;
}

.study-welcome-card {
  margin-bottom: 22px;
}

.btn-study-coach {
  margin-left: 8px;
}

@media (max-width: 768px) {
  .study-drawer {
    width: 100%;
  }

  .study-drawer-head,
  .study-drawer-toolbar,
  .study-drawer-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .study-stat-grid {
    grid-template-columns: 1fr;
  }

  .study-panel-head,
  .study-reminder-top,
  .study-history-top {
    flex-direction: column;
  }

  .topbar-right .notification-toggle,
  .topbar-right #studyCoachBtn {
    flex: 1 1 auto;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: min(92vw, 340px);
    min-width: min(92vw, 340px);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open~.sidebar-overlay {
    display: block;
  }

  .menu-btn {
    display: flex;
  }

  .content-area {
    padding: 24px 16px;
  }

  .auth-gate-shell {
    padding: 20px 14px;
  }

  .auth-gate-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .chapter-title {
    font-size: 1.75rem;
  }

  .chapter-shell .chapter-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chapter-tabs {
    gap: 8px;
  }

  .chapter-tab {
    width: 100%;
    justify-content: center;
  }

  .practice-status-top,
  .practice-section-head,
  .practice-action-row,
  .practice-section-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .practice-status-grid,
  .practice-item-list,
  .practice-option-list {
    grid-template-columns: 1fr;
  }

  .chapter-guide-grid {
    grid-template-columns: 1fr;
  }

  .learn-hero-grid,
  .learn-layout {
    grid-template-columns: 1fr;
  }

  .learn-rail {
    position: static;
    top: auto;
  }

  .beginner-term-grid,
  .beginner-flow-grid,
  .glossary-card-grid {
    grid-template-columns: 1fr;
  }

  .beginner-term-head,
  .beginner-walkthrough-head,
  .glossary-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .glossary-modal-content {
    width: 94%;
    max-height: 92vh;
    padding: 22px 18px;
  }

  .chapter-guide-diagram .diagram-arrow-horizontal {
    display: none;
  }

  .premium-diagram {
    padding: 24px 16px;
  }

  .diagram-row {
    gap: 16px;
  }

  .diagram-split-view,
  .diagram-inline-grid-two,
  .diagram-inline-grid-three,
  .diagram-branch-grid {
    grid-template-columns: 1fr;
  }

  .diagram-center-divider,
  .diagram-link-column,
  .diagram-branch-spine,
  .diagram-branch-line,
  .diagram-flow-grid .diagram-arrow-horizontal {
    display: none;
  }

  .diagram-node-column,
  .diagram-flow-step {
    max-width: none;
    width: 100%;
  }

  .diagram-auth-flow {
    gap: 18px;
  }

  .diagram-sync-band .diagram-arrow-horizontal,
  .diagram-auth-steps .diagram-arrow-horizontal,
  .diagram-branch-grid .diagram-arrow-horizontal {
    width: 72px;
  }

  .diagram-pie-grid {
    gap: 24px;
  }

  .topbar {
    padding: 10px 16px;
    min-height: auto;
    height: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-left,
  .topbar-right {
    width: 100%;
  }

  .topbar-right {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .topbar-right .theme-toggle {
    justify-content: center;
    min-width: 0;
  }

  .sync-account-btn {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .sync-account-copy {
    align-items: flex-start;
  }

  .glossary-chip-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .welcome {
    margin: 60px auto;
  }

  .welcome-shell {
    grid-template-columns: 1fr;
    margin-top: 32px;
  }

  .home-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-tab {
    justify-content: center;
  }

  .ai-chat-widget {
    right: 16px;
    bottom: 16px;
  }

  .ai-chat-window {
    width: min(100vw - 32px, 380px);
    max-height: calc(100vh - 150px);
  }

  .welcome-hero {
    padding: 24px;
  }

  .welcome-resume-top {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-sync-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .welcome-stats-grid {
    grid-template-columns: 1fr;
  }

  .welcome-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .welcome-action-row .btn {
    width: 100%;
  }

  .dashboard-current-grid,
  .dashboard-stage-grid,
  .dashboard-router-grid,
  .dashboard-prompt-list,
  .mentor-rec-grid,
  .mentor-learn-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card-top,
  .dashboard-chapter-head,
  .mentor-routing-head,
  .mentor-rec-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-action-row .btn {
    width: 100%;
  }

  .roadmap-section {
    margin-bottom: 48px;
  }

  .roadmap-card-top {
    flex-wrap: wrap;
  }
}

/* ============ FOCUS RING (shadcn accessibility) ============ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 4px);
}

.btn-pulse {
  animation: pulse-gold 2s infinite;
  box-shadow: 0 0 0 0 rgba(212, 167, 69, 0.7);
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 167, 69, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(212, 167, 69, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(212, 167, 69, 0);
  }
}

/* ============ SELECTION ============ */
::selection {
  background: rgba(212, 167, 69, 0.25);
  color: var(--foreground);
}

/* ============ AI MENTOR CHAT WIDGET ============ */
.ai-chat-widget {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

.ai-chat-head {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-head:hover {
  transform: scale(1.08) translateY(-4px);
  background: var(--primary-light);
  box-shadow: 0 8px 24px rgba(212, 167, 69, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.ai-chat-head:active {
  transform: scale(0.95);
}

[data-theme="light"] .ai-chat-head {
  box-shadow: 0 10px 28px rgba(184, 134, 11, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

.ai-chat-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.ai-chat-window {
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.12), transparent 42%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: chatPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

[data-theme="light"] .ai-chat-window {
  background:
    radial-gradient(circle at top right, rgba(184, 134, 11, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
}

@keyframes chatPopIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ai-chat-header {
  padding: 16px 20px;
  background: rgba(12, 12, 14, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.ai-chat-close {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  line-height: 1;
  padding: 6px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.ai-chat-close:hover {
  color: var(--foreground);
  background: var(--muted);
  border-color: rgba(212, 167, 69, 0.22);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 120px),
    var(--background);
}

[data-theme="light"] .ai-chat-messages {
  background:
    linear-gradient(180deg, rgba(184, 134, 11, 0.05), transparent 140px),
    #fafaf8;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 100px;
}

.ai-message {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message.user {
  align-self: flex-end;
}

.ai-message.assistant {
  align-self: flex-start;
}

.ai-message .message-content {
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
  border: 1px solid transparent;
}

.ai-message.user .message-content {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
  box-shadow: 0 10px 24px rgba(212, 167, 69, 0.18);
}

.ai-message.assistant .message-content {
  background: var(--muted);
  color: var(--foreground);
  border-radius: 12px 12px 12px 2px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 100%;
}

[data-theme="light"] .ai-message.assistant .message-content {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

/* Fix markdown rendering inside chat */
.ai-message.assistant .message-content p {
  margin-bottom: 8px;
}

.ai-message.assistant .message-content p:last-child {
  margin-bottom: 0;
}

.ai-message.assistant .message-content .mentor-routing-panel {
  margin-top: 14px;
}

.ai-message.assistant .message-content code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  color: var(--primary);
}

[data-theme="light"] .ai-message.assistant .message-content code {
  background: rgba(184, 134, 11, 0.1);
  color: var(--primary-dark);
}

.ai-message.assistant .message-content pre {
  background: #000;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .ai-message.assistant .message-content pre {
  background: #111827;
  border-color: rgba(15, 23, 42, 0.14);
}

.ai-message.assistant .message-content pre code {
  background: none;
  padding: 0;
  color: #a1a1aa;
}

.ai-chat-input-area {
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

[data-theme="light"] .ai-chat-input-area {
  background:
    linear-gradient(180deg, rgba(184, 134, 11, 0.05), transparent),
    rgba(255, 255, 255, 0.96);
}

.ai-chat-input-area textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.2s;
}

[data-theme="light"] .ai-chat-input-area textarea {
  background: #f7f3eb;
  border-color: #e7e4dd;
  color: var(--foreground);
}

.ai-chat-input-area textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.ai-chat-input-area textarea::placeholder {
  color: var(--muted-foreground);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* AI Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--muted-foreground);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

.typing-copy {
  letter-spacing: 0.01em;
}

.ai-message .message-content.is-streaming {
  white-space: normal;
}

.typing-caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-right: 2px solid rgba(var(--primary-rgb), 0.95);
  animation: typingCaretBlink 0.9s steps(1, end) infinite;
}

@keyframes typingCaretBlink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

/* Skeleton Loaders */
.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 12px;
}

.skeleton {
  background: linear-gradient(90deg,
      var(--muted) 25%,
      rgba(212, 167, 69, 0.1) 37%,
      var(--muted) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-title {
  height: 24px;
  width: 40%;
  margin-bottom: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

/* Chapter Unlock Animation */
.unlock-celebration {
  animation: unlock-reveal 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes unlock-reveal {
  0% {
    transform: scale(0.9);
    opacity: 0;
    filter: brightness(2);
  }

  50% {
    transform: scale(1.05);
    filter: brightness(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}

.gold-glow {
  text-shadow: 0 0 10px rgba(212, 167, 69, 0.5);
  color: var(--primary) !important;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--card);
  padding: 32px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-title {
  margin-top: 0;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
}

.ico-bot {
  color: var(--primary);
}

.modal-description {
  color: var(--muted-foreground);
  margin-bottom: 24px;
  line-height: 1.6;
}

.api-key-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  margin-bottom: 24px;
  font-family: inherit;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.auth-modal-content {
  max-width: 560px;
}

.glossary-modal-content {
  max-width: 1080px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.glossary-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glossary-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--muted);
  color: var(--muted-foreground);
}

.glossary-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  outline: none;
}

.glossary-search-input::placeholder {
  color: var(--muted-foreground);
}

.glossary-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.glossary-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.glossary-chip:hover,
.glossary-chip.active {
  border-color: rgba(212, 167, 69, 0.35);
  background: var(--accent-bg);
  color: var(--foreground);
}

.glossary-results {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.glossary-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.glossary-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.glossary-card {
  min-height: 100%;
}

.glossary-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.glossary-card-head h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.4;
}

.glossary-card-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(212, 167, 69, 0.12);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.glossary-card-plain {
  margin: 0 0 14px;
  color: var(--foreground);
  line-height: 1.7;
}

.glossary-card-meta {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.glossary-card-meta p {
  margin: 6px 0 0;
  color: var(--muted-foreground);
  line-height: 1.65;
}

.glossary-empty {
  margin-right: 4px;
}

.auth-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-close-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.auth-close-btn:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--primary);
}

.auth-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
}

.auth-mode-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-mode-btn:hover,
.auth-mode-btn.active {
  background: var(--accent-bg);
  border-color: rgba(212, 167, 69, 0.35);
  color: var(--foreground);
}

.auth-form-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  color: var(--foreground);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-form-copy {
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 18px;
}

.auth-merge-note,
.auth-account-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  background:
    radial-gradient(circle at top right, rgba(212, 167, 69, 0.1), transparent 42%),
    rgba(255, 255, 255, 0.02);
}

.auth-merge-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-merge-note strong,
.auth-account-card strong {
  color: var(--foreground);
}

.auth-merge-note span,
.auth-account-card p {
  color: var(--muted-foreground);
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--foreground);
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-field .api-key-input {
  margin-bottom: 0;
}

.auth-account-label {
  display: block;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.auth-account-card strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.auth-account-meta {
  margin-top: 8px;
  margin-bottom: 0;
}

.btn-muted {
  background: var(--muted) !important;
  color: var(--foreground) !important;
}

.ai-status-msg {
  font-size: 0.85rem;
  color: var(--destructive);
  margin-top: 16px;
  display: none;
  padding: 12px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.1);
}

.auth-status-msg.is-info {
  color: var(--primary);
  background: rgba(212, 167, 69, 0.12);
}

.auth-status-msg.is-success {
  color: var(--success);
  background: rgba(78, 173, 107, 0.12);
}

.auth-status-msg.is-error {
  color: var(--destructive);
  background: rgba(239, 68, 68, 0.1);
}

/* Dynamic Component Utilities */
.welcome-completed {
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
}

.welcome-completed i {
  width: 18px;
}

.welcome-done {
  color: var(--success);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.welcome-done i {
  width: 24px;
  height: 24px;
}

.chapter-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.no-margin {
  margin-bottom: 0 !important;
}

.chapter-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.exam-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ico-brain {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.msg-system .message-content {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.18);
  color: var(--destructive);
  font-size: 0.85rem;
  font-weight: 500;
}

/* AI Chat Refinements */
.ai-chat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ico-bot-chat {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.9);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
}

.chat-header-text {
  display: flex;
  flex-direction: column;
}

.chat-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--foreground);
}

.chat-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.2;
}

.preview-banner {
  border: 1px solid rgba(var(--primary-rgb), 0.26);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--accent-rgb), 0.08));
  border-radius: calc(var(--radius) + 2px);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.preview-banner-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.preview-banner-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.18);
  color: var(--foreground);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-banner p {
  color: var(--foreground);
  margin: 0;
}

.practice-status-actions,
.verify-help-row,
.remediation-action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.quiz-lock-summary {
  margin: 16px 0 4px;
  padding: 14px 16px;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  border-radius: var(--radius);
  background: rgba(var(--primary-rgb), 0.06);
}

.quiz-lock-summary strong {
  display: block;
  margin-bottom: 10px;
}

.quiz-lock-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quiz-lock-chip {
  white-space: nowrap;
}

.btn-locked {
  opacity: 0.82;
  border-style: dashed;
}

.verify-preview-copy {
  color: var(--muted-foreground);
  font-size: 0.92rem;
  margin-top: 10px;
}

.remediation-panel {
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), rgba(var(--primary-rgb), 0.04));
}

.remediation-head p {
  margin-top: 8px;
}

.remediation-section {
  margin-top: 20px;
}

.remediation-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.remediation-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.remediation-card-block {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(9, 9, 11, 0.22);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-theme="light"] .remediation-card-block {
  background: rgba(255, 255, 255, 0.72);
}

.remediation-card-block strong {
  color: var(--foreground);
}

.remediation-muted {
  color: var(--muted-foreground);
  font-size: 0.92rem;
}

.remediation-empty {
  color: var(--muted-foreground);
  font-size: 0.92rem;
}

.remediation-steps {
  margin-top: 10px;
}

.practice-section-focus {
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.42), 0 0 0 8px rgba(var(--primary-rgb), 0.08);
  transition: box-shadow 0.2s ease;
}
