@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Modern Sage Green & Pure White System */
  --canvas: #F6F9F7;          /* Ultra-soft calming mint-white canvas */
  --surface: #FFFFFF;         /* Crisp pure white cards and panels */
  --surface-subtle: #EEF4F0;  /* Very soft sage wash */
  --surface-muted: #F6F9F7;
  --surface-hover: #E7EFEA;
  
  /* Sage Borders */
  --border: #DDE7E1;          /* Soft herbal border */
  --border-subtle: #E8F0EB;
  --border-hover: #C3D5CA;
  --border-focus: #8EB79F;
  --border-blue: #C3D5CA;     /* Legacy alias mapped to sage */
  --border-sage: #C3D5CA;
  
  /* Text & Typography Colors (High Contrast, WCAG AAA) */
  --text-main: #14221A;       /* Deep forest slate, 13:1 contrast against pure white */
  --text-secondary: #2C3F34;  /* Deep sage charcoal, 8.2:1 contrast */
  --text-muted: #536B5E;      /* Muted herbal slate, 4.7:1 contrast (passes WCAG AA) */
  --text-dim: #7C9588;        /* Subtle accents & borders */
  
  /* Modern Sage Palette */
  --sage-50: #F0F6F2;
  --sage-100: #DEEBE2;
  --sage-200: #C3D5CA;
  --sage-300: #9EC0AC;
  --sage-400: #73A385;
  --sage-500: #4F8663;
  --sage-600: #3B6E52;        /* Core Brand Accent: Modern Elegant Sage */
  --sage-700: #2D553F;        /* Deep Sage: Active / Hover / Dark text */
  --sage-800: #203E2E;
  --sage-900: #14281E;

  /* Brand Accent Aliases mapped to Sage (Seamless system-wide backward compatibility) */
  --blue-600: #3B6E52;
  --blue-700: #2D553F;
  --blue-800: #203E2E;
  --blue-50: #F0F6F2;
  --blue-100: #DEEBE2;
  --blue-200: #C3D5CA;
  
  /* Semantic Colors */
  --emerald-600: #2E7D58;
  --emerald-700: #236144;
  --emerald-50: #EDF7F2;
  --emerald-200: #B7E2CE;
  
  --amber-600: #B45309;
  --amber-700: #92400E;
  --amber-50: #FEF7ED;
  --amber-200: #FBD5A5;
  
  --ruby-600: #C53030;
  --ruby-700: #9B2C2C;
  --ruby-50: #FEF2F2;
  --ruby-200: #FECACA;

  --purple-600: #6D28D9;
  --purple-50: #F5F3FF;
  --purple-200: #DDD6FE;

  /* Theme Compatibility Aliases */
  --bg-body: var(--canvas);
  --bg-card: var(--surface);
  --bg-card-subtle: var(--surface-subtle);
  --bg-card-hover: var(--surface-hover);
  --bg-card-highlight: var(--sage-50);
  --border-highlight: var(--border-hover);
  
  --cyan-400: var(--sage-600);
  --cyan-500: var(--sage-700);
  --cyan-glow: var(--sage-50);
  --border-cyan: var(--border-sage);

  --emerald-400: var(--emerald-600);
  --amber-400: var(--amber-600);
  --ruby-400: var(--ruby-600);
  --ruby-500: var(--ruby-700);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;

  /* Shadows (Natural, Multi-layered, soft herbal tint) */
  --shadow-xs: 0 1px 2px 0 rgba(20, 34, 26, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(20, 34, 26, 0.05), 0 1px 2px -1px rgba(20, 34, 26, 0.03);
  --shadow-hover: 0 8px 16px -4px rgba(20, 34, 26, 0.07), 0 2px 4px -1px rgba(20, 34, 26, 0.03);
  --shadow-elevated: 0 12px 24px -4px rgba(20, 34, 26, 0.09), 0 4px 6px -2px rgba(20, 34, 26, 0.04);
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--canvas);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; letter-spacing: -0.025em; }
h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p {
  margin-bottom: 0.75rem;
}

a {
  color: var(--blue-600);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--blue-700);
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 1260px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Navigation Bar (Modern Topbar) */
.navbar {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
  color: var(--text-main);
  text-decoration: none;
}

.brand span.brand-text {
  color: var(--text-main);
}

