/* =================================================================
   SheetLab — Design System
   Navy ocean palette · #001d39 · #0a4174 · #7bbde8
   ================================================================= */

/* ===== 1. DESIGN TOKENS — LIGHT MODE ===== */

:root {
  /* ── Navy scale (brand palette) ── */
  --navy-950: #001d39;
  --navy-800: #0a4174;
  --navy-600: #49769f;
  --navy-500: #4e8ea2;
  --navy-400: #6ea2b3;
  --navy-300: #7bbde8;
  --navy-100: #bdd8e9;
  --navy-50:  #e8f3f9;

  /* ── Zinc neutrals (kept for UI chrome) ── */
  --zinc-50:  #FAFAFA;
  --zinc-100: #F4F4F5;
  --zinc-200: #E4E4E7;
  --zinc-300: #D4D4D8;
  --zinc-400: #A1A1AA;
  --zinc-500: #71717A;
  --zinc-600: #52525B;
  --zinc-700: #3F3F46;
  --zinc-800: #27272A;
  --zinc-900: #18181B;
  --zinc-950: #09090B;

  /* ── Mapped indigo aliases → navy ── */
  --indigo-50:  #e8f3f9;
  --indigo-100: #d0e8f5;
  --indigo-200: #bdd8e9;
  --indigo-500: #7bbde8;
  --indigo-600: #49769f;
  --indigo-700: #0a4174;

  /* ── Semantic Surface ── */
  --bg-base:     #F2F7FB;   /* subtle navy tint */
  --bg-surface:  #FFFFFF;
  --bg-raised:   #E6EFF7;
  --bg-elevated: #D9E8F2;
  --bg-overlay:  rgba(255, 255, 255, 0.92);

  /* ── Semantic Text ── */
  --text-1: #001d39;   /* deepest navy — rich dark */
  --text-2: #1a3a5c;   /* dark navy */
  --text-3: #49769f;   /* mid navy — muted */
  --text-4: #8ab4cc;   /* light blue-gray */

  /* ── Semantic Border ── */
  --border:        rgba(10, 65, 116, 0.08);
  --border-medium: rgba(10, 65, 116, 0.12);
  --border-strong: rgba(10, 65, 116, 0.20);

  /* ── Primary — Deep Navy ── */
  --primary:        #0a4174;
  --primary-hover:  #001d39;
  --primary-active: #001d39;
  --primary-soft:   rgba(10, 65, 116, 0.08);
  --primary-glow:   rgba(10, 65, 116, 0.20);

  /* ── Status Colors ── */
  --success:       #188741;
  --success-soft:  rgba(22, 163, 74, 0.08);
  --danger:        #DC2626;
  --danger-soft:   rgba(220, 38, 38, 0.08);
  --warning:       #D97706;
  --warning-soft:  rgba(217, 119, 6, 0.08);

  /* ── Glass ── */
  --glass-bg:     rgba(255, 255, 255, 0.84);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-blur:   saturate(180%) blur(20px);

  /* ── Shadows — subtle, Stripe-like ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.07), 0 8px 16px rgba(0, 0, 0, 0.04);
  --shadow-primary: 0 4px 14px rgba(10, 65, 116, 0.30);
  --shadow-navy:    0 4px 20px rgba(10, 65, 116, 0.22);

  /* ── Sky accent ── */
  --sky:       #7bbde8;
  --sky-hover: #6ea2b3;
  --sky-soft:  rgba(123, 189, 232, 0.15);
  --teal:      #4e8ea2;

  /* ── Spacing (8px base) ── */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* ── Border Radius ── */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  22px;
  --r-3xl:  28px;
  --r-full: 9999px;

  /* ── Typography ── */
  --font-sans:      -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  --font-editorial: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-display:   var(--font-sans);
  --font-mono:      'SF Mono', 'Fira Code', 'Cascadia Code', 'Roboto Mono', monospace;

  /* ── Transitions ── */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:  150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base:  200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow:  300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Z-index Scale ── */
  --z-base: 1; --z-raised: 10; --z-nav: 30; --z-modal: 50; --z-toast: 9999;

  /* ── Compat aliases ── */
  --dashboard-bg:          var(--bg-base);
  --dashboard-surface:     var(--bg-surface);
  --dashboard-border:      var(--border);
  --dashboard-shadow:      var(--shadow-md);
  --dashboard-text:        var(--text-1);
  --dashboard-muted:       var(--text-3);
  --dashboard-accent:      var(--primary);
  --dashboard-accent-soft: var(--primary-soft);
  --color-bg:      var(--bg-base);
  --color-surface: var(--bg-surface);
  --color-text:    var(--text-1);
  --color-muted:   var(--text-3);
  --color-border:  var(--border);
  --dk-bg:       var(--bg-base);
  --dk-surface:  var(--bg-surface);
  --dk-raised:   var(--bg-raised);
  --dk-elevated: var(--bg-elevated);
  --dk-border:   var(--border);
  --dk-border-hi: var(--border-strong);
  --dk-text-1:   var(--text-1);
  --dk-text-2:   var(--text-2);
  --dk-text-3:   var(--text-3);
  --dk-text-4:   var(--text-4);
  --dk-accent:      var(--primary);
  --dk-accent-hi:   var(--primary-hover);
  --dk-accent-glow: var(--primary-glow);
  --dk-accent-soft: var(--primary-soft);
  --dk-shadow-sm: var(--shadow-sm);
  --dk-shadow-md: var(--shadow-md);
  --dk-shadow-lg: var(--shadow-lg);
  --dk-shadow-xl: var(--shadow-xl);

  /* Legacy aliases → navy */
  --gold:       var(--sky);
  --gold-light: var(--navy-300);
  --gold-soft:  var(--sky-soft);
  --gold-glow:  rgba(123, 189, 232, 0.25);
  --blue-50:  var(--navy-50);
  --blue-100: var(--navy-100);
  --blue-200: var(--navy-300);
  --blue-300: var(--navy-600);
  --blue-400: var(--navy-100);
  --blue-700: var(--primary);
  --blue-800: var(--primary-active);
  --ink-50:  var(--navy-50);
  --ink-100: var(--navy-100);
  --ink-200: #cddfe9;
  --ink-300: #a8c7d8;
  --ink-400: #8ab4cc;
}


/* ===== 2. DESIGN TOKENS — DARK MODE ===== */

.dark {
  color-scheme: dark;

  --bg-base:     #04111E;   /* deep navy night */
  --bg-surface:  #091C30;
  --bg-raised:   #0F2640;
  --bg-elevated: #163251;
  --bg-overlay:  rgba(4, 17, 30, 0.94);

  --text-1: #E8F3FA;
  --text-2: #B0CCDF;
  --text-3: #6ea2b3;
  --text-4: #3d6b80;

  --border:        rgba(123, 189, 232, 0.10);
  --border-medium: rgba(123, 189, 232, 0.16);
  --border-strong: rgba(123, 189, 232, 0.24);

  --primary:        #7bbde8;
  --primary-hover:  #bdd8e9;
  --primary-active: #bdd8e9;
  --primary-soft:   rgba(123, 189, 232, 0.12);
  --primary-glow:   rgba(123, 189, 232, 0.24);

  --success:      #188741;
  --success-soft: rgba(34, 197, 94, 0.10);
  --danger:       #F87171;
  --danger-soft:  rgba(248, 113, 113, 0.10);
  --warning:      #FBBF24;
  --warning-soft: rgba(251, 191, 36, 0.10);

  --glass-bg:     rgba(22, 22, 24, 0.88);
  --glass-border: rgba(255, 255, 255, 0.07);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.50);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.60), 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.60), 0 2px 6px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.70), 0 4px 12px rgba(0, 0, 0, 0.50);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.80), 0 8px 24px rgba(0, 0, 0, 0.60);
  --shadow-primary: 0 4px 14px rgba(123, 189, 232, 0.28);
  --sky:       #bdd8e9;
  --sky-hover: #7bbde8;
  --sky-soft:  rgba(123, 189, 232, 0.12);
  --teal:      #6ea2b3;

  --dashboard-bg:          var(--bg-base);
  --dashboard-surface:     var(--bg-surface);
  --dashboard-border:      var(--border);
  --dashboard-shadow:      var(--shadow-md);
  --dashboard-text:        var(--text-1);
  --dashboard-muted:       var(--text-3);
  --dashboard-accent:      var(--primary);
  --dashboard-accent-soft: var(--primary-soft);
  --color-bg:      var(--bg-base);
  --color-surface: var(--bg-surface);
  --color-text:    var(--text-1);
  --color-muted:   var(--text-3);
  --color-border:  var(--border);
  --dk-bg:       var(--bg-base);
  --dk-surface:  var(--bg-surface);
  --dk-raised:   var(--bg-raised);
  --dk-elevated: var(--bg-elevated);
  --dk-border:   var(--border);
  --dk-border-hi: var(--border-strong);
  --dk-border-top: var(--border-medium);
  --dk-text-1:   var(--text-1);
  --dk-text-2:   var(--text-2);
  --dk-text-3:   var(--text-3);
  --dk-text-4:   var(--text-4);
  --dk-accent:      var(--primary);
  --dk-accent-hi:   var(--primary-hover);
  --dk-accent-glow: var(--primary-glow);
  --dk-accent-soft: var(--primary-soft);
  --dk-shadow-sm: var(--shadow-sm);
  --dk-shadow-md: var(--shadow-md);
  --dk-shadow-lg: var(--shadow-lg);
  --dk-shadow-xl: var(--shadow-xl);

  --gold:       var(--primary);
  --gold-light: var(--primary-hover);
  --gold-soft:  var(--primary-soft);
  --gold-glow:  var(--primary-glow);
  --blue-300: #0a4174;
  --blue-400: #bdd8e9;
  --blue-700: var(--primary);
  --blue-800: var(--primary-active);
}


/* ===== 3. BASE STYLES ===== */

html.dark { background-color: var(--bg-base); }

.dark body {
  background-color: transparent;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(10, 65, 116, 0.30) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 95% 100%, rgba(78, 142, 162, 0.08) 0%, transparent 60%);
  color: var(--text-1);
}

/* Cosmos canvas injected by js/cosmos.js */
#cosmos-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* Smooth theme transition */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 0.35s var(--ease),
    border-color     0.35s var(--ease),
    color            0.25s var(--ease),
    box-shadow       0.35s var(--ease),
    opacity          0.25s var(--ease) !important;
}

/* Scrollbars */
.overflow-auto::-webkit-scrollbar             { width: 5px; height: 5px; }
.overflow-auto::-webkit-scrollbar-track       { background: transparent; }
.overflow-auto::-webkit-scrollbar-thumb       { background: var(--ink-300); border-radius: var(--r-full); }
.overflow-auto::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

.dark .overflow-auto::-webkit-scrollbar-track { background: var(--bg-base); }
.dark .overflow-auto::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }
.dark .overflow-auto::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.20); }

/* Focus ring */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dark :focus-visible { outline-color: var(--blue-400); }

a.group:hover { text-decoration: none; }


/* ===== 4. ANIMATIONS ===== */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position:  400px 0; }
}
@keyframes taskBounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.025); }
  70%  { transform: scale(0.988); }
  100% { transform: scale(1); }
}
@keyframes iconPop {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.3) rotate(6deg);  opacity: 1; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(80px) scale(0.85); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0)    scale(1); }
  to   { opacity: 0; transform: translateX(80px) scale(0.85); }
}
@keyframes taskFlash {
  0%   { box-shadow: 0 0 0 0 var(--primary-glow); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes premiumShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.animate-fade-up          { animation: fadeUp 0.5s var(--ease) both; }
.animate-fade-up-delay    { animation: fadeUp 0.5s var(--ease) 0.12s both; }
.animate-fade-up-delay-2  { animation: fadeUp 0.5s var(--ease) 0.24s both; }
.fade-up                  { animation: fadeUp 0.55s var(--ease) both; }
.fade-up-2                { animation: fadeUp 0.55s var(--ease) 0.10s both; }
.fade-up-3                { animation: fadeUp 0.55s var(--ease) 0.20s both; }

.task-bounce { animation: taskBounce 0.4s var(--ease) both; }
.task-flash  { animation: taskFlash  0.6s var(--ease); }
.icon-pop    { animation: iconPop    0.4s var(--ease-bounce) both; }
.toast-in    { animation: toastIn    0.35s var(--ease-bounce) both; }
.toast-out   { animation: toastOut   0.25s var(--ease) both; }

.hero-gradient { background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%); }


/* ===== 5. LAYOUT ===== */

.dashboard-shell,
.project-shell {
  background: var(--bg-base);
  color: var(--text-1);
}

.dashboard-grid,
.project-grid { position: relative; }

.dark .dashboard-shell,
.dark .project-shell { background: transparent; }


/* ===== 6. NAVIGATION ===== */

/* ── Sticky glass header ── */
.liquid-header {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 0 rgba(0, 0, 0, 0.03);
}

.dark .liquid-header {
  background: rgba(18, 18, 20, 0.88);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom-color: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 0 rgba(0, 0, 0, 0.30);
}

.dark .liquid-header .dashboard-title { color: var(--text-1) !important; }
.dark .liquid-header .brand-subtitle  { color: var(--text-3) !important; }
.dark #user-name                      { color: var(--text-2) !important; }
.dark #btn-logout                     { color: var(--text-3) !important; }
.dark #btn-logout:hover               { color: var(--text-1) !important; }
.dark #hamburger-icon                 { color: var(--text-2) !important; }

/* ── Nav pill container ── */
.liquid-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(116, 116, 128, 0.13);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-radius: var(--r-full);
  padding: 4px;
  border: 0.5px solid rgba(255, 255, 255, 0.40);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.05),
    0 4px 20px rgba(0, 0, 0, 0.07),
    0 1px 4px rgba(0, 0, 0, 0.05);
}

.dark .liquid-nav {
  background: rgba(31, 42, 68, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.20),
    0 4px 20px rgba(0, 0, 0, 0.35),
    0 1px 4px rgba(0, 0, 0, 0.20);
}