.brand-badge {
  background-color: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--border-blue);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.675rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.425rem 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-main);
  background-color: var(--surface-subtle);
}

.nav-link.active {
  color: var(--blue-700);
  background-color: var(--blue-50);
  font-weight: 600;
}

/* Public Navbar Mobile & Desktop Actions */
.navbar-mobile-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  min-width: 44px;
  transition: var(--transition);
}

.navbar-mobile-toggle:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-hover);
}

.nav-menu-mobile-actions {
  display: none;
}

.navbar-desktop-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-mobile-backdrop {
  display: none;
}

/* User Profile Badge in Navbar */
.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--blue-600);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ========================================================
   Modern Collapsible Sidebar & App Shell Architecture
   ======================================================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  background-color: var(--canvas);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Sidebar Component */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background-color: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1), transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 1px 0 3px rgba(15, 23, 42, 0.02);
}

.sidebar-header {
  height: 60px;
  padding: 0 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--sage-600) 0%, var(--sage-700) 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(59, 110, 82, 0.25);
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--border-hover);
}

/* Sidebar Nav Scroll Area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.85rem 0.65rem 0.35rem 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-course {
  margin: 0.15rem 0.35rem 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-subtle);
}

.sidebar-course-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sage-700);
}

.sidebar-course-name {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.sidebar-leave {
  margin: 0 0.35rem 0.55rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item:hover {
  background-color: var(--surface-subtle);
  color: var(--text-main);
}

.sidebar-item.active {
  background-color: var(--blue-50);
  color: var(--blue-700);
  font-weight: 600;
}

.sidebar-item-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.sidebar-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: var(--transition);
}

.sidebar-item:hover .sidebar-item-icon {
  color: var(--text-main);
}

.sidebar-item.active .sidebar-item-icon {
  color: var(--blue-600);
}

.sidebar-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item.sidebar-taught {
  white-space: normal;
  align-items: flex-start;
}

.sidebar-taught .sidebar-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  white-space: normal;
}

.sidebar-taught-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sage-700);
  line-height: 1.2;
}

.sidebar-taught-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-item.sidebar-taught.active .sidebar-taught-code {
  color: var(--blue-700);
}

.sidebar-collapsed .sidebar-taught-name,
.sidebar-collapsed .sidebar-taught-code {
  display: none;
}

/* Sidebar Footer (Profile & Logout) */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  text-decoration: none;
  flex: 1;
}

.sidebar-user-ring {
  flex-shrink: 0;
  padding: 3px;
  border-radius: 999px;
  background: #C5D0C8;
}