/* ── Active indicator chip ── */
.liquid-nav-indicator {
  position: absolute;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid rgba(255, 255, 255, 0.90);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.04),
    0 2px 10px rgba(0, 0, 0, 0.10),
    0 1px 3px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 0;
  transition:
    left   0.4s var(--ease-bounce),
    top    0.4s var(--ease-bounce),
    width  0.4s var(--ease-bounce),
    height 0.4s var(--ease-bounce);
}

.dark .liquid-nav-indicator {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.12),
    0 2px 12px rgba(0, 0, 0, 0.30);
}

/* ── Nav items ── */
.liquid-nav-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: rgba(0, 0, 0, 0.65);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: color var(--t-fast);
}

.liquid-nav-item svg { flex-shrink: 0; }

.liquid-nav-item.active {
  color: var(--ink-900);
  font-weight: 600;
}

.liquid-nav-item:not(.active):hover { color: rgba(0, 0, 0, 0.88); }

.dark .liquid-nav-item                    { color: var(--text-3); }
.dark .liquid-nav-item.active             { color: var(--text-1); font-weight: 600; }
.dark .liquid-nav-item:not(.active):hover { color: var(--text-1); }

/* ── Hamburger ── */
.liquid-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(116, 116, 128, 0.13);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 0.5px solid rgba(255, 255, 255, 0.40);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  color: rgba(0, 0, 0, 0.65);
  transition: background var(--t-base), transform var(--t-base) var(--ease-bounce);
}

.liquid-hamburger:hover  { background: rgba(116, 116, 128, 0.22); transform: scale(1.06); }
.liquid-hamburger:active { transform: scale(0.93); }

.dark .liquid-hamburger {
  background: rgba(31, 42, 68, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.30);
}
.dark .liquid-hamburger:hover { background: rgba(31, 42, 68, 0.80); color: var(--text-1); }

/* ── Mobile nav backdrop ── */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-nav);
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
}
.mobile-nav-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Mobile nav panel ── */
.mobile-nav-panel {
  position: fixed;
  inset-x: 0;
  z-index: calc(var(--z-nav) + 10);
  background: rgba(251, 251, 253, 0.96);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.35s var(--ease-bounce),
    opacity   var(--t-slow);
}
.mobile-nav-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }

.dark .mobile-nav-panel {
  background: rgba(10, 15, 30, 0.97);
  border-bottom-color: var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.60);
}

/* ── Mobile nav card items ── */
.mobile-nav-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text-2);
  transition: background var(--t-fast);
}
.mobile-nav-card:hover { background: rgba(0, 0, 0, 0.04); }
.mobile-nav-card.active-page {
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px rgba(87, 86, 214, 0.14);
  color: var(--primary);
}

.mobile-nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-raised);
}
.mobile-nav-card.active-page .mobile-nav-icon { background: var(--primary-soft); }
.mobile-nav-card.active-page .mobile-nav-icon svg { color: var(--primary); }

.dark .mobile-nav-card             { color: var(--text-3); }
.dark .mobile-nav-card:hover       { background: rgba(255, 255, 255, 0.04); color: var(--text-1); }
.dark .mobile-nav-card.active-page { background: var(--primary-soft); box-shadow: 0 0 0 1px rgba(124, 122, 234, 0.18); color: var(--primary); }
.dark .mobile-nav-icon             { background: rgba(255, 255, 255, 0.04); }
.dark .mobile-nav-card.active-page .mobile-nav-icon { background: var(--primary-soft); }
.dark .mobile-nav-card.active-page .mobile-nav-icon svg { color: var(--primary); }


/* ===== 7. BRAND ===== */

.brand-logo-icon {
  background: var(--zinc-950);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.brand-subtitle {
  font-family: var(--font-sans);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dashboard-title {
  font-family: var(--font-sans);
  letter-spacing: -0.03em;
}


/* ===== 8. BUTTONS ===== */

/* ── Primary CTA ── */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #FFFFFF;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition:
    background var(--t-base),
    box-shadow  var(--t-base),
    transform   var(--t-fast);
  box-shadow:
    0 2px 8px rgba(87, 86, 214, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-cta:hover {
  background: var(--primary-hover);
  box-shadow:
    0 4px 16px rgba(87, 86, 214, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-cta:active {
  background: var(--primary-active);
  transform: scale(0.977);
  box-shadow: 0 1px 4px rgba(87, 86, 214, 0.20);
}

.dark .btn-cta {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow:
    0 2px 10px rgba(124, 122, 234, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.dark .btn-cta:hover {
  background: var(--primary-hover);
  box-shadow:
    0 4px 18px rgba(124, 122, 234, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.dark .btn-cta:active {
  background: var(--primary-active);
  transform: scale(0.977);
}
.dark .btn-cta svg { color: inherit; }

/* ── Hero primary CTA ── */
.hero-cta-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(87, 86, 214, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: background var(--t-base), box-shadow var(--t-base);
}
.hero-cta-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(87, 86, 214, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.dark .hero-cta-primary {
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(124, 122, 234, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.dark .hero-cta-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 18px rgba(124, 122, 234, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* ── Hero secondary CTA ── */
.hero-cta-secondary {
  color: var(--text-2);
  background: transparent;
  transition: color var(--t-fast);
}
.hero-cta-secondary:hover { color: var(--primary); }

.dark .hero-cta-secondary       { color: var(--text-3); }
.dark .hero-cta-secondary:hover { color: var(--primary-hover); }

/* ── Hero body text ── */
.hero-body { color: var(--text-3); }
.dark .hero-body { color: var(--text-3); }

/* ── Theme toggle button ── */
#btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(116, 116, 128, 0.13);
  border: 0.5px solid rgba(255, 255, 255, 0.40);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 10px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  color: rgba(0, 0, 0, 0.65);
  transition: background var(--t-base), transform var(--t-base) var(--ease-bounce);
}
#btn-theme-toggle:hover  { background: rgba(116, 116, 128, 0.22); transform: scale(1.07); }
#btn-theme-toggle:active { transform: scale(0.92); }

.dark #btn-theme-toggle {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 10px rgba(0, 0, 0, 0.30);
}
.dark #btn-theme-toggle:hover { background: rgba(255, 255, 255, 0.11); }


/* ===== 9. CARDS & SURFACES ===== */

/* ── Base card surface ── */
.dashboard-surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
}

/* ── Stat card, panel, lesson card, banner ── */
.dashboard-stat-card,
.dashboard-panel,
.dashboard-lesson-card,
.dashboard-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.dashboard-stat-card { position: relative; overflow: hidden; }

/* ── Lesson card hover ── */
.dashboard-lesson-card {
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.dashboard-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Generic card hover ── */
.card-hover {
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Dark mode cards ── */
.dark .dashboard-surface {
  background: linear-gradient(160deg, var(--bg-surface) 0%, var(--bg-base) 100%);
  border-color: var(--border);
  border-top-color: var(--border-medium);
  box-shadow: inset 0 1px 0 var(--border-medium), var(--shadow-md);
}

.dark .dashboard-stat-card,
.dark .dashboard-panel,
.dark .dashboard-banner {
  background: var(--bg-surface);
  border-color: var(--border);
  border-top-color: var(--border-medium);
  box-shadow: inset 0 1px 0 var(--border-medium), var(--shadow-md);
}

.dark .dashboard-lesson-card {
  background: linear-gradient(160deg, #152035 0%, #0F1A2C 100%);
  border-color: rgba(255, 255, 255, 0.06);
  border-top-color: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 8px rgba(0, 0, 0, 0.45);
}
.dark .dashboard-lesson-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 36px rgba(0, 0, 0, 0.60);
}

/* ── Continue banners ── */

/*
 * Both banner variants use dark backgrounds because the JS template
 * hard-codes text-white / text-white/60 / text-white/50 throughout.
 * Light-on-dark gives it the prominent "spotlight" feel it deserves.
 */

.continue-banner-resume {
  background: linear-gradient(135deg, #001d39 0%, #0a2f55 60%, #0a4174 100%);
  border: 1px solid rgba(123, 189, 232, 0.20);
  box-shadow:
    inset 0 1px 0 rgba(123, 189, 232, 0.12),
    0 8px 32px rgba(0, 29, 57, 0.40);
}

.continue-banner-next {
  background: linear-gradient(135deg, #0a2f55 0%, #0a4174 60%, #49769f 100%);
  border: 1px solid rgba(123, 189, 232, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(123, 189, 232, 0.10),
    0 8px 32px rgba(0, 29, 57, 0.30);
}

/* Glass CTA button — sits on top of the dark banner */
.banner-continue-btn {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 2px 10px rgba(0, 0, 0, 0.20) !important;
  transition: background var(--t-base), box-shadow var(--t-base), transform var(--t-fast) !important;
}
.banner-continue-btn:hover {
  background: rgba(255, 255, 255, 0.26) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30), 0 4px 18px rgba(0, 0, 0, 0.24) !important;
  transform: translateY(-1px) !important;
}
.banner-continue-btn:active { transform: scale(0.976) !important; }

/* Flashcard nudge */
.banner-fc-btn {
  background: white;
  border: 1px solid var(--border-medium);
  color: var(--text-2);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.banner-fc-btn:hover {
  background: var(--bg-raised);
  border-color: rgba(10, 65, 116, 0.30);
  color: var(--primary);
}

/* ── All-done banner ── */
.banner-done {
  background: linear-gradient(135deg, #001d39 0%, #0a2f55 50%, #49769f 100%);
  border: 1px solid rgba(123, 189, 232, 0.20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 28px rgba(0, 0, 0, 0.28);
}
/* Banner-done uses hardcoded text-[#1F2A44] for title (dark text on light bg in JS).
   Override to white since we now use a dark banner. */
.banner-done-title { color: #FFFFFF !important; }
.banner-done-desc  { color: rgba(255, 255, 255, 0.60) !important; }
.banner-done-btn {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 10px rgba(0, 0, 0, 0.18) !important;
  transition: background var(--t-base), box-shadow var(--t-base), transform var(--t-fast) !important;
}
.banner-done-btn:hover {
  background: rgba(255, 255, 255, 0.26) !important;
  transform: translateY(-1px) !important;
}

/* Also override banner-done inline style (set via JS) text colours
   (text-[#1F2A44] and text-[#5A6882] in JS template) */
.banner-done .text-\[\#1F2A44\] { color: #FFFFFF !important; }
.banner-done .text-\[\#5A6882\] { color: rgba(255, 255, 255, 0.60) !important; }
.banner-done .text-\[\#C6A75E\] { color: rgba(255, 255, 255, 0.55) !important; }

/* Overriding the amber-dot pulse inside the banner */
.continue-banner-resume .animate-pulse,
.continue-banner-next   .animate-pulse { background-color: rgba(255, 255, 255, 0.70) !important; }

/* Dark banners — already dark on light; on dark bg just deepen slightly */
.dark .continue-banner-resume {
  background: linear-gradient(135deg, #000d1a 0%, #001d39 60%, #0a2f55 100%);
  border-color: rgba(123, 189, 232, 0.25);
  box-shadow: inset 0 1px 0 rgba(123, 189, 232, 0.10), 0 12px 48px rgba(0, 0, 0, 0.70);
}
.dark .continue-banner-next {
  background: linear-gradient(135deg, #001523 0%, #0a2744 60%, #0a4174 100%);
  border-color: rgba(123, 189, 232, 0.20);
  box-shadow: inset 0 1px 0 rgba(123, 189, 232, 0.08), 0 12px 48px rgba(0, 0, 0, 0.60);
}
.dark .banner-continue-btn {
  background: rgba(255, 255, 255, 0.14) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 12px rgba(0, 0, 0, 0.30) !important;
}
.dark .banner-continue-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 4px 20px rgba(0, 0, 0, 0.36) !important;
}
.dark .banner-fc-btn {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--text-3) !important;
  border-color: var(--border) !important;
}
.dark .banner-fc-btn:hover { background: rgba(255, 255, 255, 0.08) !important; color: var(--text-1) !important; }
.dark .banner-done {
  background: linear-gradient(135deg, #070D1A 0%, #0E1828 50%, #0A1B40 100%) !important;
  border-color: rgba(255, 255, 255, 0.07) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 48px rgba(0, 0, 0, 0.80) !important;
}


/* ===== 10. CHIPS & BADGES ===== */

/* ── Filter chips ── */
.dashboard-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.dashboard-chip:hover { background: var(--bg-raised); color: var(--text-2); }

.dashboard-chip-active {
  background: var(--primary);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.dark .dashboard-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-3);
}
.dark .dashboard-chip:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-2); }
.dark .dashboard-chip-active {
  background: var(--primary);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* ── Hero label pill ── */
.hero-label-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-3);
  box-shadow: var(--shadow-xs);
}

.dark .hero-label-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-3);
}

/* ── User avatar ── */
.dark #user-avatar {
  background: var(--bg-raised) !important;
  border: 1px solid var(--border-medium) !important;
  color: var(--text-2) !important;
}
.dark #user-avatar:hover { background: var(--bg-elevated) !important; }


/* ===== 11. PROGRESS ===== */

.dashboard-progress-track { background: rgba(0, 0, 0, 0.06); }
.dashboard-progress-fill  { background: linear-gradient(90deg, var(--primary-hover), var(--primary)); }
.project-progress-track   { background: rgba(0, 0, 0, 0.06); }
.project-progress-fill    { background: var(--gold); }

.dark .dashboard-progress-track { background: rgba(255, 255, 255, 0.07); }
.dark .dashboard-progress-fill  {
  background: linear-gradient(90deg, var(--blue-700), var(--primary));
  box-shadow: 0 0 10px var(--primary-glow);
}
.dark .project-progress-track { background: rgba(255, 255, 255, 0.07); }
.dark .project-progress-fill  { background: linear-gradient(90deg, var(--gold), var(--gold-light)); box-shadow: 0 0 8px var(--gold-glow); }


/* ===== 12. SEARCH ===== */

.dashboard-search {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-1);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.dashboard-search:focus {
  border-color: rgba(87, 86, 214, 0.50);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
.dashboard-search::placeholder { color: var(--text-4); }

.dark .dashboard-search {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-1);
}
.dark .dashboard-search:focus {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(124, 122, 234, 0.45);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.dark .dashboard-search::placeholder { color: var(--text-4); }

/* Search clear button */
.dark #search-clear {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-3) !important;
}
.dark #search-clear:hover { background: rgba(255, 255, 255, 0.14) !important; }


/* ===== 13. SKELETON ===== */

.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-200) 50%, var(--ink-100) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  user-select: none;
}

.dark .skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-raised) 50%, var(--bg-surface) 75%);
  background-size: 400px 100%;
}


/* ===== 14. FORMS ===== */

.admin-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-1);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.admin-input:focus {
  border-color: rgba(87, 86, 214, 0.45);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

.auth-input { transition: border-color var(--t-base), box-shadow var(--t-base); }
.auth-input:focus {
  border-color: rgba(87, 86, 214, 0.50);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

.dark .admin-input,
.dark .auth-input {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}
.dark .admin-input:focus,
.dark .auth-input:focus {
  border-color: rgba(124, 122, 234, 0.48) !important;
  box-shadow: 0 0 0 3px var(--primary-soft) !important;
}

/* Generic input dark mode */
.dark input:not([type="checkbox"]):not([type="radio"]),
.dark textarea,
.dark select {
  background-color: rgba(255, 255, 255, 0.04) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}
.dark input::placeholder,
.dark textarea::placeholder { color: var(--text-4) !important; }
.dark input:focus:not([type="checkbox"]):not([type="radio"]),
.dark textarea:focus {
  border-color: rgba(124, 122, 234, 0.48) !important;
  box-shadow: 0 0 0 3px var(--primary-soft) !important;
}


/* ===== 15. LESSON PROSE ===== */

.lesson-prose h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 1.5rem 0 0.5rem;
}
.lesson-prose h2:first-child { margin-top: 0; }

.lesson-prose h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 1.1rem 0 0.375rem;
}

.lesson-prose p {
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.lesson-prose ul {
  list-style: disc;
  padding-left: 1.25rem;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}
.lesson-prose ul li {
  margin-bottom: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ── Numbered steps ── */
.lesson-prose ol {
  list-style: none;
  counter-reset: lesson-steps;
  padding-left: 0;
  margin-bottom: 0.75rem;
}
.lesson-prose ol li {
  counter-increment: lesson-steps;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.6;
}
.lesson-prose ol li::before {
  content: counter(lesson-steps);
  min-width: 1.375rem;
  height: 1.375rem;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.175rem;
}

/* ── Inline code ── */
.lesson-prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--blue-50);
  color: var(--blue-700);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--blue-100);
}

/* ── Keyboard shortcut ── */
.lesson-prose kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75em;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.45em;
  color: var(--text-1);
  white-space: nowrap;
}

/* ── Code block ── */
.lesson-prose pre {
  background: #0D1117;
  color: #E6EDF3;
  padding: 1rem 1rem 1rem 1.1rem;
  border-radius: var(--r-lg);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.7;
  margin: 0.875rem 0;
  font-family: var(--font-mono);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.lesson-prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}
.lesson-prose pre .code-label {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}

/* ── Formula token colors ── */
.lesson-prose .tok-fn   { color: #60A5FA; font-weight: 600; }
.lesson-prose .tok-ref  { color: #34D399; }
.lesson-prose .tok-str  { color: #FCD34D; }
.lesson-prose .tok-num  { color: #C084FC; }
.lesson-prose .tok-op   { color: #F9A8D4; }
.lesson-prose .tok-punc { color: #64748B; }

/* ── Callouts ── */
.lesson-prose blockquote,
.lesson-prose .callout {
  background: var(--blue-50);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 0.875rem 0;
}
.lesson-prose blockquote p,
.lesson-prose .callout p {
  margin: 0;
  color: var(--blue-800);
  font-size: 0.9rem;
}

.lesson-prose blockquote.tip,
.lesson-prose .callout.tip {
  background: rgba(184, 146, 74, 0.06);
  border-left-color: var(--gold);
}
.lesson-prose blockquote.tip p,
.lesson-prose .callout.tip p { color: #7A5A1E; }

.lesson-prose blockquote.warning,
.lesson-prose .callout.warning {
  background: var(--warning-soft);
  border-left-color: var(--warning);
}
.lesson-prose blockquote.warning p,
.lesson-prose .callout.warning p { color: #92400E; }

.lesson-prose blockquote.example,
.lesson-prose .callout.example {
  background: rgba(139, 92, 246, 0.06);
  border-left-color: #8B5CF6;
}
.lesson-prose blockquote.example p,
.lesson-prose .callout.example p { color: #5B21B6; }

/* ── Dark prose ── */
.dark .lesson-prose h2 { color: var(--text-1); }
.dark .lesson-prose h3 { color: var(--text-2); }
.dark .lesson-prose p,
.dark .lesson-prose ul,
.dark .lesson-prose ol li { color: var(--text-2); }

.dark .lesson-prose code {
  background: var(--primary-soft);
  color: var(--blue-300);
  border-color: rgba(59, 130, 246, 0.20);
}
.dark .lesson-prose kbd {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
  color: var(--text-1);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.06);
}
.dark .lesson-prose ol li::before {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}
.dark .lesson-prose blockquote,
.dark .lesson-prose .callout {
  background: var(--primary-soft);
  border-left-color: var(--primary);
}
.dark .lesson-prose blockquote p,
.dark .lesson-prose .callout p { color: var(--blue-300); }

.dark .lesson-prose blockquote.tip,
.dark .lesson-prose .callout.tip { background: rgba(184, 146, 74, 0.07); border-left-color: var(--gold); }
.dark .lesson-prose blockquote.tip p,
.dark .lesson-prose .callout.tip p { color: var(--gold-light); }

.dark .lesson-prose blockquote.warning,
.dark .lesson-prose .callout.warning { background: var(--warning-soft); border-left-color: var(--warning); }
.dark .lesson-prose blockquote.warning p,
.dark .lesson-prose .callout.warning p { color: #FCD34D; }

.dark .lesson-prose blockquote.example,
.dark .lesson-prose .callout.example { background: rgba(139, 92, 246, 0.08); border-left-color: #A78BFA; }
.dark .lesson-prose blockquote.example p,
.dark .lesson-prose .callout.example p { color: #C4B5FD; }


/* ===== 16. LESSON LAYOUT ===== */

/* ── Lesson meta bar ── */
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-4);
  flex-shrink: 0;
}

.dark .lesson-meta { border-bottom-color: var(--border); color: var(--text-4); }

/* ── Task cards ── */
.task-card {
  transition: box-shadow var(--t-base), transform var(--t-fast);
}

.task-num {
  min-width: 1.5rem;
  height: 1.5rem;
}

/* Clickable task cards */
[data-task-id][style*="cursor"] {
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
[data-task-id][style*="cursor"]:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ── Lesson sheet panel ── */
@media (max-width: 768px) {
  .lesson-sheet-panel { min-height: 360px; }
}

/* ── Task hint / explain boxes ── */
.task-hint-box {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(217, 119, 6, 0.06);
  border: 1px solid rgba(217, 119, 6, 0.20);
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.5;
}
.task-explain-box {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* ── Lesson shell (replaces raw bg-gray-100 on body) ── */
.lesson-shell {
  background: var(--bg-base);
  color: var(--text-1);
}

/* ── Panel surfaces (aside + toolbar) ── */
.lesson-aside-panel {
  background: var(--bg-surface);
  border-color: var(--border);
}
.lesson-toolbar {
  background: var(--bg-surface);
  border-color: var(--border);
}
.lesson-tasks-border {
  border-top: 1px solid var(--border);
}
.lesson-tasks-toggle:hover { background: var(--bg-raised); }

/* ── Task cards — token-based text ── */
.task-card p.text-gray-800   { color: var(--text-1) !important; }
.task-card .text-gray-800    { color: var(--text-1) !important; }
.task-card .text-gray-700    { color: var(--text-2) !important; }
.task-card .text-xs.text-gray-400 { color: var(--text-4) !important; }
.task-card code              { background: var(--bg-raised) !important; color: var(--text-2) !important; }

/* Task card done / error states using tokens */
.task-card-success           { background: var(--success-soft); border: 1px solid rgba(22, 163, 74, 0.15); border-radius: 0.75rem; padding: 0.625rem 0.875rem; }
.task-card-error             { background: var(--danger-soft);  border: 1px solid rgba(220, 38, 38, 0.15);  border-radius: 0.75rem; padding: 0.625rem 0.875rem; }
.task-card                   { border-radius: 0.75rem; padding: 0.625rem 0.875rem; }

/* ── Formula pill ── */
.lesson-formula-pill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.125rem;
  padding: 0.5rem 0.875rem;
  background: var(--primary-soft);
  border: 1px solid oklch(62% 0.14 235 / 0.16);
  border-radius: var(--r-lg);
}
.lesson-formula-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  opacity: 0.75;
}
.lesson-formula-code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid oklch(62% 0.14 235 / 0.20);
  padding: 0.2em 0.6em;
  border-radius: var(--r-sm);
}

/* ── Dark lesson panels ── */
.dark .lesson-aside-panel  { background: var(--bg-base); border-color: var(--border); }
.dark .lesson-toolbar      { background: var(--bg-base); border-color: var(--border); }
.dark .lesson-tasks-border { border-color: var(--border); }
.dark .lesson-tasks-toggle:hover { background: rgba(255, 255, 255, 0.04); }

.dark .task-card-success { background: rgba(34, 197, 94, 0.07);  border-color: rgba(34, 197, 94, 0.18); }
.dark .task-card-error   { background: rgba(248, 113, 113, 0.07); border-color: rgba(248, 113, 113, 0.18); }

.dark .lesson-formula-pill {
  background: oklch(65% 0.12 220 / 0.08);
  border-color: oklch(65% 0.12 220 / 0.18);
}
.dark .lesson-formula-label { color: var(--primary-hover); }
.dark .lesson-formula-code  {
  background: oklch(65% 0.12 220 / 0.10);
  color: var(--primary-hover);
  border-color: oklch(65% 0.12 220 / 0.22);
}

.dark #lesson-aside        { background: var(--bg-base); border-color: var(--border); }
.dark #sheet-panel         { background: var(--bg-base); border-color: var(--border); }
.dark #mobile-tabs         { background: var(--bg-surface); border-color: var(--border); }
.dark #tasks-panel-body    { background: var(--bg-base); }
.dark #lesson-layout,
.dark #lesson-main         { background: var(--bg-base); }

.dark #lesson-main > div:first-child {
  background: var(--bg-base) !important;
  border-color: var(--border) !important;
}
.dark #lesson-main .text-gray-700 { color: var(--text-2) !important; }

/* Dark mode task instruction text (set inline by lesson.js) */
.dark .task-card .text-sm.font-medium { color: var(--text-1) !important; }
.dark .task-card .text-xs             { color: var(--text-3) !important; }
.dark #tasks-panel-toggle .text-sm.font-semibold { color: var(--text-1) !important; }
.dark #tasks-panel-toggle .text-xs    { color: var(--text-4) !important; }
.dark .task-hint-box  { background: rgba(217, 119, 6, 0.10) !important; color: var(--text-2) !important; border-color: rgba(217, 119, 6, 0.22) !important; }
.dark .task-explain-box { color: var(--text-3) !important; }
.dark #tasks-panel-body .text-gray-800 { color: var(--text-1) !important; }
.dark #tasks-panel-body .bg-gray-100   { background: rgba(255,255,255,0.06) !important; color: var(--text-2) !important; }
.dark #tasks-panel-body .text-gray-400 { color: var(--text-4) !important; }
.dark #tasks-panel-body .text-gray-700 { color: var(--text-2) !important; }
.dark #tasks-panel-body .bg-gray-200   { background: rgba(255,255,255,0.10) !important; }

/* Breadcrumb */
.dark #btn-back-lesson,
.dark #lesson-category,
.dark #lesson-title { color: var(--text-2) !important; }
.dark #btn-back-lesson:hover { color: var(--text-1) !important; }
.dark #lesson-difficulty {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--text-3) !important;
}
.dark #btn-reset {
  color: var(--text-3) !important;
  border-color: var(--border) !important;
}
.dark #btn-reset:hover { color: var(--text-1) !important; }


/* ===== 17. SHEET SIMULATOR ===== */

.sheet-container {
  font-family: 'Google Sans', 'Segoe UI', Arial, sans-serif;
}

.formula-pointing-mode [data-ref] { cursor: crosshair !important; }

.sheet-cell {
  min-width: 96px;
  max-width: 240px;
}
.sheet-cell:focus { outline: none; }
.sheet-cell[data-error] { color: var(--danger); font-style: italic; }

/* Sandbox */
#ref-panel { transition: width 0.2s var(--ease); }

/* Dark sheet */
.dark .sheet-container {
  background: var(--bg-base);
  border-color: var(--border);
}
.dark .sheet-col-header,
.dark .sheet-row-header,
.dark .sheet-corner {
  background-color: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text-3) !important;
}
.dark .sheet-container .bg-gray-50 { background-color: var(--bg-surface) !important; }
.dark .sheet-container input {
  background-color: var(--bg-base) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}
.dark .sheet-cell {
  background-color: var(--bg-base) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-1) !important;
}
.dark .sheet-cell.bg-indigo-50  { background-color: rgba(99, 102, 241, 0.14) !important; border-color: rgba(99, 102, 241, 0.40) !important; }
.dark .sheet-cell.bg-emerald-50 { background-color: rgba(59, 130, 246, 0.10) !important; border-color: rgba(59, 130, 246, 0.40) !important; }
.dark .sheet-cell.bg-red-50     { background-color: rgba(239, 68, 68, 0.10) !important;  border-color: rgba(239, 68, 68, 0.40) !important; }
.dark .sheet-cell.bg-blue-100   { background-color: rgba(59, 130, 246, 0.13) !important; border-color: rgba(59, 130, 246, 0.40) !important; }
.dark .sheet-container .bg-yellow-50 { background-color: rgba(245, 158, 11, 0.08) !important; }
.dark .sheet-cell-fill-preview { outline-color: var(--primary); background: var(--primary-soft) !important; }

/* Autocomplete / dropdown overlays */
.dark [class*="z-\[9999\]"],
.dark [class*="fixed"][class*="shadow-xl"][class*="bg-white"] {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow-lg) !important;
}
.dark .sheet-container [class*="hover:bg-gray-50"] { color: var(--text-1) !important; }
.dark .sheet-container [class*="border-b"]         { border-color: var(--border) !important; }
.dark .sheet-container [class*="text-gray-400"]    { color: var(--text-3) !important; }


/* ===== 18. TOASTS ===== */

#toast-container {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  border-radius: var(--r-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-base), transform var(--t-base);
  white-space: nowrap;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }

.toast-error   { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.toast-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.toast-info    { background: var(--bg-surface); color: var(--text-1); border: 1px solid var(--border-medium); }

.toast-action {
  margin-left: 0.25rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}


/* ===== 19. LESSON RAILS (App Store / Apple TV horizontal scroll) ===== */

.lesson-rail-section { margin-bottom: 3rem; }

/* ── Chapter header ── */
.lesson-rail-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.125rem;
  padding: 0 0.25rem;
}

.lesson-rail-title {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 1.625rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.15;
}

.lesson-rail-meta {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: 0;
  white-space: nowrap;
}

.lesson-rail-progress {
  flex: 0 0 80px;
  height: 2px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-left: 0.25rem;
  align-self: center;
}
.lesson-rail-progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary);
  transition: width 0.6s var(--ease);
}

/* ── Scroll outer wrapper (contains track + fade overlays) ── */
.lesson-rail-outer {
  position: relative;
  overflow: hidden;
}

/* Right fade — always on, dims when nothing to scroll */
.lesson-rail-outer::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 6px;
  width: 80px;
  background: linear-gradient(to left, var(--bg-base) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.25s;
}
/* Left fade — visible only when scrolled */
.lesson-rail-outer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 6px;
  width: 60px;
  background: linear-gradient(to right, var(--bg-base) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s;
}
.lesson-rail-outer.has-scroll-left::before  { opacity: 1; }
.lesson-rail-outer.has-scroll-right::after  { opacity: 1; }
.lesson-rail-outer:not(.has-scroll-right)::after { opacity: 0; }

/* ── Scroll buttons ── */
.rail-scroll-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.rail-scroll-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.rail-scroll-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-navy);
  transform: scale(1.05);
}
.rail-scroll-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
.dark .rail-scroll-btn {
  background: var(--bg-raised);
  border-color: var(--border-medium);
  color: var(--text-3);
}
.dark .rail-scroll-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--bg-base);
  border-color: var(--primary);
}

/* ── Scrollable track ── */
.lesson-rail-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: none;
  margin-left: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 80px; /* peek space + fade room */
}
.lesson-rail-track::-webkit-scrollbar { display: none; }

/* ── Individual rail card wrapper ── */
.lesson-rail-item {
  flex: 0 0 272px;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

@media (max-width: 480px) {
  .lesson-rail-item { flex: 0 0 88vw; }
}

/* ── Chapter divider line ── */
.lesson-rail-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border-medium) 0%, transparent 100%);
  margin: 0 0.25rem 2.75rem;
}