.sidebar-user-ring.rarity-noted { background: #3B82F6; }
.sidebar-user-ring.rarity-rare {
  background: linear-gradient(130deg, #14B8A6, #5EEAD4, #0F766E);
  background-size: 200% 200%;
  animation: rank-sheen 3.5s linear infinite;
}
.sidebar-user-ring.rarity-mythic {
  background: #F43F5E;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.55);
  animation: rank-pulse 2s ease-in-out infinite;
}
.sidebar-user-ring.rarity-apex {
  padding: 3px;
  background: linear-gradient(130deg, #F59E0B, #FDE68A, #F59E0B);
  background-size: 180% 180%;
  animation: rank-sheen 2.4s linear infinite, rank-pulse 1.6s ease-in-out infinite;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--blue-600);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.775rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  overflow: hidden;
  line-height: 1.25;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-level {
  color: var(--text-main);
  font-weight: 600;
  font-family: var(--font-sans, inherit);
}

@keyframes rank-sheen {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@keyframes rank-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
@keyframes rank-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .sidebar-user-ring { animation: none; }
}

.sidebar-logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background-color: var(--ruby-50);
  color: var(--ruby-700);
}

/* App Main Wrapper */
.app-main-wrapper {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 220ms cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
}

/* App Header (Sticky Topbar) */
.app-header {
  height: 60px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: var(--shadow-xs);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-toggle-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.header-toggle-btn:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.header-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-title-wrap .page-breadcrumb {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

/* App Content Area */
.app-content {
  flex: 1;
  padding: 2.25rem 2rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

/* App Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  background-color: #FFFFFF;
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: auto;
}

/* ========================================================
   Collapsed State (Desktop)
   ======================================================== */
.sidebar-collapsed .app-sidebar {
  width: 72px;
}

.sidebar-collapsed .app-main-wrapper {
  margin-left: 72px;
}

.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-brand-badge,
.sidebar-collapsed .sidebar-item-text,
.sidebar-collapsed .sidebar-item .badge,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .sidebar-course,
.sidebar-collapsed .sidebar-leave,
.sidebar-collapsed .sidebar-user-info {
  display: none !important;
}

.sidebar-collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar-collapsed .sidebar-brand {
  display: none;
}

.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: 0.65rem 0;
}

.sidebar-collapsed .sidebar-item-inner {
  justify-content: center;
  width: 100%;
}

.sidebar-collapsed .sidebar-footer {
  padding: 0.85rem 0;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-collapsed .sidebar-user {
  justify-content: center;
}

/* ========================================================
   Mobile Responsiveness (Navbar & Sidebar Drawer)
   ======================================================== */
.sidebar-backdrop {
  display: none;
}

.sidebar-mobile-close-btn {
  display: none;
}

.header-xp-short,
.header-node-short,
.header-lecturer-short {
  display: none;
}

@media (max-width: 900px) {
  /* Public Landing Navbar Mobile State */
  .navbar-mobile-toggle {
    display: inline-flex;
  }

  .navbar-desktop-actions {
    display: none;
  }

  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.12);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.25rem 1.5rem;
    gap: 0.4rem;
    display: none;
    z-index: 60;
  }

  .nav-menu.nav-menu-open {
    display: flex;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.925rem;
    border-radius: var(--radius-md);
    background-color: var(--surface-subtle);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-link:hover {
    background-color: var(--blue-50);
    color: var(--blue-700);
  }

  .nav-menu-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.65rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
  }

  .navbar-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 55;
  }

  .navbar-mobile-backdrop.active {
    display: block;
  }

  /* Authenticated App Sidebar Mobile Drawer */
  .app-sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    box-shadow: var(--shadow-elevated);
    z-index: 100;
  }

  .sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-mobile-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--surface-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
  }

  .sidebar-mobile-close-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-main);
  }

  .sidebar-toggle-btn {
    display: none !important;
  }

  .sidebar-item {
    min-height: 44px;
    padding: 0.65rem 0.85rem;
  }

  .app-main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .app-header {
    padding: 0 1rem;
    height: 56px;
    width: 100%;
    max-width: 100%;
  }

  .app-content {
    padding: 1.25rem 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .app-footer {
    padding: 1.25rem 1rem;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .header-badge-cluster {
    display: none !important;
  }

  .page-breadcrumb {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 580px) {
  .header-node-full {
    display: none;
  }
  .header-node-short {
    display: inline;
  }

  .header-xp-full {
    display: none;
  }
  .header-xp-short {
    display: inline;
  }

  .header-lecturer-full {
    display: none;
  }
  .header-lecturer-short {
    display: inline;
  }

  .header-logout-text {
    display: none;
  }

  .header-logout-btn {
    padding: 0.4rem 0.55rem !important;
    min-width: 36px;
    min-height: 36px;
  }

  .app-header-right {
    gap: 0.45rem;
  }

  .page-breadcrumb {
    max-width: 110px;
  }
}

@media (max-width: 480px) {
  .header-badge-node {
    display: none !important;
  }

  .page-breadcrumb {
    max-width: 90px;
  }
}

/* Modern SaaS Card System */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 0;
}

.course-banner {
  position: relative;
  overflow: hidden;
  background: #14281E;
}

.course-banner img:not(.course-banner-logo) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.course-banner-logo {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  z-index: 1;
  height: 58%;
  width: auto;
  max-width: 40%;
  object-fit: contain;
  transform: translateY(-50%);
  opacity: 0.88;
  pointer-events: none;
}

.course-banner-card {
  height: 168px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.course-banner-hero {
  min-height: 180px;
  height: 100%;
}

.course-banner-dash {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

.course-banner-dash.course-banner-generated span {
  display: none;
}

.course-banner-dash .course-banner-logo {
  right: 1.4rem;
  height: 46%;
  opacity: 0.72;
}

.course-banner-thumb .course-banner-logo {
  right: 0.45rem;
  height: 62%;
  max-width: 36%;
}

.course-banner-thumb {
  flex: 0 0 168px;
  width: 168px;
  height: 96px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #14281E;
}

.course-banner-generated {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.75rem 42% 0.75rem 0.9rem;
  color: #EAF7EF;
  background: linear-gradient(135deg, #1F6E4C 0%, #14532D 62%, #0F3D22 100%);
}

.course-banner-generated::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.12), transparent 46%);
  pointer-events: none;
}

.course-banner-code {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #A7E8C4;
}

.course-banner-name {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  color: #FFFFFF;
}

.course-banner-type {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin-top: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm, 4px);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.course-banner-thumb.course-banner-generated {
  padding: 0.45rem 0.55rem;
}

.course-banner-thumb .course-banner-name {
  font-size: 0.72rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-banner-thumb .course-banner-type {
  display: none;
}

@media (max-width: 640px) {
  .course-banner-thumb {
    flex-basis: 100%;
    width: 100%;
    height: 140px;
  }

  .course-banner-hero {
    min-height: 160px;
  }
}

/* Standard SaaS Buttons (Ergonomic & Proportional) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.35;
  box-shadow: var(--shadow-xs);
  user-select: none;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #3B6E52 0%, #2D553F 100%);
  color: #FFFFFF;
  border-color: rgba(20, 34, 26, 0.12);
  box-shadow: 0 1px 2px 0 rgba(59, 110, 82, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2D553F 0%, #203E2E 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 4px 0 rgba(59, 110, 82, 0.35);
}

.btn-secondary {
  background-color: #FFFFFF;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border-hover);
  color: var(--text-main);
}

.btn-danger {
  background-color: var(--ruby-50);
  border-color: var(--ruby-200);
  color: var(--ruby-600);
}

.btn-danger:hover {
  background-color: var(--ruby-600);
  color: #FFFFFF;
}

.btn-success {
  background-color: var(--emerald-50);
  border-color: var(--emerald-200);
  color: var(--emerald-600);
}

.btn-success:hover {
  background-color: var(--emerald-600);
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.325rem 0.7rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.65rem 1.35rem;
  font-size: 0.925rem;
  border-radius: var(--radius-md);
}

/* Functional Badges (Restrained, Crisp Pill Style) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

.badge-sage, .badge-blue, .badge-cyan {
  background-color: var(--sage-50);
  color: var(--sage-700);
  border: 1px solid var(--border-sage);
}

.badge-slate {
  background-color: #F1F5F4;
  color: #4A6356;
  border: 1px solid #CBDCD2;
}

.badge-purple {
  background-color: var(--purple-50);
  color: var(--purple-600);
  border: 1px solid var(--purple-200);
}

.badge-online {
  background-color: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-200);
}

.badge-offline {
  background-color: var(--ruby-50);
  color: var(--ruby-700);
  border: 1px solid var(--ruby-200);
}

.badge-amber {
  background-color: var(--amber-50);
  color: var(--amber-700);
  border: 1px solid var(--amber-200);
}

.badge-secondary {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-main);
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
  color: var(--text-dim);
}

/* Modern Grid System */
.grid {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
}

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .grid { gap: 1rem; }
  .card { padding: 1rem; }
  .gamification-hero { padding: 1.15rem 1rem; }
  .stat-box { padding: 1rem; }
}

/* Modern Node Grid (28 Nodes) */
.node-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .node-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 440px) {
  .node-grid { grid-template-columns: 1fr; }
}