/* ── Dark mode rail ── */
.dark .lesson-rail-title   { color: var(--text-1); }
.dark .lesson-rail-meta    { color: var(--text-4); }
.dark .lesson-rail-divider { background: linear-gradient(90deg, var(--border) 0%, transparent 100%); }
.dark .lesson-rail-outer::after  { background: linear-gradient(to left, var(--bg-base) 0%, transparent 100%); }
.dark .lesson-rail-outer::before { background: linear-gradient(to right, var(--bg-base) 0%, transparent 100%); }

/* Rail cards — tighter padding on small rail size */
.lesson-rail-item .dashboard-lesson-card { height: 100%; }

/* ===== 19a. VIEW TOGGLE (rail ↔ map) ===== */

.view-toggle-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-raised);
  border-radius: 0.625rem;
  padding: 3px;
  border: 1px solid var(--border);
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  color: var(--text-4);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  background: none;
  border: none;
}

.view-toggle-btn:hover { color: var(--text-2); }

.view-toggle-btn.view-toggle-active {
  background: var(--bg-surface);
  color: var(--text-1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}

.dark .view-toggle-group {
  background: var(--bg-raised);
  border-color: var(--border-medium);
}
.dark .view-toggle-btn.view-toggle-active {
  background: var(--bg-elevated);
  color: var(--text-1);
}

/* ===== 19b. LESSON MAP VIEW ===== */

.lesson-map-section { margin-bottom: 2.25rem; }

.lesson-map-section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.lesson-map-section-title {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.lesson-map-section-meta {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-4);
}

.lesson-map-section-progress {
  flex: 0 0 60px;
  height: 2px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  align-self: center;
}
.lesson-map-section-progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary);
  transition: width 0.5s var(--ease);
}

.lesson-map-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
@media (min-width: 480px)  { .lesson-map-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .lesson-map-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .lesson-map-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1280px) { .lesson-map-grid { grid-template-columns: repeat(6, 1fr); } }

.lesson-map-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0.75rem 0.625rem;
  border-radius: 0.875rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: transform 0.13s ease, box-shadow 0.13s ease, border-color 0.13s ease;
  overflow: hidden;
  min-height: 96px;
}

.lesson-map-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.lesson-map-cell.map-cell-done {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: rgba(22, 163, 74, 0.18);
}
.lesson-map-cell.map-cell-done:hover { border-color: rgba(22, 163, 74, 0.30); }

.lesson-map-cell.map-cell-progress {
  border-color: var(--navy-300);
  box-shadow: 0 0 0 1px var(--navy-300);
}
.lesson-map-cell.map-cell-progress:hover {
  box-shadow: 0 0 0 1px var(--navy-300), var(--shadow-md);
}

.lesson-map-cell-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0.875rem 0.875rem 0 0;
}

.lesson-map-cell-num {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-4);
  margin-top: 0.35rem;
  margin-bottom: 0.3rem;
  letter-spacing: 0.04em;
}

.lesson-map-cell-title {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.lesson-map-cell-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.25rem;
}

.lesson-map-cell-diff {
  font-size: 0.575rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.lesson-map-cell-check {
  flex-shrink: 0;
  color: #16a34a;
}

.lesson-map-cell-prog {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--navy-800);
  flex-shrink: 0;
}