.node-card {
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  transition: var(--transition);
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.node-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}

.node-card.my-node {
  border-color: var(--border-blue);
  background-color: var(--blue-50);
}

.node-card.offline {
  border-color: var(--ruby-200);
  background-color: var(--ruby-50);
}

.node-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

.node-status-dot.online {
  background-color: var(--emerald-600);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.node-status-dot.offline {
  background-color: var(--ruby-600);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Blockchain Horizontal Explorer */
.chain-scroller {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.75rem 0.25rem 1.25rem 0.25rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.chain-scroller::-webkit-scrollbar {
  height: 8px;
}

.chain-scroller::-webkit-scrollbar-track {
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
}

.chain-scroller::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: var(--radius-full);
}

.chain-scroller::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

.block-card {
  flex: 0 0 320px;
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  scroll-snap-align: start;
}

.block-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.block-card.valid {
  border-top: 3px solid var(--sage-600);
}

.block-card.tampered {
  border-top: 3px solid var(--ruby-600);
  background-color: var(--ruby-50);
  border-color: var(--ruby-200);
}

.chain-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
  padding: 0 0.15rem;
}

@keyframes blockHighlightPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(82, 121, 111, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(82, 121, 111, 0.2); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(82, 121, 111, 0); }
}

.block-card.highlight-focus {
  animation: blockHighlightPulse 1.5s ease;
  border-color: var(--sage-600) !important;
}

/* Stat Box (Clean Metrics Counter) */
.stat-box {
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

/* Modern Clean Tables */
.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.table th {
  background-color: var(--surface-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.725rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background-color: var(--surface-hover);
}

/* Alerts */
.alert {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.alert-success {
  background-color: var(--emerald-50);
  border: 1px solid var(--emerald-200);
  color: var(--emerald-700);
}

.alert-warning {
  background-color: var(--amber-50);
  border: 1px solid var(--amber-200);
  color: var(--amber-700);
}

.alert-danger {
  background-color: var(--ruby-50);
  border: 1px solid var(--ruby-200);
  color: var(--ruby-700);
}

/* Progress Bar */
.progress-bar-wrap, .progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-600) 0%, var(--sage-400) 100%);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

/* Responsive YouTube Video Wrapper (16:9 Aspect Ratio) */
.video-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: #0F172A;
}

.video-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Lecture Notes Markdown Typography (Medium / Stripe Style) */
.lecture-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.lecture-content h2 {
  font-size: 1.35rem;
  color: var(--text-main);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.lecture-content h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.lecture-content p {
  margin-bottom: 1rem;
}

.lecture-content ul, .lecture-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.lecture-content li {
  margin-bottom: 0.45rem;
}

.lecture-content blockquote {
  border-left: 3px solid var(--blue-600);
  background-color: var(--blue-50);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.5rem 0;
  color: var(--text-main);
  font-size: 0.925rem;
}

.lecture-content blockquote strong {
  color: var(--blue-700);
}

.lecture-content pre {
  background-color: #0F172A;
  color: #F8FAFC;
  padding: 1.15rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}

.lecture-content code {
  background-color: var(--surface-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--blue-700);
}

.lecture-content pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.lecture-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

.lecture-content th {
  background-color: var(--surface-subtle);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
}

.lecture-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

/* Strict SVG Icon Sizing */
svg {
  display: inline-block;
  vertical-align: middle;
}

.icon-svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.w-3 { width: 0.75rem !important; height: 0.75rem !important; }
.w-3\.5, .w-3-5 { width: 0.875rem !important; height: 0.875rem !important; }
.w-4 { width: 1rem !important; height: 1rem !important; }
.w-5 { width: 1.2rem !important; height: 1.2rem !important; }
.w-6 { width: 1.35rem !important; height: 1.35rem !important; }
.w-7 { width: 1.5rem !important; height: 1.5rem !important; }
.w-8 { width: 1.75rem !important; height: 1.75rem !important; }
.h-3 { height: 0.75rem !important; }
.h-3\.5, .h-3-5 { height: 0.875rem !important; }
.h-4 { height: 1rem !important; }
.h-5 { height: 1.2rem !important; }
.h-6 { height: 1.35rem !important; }
.h-7 { height: 1.5rem !important; }
.h-8 { height: 1.75rem !important; }

/* Subtle Color Helpers */
.text-blue-500, .text-blue-600, .text-cyan-400 { color: var(--blue-600) !important; }
.text-emerald-500, .text-emerald-600 { color: var(--emerald-600) !important; }
.text-amber-500, .text-amber-600 { color: var(--amber-600) !important; }
.text-red-500, .text-ruby-600 { color: var(--ruby-600) !important; }

/* Clean Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  background-color: #FFFFFF;
}

/* ==========================================================================
   GAMIFICATION, LEADERBOARD & COURSE PLAYER (Udemy / Coursera / Claude AI)
   ========================================================================== */

/* Gamification Hero Banner (Modern Sage Soft Card) */
.gamification-hero {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--sage-50) 100%);
  border: 1px solid var(--border-sage);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.gamification-hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 110, 82, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.gamification-hero-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.gamification-hero-content {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.gamification-badges {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.gamification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gamification-hero-action {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .gamification-hero {
    padding: 1.25rem 1rem;
  }

  .gamification-hero-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1.15rem;
  }

  .gamification-hero-action {
    width: 100%;
  }

  .gamification-hero-action .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* XP Progress Bar Component */
.xp-bar-wrap {
  width: 100%;
  margin: 0.5rem 0;
}

.xp-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--surface-subtle);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-600) 0%, var(--sage-400) 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Student Dashboard Next Step Prompt Card */
.next-step-card {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--sage-50) 100%);
  border: 1px solid var(--border-sage);
  border-left: 5px solid var(--sage-600);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.next-step-content {
  flex: 1;
  min-width: 260px;
}