/* dark mode */
.dark .lesson-map-cell {
  background: var(--bg-surface);
  border-color: var(--border);
}
.dark .lesson-map-cell.map-cell-done {
  background: linear-gradient(135deg, rgba(22,163,74,0.08) 0%, rgba(22,163,74,0.04) 100%);
  border-color: rgba(22, 163, 74, 0.20);
}
.dark .lesson-map-cell.map-cell-progress {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 1px var(--navy-600);
}
.dark .lesson-map-section-title { color: var(--text-1); }
.dark .lesson-map-cell-title    { color: var(--text-1); }
.dark .lesson-map-cell-check    { color: #4ade80; }
.dark .lesson-map-cell-prog     { color: var(--navy-300); }

/* ===== 19. PREMIUM CARDS — Deep Ocean Navy ===== */

/* ── Card Surface (light) ── */
.premium-locked-card {
  position: relative;
  background: linear-gradient(145deg, #EEF6FC 0%, #DCEEf8 45%, #C8E1F2 100%) !important;
  border-color: rgba(10, 65, 116, 0.22) !important;
  box-shadow:
    0 0 0 1px rgba(10, 65, 116, 0.10),
    0 2px 18px rgba(10, 65, 116, 0.12),
    0 1px 4px rgba(0, 0, 0, 0.04) !important;
  transition:
    transform var(--t-base, 0.2s) ease-out,
    border-color var(--t-base, 0.2s) ease-out,
    box-shadow var(--t-base, 0.2s) ease-out;
  will-change: transform;
}

.premium-locked-card:hover {
  transform: translateY(-4px) scale(1.01) !important;
  border-color: rgba(10, 65, 116, 0.35) !important;
  box-shadow:
    0 0 0 1px rgba(10, 65, 116, 0.18),
    0 12px 40px rgba(10, 65, 116, 0.20),
    0 4px 10px rgba(0, 0, 0, 0.06) !important;
}

/* ── Sky shimmer top bar ── */
.premium-top-bar {
  height: 3px;
  background: linear-gradient(
    90deg,
    #49769f 0%,
    #7bbde8 30%,
    #bdd8e9 50%,
    #7bbde8 70%,
    #49769f 100%
  );
  background-size: 200% 100%;
  animation: premiumShimmer 2.4s linear infinite;
}

@keyframes premiumShimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── Navy badge ── */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.3125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: linear-gradient(135deg, #49769f 0%, #0a4174 100%);
  border-radius: var(--r-full, 9999px);
  box-shadow: 0 1px 8px rgba(10, 65, 116, 0.35);
}

/* ── Watermark ── */
.premium-watermark {
  position: absolute;
  top: 0.75rem;
  right: 0.875rem;
  opacity: 0.06;
  color: #0a4174;
  pointer-events: none;
  user-select: none;
}

/* ── Card Title ── */
.premium-locked-card .premium-card-title {
  color: #001d39;
}

/* ── CTA Button — ocean gradient ── */
.premium-unlock-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  background: linear-gradient(135deg, #4e8ea2 0%, #0a4174 100%);
  border: none;
  border-radius: var(--r-full, 9999px);
  box-shadow:
    0 2px 14px rgba(10, 65, 116, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition:
    box-shadow var(--t-base, 0.2s) ease-out,
    transform var(--t-fast, 0.15s) ease-out;
}

.premium-unlock-cta:hover {
  transform: translateY(-1px);
}

.premium-locked-card:hover .premium-unlock-cta {
  box-shadow:
    0 6px 24px rgba(10, 65, 116, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.premium-unlock-cta:active {
  transform: translateY(0);
}


/* ── DARK MODE — deep ocean ── */

.dark .premium-locked-card {
  background: linear-gradient(145deg, #001d39 0%, #0a2f55 55%, #0a4174 100%) !important;
  border-color: rgba(123, 189, 232, 0.25) !important;
  box-shadow:
    0 0 0 1px rgba(123, 189, 232, 0.10),
    inset 0 1px 0 rgba(123, 189, 232, 0.10),
    0 2px 20px rgba(0, 0, 0, 0.50),
    0 3px 10px rgba(0, 0, 0, 0.40) !important;
}

.dark .premium-locked-card:hover {
  transform: translateY(-4px) scale(1.01) !important;
  border-color: rgba(123, 189, 232, 0.45) !important;
  box-shadow:
    0 0 0 1px rgba(123, 189, 232, 0.22),
    inset 0 1px 0 rgba(123, 189, 232, 0.14),
    0 14px 48px rgba(10, 65, 116, 0.60),
    0 4px 16px rgba(0, 0, 0, 0.50) !important;
}

.dark .premium-locked-card .premium-card-title {
  color: #bdd8e9;
}

.dark .premium-watermark {
  opacity: 0.12;
  color: #7bbde8;
}

.dark .premium-unlock-cta {
  color: #001d39;
  background: linear-gradient(135deg, #7bbde8 0%, #bdd8e9 100%);
  box-shadow:
    0 3px 16px rgba(123, 189, 232, 0.40),
    0 0 0 1px rgba(123, 189, 232, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.dark .premium-locked-card:hover .premium-unlock-cta {
  box-shadow:
    0 6px 28px rgba(123, 189, 232, 0.55),
    0 0 0 1px rgba(123, 189, 232, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
}


/* ========================================
   ONBOARDING MODAL (DARK MODE)
======================================== */

.dark #onboarding-modal .relative.bg-white {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-xl) !important;
}

.dark #onboarding-modal .text-gray-900,
.dark #onboarding-modal .text-gray-800 {
  color: var(--text-1) !important;
}

.dark #onboarding-modal .text-gray-700 {
  color: var(--text-2) !important;
}

.dark #onboarding-modal .text-gray-500 {
  color: var(--text-3) !important;
}

.dark #onboarding-modal .bg-\[#FAF7F2\] {
  background: var(--bg-raised) !important;
  border-color: var(--border) !important;
}

.dark #onboarding-modal .bg-\[#FAF7F2\]:hover {
  background: var(--bg-elevated) !important;
}

/* ===== 20. PROJECTS ===== */

.project-shell {
  --project-accent:       oklch(62% 0.14 235);
  --project-accent-2:     oklch(62% 0.14 235);
  --project-accent-rgb:   192, 122, 48;
  --project-accent-2-rgb: 192, 122, 48;
  background: var(--bg-base);
  color: var(--text-1);
}

.project-surface,
.project-card,
.project-stage-card,
.project-cta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.project-hero { position: relative; overflow: hidden; }
.project-floating-orb { display: none; }

.project-metric {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.project-accent-tint {
  background: linear-gradient(135deg, rgba(var(--project-accent-rgb), 0.08), rgba(var(--project-accent-2-rgb), 0.04));
  border-color: rgba(var(--project-accent-rgb), 0.14);
}
.project-accent-soft   { background: rgba(var(--project-accent-rgb), 0.08); color: var(--primary); }
.project-accent-text   { color: var(--primary); }
.project-accent-border { border-color: rgba(var(--project-accent-rgb), 0.20); }

.project-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-3);
}

.project-stage-card {
  position: relative;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.project-stage-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.project-stage-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%);
  opacity: 0;
  transition: opacity var(--t-base);
}
.project-stage-card:hover::before { opacity: 1; }

.project-stage-complete { background: oklch(62% 0.14 235 / 0.06); border-color: oklch(62% 0.14 235 / 0.18); }
.project-stage-active   { background: oklch(62% 0.14 235 / 0.05); border-color: oklch(62% 0.14 235 / 0.16); }
.project-stage-locked   { background: var(--bg-surface); }

.project-stage-line { width: 2px; margin-left: 1.35rem; border-radius: var(--r-full); }

/* Dark projects */
.dark .project-surface,
.dark .project-card,
.dark .project-stage-card,
.dark .project-cta-card {
  background: var(--bg-surface);
  border-color: var(--border);
  border-top-color: var(--border-medium);
  box-shadow: inset 0 1px 0 var(--border-medium), var(--shadow-sm);
}
.dark .project-stage-card:hover { border-color: var(--border-medium); box-shadow: inset 0 1px 0 var(--border-medium), var(--shadow-md); }
.dark .project-pill { background: rgba(255, 255, 255, 0.04); border-color: var(--border); color: var(--text-3); }
.dark .project-stage-complete { background: oklch(65% 0.12 220 / 0.08); border-color: oklch(65% 0.12 220 / 0.22); border-top-color: oklch(65% 0.12 220 / 0.32); }
.dark .project-stage-active   { background: oklch(65% 0.12 220 / 0.06); border-color: oklch(65% 0.12 220 / 0.20); border-top-color: oklch(65% 0.12 220 / 0.28); }
.dark .project-stage-locked   { background: var(--bg-surface); }


/* ===== 21. FUNCTIONS PAGE ===== */

.func-cat {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-full);
  white-space: nowrap;
}

.func-cat-math        { background: var(--blue-50);  color: var(--blue-700); }
.func-cat-statistical { background: #FDF2F8; color: #9D174D; }
.func-cat-text        { background: #FFFBEB; color: #92400E; }
.func-cat-logical     { background: #F5F3FF; color: #5B21B6; }
.func-cat-date        { background: #F0F9FF; color: #0369A1; }
.func-cat-lookup      { background: #ECFDF5; color: #065F46; }
.func-cat-info        { background: var(--ink-50);   color: var(--text-2); }
.func-cat-array       { background: #F0FDFA; color: #0F766E; }
.func-cat-financial   { background: #F7FEE7; color: #3F6212; }
.func-cat-engineering { background: #FFF7ED; color: #9A3412; }
.func-cat-google      { background: var(--blue-50);  color: var(--blue-700); }
.func-cat-database    { background: #FEF2F2; color: #991B1B; }
.func-cat-web         { background: #ECFEFF; color: #0E7490; }

.dark .func-cat-math        { background: rgba(37, 99, 235, 0.10);   color: var(--blue-300); }
.dark .func-cat-statistical { background: rgba(236, 72, 153, 0.12);  color: #F9A8D4; }
.dark .func-cat-text        { background: rgba(245, 158, 11, 0.12);  color: #FCD34D; }
.dark .func-cat-logical     { background: rgba(139, 92, 246, 0.12);  color: #C4B5FD; }
.dark .func-cat-date        { background: rgba(14, 165, 233, 0.12);  color: #7DD3FC; }
.dark .func-cat-lookup      { background: rgba(16, 185, 129, 0.12);  color: #6EE7B7; }
.dark .func-cat-info        { background: rgba(255, 255, 255, 0.06); color: var(--text-3); }
.dark .func-cat-array       { background: rgba(20, 184, 166, 0.12);  color: #5EEAD4; }
.dark .func-cat-financial   { background: rgba(132, 204, 22, 0.12);  color: #BEF264; }
.dark .func-cat-engineering { background: rgba(249, 115, 22, 0.12);  color: #FDBA74; }
.dark .func-cat-google      { background: rgba(59, 130, 246, 0.12);  color: var(--blue-300); }
.dark .func-cat-database    { background: rgba(239, 68, 68, 0.12);   color: #FCA5A5; }
.dark .func-cat-web         { background: rgba(6, 182, 212, 0.12);   color: #67E8F9; }

.func-example-block {
  background: oklch(97% 0.018 65);
  border: 1px solid oklch(62% 0.14 235 / 0.14);
  color: oklch(42% 0.12 65);
}
.dark .func-example-block {
  background: var(--primary-soft);
  border-color: oklch(65% 0.12 220 / 0.18);
  color: var(--primary-hover);
}


/* ===== 22. MODALS ===== */

.modal-code-block {
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.modal-code-text  { color: var(--text-1); }

.modal-example-block {
  background: var(--primary-soft);
  border: 1px solid oklch(62% 0.14 235 / 0.16);
}
.modal-example-block code { color: oklch(46% 0.12 65); }

.modal-divider    { border-top: 1px solid var(--border); }
.modal-close-btn  { color: var(--text-3); }
.modal-close-btn:hover { color: var(--text-1); background: var(--bg-raised); }

.dark .modal-code-block   { background: rgba(255, 255, 255, 0.04); border-color: var(--border); }
.dark .modal-code-text    { color: var(--text-1); }
.dark .modal-example-block { background: var(--primary-soft); border-color: oklch(65% 0.12 220 / 0.18); }
.dark .modal-example-block code { color: var(--primary-hover); }
.dark .modal-divider      { border-top-color: var(--border); }
.dark .modal-close-btn    { color: var(--text-3); }
.dark .modal-close-btn:hover { color: var(--text-1); background: rgba(255, 255, 255, 0.07); }


/* ===== 23. UTILITIES ===== */

.stat-counter { font-variant-numeric: tabular-nums; }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Admin table */
#lessons-tbody tr { transition: background-color var(--t-fast); }

/* Badge grid */
#badges-container .text-2xl { line-height: 1; }


/* ===== 24. DARK MODE — TAILWIND OVERRIDES ===== */

.dark .bg-white           { background-color: var(--bg-surface)  !important; }
.dark .bg-gray-50,
.dark .bg-slate-50        { background-color: var(--bg-raised)   !important; }
.dark .bg-gray-100,
.dark .bg-slate-100       { background-color: var(--bg-surface)  !important; }
.dark .bg-gray-200        { background-color: #2A3A50            !important; }

.dark .border-gray-200,
.dark .border-slate-200   { border-color: var(--border)           !important; }
.dark .border-gray-100    { border-color: rgba(255,255,255,0.04)  !important; }
.dark .border-black\/\[0\.08\],
.dark .border-black\/\[0\.06\],
.dark .border-black\/\[0\.05\],
.dark .border-black\/\[0\.1\]  { border-color: var(--border)      !important; }
.dark .divide-gray-200 > * + * { border-color: var(--border)      !important; }

.dark .hover\:bg-gray-100:hover,
.dark .hover\:bg-gray-50:hover { background-color: var(--bg-raised) !important; }

/* Text overrides */
.dark .text-slate-950,
.dark .text-slate-900   { color: var(--text-1) !important; }
.dark .text-slate-800,
.dark .text-slate-700,
.dark .text-gray-800,
.dark .text-gray-700    { color: var(--text-2) !important; }
.dark .text-slate-600,
.dark .text-slate-500,
.dark .text-gray-600,
.dark .text-gray-500    { color: var(--text-3) !important; }
.dark .text-gray-400,
.dark .text-gray-300    { color: var(--text-4) !important; }
.dark .hover\:text-\[#1F2A44\]:hover { color: var(--text-1) !important; }

/* Feature pills on landing */
.dark span.px-3.py-1\.5.rounded-full.bg-white {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: var(--text-3) !important;
}

/* Step circles on landing */
.dark div.bg-gray-200.rounded-full {
  background: var(--bg-raised) !important;
  color: var(--text-3) !important;
}

/* Filter divider */
.dark .w-px.bg-black\/\[0\.08\] { background: rgba(255, 255, 255, 0.08) !important; }

/* Stat sub-labels */
.dark .dashboard-stat-card .text-sm { color: var(--text-3) !important; }

/* Hero label pill inner span */
.dark .hero-label-pill span { color: var(--text-3); }


/* ===== 25. LESSON CARDS — COMPONENT CLASSES ===== */

/*
 * These are applied by JS templates in dashboard.js:renderLessons()
 * and must exist or cards render with no colours / hierarchy.
 */

/* ── Card text roles ── */
.card-title    { color: var(--text-1); }
.card-desc     { color: var(--text-3); }
.card-meta     { color: var(--text-4); }
.card-category { color: var(--primary); font-size: 0.75rem; }

.dark .card-title    { color: var(--text-1); }
.dark .card-desc     { color: var(--text-3); }
.dark .card-meta     { color: var(--text-4); }
.dark .card-category { color: var(--primary-hover); }

/* Group hover: title picks up primary */
.group:hover .card-title { color: var(--primary); }
.dark .group:hover .card-title { color: var(--primary-hover); }

/* ── Completed badge ── */
.badge-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 10px 2px 6px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 600;
}

.dark .badge-done {
  color: #4ADE80;
  background: rgba(74, 222, 128, 0.10);
}

/* ── Difficulty badge colours ── */
.diff-beginner {
  background: #ECFDF5;
  color: #065F46;
}
.diff-intermediate {
  background: #FFF7ED;
  color: #9A3412;
}
.diff-advanced {
  background: #FEF2F2;
  color: #991B1B;
}
.diff-default {
  background: var(--bg-raised);
  color: var(--text-3);
}

.dark .diff-beginner     { background: rgba(74, 222, 128, 0.10); color: #4ADE80; }
.dark .diff-intermediate { background: rgba(251, 146, 60, 0.10); color: #FB923C; }
.dark .diff-advanced     { background: rgba(248, 113, 113, 0.10); color: #F87171; }
.dark .diff-default      { background: rgba(255, 255, 255, 0.06); color: var(--text-3); }

/* ── Top-bar status stripe ── */
.card-top-bar {
  display: block;
  border-radius: var(--r-3xl) var(--r-3xl) 0 0;   /* matches card's top corners */
}

.bar-done {
  background: linear-gradient(90deg, #22C55E 0%, #16A34A 100%);
}
.bar-progress {
  background: linear-gradient(90deg, var(--blue-400) 0%, var(--primary) 100%);
}
.bar-new {
  background: var(--border);
}

.dark .bar-done     { background: linear-gradient(90deg, #4ADE80 0%, #22C55E 100%); }
.dark .bar-progress { background: linear-gradient(90deg, var(--blue-400) 0%, var(--primary) 100%); box-shadow: 0 0 8px var(--primary-glow); }
.dark .bar-new      { background: rgba(255, 255, 255, 0.06); }


/* ===== 26. QUICK LINKS (dashboard hero sidebar) ===== */

.quick-link {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  text-decoration: none;
  transition:
    background    var(--t-fast),
    border-color  var(--t-fast),
    transform     var(--t-fast),
    box-shadow    var(--t-base);
}
.quick-link:hover {
  background: var(--blue-50);
  border-color: var(--blue-100);
  box-shadow: var(--shadow-sm);
}

.quick-link-title { color: var(--text-1); font-size: 0.875rem; }
.quick-link-desc  { color: var(--text-4); font-size: 0.75rem; }

.dark .quick-link {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}
.dark .quick-link:hover {
  background: var(--primary-soft);
  border-color: oklch(65% 0.12 220 / 0.20);
}
.dark .quick-link-title { color: var(--text-1); }
.dark .quick-link-desc  { color: var(--text-4); }


/* ===== 27. PROJECT CARDS — VISUAL IMPROVEMENTS ===== */

/*
 * The projects grid uses the same .dashboard-lesson-card shell as lessons,
 * but project cards have a tall gradient header (h-32) followed by a content area.
 * We scope all enhancements to #projects-grid to avoid touching lesson cards.
 */

/* ── Gradient header: taller + atmospheric depth ── */
#projects-grid .dashboard-lesson-card > div:first-child {
  position: relative;
  height: 9.5rem;        /* 152px — up from Tailwind h-32 = 128px */
  overflow: hidden;
}

/* Specular sheen on top-left of gradient */
#projects-grid .dashboard-lesson-card > div:first-child::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.04) 40%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--t-base);
}

/* Bottom atmospheric fade — makes card body feel grounded */
#projects-grid .dashboard-lesson-card > div:first-child::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.28), transparent);
  pointer-events: none;
  z-index: 1;
}

/* Emoji: smooth lift on hover */
#projects-grid .dashboard-lesson-card > div:first-child > span[class*="text-5xl"] {
  position: relative;
  z-index: 2;
  display: inline-block;
  transition:
    transform var(--t-slow) var(--ease-bounce),
    filter    var(--t-base) var(--ease);
}
#projects-grid .dashboard-lesson-card:hover > div:first-child > span[class*="text-5xl"] {
  transform: scale(1.16) translateY(-5px);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.34)) !important;
}

/* Card border glow on hover */
#projects-grid .dashboard-lesson-card:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px oklch(62% 0.14 235 / 0.10) !important;
}

.dark #projects-grid .dashboard-lesson-card:hover {
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px oklch(65% 0.12 220 / 0.14),
    0 0 30px oklch(65% 0.12 220 / 0.07) !important;
}

/* ── Status badge: glass pill in top-right of header ── */
#projects-grid .dashboard-lesson-card .absolute.top-3.right-3 {
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  transition: transform var(--t-base) var(--ease-bounce), box-shadow var(--t-base);
}
#projects-grid .dashboard-lesson-card:hover .absolute.top-3.right-3 {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

/* ── Project outcome box ── */
.project-outcome-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink-200);
  transition: border-left-color var(--t-base);
}
.dashboard-lesson-card:hover .project-outcome-box {
  border-left-color: var(--primary);
}

.dark .project-outcome-box {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  border-left-color: var(--border-medium);
}
.dark .dashboard-lesson-card:hover .project-outcome-box {
  border-left-color: var(--blue-500);
}

/* ── btn-gold → repurposed as navy CTA (legacy alias kept) ── */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.28);
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 2px 10px rgba(0, 0, 0, 0.20);
  transition: background var(--t-base), box-shadow var(--t-base), transform var(--t-fast);
}
.btn-gold:hover {
  background: rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30), 0 4px 18px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}
.btn-gold:active { transform: scale(0.976); }
.dark .btn-gold { background: rgba(255, 255, 255, 0.14); }
.dark .btn-gold:hover { background: rgba(255, 255, 255, 0.22); }

/* ── Active project banner — matches continue-banner-resume ── */
.projects-active-banner {
  background: linear-gradient(135deg, #001d39 0%, #0a2f55 60%, #0a4174 100%);
  border: 1px solid rgba(123, 189, 232, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(123, 189, 232, 0.14),
    0 8px 32px rgba(0, 29, 57, 0.38);
}

.dark .projects-active-banner {
  background: linear-gradient(135deg, #000d1a 0%, #001d39 60%, #0a2f55 100%);
  border-color: rgba(123, 189, 232, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(123, 189, 232, 0.12),
    0 12px 48px rgba(0, 0, 0, 0.60);
}

/* ── Project outcome box ── */
.project-outcome-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.dark .project-outcome-box {
  background: rgba(123, 189, 232, 0.05);
  border-color: rgba(123, 189, 232, 0.12);
}


/* ===== 28. PROJECT DETAIL PAGE ===== */

/*
 * project.html has its own inline header (no .liquid-header), floating orbs,
 * a progress card inside the gradient banner, a lesson arc with three distinct
 * stage states, and a CTA section whose accent colour is set per-project by JS.
 *
 * CSS variables used by JS: --project-accent-rgb (r, g, b  — no css rgb())
 */

/* ── 1. Header ─────────────────────────────────────────────────── */
.project-grid > header {
  background: var(--glass-bg) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border-bottom-color: var(--glass-border) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 0 rgba(0, 0, 0, 0.03) !important;
}
.dark .project-grid > header {
  background: rgba(10, 15, 30, 0.88) !important;
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.40) !important;
}

/* ── 2. Floating orbs ──────────────────────────────────────────── */
/*
 * These were disabled (display:none). Enabling them adds layered luminosity
 * depth to the gradient hero banner — like atmospheric light spheres.
 */
.project-floating-orb {
  display: block;
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  will-change: transform;
}
.project-floating-orb.one {
  width: 460px;
  height: 460px;
  top: -150px;
  right: -100px;
  background: rgba(255, 255, 255, 0.20);
  animation: orbDrift1 16s ease-in-out infinite;
}
.project-floating-orb.two {
  width: 300px;
  height: 300px;
  bottom: -80px;
  left: 6%;
  background: rgba(255, 255, 255, 0.12);
  animation: orbDrift2 20s ease-in-out infinite;
}

@keyframes orbDrift1 {
  0%, 100% { transform: translate(0, 0)       scale(1);    }
  33%       { transform: translate(-22px, 16px) scale(1.04); }
  66%       { transform: translate(15px, -12px) scale(0.97); }
}
@keyframes orbDrift2 {
  0%, 100% { transform: translate(0, 0)      scale(1);    }
  50%       { transform: translate(20px, -16px) scale(1.06); }
}

/* ── 3. Hero section ───────────────────────────────────────────── */

/* Project metric pills (hero stats row) */
.project-metric {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.20);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.project-metric:hover {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Summary card floats over the banner (-mt-6) — needs strong shadow */
#project-hero > .project-card {
  box-shadow:
    0 -4px 16px rgba(0, 0, 0, 0.06),
    var(--shadow-xl) !important;
}
.dark #project-hero > .project-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow:
    0 -4px 16px rgba(0, 0, 0, 0.25),
    var(--shadow-xl) !important;
}

/* Progress card inside the hero (glassmorphism on gradient bg) */
#project-hero aside.project-card {
  background: rgba(255, 255, 255, 0.13) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    0 4px 20px rgba(0, 0, 0, 0.18) !important;
}

/* ── 4. Outcome section ────────────────────────────────────────── */
/* project-accent-tint + project-card already handled by project-* classes.
   Just ensure the accent icon circle has a subtle glow. */
.project-accent-soft {
  background: rgba(var(--project-accent-rgb, 37, 99, 235), 0.08);
  color: rgba(var(--project-accent-rgb, 37, 99, 235), 1);
  transition: background var(--t-fast);
}

/* ── 5. Lesson arc ─────────────────────────────────────────────── */

/*
 * Three states: complete | active (in-progress) | locked
 * All share a left accent bar via ::before (clipped by overflow:hidden).
 * Active state is the PRIMARY interaction target — it gets strong elevation.
 */

.project-stage-card {
  position: relative;
  overflow: hidden;    /* clips ::before accent bar to border-radius */
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base);
}

/* Left accent bar — colored stripe at card left edge */
.project-stage-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  pointer-events: none;
  transition: opacity var(--t-base), box-shadow var(--t-base);
}

/* ── Completed stage ── */
.project-stage-complete {
  background: #F0FDF4;
  border: 1px solid rgba(34, 197, 94, 0.18);
}
.project-stage-complete::before {
  background: #22C55E;
  opacity: 0.80;
}

/* Completed icon glow */
.project-stage-complete .bg-emerald-500 {
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.36), 0 2px 6px rgba(0, 0, 0, 0.10) !important;
}

/* ── Active (in-progress) stage — primary focal point ── */
.project-stage-active {
  background: rgba(var(--project-accent-rgb, 37, 99, 235), 0.04);
  border: 1px solid rgba(var(--project-accent-rgb, 37, 99, 235), 0.22);
  box-shadow:
    0 0 0 1px rgba(var(--project-accent-rgb, 37, 99, 235), 0.08),
    0 4px 20px rgba(var(--project-accent-rgb, 37, 99, 235), 0.12),
    var(--shadow-md);
}
.project-stage-active::before {
  background: rgba(var(--project-accent-rgb, 37, 99, 235), 1);
  box-shadow: 2px 0 10px rgba(var(--project-accent-rgb, 37, 99, 235), 0.48);
  opacity: 1;
}
.project-stage-active:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(var(--project-accent-rgb, 37, 99, 235), 0.14),
    0 8px 32px rgba(var(--project-accent-rgb, 37, 99, 235), 0.18),
    var(--shadow-lg);
}

/* Active stage icon */
.project-stage-active .project-accent-soft {
  box-shadow: 0 4px 14px rgba(var(--project-accent-rgb, 37, 99, 235), 0.28);
}

/* ── Locked / not started stage ── */
.project-stage-locked {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  opacity: 0.78;
  transition: opacity var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}
.project-stage-locked::before {
  background: var(--ink-200);
  opacity: 0.5;
}
.project-stage-locked:hover {
  opacity: 1;
}

/* ── Connector lines between stages ── */
.project-stage-line {
  width: 2px;
  margin-left: 1.35rem;
  border-radius: var(--r-full);
  opacity: 0.55;
  transition: background var(--t-base), opacity var(--t-base);
}

/* ── 6. CTA section ────────────────────────────────────────────── */
.project-cta-card {
  position: relative;
  overflow: hidden;
}
/* Soft accent glow in top-left corner of CTA card */
.project-cta-card::after {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(var(--project-accent-rgb, 37, 99, 235), 0.10) 0%,
    transparent 70%
  );
  pointer-events: none;
  filter: blur(20px);
}

/* CTA button */
#btn-start {
  position: relative;
  z-index: 1;
  transition:
    transform var(--t-fast) var(--ease-bounce),
    box-shadow var(--t-base) !important;
}
#btn-start:hover {
  transform: translateY(-2px) !important;
  box-shadow:
    0 10px 32px rgba(var(--project-accent-rgb, 37, 99, 235), 0.44),
    0 2px 8px rgba(0, 0, 0, 0.10) !important;
}
#btn-start:active { transform: scale(0.974) !important; }

/* ── 7. Dark mode ──────────────────────────────────────────────── */

/* Completed */
.dark .project-stage-complete {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.16);
}
.dark .project-stage-complete::before { background: #4ADE80; }
.dark .project-stage-complete .bg-emerald-500 {
  background-color: rgba(34, 197, 94, 0.18) !important;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.20), 0 0 20px rgba(34, 197, 94, 0.12) !important;
}
.dark .project-stage-complete .bg-emerald-500 svg { color: #4ADE80 !important; }
.dark .bg-emerald-100     { background-color: rgba(34, 197, 94, 0.12) !important; }
.dark .text-emerald-700,
.dark .text-emerald-600   { color: #4ADE80 !important; }
.dark .border-emerald-200 { border-color: rgba(74, 222, 128, 0.22) !important; }
.dark a.border-emerald-200 {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #4ADE80 !important;
}
.dark a.border-emerald-200:hover { background-color: rgba(74, 222, 128, 0.10) !important; }

/* Active */
.dark .project-stage-active {
  background: rgba(var(--project-accent-rgb, 59, 130, 246), 0.08);
  border-color: rgba(var(--project-accent-rgb, 59, 130, 246), 0.26);
  box-shadow:
    0 0 0 1px rgba(var(--project-accent-rgb, 59, 130, 246), 0.10),
    0 4px 24px rgba(var(--project-accent-rgb, 59, 130, 246), 0.18),
    var(--shadow-md);
}
.dark .project-stage-active::before {
  box-shadow: 2px 0 12px rgba(var(--project-accent-rgb, 59, 130, 246), 0.60);
}
.dark .project-stage-active:hover {
  box-shadow:
    0 0 0 1px rgba(var(--project-accent-rgb, 59, 130, 246), 0.18),
    0 8px 36px rgba(var(--project-accent-rgb, 59, 130, 246), 0.26),
    var(--shadow-lg);
}

/* Locked */
.dark .project-stage-locked         { background: var(--bg-surface); border-color: var(--border); }
.dark .bg-slate-100                  { background-color: rgba(255, 255, 255, 0.07) !important; }
.dark .project-stage-locked a.border { background-color: rgba(255, 255, 255, 0.05) !important; }
.dark .project-stage-locked a.border:hover { background-color: var(--primary-soft) !important; }

/* Connector lines */
.dark .bg-emerald-300 { background-color: rgba(74, 222, 128, 0.32) !important; }
.dark .bg-slate-200   { background-color: rgba(255, 255, 255, 0.08) !important; }

/* CTA */
.dark .project-cta-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-raised) 100%) !important;
}
.dark #btn-start:hover {
  box-shadow:
    0 10px 32px rgba(var(--project-accent-rgb, 59, 130, 246), 0.48),
    0 2px 8px rgba(0, 0, 0, 0.30) !important;
}

/* Dark summary card */
.dark .project-surface .project-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   § 20  LEGACY HARDCODED COLOR OVERRIDES
   Maps old Tailwind arbitrary-value classes to new design tokens.
   Fixes every HTML page without touching each file individually.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Text ── */
.text-\[\#1F2A44\]               { color: var(--text-1)   !important; }
.text-\[\#5A6882\]               { color: var(--text-3)   !important; }
.text-\[\#C6A75E\]               { color: var(--primary)  !important; }
.text-\[\#A07B3D\]               { color: var(--text-3)   !important; }
.text-\[\#C7C7CC\]               { color: var(--text-4)   !important; }

/* ── Backgrounds ── */
.bg-\[\#FAF7F2\]                 { background-color: var(--bg-base)    !important; }
.bg-\[\#FAF4E8\]                 { background-color: var(--bg-base)    !important; }
.bg-\[\#F5EDD8\]                 { background-color: var(--bg-raised)  !important; }
.bg-\[\#1F2A44\]                 { background-color: var(--text-1)     !important; }
.bg-\[\#C6A75E\]                 { background-color: var(--primary)    !important; }

/* ── Hover states ── */
.hover\:text-\[\#1F2A44\]:hover  { color: var(--text-1)   !important; }
.hover\:text-\[\#C6A75E\]:hover  { color: var(--primary)  !important; }
.hover\:bg-\[\#FAF7F2\]:hover    { background-color: var(--bg-raised)  !important; }
.hover\:bg-\[\#F5EDD8\]:hover    { background-color: var(--bg-raised)  !important; }

/* ── Borders ── */
.border-\[\#D4BA76\/40\]         { border-color: var(--border-medium)  !important; }
.border-\[\#FAF7F2\]             { border-color: var(--bg-base)        !important; }
.border-\[\#C6A75E\]             { border-color: var(--primary)        !important; }

/* ── Dot / indicator pills ── */
.bg-\[\#C6A75E\].w-2.h-2         { background-color: var(--primary)    !important; }

/* ── Box shadow overrides for old amber glow ── */
[style*="rgba(198,167,94"]       { box-shadow: var(--shadow-primary)   !important; }


/* ===== FEATURE: CELL CASCADE ANIMATION ===== */
@keyframes cellCascade {
  0%   { box-shadow: inset 0 0 0 2000px rgba(16, 185, 129, 0.22); }
  60%  { box-shadow: inset 0 0 0 2000px rgba(16, 185, 129, 0.07); }
  100% { box-shadow: inset 0 0 0 2000px transparent; }
}
.sheet-cell-cascade { animation: cellCascade 0.7s var(--ease); }

/* ===== FEATURE: AHA MOMENT CELL CELEBRATION ===== */
@keyframes cellAha {
  0%   { box-shadow: 0 0 0 3px #10B981 inset, 0 0 16px rgba(16,185,129,0.5); transform: scale(1.07); background: rgba(16,185,129,0.18); }
  55%  { box-shadow: 0 0 0 2px #10B981 inset, 0 0 8px rgba(16,185,129,0.2);  transform: scale(0.98); background: rgba(16,185,129,0.08); }
  100% { box-shadow: none; transform: scale(1); background: transparent; }
}
.sheet-cell-aha {
  animation: cellAha 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 10;
}


/* ===== FEATURE: LESSON PATH (MAP VIEW REDESIGN) ===== */
.lesson-path-root { padding: 0.5rem 0; }
.lesson-path-section { margin-bottom: 2.5rem; }

.lesson-path-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}
.lesson-path-title {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
}
.lesson-path-meta { font-size: 0.7rem; font-weight: 500; color: var(--text-4); }
.lesson-path-bar {
  flex: 0 0 60px; height: 2px; background: var(--border);
  border-radius: var(--r-full); overflow: hidden; align-self: center;
}
.lesson-path-bar-fill {
  height: 100%; background: var(--primary);
  border-radius: var(--r-full); transition: width 0.5s var(--ease);
}

.lesson-path-timeline { position: relative; display: flex; flex-direction: column; }

.lesson-path-node { display: flex; align-items: flex-start; position: relative; }

.path-spine-line {
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--border);
  z-index: 0;
}
.path-spine-line.path-spine-done { background: #10B981; }
.path-spine-line.path-spine-last { display: none; }

.path-node-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0.875rem 0.625rem 0;
  text-decoration: none;
  flex: 1;
  border-radius: var(--r-lg);
  transition: background 0.15s;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.path-node-inner:hover { background: var(--bg-raised); }

.path-node-dot {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700;
  transition: all 0.2s var(--ease); position: relative; z-index: 1;
}
.path-dot-done {
  background: #10B981; color: #fff;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.path-dot-current {
  background: #3B82F6; color: #fff;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.18), 0 0 18px rgba(59,130,246,0.35);
  animation: pathNodePulse 2.2s var(--ease) infinite;
}
.path-dot-new {
  background: var(--bg-surface); border: 2px solid var(--border-medium); color: var(--text-4);
}
@keyframes pathNodePulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(59,130,246,0.18), 0 0 18px rgba(59,130,246,0.35); }
  50%     { box-shadow: 0 0 0 7px rgba(59,130,246,0.10), 0 0 28px rgba(59,130,246,0.50); }
}
.path-node-num { font-size: 0.8125rem; font-weight: 700; }

.path-node-content {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem;
}
.path-node-title {
  font-size: 0.875rem; font-weight: 600; color: var(--text-1); line-height: 1.3;
}
.lesson-path-node-new .path-node-title { color: var(--text-3); }

.path-node-meta { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }

.path-node-badge {
  font-size: 0.65rem; font-weight: 600;
  padding: 0.1rem 0.45rem; border-radius: 999px;
}
.path-node-badge.done     { background: #dcfce7; color: #15803d; }
.path-node-badge.progress { background: #eff6ff; color: #1d4ed8; }
.path-node-badge.new      { background: var(--bg-raised); color: var(--text-4); }

.path-node-progress {
  height: 2px; background: var(--border);
  border-radius: var(--r-full); overflow: hidden; margin-top: 0.125rem;
}
.path-node-progress-fill {
  height: 100%; background: #3B82F6;
  border-radius: var(--r-full); transition: width 0.4s var(--ease);
}

.dark .path-dot-new { background: var(--bg-raised); border-color: var(--border-medium); color: var(--text-4); }
.dark .path-node-badge.done     { background: rgba(22,163,74,0.12);   color: #4ade80; }
.dark .path-node-badge.progress { background: rgba(59,130,246,0.10);  color: #93c5fd; }
.dark .path-node-badge.new      { background: var(--bg-raised);       color: var(--text-4); }
.dark .path-node-title          { color: var(--text-1); }
.dark .lesson-path-node-new .path-node-title { color: var(--text-3); }
.dark .lesson-path-title        { color: var(--text-1); }

/* ── Curriculum Map Panel ──────────────────────────────────── */

.curmap-panel-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.5rem 0.875rem;
  border-bottom: 1px solid var(--border-1);
}

.curmap-panel-label {
  font-size: 0.625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--text-4);
}

.curmap-panel-count {
  font-size: 0.6rem; font-weight: 500;
  color: var(--text-5, var(--text-4));
  margin-left: auto;
}

.curmap-scroll {
  display: flex; align-items: center;
  overflow-x: auto;
  padding: 1rem 1.5rem 1.25rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.curmap-scroll::-webkit-scrollbar { display: none; }

.curmap-block {
  flex-shrink: 0;
  width: 96px;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.375rem;
  border-radius: 0.875rem;
  border: 1px solid transparent;
  transition: opacity 0.2s;
}

.curmap-block-done     { opacity: 0.55; }
.curmap-block-upcoming { opacity: 0.38; }
.curmap-block-active {
  background: rgba(123, 189, 232, 0.07);
  border-color: rgba(123, 189, 232, 0.22);
}

.curmap-ring-wrap {
  position: relative;
  width: 48px; height: 48px;
  flex-shrink: 0;
}

.curmap-ring-fill {
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.curmap-ring-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; line-height: 1;
}

.curmap-block-label {
  font-size: 0.6rem; font-weight: 600;
  color: var(--text-3);
  text-align: center; line-height: 1.35;
  max-width: 88px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.curmap-block-active .curmap-block-label { color: var(--text-1); font-weight: 700; }

.curmap-block-count {
  font-size: 0.55rem; font-weight: 500;
  color: var(--text-4);
}

.curmap-you-are-here {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.5rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: #7bbde8;
  background: rgba(123, 189, 232, 0.12);
  border: 1px solid rgba(123, 189, 232, 0.28);
  padding: 2px 5px; border-radius: 999px;
  white-space: nowrap; margin-top: 0.1rem;
}
.curmap-you-are-here::before {
  content: '';
  width: 4px; height: 4px; border-radius: 50%;
  background: #7bbde8;
  animation: curmap-pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.curmap-badge-hidden { visibility: hidden; }

@keyframes curmap-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.65); }
}

.curmap-connector {
  flex-shrink: 0;
  width: 2rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4);
  opacity: 0.4;
  margin-bottom: 1.75rem; /* nudge up to align with ring centers */
}

.dark .curmap-block-active {
  background: rgba(123, 189, 232, 0.09);
  border-color: rgba(123, 189, 232, 0.18);
}


/* ===== FEATURE: FORMULA ANATOMY OVERLAY ===== */
.formula-anatomy-panel {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.875rem 0.625rem;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-shrink: 0;
}
.formula-anatomy-panel::-webkit-scrollbar { display: none; }

.formula-anatomy-tokens {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 2px;
}

.fat {
  display: inline-flex; flex-direction: column; align-items: center;
  font-family: 'Fira Code','Cascadia Code','Courier New',monospace;
  font-size: 11.5px;
}
.fat-text  { padding: 1px 4px; border-radius: 3px; font-weight: 500; line-height: 1.5; }
.fat-label {
  font-size: 0.55rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; opacity: 0.65; margin-top: 1px; line-height: 1;
  font-family: var(--font-sans, sans-serif);
}

.fat-fn    .fat-text { color: #059669; background: #f0fdf4; }
.fat-range .fat-text { color: #2563eb; background: #eff6ff; }
.fat-ref   .fat-text { color: #7c3aed; background: #f5f3ff; }
.fat-num   .fat-text { color: #d97706; background: #fffbeb; }
.fat-str   .fat-text { color: #b45309; background: #fef3c7; }
.fat-op    .fat-text { color: #6b7280; }
.fat-paren .fat-text { color: #9ca3af; }
.fat-sep   .fat-text { color: #9ca3af; }
.fat-kw    .fat-text { color: #7c3aed; background: #f5f3ff; }
.fat-other .fat-text { color: var(--text-2); }

.fat-fn    .fat-label { color: #059669; }
.fat-range .fat-label { color: #2563eb; }
.fat-ref   .fat-label { color: #7c3aed; }
.fat-num   .fat-label { color: #d97706; }
.fat-str   .fat-label { color: #b45309; }

.dark .fat-fn    .fat-text { color: #4ade80;  background: rgba(16,185,129,0.10); }
.dark .fat-range .fat-text { color: #60a5fa;  background: rgba(59,130,246,0.10); }
.dark .fat-ref   .fat-text { color: #a78bfa;  background: rgba(124,58,237,0.10); }
.dark .fat-num   .fat-text { color: #fbbf24;  background: rgba(217,119,6,0.10); }
.dark .fat-str   .fat-text { color: #fcd34d;  background: rgba(180,83,9,0.10); }
.dark .fat-fn    .fat-label { color: #4ade80; }
.dark .fat-range .fat-label { color: #60a5fa; }
.dark .fat-ref   .fat-label { color: #a78bfa; }
.dark .fat-num   .fat-label { color: #fbbf24; }
.dark .fat-str   .fat-label { color: #fcd34d; }

.formula-anatomy-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-4); font-size: 11px; font-weight: 700;
  flex-shrink: 0; transition: all 0.15s; letter-spacing: -0.03em; font-family: monospace;
}
.formula-anatomy-btn:hover { background: var(--bg-raised); color: var(--text-2); border-color: var(--border-medium); }
.formula-anatomy-btn.active {
  background: var(--primary-soft); border-color: oklch(62% 0.14 235 / 0.4); color: var(--primary);
}


/* =================================================================
   CASELAB — Dark editorial design system
   ================================================================= */

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --cl-bg:        #06080E;
  --cl-surface:   #0D1120;
  --cl-surface2:  #111827;
  --cl-border:    rgba(255,255,255,0.07);
  --cl-border2:   rgba(255,255,255,0.13);
  --cl-text:      #EEF2F8;
  --cl-text2:     #8EA3B8;
  --cl-muted:     #42556B;
  --cl-accent:    var(--case-accent, #6366F1);
  --cl-gold:      #C6A75E;
  --cl-gold-soft: rgba(198,167,94,0.12);
  --cl-gold-glow: rgba(198,167,94,0.18);
}

/* ── Shared shell ────────────────────────────────────────────── */
.cl-shell,
.case-shell {
  background: var(--cl-bg);
  min-height: 100vh;
  color: var(--cl-text);
  font-family: var(--font-sans, system-ui, sans-serif);
}

/* ── Dark header override — CaseLab only ────────────────────── */
.cl-shell .liquid-header {
  background: rgba(6,8,14,0.82);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 1px 0 rgba(0,0,0,0.40);
}
.cl-shell .dashboard-title { color: #EEF2F8 !important; }
.cl-shell .brand-subtitle  { color: var(--cl-muted) !important; }
.cl-shell .liquid-nav {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -0.5px 0 rgba(0,0,0,0.25),
    0 4px 20px rgba(0,0,0,0.40);
}
.cl-shell .liquid-nav-indicator {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 2px 12px rgba(0,0,0,0.35);
}
.cl-shell .liquid-nav-item            { color: rgba(255,255,255,0.42); }
.cl-shell .liquid-nav-item.active     { color: #EEF2F8; font-weight: 600; }
.cl-shell .liquid-nav-item:not(.active):hover { color: rgba(255,255,255,0.82); }
.cl-shell .liquid-hamburger {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.60);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 10px rgba(0,0,0,0.35);
}
.cl-shell .liquid-hamburger:hover { background: rgba(255,255,255,0.10); color: #EEF2F8; }
.cl-shell #hamburger-icon    { color: rgba(255,255,255,0.60) !important; }
.cl-shell #user-avatar {
  background: rgba(255,255,255,0.08) !important;
  color: #EEF2F8 !important;
  border: 1px solid rgba(255,255,255,0.10);
}
.cl-shell #btn-logout       { color: var(--cl-muted) !important; }
.cl-shell #btn-logout:hover { color: rgba(255,255,255,0.72) !important; }

/* ================================================================
   CASELAB LISTING PAGE
   ================================================================ */

/* Hero */
.cl-hero {
  position: relative;
  padding: 5.5rem 1.5rem 4rem;
  text-align: center;
  overflow: hidden;
}

.cl-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 50% -5%,  rgba(198,167,94,0.09)  0%, transparent 60%),
    radial-gradient(ellipse 70% 55% at 15% 65%,  rgba(99,102,241,0.11)  0%, transparent 60%),
    radial-gradient(ellipse 55% 50% at 85% 25%,  rgba(139,92,246,0.08)  0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 105%, rgba(16,185,129,0.05)  0%, transparent 60%);
  animation: clBgPulse 12s ease-in-out infinite alternate;
}
@keyframes clBgPulse {
  from { opacity: 0.65; }
  to   { opacity: 1; }
}

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

.cl-hero-content { position: relative; z-index: 1; }

/* Premium badge */
.cl-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cl-gold);
  background: var(--cl-gold-soft);
  border: 1px solid rgba(198,167,94,0.28);
  border-radius: 100px;
  padding: 0.32rem 0.85rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 0 16px rgba(198,167,94,0.12);
}
.cl-premium-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cl-gold);
  box-shadow: 0 0 6px var(--cl-gold);
  animation: clDotPulse 2.5s ease-in-out infinite;
}

@keyframes clDotPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.65); }
}

.cl-wordmark {
  font-size: clamp(3.25rem, 9vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1;
  color: var(--cl-text);
  margin-bottom: 1.125rem;
  display: block;
}
.cl-wordmark span {
  background: linear-gradient(135deg, #C8B06A 0%, #E8D080 45%, #C6A75E 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cl-hero-sub {
  font-size: clamp(0.9rem, 2vw, 1.075rem);
  color: var(--cl-text2);
  max-width: 440px;
  margin: 0 auto 2.25rem;
  line-height: 1.65;
}

/* Stats row */
.cl-hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin: 0 auto;
  max-width: 380px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  overflow: hidden;
}
.cl-stat-item {
  flex: 1;
  padding: 0.875rem 0.5rem;
  text-align: center;
  position: relative;
}
.cl-stat-item + .cl-stat-item::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 1px;
  background: rgba(255,255,255,0.07);
}
.cl-stat-num {
  display: block;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--cl-text);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.3rem;
}
.cl-stat-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--cl-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Filter bar */
.cl-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 2rem 1.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.cl-filter-bar.cl-filter-bar-visible { opacity: 1; transform: translateY(0); }

.cl-filter-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: 100px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--cl-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}
.cl-filter-btn:hover { background: rgba(255,255,255,0.08); color: var(--cl-text2); border-color: rgba(255,255,255,0.10); }
.cl-filter-btn.active {
  background: var(--cl-gold-soft);
  border-color: rgba(198,167,94,0.35);
  color: var(--cl-gold);
  box-shadow: 0 0 12px rgba(198,167,94,0.08);
}

/* Cards grid */
.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.cl-card {
  display: block;
  text-decoration: none;
  background: var(--cl-surface);
  border: 1px solid var(--cl-border);
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.cl-card.cl-card-visible { opacity: 1; transform: translateY(0); }
.cl-card:hover {
  border-color: rgba(198,167,94,0.22);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.55),
    0 0 0 1px rgba(198,167,94,0.08),
    0 0 40px rgba(198,167,94,0.05);
  transform: translateY(-4px) !important;
}

/* Card cover */
.cl-card-cover {
  height: 148px;
  position: relative;
  overflow: hidden;
  background: #0A0D16;
}
.cl-card-cover-inner {
  position: absolute;
  inset: 0;
  transition: opacity 0.35s;
}
.cl-card:hover .cl-card-cover-inner { opacity: 1 !important; }

/* Dot grid instead of line grid — more premium */
.cl-card-cover-mesh {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.7;
}
.cl-card:hover .cl-card-cover-mesh { opacity: 1; }

/* Difficulty pill in cover top-left */
.cl-card-cover-diff {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  border: 1px solid currentColor;
  opacity: 0.75;
  backdrop-filter: blur(8px);
}

.cl-card-cover-formula {
  position: absolute;
  bottom: 14px;
  right: 14px;
  font-family: 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;
  font-size: 1.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.06);
  letter-spacing: -0.03em;
  user-select: none;
  transition: all 0.35s ease;
  line-height: 1;
}
.cl-card:hover .cl-card-cover-formula {
  color: rgba(255,255,255,0.16);
  transform: scale(1.04) translateX(-2px);
}

/* Gold shimmer line at top of cover on hover */
.cl-card-cover::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(198,167,94,0.35), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
}
.cl-card:hover .cl-card-cover::before { opacity: 1; }

.cl-card-accent-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
}

/* Card body */
.cl-card-body { padding: 1.25rem 1.375rem 1.5rem; }

.cl-card-company {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cl-muted);
  margin-bottom: 0.45rem;
}
.cl-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cl-text);
  line-height: 1.3;
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}
.cl-card-teaser {
  font-size: 0.82rem;
  color: var(--cl-text2);
  line-height: 1.55;
  margin-bottom: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cl-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.73rem;
  color: var(--cl-muted);
  margin-bottom: 0.75rem;
}
.cl-card-meta-item { display: flex; align-items: center; gap: 0.3rem; }
.cl-card-meta-dot  { color: rgba(255,255,255,0.12); }

.cl-tags  { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.125rem; }
.cl-tag {
  font-family: 'Fira Code', 'SF Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid;
  letter-spacing: 0.01em;
}

.cl-card-cta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cl-muted);
  transition: color 0.2s, gap 0.2s;
}
.cl-card:hover .cl-card-cta { color: var(--cl-gold); gap: 0.6rem; }

/* Coming soon */
.cl-coming-soon {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}
.cl-coming-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1.5rem;
  background: rgba(198,167,94,0.04);
  border: 1px dashed rgba(198,167,94,0.18);
  border-radius: 16px;
}
.cl-coming-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--cl-gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cl-gold);
}
.cl-empty-state { text-align: center; padding: 3rem 1.5rem; }


/* ================================================================
   CASE VIEWER PAGE
   ================================================================ */

/* Top nav */
.case-topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(7,9,15,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: box-shadow 0.3s;
}
.case-topnav.case-topnav-scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.case-topnav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cl-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s;
}
.case-topnav-back:hover { color: var(--cl-text); }
.case-topnav-center {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cl-text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-topnav-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--cl-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.case-meta-sep { color: var(--cl-border2); }

/* Main layout */
.case-layout {
  display: grid;
  grid-template-columns: 55fr 45fr;
  height: calc(100vh - 52px);
  margin-top: 52px;
}

/* Sheet panel (left, sticky) */
.case-sheet-panel {
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.25rem;
  background: #0D1117;
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

/* Panel header */
.case-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.case-panel-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}
.case-panel-progress {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.case-replay-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--cl-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.case-replay-btn:hover { background: rgba(255,255,255,0.12); color: var(--cl-text); }
.case-replay-btn.spinning svg { animation: replaySpin 0.55s cubic-bezier(0.4,0,0.2,1) forwards; }
@keyframes replaySpin { to { transform: rotate(360deg); } }
.case-panel-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--case-accent, #6366F1), #8B5CF6);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 0 8px color-mix(in srgb, var(--case-accent, #6366F1) 60%, transparent);
}

/* Sheet wrapper */
.case-sheet-wrapper {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: white;
  overflow: auto;
  min-height: 0;
  color: #111827;
}
.case-sheet-wrapper .sheet-container {
  font-size: 0.78rem;
  color: #111827;
}
.case-sheet-wrapper .sheet-cell { color: #111827 !important; }
.case-sheet-wrapper .sheet-col-header,
.case-sheet-wrapper .sheet-row-header,
.case-sheet-wrapper .sheet-corner { color: #6B7280 !important; background-color: #F9FAFB !important; }
.case-sheet-wrapper input { color: #111827 !important; }

/* Formula spotlight */
.case-formula-spotlight {
  flex-shrink: 0;
  min-height: 90px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 0.875rem 1.125rem;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}
.case-formula-spotlight.case-spotlight-active {
  border-color: color-mix(in srgb, var(--spot-color, #6366F1) 35%, transparent);
  background: color-mix(in srgb, var(--spot-color, #6366F1) 8%, transparent);
  box-shadow: inset 3px 0 0 var(--spot-color, #6366F1);
  animation: spotlightIn 0.3s ease both;
}
.case-formula-spotlight.case-spotlight-insight-active {
  border-color: rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.07);
  box-shadow: inset 3px 0 0 #10B981;
}
@keyframes spotlightIn {
  from { opacity: 0.4; transform: translateY(5px); }
  to   { opacity: 1;   transform: translateY(0); }
}
.case-spotlight-idle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.25);
  font-size: 0.78rem;
  height: 100%;
}
.case-spotlight-formula {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
  line-height: 1.2;
}
.case-spotlight-eq    { color: rgba(255,255,255,0.3); }
.case-spotlight-paren { color: rgba(255,255,255,0.3); }
.case-spotlight-desc  {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.58);
  font-family: system-ui, sans-serif;
  line-height: 1.45;
}
.case-spotlight-result {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #34D399;
  margin-top: 0.5rem;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  animation: spotlightResultIn 0.4s ease both;
}
.case-spotlight-result-arrow { color: rgba(255,255,255,0.25); font-weight: 400; }
@keyframes spotlightResultIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.case-spotlight-insight {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.55;
}

/* Chapter dots */
.case-chapter-dots {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  z-index: 10;
}
.case-chapter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  padding: 0;
}
.case-chapter-dot.active {
  background: var(--case-accent, #6366F1);
  transform: scale(1.75);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--case-accent, #6366F1) 25%, transparent);
}
.case-chapter-dot:hover:not(.active) {
  background: rgba(255,255,255,0.45);
  transform: scale(1.5);
}

/* Narrative column */
.case-narrative {
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Step sections */
.case-step {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 3.5rem 5rem 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.case-step.case-step-visible { opacity: 1; transform: translateY(0); }

.case-step-eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--step-accent, #6366F1);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.case-step-eyebrow::before {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  flex-shrink: 0;
}
.case-step-count {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.2);
  font-family: 'Fira Code', monospace;
}

.case-step-headline {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  color: #F1F5F9;
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin-bottom: 1.125rem;
}

.case-step-body {
  font-size: 1.0rem;
  color: #94A3B8;
  line-height: 1.78;
  max-width: 48ch;
}

.case-callout {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--step-accent, #6366F1);
  background: color-mix(in srgb, var(--step-accent, #6366F1) 8%, transparent);
  border-radius: 0 12px 12px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #E2E8F0;
  font-style: italic;
  line-height: 1.55;
}

.case-formula-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: color-mix(in srgb, currentColor 6%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  border-radius: 8px;
  padding: 0.375rem 0.875rem;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875rem;
  font-weight: 700;
  margin-top: 1.375rem;
  letter-spacing: -0.01em;
}

/* Finish row */
.case-finish-row {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
}
.case-finish-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cl-text2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.625rem 1.125rem;
  text-decoration: none;
  transition: all 0.2s;
}
.case-finish-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--cl-text);
  transform: translateX(-2px);
}

/* Cell flash animation (non-typewriter cells) */
@keyframes caseCellFlash {
  0%   { background: rgba(99,102,241,0.25); }
  100% { background: transparent; }
}
.case-cell-flash { animation: caseCellFlash 0.45s ease-out both; }

/* Mobile responsive */
@media (max-width: 900px) {
  .case-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .case-sheet-panel {
    position: relative;
    top: 0;
    height: auto;
    min-height: 420px;
  }
  .case-chapter-dots { display: none; }
  .case-step {
    min-height: auto;
    padding: 3.5rem 1.5rem;
  }
  .case-step-headline { font-size: 1.75rem; }
  .case-step-body { max-width: 100%; }
}
@media (max-width: 640px) {
  .cl-wordmark { font-size: 2.75rem; }
  .cl-grid { grid-template-columns: 1fr; }
  .case-topnav-meta { display: none; }
}

/* ===== 28. SLIM CONTINUE BANNERS ===== */

.continue-banner-slim {
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,29,57,0.20) !important;
}
.continue-banner-slim a {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.continue-banner-slim a:hover { opacity: 0.85; }

.banner-done-slim {
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #001d39 0%, #0a4174 100%);
  border: 1px solid rgba(123,189,232,0.20);
  box-shadow: 0 2px 12px rgba(0,29,57,0.18);
}
.dark .banner-done-slim {
  background: linear-gradient(90deg, #000d1a 0%, #001d39 100%);
}

/* ===== 29. HERO WIDGETS ===== */

/* ── Mini spreadsheet (dashboard hero) ── */
.sh-widget {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(10,65,116,0.10);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  font-size: 11px;
  user-select: none;
  width: 270px;
}
.sh-formulabar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 30px;
  background: #f8f9fa;
  border-bottom: 1px solid #dadce0;
}
.sh-ref {
  font-size: 10px;
  font-weight: 700;
  color: #0a4174;
  min-width: 22px;
}
.sh-fx {
  color: #80868b;
  font-size: 13px;
  font-weight: 300;
}
.sh-grid { display: flex; flex-direction: column; }
.sh-row {
  display: flex;
  border-bottom: 1px solid #e8eaed;
}
.sh-row:last-child { border-bottom: none; }
.sh-head-row { background: #f8f9fa; }
.sh-rn {
  width: 28px;
  min-width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #80868b;
  font-size: 10px;
  border-right: 1px solid #dadce0;
  background: #f8f9fa;
}
.sh-rn-active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 700;
}
.sh-ch {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #80868b;
  font-size: 10px;
  border-right: 1px solid #e8eaed;
}
.sh-ch:last-child { border-right: none; }
.sh-cell {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 7px;
  color: #202124;
  font-size: 11px;
  border-right: 1px solid #e8eaed;
  overflow: hidden;
  white-space: nowrap;
}
.sh-cell:last-child { border-right: none; }
.sh-right { justify-content: flex-end; }
.sh-col-label { color: #5f6368; font-weight: 600; font-size: 10px; }
.sh-bold-cell { font-weight: 700; color: #001d39; }
.sh-active-cell {
  border: 2px solid #1a73e8 !important;
  color: #1a73e8;
  padding: 0 5px;
}

/* Typing animation */
@keyframes sh-type {
  0%   { max-width: 0; }
  65%  { max-width: 110px; }
  85%  { max-width: 110px; }
  100% { max-width: 0; }
}
@keyframes sh-blink {
  50% { opacity: 0; }
}
.sh-typing {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  max-width: 0;
  animation: sh-type 3.5s steps(12, end) infinite;
  vertical-align: bottom;
}
.sh-cursor {
  animation: sh-blink 0.7s step-end infinite;
  color: #1a73e8;
}

/* Dark mode */
.dark .sh-widget {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.dark .sh-formulabar,
.dark .sh-head-row,
.dark .sh-rn {
  background: var(--bg-raised);
  border-color: var(--border);
}
.dark .sh-ch,
.dark .sh-cell { border-color: var(--border); color: var(--text-2); }
.dark .sh-col-label { color: var(--text-3); }
.dark .sh-bold-cell { color: var(--text-1); }
.dark .sh-active-cell { border-color: #4a9eff !important; color: #4a9eff; }
.dark .sh-cursor { color: #4a9eff; }
.dark .sh-rn-active { background: rgba(74,158,255,0.15); color: #4a9eff; }

/* ── Stacked project card deck (projects hero) ── */
.proj-deck-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 164px;
  background: #fff;
  border: 1px solid rgba(10,65,116,0.12);
  border-radius: 16px;
  padding: 18px 16px 14px;
  box-shadow: 0 4px 18px rgba(10,65,116,0.10);
}
.proj-deck-emoji {
  font-size: 26px;
  display: block;
}
.proj-deck-title {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1F2A44;
}
.proj-deck-dots {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.proj-deck-dot {
  width: 20px;
  height: 4px;
  border-radius: 9999px;
  background: #e8eaed;
}
.proj-deck-dot--filled { background: #0a4174; }
.proj-deck-meta {
  margin-top: 6px;
  font-size: 10px;
  color: #80868b;
}

.dark .proj-deck-card {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
.dark .proj-deck-title { color: var(--text-1); }
.dark .proj-deck-dot { background: var(--border-medium); }
.dark .proj-deck-dot--filled { background: var(--navy-300); }
.dark .proj-deck-meta { color: var(--text-4); }