.next-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sage-700);
  background-color: var(--sage-100);
  border: 1px solid var(--border-sage);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.45rem;
}

.next-step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.next-step-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0;
}

.next-step-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .next-step-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1.15rem 1rem;
    gap: 1rem;
  }
  .next-step-actions {
    width: 100%;
  }
  .next-step-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* Helper Callout for Laymen */
.layman-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--sage-50);
  border: 1px solid var(--border-sage);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* Podium 3 Besar (Coursera / Stripe Inspiration) */
.leaderboard-podium {
  display: grid;
  grid-template-columns: 1fr 1.08fr 1fr;
  gap: 1.25rem;
  align-items: end;
  margin: 1.5rem 0 2rem;
}

@media (max-width: 860px) {
  .leaderboard-podium {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.podium-card {
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.podium-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.podium-card.rank-1 {
  border-top: 4px solid #D97706; /* Emas */
  background: linear-gradient(180deg, #FFFDF8 0%, #FFFFFF 60%);
  box-shadow: 0 4px 20px -2px rgba(217, 119, 6, 0.12), 0 2px 6px -1px rgba(0, 0, 0, 0.05);
}

.podium-card.rank-2 {
  border-top: 4px solid #64748B; /* Perak */
}

.podium-card.rank-3 {
  border-top: 4px solid #B45309; /* Perunggu */
}

.podium-rank-badge {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

.podium-card.rank-1 .podium-rank-badge {
  background-color: #FEF3C7;
  color: #B45309;
  border: 2px solid #FDE68A;
}

.podium-card.rank-2 .podium-rank-badge {
  background-color: #F1F5F9;
  color: #475569;
  border: 2px solid #E2E8F0;
}

.podium-card.rank-3 .podium-rank-badge {
  background-color: #FFEDD5;
  color: #9A3412;
  border: 2px solid #FED7AA;
}

.podium-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-600) 0%, var(--sage-700) 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.65rem;
  box-shadow: var(--shadow-sm);
}

.podium-card.rank-1 .podium-avatar {
  width: 4.25rem;
  height: 4.25rem;
  font-size: 1.35rem;
  box-shadow: 0 0 0 4px #FEF3C7, var(--shadow-md);
}

/* Highlight Row for Current User in Leaderboard Table */
.table-row-highlight {
  background-color: var(--sage-50) !important;
  font-weight: 600;
  border-left: 3px solid var(--sage-600);
}

.table-row-highlight td {
  color: var(--sage-900) !important;
}

/* Badge Gallery / Achievement Cards */
.badge-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: all var(--transition-fast);
}

.achievement-card:hover {
  border-color: var(--blue-300);
  box-shadow: var(--shadow-sm);
}

.achievement-card.locked {
  background-color: #F8FAFC;
  border-style: dashed;
  opacity: 0.65;
}

.achievement-icon-wrap {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  background-color: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--blue-100);
}

.achievement-card.locked .achievement-icon-wrap {
  background-color: var(--slate-100);
  color: var(--slate-400);
  border-color: var(--slate-200);
}

/* Course Learning Player (Udemy & Coursera Style) */
.course-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.75rem;
  align-items: start;
}

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

.course-syllabus-drawer {
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.course-syllabus-header {
  padding: 1rem 1.25rem;
  background-color: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.course-syllabus-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0;
}

.course-syllabus-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.825rem;
  transition: background-color var(--transition-fast);
}

.course-syllabus-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

.course-syllabus-item.active {
  background-color: var(--sage-50);
  border-left-color: var(--sage-600);
  color: var(--sage-700);
  font-weight: 600;
}

.course-syllabus-item.completed .item-check {
  color: var(--emerald-600);
}

/* Course Tab Navigation (Claude AI / Coursera Style) */
.course-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.course-tab-btn {
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.course-tab-btn:hover {
  color: var(--text-main);
}

.course-tab-btn.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
}

/* Claude AI Typography for Reading Content */
.claude-prose {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: #334155; /* Slate-700 */
}

.claude-prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0F172A; /* Slate-900 */
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
  border-bottom: 1px solid var(--slate-100);
  padding-bottom: 0.5rem;
}

.claude-prose h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1E293B;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.claude-prose p {
  margin-bottom: 1.25rem;
}

.claude-prose ul, .claude-prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.claude-prose li {
  margin-bottom: 0.4rem;
}

.challenge-prompt > :first-child {
  margin-top: 0;
}
.challenge-prompt h1,
.challenge-prompt h2,
.challenge-prompt h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.1rem 0 0.5rem;
  letter-spacing: -0.01em;
}
.challenge-prompt p {
  margin: 0 0 0.85rem;
}
.challenge-prompt ul,
.challenge-prompt ol {
  margin: 0 0 0.85rem;
  padding-left: 1.35rem;
}
.challenge-prompt li {
  margin-bottom: 0.35rem;
}
.challenge-prompt code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: var(--text-main);
}
.challenge-prompt pre {
  background: #0F172A;
  color: #F8FAFC;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0 0 0.85rem;
}
.challenge-prompt pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

.claude-callout {
  background-color: #F8FAFC;
  border-left: 3px solid var(--blue-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
}

.claude-callout-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue-700);
  margin-bottom: 0.35rem;
}

/* Academic Integrity & Anti-Cheat System */
.no-copy-zone {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.integrity-card-banner {
  background: linear-gradient(135deg, var(--sage-50) 0%, #FFFFFF 100%);
  border: 1px solid var(--border-sage);
  border-left: 4px solid var(--sage-600);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.integrity-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.integrity-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 380px;
  background-color: #FFFFFF;
  border: 1px solid #FECACA;
  border-left: 4px solid var(--ruby-600);
  box-shadow: var(--shadow-elevated);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.integrity-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@keyframes integrityShake {
  0%, 100% { transform: translateX(0); border-color: var(--border); }
  20%, 60% { transform: translateX(-4px); border-color: var(--ruby-600); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
  40%, 80% { transform: translateX(4px); border-color: var(--ruby-600); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
}

.integrity-shake {
  animation: integrityShake 380ms ease-in-out;
}

/* Game Progression: Dark Locked State for Meetings & Challenges */
.game-locked-card {
  position: relative !important;
  background: linear-gradient(145deg, #090D16 0%, #0F172A 55%, #1E293B 100%) !important;
  border: 1px solid #334155 !important;
  border-top: 2px solid #475569 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  color: #94A3B8 !important;
  overflow: hidden !important;
}

.game-locked-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(71, 85, 105, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.game-locked-card h3,
.game-locked-card h4 {
  color: #CBD5E1 !important;
}

.game-locked-card p {
  color: #64748B !important;
}

.badge-game-locked {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
  font-family: var(--font-mono);
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.game-lock-banner {
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #94A3B8;
  margin-bottom: 0.85rem;
}

.btn-game-locked {
  background-color: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #64748B !important;
  cursor: not-allowed !important;
  font-weight: 600;
  opacity: 0.85;
}

/* Course Player Syllabus Drawer Locked Item */
.drawer-item-locked {
  background: #090D16 !important;
  border: 1px solid #1E293B !important;
  color: #64748B !important;
  cursor: not-allowed !important;
  opacity: 0.8;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.drawer-item-locked:hover {
  background: #090D16 !important;
  border-color: #1E293B !important;
  transform: none !important;
}

/* Challenge Grid Card Locked */
.challenge-card-locked {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  width: 100% !important;
  gap: 0.65rem !important;
  padding: 1rem 1.2rem !important;
  background: #17231D !important;
  border: 1px solid #334155 !important;
  color: #F8FAFC !important;
  cursor: pointer !important;
  opacity: 1;
  text-align: left !important;
}

.challenge-card-locked > .challenge-meeting-title {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) !important;
  grid-column: 1 / 3 !important;
  align-items: center !important;
  gap: 0.65rem !important;
}

.challenge-card-locked > .badge {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
}

.challenge-card-locked h2 {
  margin: 0 !important;
  color: #F8FAFC !important;
  font-size: 0.98rem !important;
  text-align: left !important;
}

.challenge-card-locked small {
  display: block !important;
  margin-top: 0.15rem !important;
  color: #CBD5E1 !important;
  text-align: left !important;
}

.challenge-card-locked:hover {
  transform: none !important;
  box-shadow: none !important;
}

@media (max-width: 900px) {
  .fullstack-split-grid,
  .fullstack-sql-grid,
  .fullstack-playground-grid {
    grid-template-columns: 1fr !important;
  }
  .fullstack-sql-grid > .fullstack-sql-editor {
    order: -1;
  }
  .fullstack-split-grid > .fullstack-lab-editor {
    order: -1;
  }
}

.fs-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  visibility: hidden;
  pointer-events: none;
}
.fs-modal.is-open {
  visibility: visible;
  pointer-events: auto;
}
.fs-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.fs-modal.is-open .fs-modal-backdrop {
  opacity: 1;
}
.fs-modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(82vh, 740px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}
.fs-modal.is-open .fs-modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.fs-modal-panel:focus {
  outline: 2px solid var(--sage-600);
  outline-offset: 2px;
}
.fs-modal-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage-700);
  margin: 0 0 0.2rem;
}
.fs-modal-section {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.fs-modal-file {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-top: 0.4rem;
}
.fs-modal-test {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.825rem;
}
.fs-modal-test:last-child { border-bottom: none; }
body.fs-modal-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .fs-modal-backdrop,
  .fs-modal-panel {
    transition: none;
  }
}



/* Compact locked rows on the challenge index retain readable hierarchy. */
.challenge-index [data-locked-meeting] {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  width: 100% !important;
  gap: 0.65rem !important;
  padding: 1rem 1.2rem !important;
  text-align: left !important;
  color: #F8FAFC !important;
  background: #17231D !important;
  border: 1px solid #334155 !important;
}
.challenge-index [data-locked-meeting] > .challenge-meeting-title {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) !important;
  grid-column: 1 / 3 !important;
  align-items: center !important;
  gap: 0.65rem !important;
  min-width: 0 !important;
  text-align: left !important;
}
.challenge-index [data-locked-meeting] > .badge {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
}
.challenge-index [data-locked-meeting] h2,
.challenge-index [data-locked-meeting] .challenge-meeting-heading {
  margin: 0 !important;
  color: #F8FAFC !important;
  font-size: 0.98rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-align: left !important;
}
.challenge-index [data-locked-meeting] small {
  display: block !important;
  margin-top: 0.15rem !important;
  color: #CBD5E1 !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  text-align: left !important;
}

.challenge-card-locked {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  width: 100% !important;
  gap: 0.65rem !important;
  padding: 1rem 1.2rem !important;
  text-align: left !important;
  background: #17231D !important;
}
.challenge-card-locked > .challenge-meeting-title {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) !important;
  grid-column: 1 / 3 !important;
  align-items: center !important;
  gap: 0.65rem !important;
}
.challenge-card-locked > .badge { grid-column: 3 !important; grid-row: 1 !important; justify-self: end !important; }
.challenge-card-locked h2 { margin: 0 !important; color: #F8FAFC !important; font-size: 0.98rem !important; text-align: left !important; }
.challenge-card-locked small { display: block !important; margin-top: 0.15rem !important; color: #CBD5E1 !important; text-align: left !important; }

/* Mobile and tablet primary navigation */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 68px;
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
  }

  .mobile-bottom-nav-item {
    display: flex;
    min-width: 0;
    min-height: 44px;
    padding: 0.25rem 0.2rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
  }

  .mobile-bottom-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav-item.is-active {
    color: var(--blue-700);
  }

  .mobile-bottom-nav-item.is-active svg {
    color: var(--blue-600);
  }

  .mobile-bottom-nav-item:focus-visible {
    outline: 3px solid var(--blue-600);
    outline-offset: -3px;
  }

  .app-content,
  .app-footer {
    padding-bottom: calc(1.25rem + 80px + env(safe-area-inset-bottom, 0px));
  }
}
