/* Mobile-First LeetCode Articles CSS */

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Add keyframe animations */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes backgroundShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive Stats Grid */
@media (max-width: 768px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: calc(1rem * var(--mobile-scale)) !important;
    margin-bottom: calc(1.5rem * var(--mobile-scale)) !important;
  }
}

@media (max-width: 480px) {
  .stats-grid-4 {
    grid-template-columns: 1fr !important;
    gap: calc(1rem * var(--mobile-scale)) !important;
    margin-bottom: calc(1.5rem * var(--mobile-scale)) !important;
  }
}

/* Home page stats cards scaling - Override inline styles */
.stats-grid-4 {
  gap: calc(1rem * var(--mobile-scale)) !important;
  margin-bottom: calc(1.5rem * var(--mobile-scale)) !important;
}

.stats-grid-4 > div {
  border-radius: calc(12px * var(--mobile-scale)) !important;
  padding: calc(1.5rem * var(--mobile-scale)) calc(1rem * var(--mobile-scale)) !important;
}

.stats-grid-4 > div > div:first-child {
  border-radius: 0 calc(12px * var(--mobile-scale)) 0 calc(50px * var(--mobile-scale)) !important;
  width: calc(50px * var(--mobile-scale)) !important;
  height: calc(50px * var(--mobile-scale)) !important;
}

.stats-grid-4 > div > div:nth-child(2) {
  font-size: calc(2rem * var(--mobile-scale)) !important;
  margin-bottom: calc(0.25rem * var(--mobile-scale)) !important;
}

.stats-grid-4 > div > div:nth-child(3) {
  font-size: calc(0.85rem * var(--mobile-scale)) !important;
}

/* Desktop home page scaling */
@media (min-width: 1024px) {
  .stats-grid-4 {
    gap: calc(1rem * var(--desktop-scale)) !important;
    margin-bottom: calc(1.5rem * var(--desktop-scale)) !important;
  }
  
  .stats-grid-4 > div {
    border-radius: calc(12px * var(--desktop-scale)) !important;
    padding: calc(1.5rem * var(--desktop-scale)) calc(1rem * var(--desktop-scale)) !important;
  }
  
  .stats-grid-4 > div > div:first-child {
    border-radius: 0 calc(12px * var(--desktop-scale)) 0 calc(50px * var(--desktop-scale)) !important;
    width: calc(50px * var(--desktop-scale)) !important;
    height: calc(50px * var(--desktop-scale)) !important;
  }
  
  .stats-grid-4 > div > div:nth-child(2) {
    font-size: calc(2rem * var(--desktop-scale)) !important;
    margin-bottom: calc(0.25rem * var(--desktop-scale)) !important;
  }
  
  .stats-grid-4 > div > div:nth-child(3) {
    font-size: calc(0.85rem * var(--desktop-scale)) !important;
  }
}

:root {
  /* Responsive Scaling - Best Practices Implementation */
  
  /* Mobile scaling - Default to comfortable size */
  --mobile-scale: 1.0;
  
  /* Desktop scaling - Default for standard desktop (1024px-1440px) */
  --desktop-scale: 0.9;
  
  /* Viewport-based scaling for different screen sizes */
  --content-max-width: 1200px; /* Prevent content from becoming too wide */
  --sidebar-max-scale: 1.0;     /* Keep sidebars reasonable on large screens */
  
  /* Fluid Typography - Prevents text from being too large on big screens */
  --fluid-font-size-sm: clamp(0.8rem, 0.7rem + 0.5vw, 1.0rem);
  --fluid-font-size-base: clamp(0.9rem, 0.8rem + 0.5vw, 1.1rem);
  --fluid-font-size-lg: clamp(1.1rem, 1.0rem + 0.5vw, 1.3rem);
  --fluid-font-size-xl: clamp(1.3rem, 1.2rem + 0.5vw, 1.6rem);
  
  /* Responsive spacing */
  --spacing-scale: clamp(0.8, 0.7 + 0.5vw, 1.2);
  
  /* User preference classes for JavaScript control */
  --user-mobile-scale: var(--mobile-scale);
  --user-desktop-scale: var(--desktop-scale);
  
  /* Resizable Column Variables - User can adjust these */
  --lists-width: calc(22% * 2 / 3);
  --problems-width: calc(26% * 2 / 3);
  --min-lists-width: 250px;
  --max-lists-width: 400px;
  --min-problems-width: 300px;
  --max-problems-width: 500px;
  --resize-handle-width: 4px;
  
  /* Responsive column constraints */
  --min-content-width: 400px;
  --max-combined-sidebars: 65%;
}

/* ========================================
   USER SCALE PREFERENCE CLASSES
   ======================================== */

/* Mobile Scale Options */
body.mobile-scale-small, html.mobile-scale-small { --mobile-scale: 0.85; }
body.mobile-scale-compact, html.mobile-scale-compact { --mobile-scale: 0.9; }  
body.mobile-scale-normal, html.mobile-scale-normal { --mobile-scale: 1.0; }
body.mobile-scale-comfortable, html.mobile-scale-comfortable { --mobile-scale: 1.1; }
body.mobile-scale-large, html.mobile-scale-large { --mobile-scale: 1.2; }

/* Desktop Scale Options */
body.desktop-scale-tiny, html.desktop-scale-tiny { --desktop-scale: 0.75; }
body.desktop-scale-compact, html.desktop-scale-compact { --desktop-scale: 0.85; }
body.desktop-scale-normal, html.desktop-scale-normal { --desktop-scale: 0.9; }
body.desktop-scale-comfortable, html.desktop-scale-comfortable { --desktop-scale: 1.0; }
body.desktop-scale-large, html.desktop-scale-large { --desktop-scale: 1.1; }

html, body {
  margin: 0 !important;
  font-family: 'Inter', 'Roboto', Arial, sans-serif !important;
  background: linear-gradient(135deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%) !important;
  background-size: 200% 200% !important;
  animation: backgroundShift 20s ease infinite;
  color: #24292f !important;
  height: 100vh;
  overflow-x: hidden;
}

/* Mobile Ribbon (Top Bar) */
/* Mobile Ribbon */
#mobile-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(48px * var(--mobile-scale));
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(16px * var(--mobile-scale));
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
  z-index: 1000;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#mobile-ribbon-title {
  font-size: calc(16px * var(--mobile-scale));
  font-weight: 800;
  text-align: center;
  flex: 1;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.mobile-nav-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: calc(36px * var(--mobile-scale));
  height: calc(36px * var(--mobile-scale));
  border-radius: calc(10px * var(--mobile-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.mobile-nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.mobile-nav-btn:hover::before {
  opacity: 1;
}

.btn-icon {
  font-size: 16px;
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  z-index: 1;
  position: relative;
}

.mobile-nav-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

#mobile-ribbon-actions {
  display: flex;
  gap: 4px;
}

/* Mobile Container */
#mobile-container {
  display: flex;
  min-height: 100vh;
  height: auto;
  flex-direction: column;
  padding-top: calc(84px * var(--mobile-scale)); /* Space for ribbon (48px) + breadcrumb (36px) */
}

/* Mobile Breadcrumb Navigation */
.mobile-breadcrumb-nav {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  padding: calc(4px * var(--mobile-scale)) calc(12px * var(--mobile-scale));
  position: fixed;
  top: calc(48px * var(--mobile-scale));
  left: 0;
  right: 0;
  z-index: 999;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  height: calc(36px * var(--mobile-scale));
}

.mobile-breadcrumb {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--mobile-scale));
  font-size: calc(14px * var(--mobile-scale));
  color: #64748b;
  flex-wrap: nowrap;
  overflow: hidden;
  width: 100%;
  min-height: calc(28px * var(--mobile-scale));
  padding: calc(2px * var(--mobile-scale)) 0;
}

.mobile-breadcrumb-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  padding: calc(6px * var(--mobile-scale)) calc(10px * var(--mobile-scale));
  border-radius: calc(8px * var(--mobile-scale));
  transition: all 0.2s ease;
  cursor: pointer;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: calc(13px * var(--mobile-scale));
}

.mobile-breadcrumb-link:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

/* Home breadcrumb - compact width */
#mobile-breadcrumb-home {
  min-width: calc(60px * var(--mobile-scale));
  max-width: calc(60px * var(--mobile-scale));
  text-align: center;
}

/* List breadcrumb - flexible width for priority display */
#mobile-breadcrumb-list {
  min-width: calc(100px * var(--mobile-scale));
  max-width: calc(180px * var(--mobile-scale));
  text-align: left;
}

.mobile-breadcrumb-link:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.mobile-breadcrumb-text {
  color: #1e293b;
  font-weight: 500;
  padding: calc(6px * var(--mobile-scale)) calc(8px * var(--mobile-scale));
  border-radius: calc(8px * var(--mobile-scale));
  text-transform: capitalize;
  font-size: calc(13px * var(--mobile-scale));
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
}

.mobile-breadcrumb-arrow {
  color: #94a3b8;
  font-weight: 300;
  margin: 0 calc(4px * var(--mobile-scale));
  flex-shrink: 0;
  font-size: calc(12px * var(--mobile-scale));
  opacity: 0.7;
}

.mobile-back-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0969da;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mobile-back-button:hover {
  background: #0860ca;
}

.mobile-back-button:active {
  transform: scale(0.95);
}

.back-arrow {
  font-size: calc(16px * var(--mobile-scale));
}

/* Removed duplicate rule - consolidated above */

/* Removed duplicate rule - consolidated above */

.mobile-breadcrumb-link:hover {
  color: #0860ca;
  text-decoration: underline;
}

/* Removed duplicate rule - consolidated above */

.mobile-action-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0; /* Remove bottom margin since it's now part of the content background */
  padding: 8px 12px;
  background: transparent; /* Remove individual background */
  border: none; /* Remove individual border */
  box-shadow: none; /* Remove individual shadow */
  border-radius: 0; /* Remove individual border radius */
  flex-wrap: nowrap;
  gap: 6px;
}

/* Inline Code Controls (within headings) */
.code-control-inline {
  opacity: 0.8;
  transition: opacity 0.2s ease;
  vertical-align: bottom;
}

.code-control-inline:hover {
  opacity: 1;
}

/* Removed duplicate rule - consolidated above */

/* Mobile Content Area */
.mobile-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mobile-view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* Special handling for mobile lists view to allow expansion */
#mobile-lists-view.mobile-view {
  flex: 0 1 auto;
  overflow-y: visible;
  min-height: fit-content;
  height: auto;
  /* Ensure smooth adjustments during accordion operations */
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Lists View */
#mobile-lists-sidebar {
  background: #e5e7eb;
  padding: calc(16px * var(--mobile-scale));
  margin-top: calc(8px * var(--mobile-scale));
  min-height: fit-content;
  height: auto;
}

#mobile-lists-list {
  list-style: none;
  padding: calc(24px * var(--mobile-scale)) calc(24px * var(--mobile-scale)) calc(12px * var(--mobile-scale)) calc(24px * var(--mobile-scale));
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--mobile-scale));
  background: #ffffff;
  border-radius: calc(12px * var(--mobile-scale));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  width: 100%;
  box-sizing: border-box;
  min-height: fit-content;
  height: auto;
  /* Ensure smooth container height adjustments during accordion animations */
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-lists-list li {
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  transition: none;
  width: 100%;
  box-sizing: border-box;
}

/* Apply original main branch styling to individual category list items - MOBILE ONLY */
@media (max-width: 1023px) {
  .category-list-item {
    margin: 0;
    border-radius: calc(12px * var(--mobile-scale));
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #d1d5db;
    overflow: visible;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
  }

  /* Apply hover effects to individual category list items */
  .category-list-item:hover {
    transform: translateY(calc(-2px * var(--mobile-scale)));
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }

  .category-list-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

#mobile-lists-list a {
  display: block;
  padding: 0;
  text-decoration: none;
  color: #1e293b;
  transition: all 0.2s ease;
  position: relative;
}

.mobile-list-header {
  padding: calc(14px * var(--mobile-scale)) calc(18px * var(--mobile-scale));
}

#mobile-lists-list a:hover {
  background: #f9fafb;
}

#mobile-lists-list a:active {
  background: #e2e8f0;
}

.mobile-list-icon {
  font-size: calc(18px * var(--mobile-scale));
  min-width: calc(24px * var(--mobile-scale));
  height: calc(24px * var(--mobile-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: calc(6px * var(--mobile-scale));
  color: white;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
  margin-top: calc(2px * var(--mobile-scale));
}

.mobile-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--mobile-scale));
  min-width: 0;
}

.mobile-list-title {
  font-size: calc(18px * var(--mobile-scale));
  font-weight: 500;
  line-height: 1.3;
  color: #1e293b;
}

.mobile-list-title-with-icon-and-dots {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.mobile-list-icon-and-title {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--mobile-scale));
  flex: 1;
  min-width: 0;
}

.mobile-list-count {
  font-size: calc(13px * var(--mobile-scale));
  font-weight: 500;
  color: #64748b;
  opacity: 0.8;
  margin-top: calc(4px * var(--mobile-scale));
}

.mobile-list-description {
  font-size: calc(13px * var(--mobile-scale));
  line-height: 1.3;
  color: #64748b;
  margin-top: calc(4px * var(--mobile-scale));
}

/* Inline difficulty dots within count text */
.difficulty-dot-inline {
  display: inline-block;
  width: calc(8px * var(--mobile-scale));
  height: calc(8px * var(--mobile-scale));
  border-radius: 50%;
  margin-right: calc(2px * var(--mobile-scale));
  vertical-align: middle;
}

.difficulty-dot-inline.easy {
  background: #15803d;
}

.difficulty-dot-inline.medium {
  background: #ca8a04;
}

.difficulty-dot-inline.hard {
  background: #dc2626;
}

.mobile-list-text {
  flex: 1;
  font-size: calc(16px * var(--mobile-scale));
  font-weight: 600;
  line-height: 1.4;
  color: #1e293b;
}

.mobile-list-arrow {
  color: #64748b;
  font-size: calc(16px * var(--mobile-scale));
  font-weight: 600;
  opacity: 0.7;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: calc(2px * var(--mobile-scale));
}

#mobile-lists-list a:hover .mobile-list-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* Problems View */
#mobile-sidebar {
  background: #e5e7eb;
  padding: 16px;
  margin-top: 8px;
}

#mobile-file-list {
  list-style: none;
  padding: 24px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  flex: 1;
  overflow-y: auto;
}

/* Quick Action Buttons for Problem Lists */
.mobile-list-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: calc(12px * var(--mobile-scale));
  padding: calc(12px * var(--mobile-scale)) calc(16px * var(--mobile-scale));
  background: #ffffff;
  border-radius: calc(12px * var(--mobile-scale));
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
  gap: calc(8px * var(--mobile-scale));
}

/* Welcome message styling - override flex alignment to center */
.mobile-welcome-message {
  justify-content: center;
}

.mobile-action-button {
  background: #6f42c1;
  color: white;
  border: none;
  padding: 0.2em 0.5em;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.65em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  line-height: 1;
  vertical-align: middle;
  gap: 4px;
  transition: all 0.2s ease;
}

.mobile-start-button {
  background: #10b981;
}

.mobile-start-button:hover {
  background: #059669;
  transform: translateY(-1px);
}

.mobile-random-button {
  background: #f59e0b;
}

.mobile-random-button:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.mobile-action-button:active {
  transform: scale(0.95);
}

#mobile-file-list li {
  margin: 0;
  border-radius: calc(12px * var(--mobile-scale));
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  overflow: hidden;
  transition: all 0.3s ease;
  min-height: calc(60px * var(--mobile-scale));
}

#mobile-file-list li:hover {
  transform: translateY(calc(-2px * var(--mobile-scale)));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

#mobile-file-list li:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#mobile-file-list a {
  display: flex;
  align-items: center;
  padding: calc(16px * var(--mobile-scale)) calc(18px * var(--mobile-scale));
  text-decoration: none;
  color: #1e293b;
  transition: all 0.2s ease;
  gap: calc(12px * var(--mobile-scale));
}

#mobile-file-list a:hover {
  background: #f8fafc;
}

#mobile-file-list a:active {
  background: #e2e8f0;
}

.mobile-problem-number {
  font-size: calc(13px * var(--mobile-scale));
  color: #475569;
  font-weight: 600;
  min-width: calc(45px * var(--mobile-scale));
  padding: calc(4px * var(--mobile-scale)) calc(8px * var(--mobile-scale));
  background: #f1f5f9;
  border-radius: calc(6px * var(--mobile-scale));
  text-align: center;
  border: 1px solid #e2e8f0;
}

.mobile-problem-title {
  flex: 1;
  font-size: calc(15px * var(--mobile-scale));
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1e293b;
}

/* Difficulty indicators for list cards */
.mobile-list-difficulty-indicators {
  display: flex;
  gap: calc(6px * var(--mobile-scale));
  align-items: center;
  flex-shrink: 0;
}

.mobile-difficulty-dot {
  width: calc(10px * var(--mobile-scale));
  height: calc(10px * var(--mobile-scale));
  border-radius: 50%;
  transition: opacity 0.2s ease;
}

.mobile-difficulty-dot.easy {
  background: #15803d;
}

.mobile-difficulty-dot.medium {
  background: #ca8a04;
}

.mobile-difficulty-dot.hard {
  background: #dc2626;
}

/* Difficulty dots for problem lists */
.mobile-problem-difficulty-dot {
  width: calc(12px * var(--mobile-scale));
  height: calc(12px * var(--mobile-scale));
  border-radius: 50%;
  flex-shrink: 0;
}

.mobile-problem-difficulty-dot.easy {
  background: #15803d;
}

.mobile-problem-difficulty-dot.medium {
  background: #ca8a04;
}

.mobile-problem-difficulty-dot.hard {
  background: #dc2626;
}

.mobile-problem-difficulty {
  font-size: calc(11px * var(--mobile-scale));
  font-weight: 700;
  padding: calc(5px * var(--mobile-scale)) calc(10px * var(--mobile-scale));
  border-radius: calc(8px * var(--mobile-scale));
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mobile-problem-difficulty.easy {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.2);
}

.mobile-problem-difficulty.medium {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.mobile-problem-difficulty.hard {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Content View */
#mobile-content {
  flex: 1;
  background: #e5e7eb;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(16px * var(--mobile-scale));
  margin-top: calc(8px * var(--mobile-scale));
}

.mobile-content-inner {
  background: #ffffff;
  border-radius: calc(12px * var(--mobile-scale));
  padding: calc(24px * var(--mobile-scale));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  max-width: none;
  line-height: 1.6;
  margin: 0 auto;
}

.mobile-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: calc(12px * var(--mobile-scale));
  padding: calc(12px * var(--mobile-scale)) calc(16px * var(--mobile-scale));
  background: #ffffff;
  border-radius: calc(12px * var(--mobile-scale));
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
  gap: calc(8px * var(--mobile-scale));
}

.mobile-action-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: calc(8px * var(--mobile-scale)) calc(16px * var(--mobile-scale));
  border-radius: calc(8px * var(--mobile-scale));
  font-size: calc(13px * var(--mobile-scale));
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-action-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.mobile-action-btn:active {
  transform: scale(0.95);
}

.mobile-action-btn:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  border: 1px solid #cbd5e1;
}

.mobile-action-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Typography for mobile content */
.mobile-content-inner h1 {
  font-size: calc(24px * var(--mobile-scale));
  font-weight: 700;
  margin-bottom: calc(16px * var(--mobile-scale));
  color: #24292f;
  line-height: 1.3;
}

.mobile-content-inner h2 {
  font-size: calc(20px * var(--mobile-scale));
  font-weight: 600;
  margin: calc(24px * var(--mobile-scale)) 0 calc(16px * var(--mobile-scale)) 0;
  color: #24292f;
  line-height: 1.3;
}

.mobile-content-inner h3 {
  font-size: calc(18px * var(--mobile-scale));
  font-weight: 600;
  margin: calc(20px * var(--mobile-scale)) 0 calc(12px * var(--mobile-scale)) 0;
  /* color: #5b6fe8; */
  color: #2364b5;
  line-height: 1.3;
}

.mobile-content-inner h3:first-of-type {
  margin-top: calc(24px * var(--mobile-scale));
}

.mobile-content-inner p {
  margin-bottom: calc(16px * var(--mobile-scale));
  color: #24292f;
  font-size: calc(16px * var(--mobile-scale));
  line-height: 1.6;
}

.mobile-content-inner code {
  background: #f6f8fa;
  padding: calc(2px * var(--mobile-scale)) calc(6px * var(--mobile-scale));
  border-radius: calc(4px * var(--mobile-scale));
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: calc(14px * var(--mobile-scale));
  color: #24292f;
}

.mobile-content-inner pre {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: calc(8px * var(--mobile-scale));
  padding: calc(14px * var(--mobile-scale));
  overflow-x: auto;
  margin: calc(16px * var(--mobile-scale)) 0;
  font-size: calc(13px * var(--mobile-scale));
  line-height: 1.45;
  /* Mobile code optimizations */
  tab-size: 3;
  -moz-tab-size: 3;
  -webkit-tab-size: 3;
  white-space: pre;
  word-wrap: break-word;
  /* Improved scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  /* Better readability */
  font-family: 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  /* Mobile scroll indicator */
  position: relative;
}

/* Add scroll hint for mobile */
.mobile-content-inner pre::-webkit-scrollbar {
  height: 4px;
}

.mobile-content-inner pre::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.mobile-content-inner pre::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
}

.mobile-content-inner pre::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* Syntax Highlighting for Code Blocks */
.hljs {
  background: #f6f8fa;
  color: #24292f;
  /* Mobile optimizations */
  font-size: inherit;
  line-height: inherit;
}

/* Ensure proper font family for HLJS elements in desktop content */
.desktop-content-inner .hljs,
.mobile-content-inner .hljs {
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
}

.desktop-content-inner code.hljs,
.mobile-content-inner code.hljs {
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  background: #f6f8fa;
  color: #24292f;
}

.desktop-content-inner pre.hljs,
.mobile-content-inner pre.hljs {
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  background: #f6f8fa;
  color: #24292f;
}

/* Enhanced Syntax Highlighting - GitHub Colors with Better Contrast */
.hljs-keyword {
  color: #cf222e !important;
  font-weight: 600 !important;
}

/* Function names */
.hljs-title.function_ {
  color: #8250df !important;
  font-weight: 600 !important;
}

/* Parameters and variables */
.hljs-params {
  color: #953800 !important;
}

/* Numbers */
.hljs-number {
  color: #0550ae !important;
  font-weight: 500 !important;
}

/* Comments */
.hljs-comment {
  color: #656d76 !important;
  font-style: italic !important;
  /* Better mobile readability for comments */
  line-height: 1.3;
}

/* Built-in functions (range, len) */
.hljs-built_in {
  color: #0550ae !important;
  font-weight: 500 !important;
}

/* Strings */
.hljs-string {
  color: #0a3069 !important;
}

/* Operators */
.hljs-operator {
  color: #cf222e !important;
}

/* General syntax elements */
.hljs-punctuation {
  color: #24292f !important;
}

/* Attributes and properties */
.hljs-attr,
.hljs-attribute {
  color: #8250df !important;
}

/* Class names */
.hljs-class .hljs-title {
  color: #8250df !important;
  font-weight: 600 !important;
}

/* Variables and identifiers */
.hljs-variable,
.hljs-name {
  color: #953800 !important;
}

.mobile-content-inner pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.45;
  /* Mobile code optimizations */
  tab-size: 3;
  -moz-tab-size: 3;
  -webkit-tab-size: 3;
  white-space: pre;
  /* Improved font for mobile readability */
  font-family: 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  /* Better text rendering on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mobile-content-inner a {
  color: #0969da;
  text-decoration: none;
}

.mobile-content-inner a:hover {
  text-decoration: underline;
}

.mobile-content-inner blockquote {
  border-left: 4px solid #d0d7de;
  padding: 0 16px;
  margin: 16px 0;
  color: #656d76;
}

.mobile-content-inner ul, .mobile-content-inner ol {
  padding-left: calc(24px * var(--mobile-scale));
  margin-bottom: calc(16px * var(--mobile-scale));
}

.mobile-content-inner li {
  margin-bottom: calc(8px * var(--mobile-scale));
  color: #24292f;
  font-size: calc(16px * var(--mobile-scale));
  line-height: 1.6;
}

/* Ensure all text elements have consistent styling */
.mobile-content-inner *:not(button):not(.tag-button):not(a):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(code):not(.hljs):not(.heart) {
  color: inherit;
  font-family: inherit;
}

.mobile-content-inner * {
  font-family: inherit;
}

.mobile-content-inner strong,
.mobile-content-inner b {
  font-weight: 600;
  color: #24292f;
}

.mobile-content-inner em,
.mobile-content-inner i {
  font-style: italic;
  color: #24292f;
}

/* Author footnote */
.mobile-author-footnote {
  text-align: center;
  margin-top: calc(24px * var(--mobile-scale));
  padding: calc(20px * var(--mobile-scale));
  border-top: 2px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: calc(14px * var(--mobile-scale));
  font-weight: 400;
}

.heart {
  color: #dc2626 !important;
  font-weight: 600;
  animation: heartbeat 2s ease-in-out infinite;
  text-shadow: 0 1px 2px rgba(220, 38, 38, 0.4);
}

.mobile-author-footnote .heart,
.desktop-content-inner .mobile-author-footnote .heart {
  color: #dc2626 !important;
  font-weight: 600;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Share FAB */
.mobile-share-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0969da;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 16px rgba(9, 105, 218, 0.3);
  transition: all 0.2s ease;
  z-index: 200;
}

/* Feedback FAB */
.mobile-feedback-fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6f42c1;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 16px rgba(111, 66, 193, 0.3);
  transition: all 0.2s ease;
  z-index: 200;
}

.mobile-share-fab:hover {
  background: #0860ca;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(9, 105, 218, 0.4);
}

.mobile-share-fab:active {
  transform: scale(0.95);
}

.mobile-feedback-fab:hover {
  background: #5a2d91;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

.mobile-feedback-fab:active {
  transform: scale(0.95);
}

/* Mobile Modals */
.mobile-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-modal.flex {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
}

.mobile-modal-content {
  background-color: #ffffff;
  margin: 5vh auto;
  padding: 0;
  border-radius: calc(12px * var(--mobile-scale));
  width: 90%;
  max-width: calc(500px * var(--mobile-scale));
  max-height: 70vh;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: calc(12px * var(--mobile-scale)) calc(12px * var(--mobile-scale)) 0 0;
}

.mobile-modal-header h3 {
  margin: 0;
  font-size: calc(18px * var(--mobile-scale));
  font-weight: 600;
  color: white;
}

.mobile-close-btn {
  color: rgba(255, 255, 255, 0.8);
  font-size: calc(28px * var(--mobile-scale));
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
  width: calc(30px * var(--mobile-scale));
  height: calc(30px * var(--mobile-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.mobile-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-modal-body {
  padding: calc(16px * var(--mobile-scale));
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-modal-body input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 16px;
}

.mobile-modal-body input[type="text"]:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.mobile-search-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mobile-search-filters label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #24292f;
    cursor: pointer;
  }

  /* Mobile Search Results */
  #mobile-search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f8fafc;
    margin-top: 16px;
  }

  .mobile-search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-search-result-item:hover {
    background: #ffffff;
    transform: translateX(2px);
  }

  .mobile-search-result-item:last-child {
    border-bottom: none;
  }

  .mobile-search-result-title {
    font-weight: 500;
    color: #1e293b;
    font-size: 15px;
    line-height: 1.4;
  }

  .mobile-search-result-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-search-result-difficulty {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .mobile-search-result-difficulty.easy {
    background: #dcfce7;
    color: #15803d;
  }

  .mobile-search-result-difficulty.medium {
    background: #fef3c7;
    color: #d97706;
  }

  .mobile-search-result-difficulty.hard {
    background: #fecaca;
    color: #dc2626;
  }

  .mobile-search-section-header {
    padding: 12px 16px 8px 16px;
    margin: 0 -8px;
    background: #f6f8fa;
    border-top: 1px solid #e1e5e9;
    border-bottom: 1px solid #e1e5e9;
    font-size: 12px;
    font-weight: 600;
    color: #656d76;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .mobile-search-section-header:first-child {
    border-top: none;
  }

  .mobile-setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.mobile-setting-item label {
  font-size: 14px;
  font-weight: 500;
  color: #24292f;
}

.mobile-setting-item select {
  padding: 8px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
  color: #24292f;
}

/* Mobile Toast */
.mobile-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #24292f;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mobile-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Desktop Toast */
.desktop-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #24292f;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.desktop-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Dark theme toast styling */
body.dark-theme .mobile-toast {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
  border: 1px solid #d1d5db !important;
}

body.dark-theme .desktop-toast {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
  border: 1px solid #d1d5db !important;
}

/* Feedback Modal Styles */
.feedback-field {
  margin-bottom: calc(16px * var(--mobile-scale));
}

.feedback-field label {
  display: block;
  margin-bottom: calc(6px * var(--mobile-scale));
  font-weight: 600;
  color: #24292f;
  font-size: calc(13px * var(--mobile-scale));
}

.feedback-field input[type="text"],
.feedback-field select,
.feedback-field textarea {
  width: 100%;
  padding: calc(10px * var(--mobile-scale));
  border: 2px solid #d1d5db;
  border-radius: calc(6px * var(--mobile-scale));
  font-size: calc(14px * var(--mobile-scale));
  color: #24292f;
  background: #ffffff;
  transition: border-color 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.feedback-field input[type="text"]:focus,
.feedback-field select:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.feedback-field textarea {
  resize: vertical;
  min-height: calc(100px * var(--mobile-scale));
}

.feedback-actions {
  display: flex;
  gap: calc(12px * var(--mobile-scale));
  justify-content: flex-end;
  padding: calc(16px * var(--mobile-scale)) calc(16px * var(--mobile-scale));
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 0 0 calc(12px * var(--mobile-scale)) calc(12px * var(--mobile-scale));
  flex-shrink: 0;
}

.feedback-btn-cancel,
.feedback-btn-submit {
  padding: calc(10px * var(--mobile-scale)) calc(16px * var(--mobile-scale));
  border: none;
  border-radius: calc(6px * var(--mobile-scale));
  font-size: calc(13px * var(--mobile-scale));
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: calc(80px * var(--mobile-scale));
  min-height: calc(40px * var(--mobile-scale)); /* Better touch target for mobile */
  touch-action: manipulation; /* Prevent zoom on tap */
}

.feedback-btn-cancel {
  background: #f6f8fa;
  color: #24292f;
  border: 1px solid #d1d5db;
}

.feedback-btn-cancel:hover {
  background: #f3f4f6;
  border-color: #afb8c1;
}

.feedback-btn-submit {
  background: #0969da;
  color: #ffffff;
}

.feedback-btn-submit:hover {
  background: #0550ae;
}

.feedback-btn-submit:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Dark theme feedback modal styles */
body.dark-theme .feedback-field label {
  color: #f0f6fc;
}

body.dark-theme .feedback-field input[type="text"],
body.dark-theme .feedback-field select,
body.dark-theme .feedback-field textarea {
  background: #21262d;
  border-color: #30363d;
  color: #f0f6fc;
}

body.dark-theme .feedback-field input[type="text"]:focus,
body.dark-theme .feedback-field select:focus,
body.dark-theme .feedback-field textarea:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

body.dark-theme .feedback-btn-cancel {
  background: #21262d;
  color: #f0f6fc;
  border-color: #30363d;
}

body.dark-theme .feedback-btn-cancel:hover {
  background: #30363d;
  border-color: #484f58;
}

body.dark-theme .feedback-actions {
  border-color: #30363d;
  background: #0d1117;
}

/* Dark theme desktop feedback modal styles */
body.dark-theme .desktop-feedback-field label {
  color: #f0f6fc;
}

body.dark-theme .desktop-feedback-field input[type="text"],
body.dark-theme .desktop-feedback-field select,
body.dark-theme .desktop-feedback-field textarea {
  background: #21262d;
  border-color: #30363d;
  color: #f0f6fc;
}

body.dark-theme .desktop-feedback-field input[type="text"]:focus,
body.dark-theme .desktop-feedback-field select:focus,
body.dark-theme .desktop-feedback-field textarea:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

body.dark-theme .desktop-feedback-btn-cancel {
  background: #21262d;
  color: #f0f6fc;
  border-color: #30363d;
}

body.dark-theme .desktop-feedback-btn-cancel:hover {
  background: #30363d;
  border-color: #484f58;
}

/* Loading Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Bulb Animation */
@keyframes bulbGlow {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
    filter: brightness(1);
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.1);
    filter: brightness(1.3);
  }
}

.bulb-animation {
  animation: bulbGlow 2s ease-in-out infinite;
  display: inline-block;
}

/* Modal Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-50px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Difficulty Badges */
.difficulty-badge {
  display: inline-block;
  margin-right: 12px;
  vertical-align: middle;
}

.difficulty-badge.easy {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #15803d;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.2);
  border: 1px solid rgba(21, 128, 61, 0.2);
}

.difficulty-badge.medium {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #d97706;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.difficulty-badge.hard {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  color: #dc2626;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Difficulty dots for markdown headers */
.markdown-difficulty-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.markdown-difficulty-dot.easy {
  background: #15803d;
}

.markdown-difficulty-dot.medium {
  background: #ca8a04;
}

.markdown-difficulty-dot.hard {
  background: #dc2626;
}

/* Responsive Adjustments */
/* Extra small mobile devices */
@media (max-width: 360px) {
  .mobile-content-inner pre {
    font-size: 12px;
    padding: 12px;
    line-height: 1.4;
    tab-size: 3;
    margin: 12px 0;
  }
  
  .mobile-content-inner pre code {
    font-size: 12px;
    line-height: 1.4;
  }
  
  .mobile-content-inner {
    padding: 16px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .mobile-content-inner pre {
    font-size: 12px;
    padding: 13px;
    line-height: 1.42;
    tab-size: 3;
  }
  
  .mobile-content-inner pre code {
    font-size: 12px;
    line-height: 1.42;
  }
}

@media (min-width: 480px) {
  .mobile-content-inner {
    padding: 24px;
  }
  
  #mobile-lists-list a,
  #mobile-file-list a {
    padding: 18px 24px;
  }
  
  .mobile-content-inner pre {
    font-size: 13px;
    padding: 14px;
    line-height: 1.45;
  }
  
  .mobile-content-inner pre code {
    font-size: 13px;
    line-height: 1.45;
  }
}

@media (min-width: 640px) {
  #mobile-container {
    max-width: 640px;
    margin: 0 auto;
    border-left: 1px solid #d0d7de;
    border-right: 1px solid #d0d7de;
    padding-top: 84px; /* Maintain space for shorter ribbon + breadcrumb */
  }
  
  #mobile-ribbon {
    max-width: 640px;
    margin: 0 auto;
    left: 0;
    right: 0;
    transform: none;
    border-left: 1px solid #d0d7de;
    border-right: 1px solid #d0d7de;
  }
  
  .mobile-breadcrumb-nav {
    max-width: 640px;
    margin: 0 auto;
    left: 0;
    right: 0;
    border-left: 1px solid rgba(226, 232, 240, 0.3);
    border-right: 1px solid rgba(226, 232, 240, 0.3);
  }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
  .mobile-nav-btn:hover,
  #mobile-lists-list a:hover,
  #mobile-file-list a:hover {
    background: inherit;
  }
  
  .mobile-nav-btn:active,
  #mobile-lists-list a:active,
  #mobile-file-list a:active {
    background: #e1e4e8;
    transform: scale(0.98);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* System Theme Detection - Uses existing comprehensive dark-theme class */

/* Mobile Content Animation Classes */
.mobile-content-fade-in {
  animation: mobileContentFadeIn 0.3s ease-out forwards;
}

.mobile-content-slide-in {
  animation: mobileContentSlideIn 0.3s ease-out forwards;
}

.mobile-content-slide-up {
  animation: mobileContentSlideUp 0.3s ease-out forwards;
}

.mobile-content-exit {
  animation: mobileContentExit 0.2s ease-in forwards;
}

/* Mobile Animation Keyframes */
@keyframes mobileContentFadeIn {
  from { 
    opacity: 0;
  }
  to { 
    opacity: 1;
  }
}

@keyframes mobileContentSlideIn {
  from { 
    opacity: 0;
    transform: translateX(20px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mobileContentSlideUp {
  from { 
    opacity: 0;
    transform: translateY(15px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mobileContentExit {
  from { 
    opacity: 1;
    transform: translateX(0);
  }
  to { 
    opacity: 0;
    transform: translateX(-15px);
  }
}

@keyframes mobileContentSlideDown {
  from { 
    opacity: 0;
    transform: translateY(-20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Background Animation */
@keyframes backgroundShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Enhanced Visual Polish */
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
  50% { text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3), 0 0 15px rgba(255, 255, 255, 0.1); }
}

/* ========================================
   DESKTOP LAYOUT - RESPONSIVE FRAMEWORK
   ======================================== */

/* Mobile-First: Hide desktop layout by default */
.desktop-layout {
  display: none !important;
}

.mobile-layout {
  display: flex !important;
}

/* Desktop Breakpoint: Show desktop layout, hide mobile */
@media (min-width: 1024px) {
  :root {
    /* Standard Desktop (1024px-1440px): Compact scale for optimal density */
    --desktop-scale: clamp(0.85, 0.7 + 0.2vw, 0.95);
  }
  
  .desktop-layout {
    display: flex !important;
  }
  
  .mobile-layout {
    display: none !important;
  }
  
  /* Adjust mobile ribbon for desktop - hide it */
  #mobile-ribbon {
    display: none !important;
  }
  
  /* Desktop Container Structure */
  #desktop-container {
    display: flex;
    height: 100vh;
    padding-top: calc(52px * var(--desktop-scale));
    flex-direction: row;
    max-width: 100vw; /* Prevent horizontal overflow */
    margin: 0 auto;
  }
  
  /* Desktop Ribbon */
  #desktop-ribbon {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(52px * var(--desktop-scale));
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 calc(20px * var(--desktop-scale));
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  #desktop-ribbon-title {
    color: white;
    font-weight: 800;
    font-size: calc(1.1rem * var(--desktop-scale));
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  
  #desktop-ribbon-actions {
    display: flex;
    gap: calc(8px * var(--desktop-scale));
  }
  
  .desktop-nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: calc(8px * var(--desktop-scale)) calc(14px * var(--desktop-scale));
    border-radius: calc(10px * var(--desktop-scale));
    cursor: pointer;
    text-decoration: none;
    font-size: calc(0.9rem * var(--desktop-scale));
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: calc(8px * var(--desktop-scale));
    backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .desktop-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .desktop-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
  
  .desktop-nav-btn:hover::before {
    opacity: 1;
  }
  
  .desktop-nav-btn:active {
    transform: translateY(-1px) scale(0.98);
  }
  
  .desktop-nav-btn .btn-text {
    font-weight: 600;
    position: relative;
    z-index: 1;
  }
  
  .desktop-nav-btn .btn-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
  }
  
  /* Desktop Modals - Only show on desktop screens */
  .desktop-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
  
  /* Only enable desktop modals on desktop screens */
  @media (min-width: 1024px) {
    .desktop-modal {
      display: none; /* Still hidden by default, shown via JS */
    }
  }
  
  /* Force hide desktop modals on mobile */
  @media (max-width: 1023px) {
    .desktop-modal,
    .desktop-modal *,
    .desktop-modal-header,
    .desktop-modal-content,
    .desktop-modal-body,
    #desktop-search-modal,
    #desktop-settings-modal,
    .desktop-search-filters,
    .desktop-setting-item {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      pointer-events: none !important;
      position: absolute !important;
      left: -9999px !important;
      top: -9999px !important;
    }
  }
  
  .desktop-modal-content {
    background-color: white;
    margin: 8% auto;
    padding: 0;
    border-radius: calc(12px * var(--desktop-scale));
    width: 90%;
    max-width: calc(600px * var(--desktop-scale));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
  }
  
  .desktop-modal-header {
    padding: calc(20px * var(--desktop-scale)) calc(24px * var(--desktop-scale));
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: calc(12px * var(--desktop-scale)) calc(12px * var(--desktop-scale)) 0 0;
  }
  
  .desktop-modal-header h3 {
    margin: 0;
    font-size: calc(1.2rem * var(--desktop-scale));
    font-weight: 600;
  }
  
  .desktop-close-btn {
    color: rgba(255, 255, 255, 0.8);
    font-size: calc(28px * var(--desktop-scale));
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
    width: calc(30px * var(--desktop-scale));
    height: calc(30px * var(--desktop-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
  }
  
  .desktop-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
  }
  
  .desktop-modal-body {
    padding: calc(24px * var(--desktop-scale));
    max-height: 60vh;
    overflow-y: auto;
  }
  
  /* Desktop Search Modal Specific */
  #desktop-search-input {
    width: 100%;
    padding: calc(12px * var(--desktop-scale)) calc(16px * var(--desktop-scale));
    border: 2px solid #e5e7eb;
    border-radius: calc(8px * var(--desktop-scale));
    font-size: calc(1rem * var(--desktop-scale));
    margin-bottom: calc(16px * var(--desktop-scale));
    transition: border-color 0.2s ease;
  }
  
  #desktop-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }
  
  .desktop-search-filters {
    display: flex;
    gap: calc(20px * var(--desktop-scale));
    margin-bottom: calc(20px * var(--desktop-scale));
    padding-bottom: calc(16px * var(--desktop-scale));
    border-bottom: 1px solid #e5e7eb;
  }
  
  .desktop-search-filters label {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--desktop-scale));
    font-weight: 500;
    cursor: pointer;
  }
  
  .desktop-search-filters input[type="checkbox"] {
    width: calc(16px * var(--desktop-scale));
    height: calc(16px * var(--desktop-scale));
    accent-color: #667eea;
  }
  
  #desktop-search-results {
    max-height: calc(400px * var(--desktop-scale));
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: calc(8px * var(--desktop-scale));
    background: #f8fafc;
  }
  
  .desktop-search-result-item {
    padding: calc(12px * var(--desktop-scale)) calc(16px * var(--desktop-scale));
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--desktop-scale));
  }
  
  .desktop-search-result-item:hover {
    background: #ffffff;
    transform: translateX(2px);
  }
  
  .desktop-search-result-item:last-child {
    border-bottom: none;
  }
  
  .desktop-search-result-title {
    font-weight: 500;
    color: #1e293b;
    font-size: calc(15px * var(--desktop-scale));
    line-height: 1.4;
  }
  
  .desktop-search-result-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .desktop-search-result-difficulty {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  
  .desktop-search-result-difficulty.easy {
    background: #dcfce7;
    color: #15803d;
  }
  
  .desktop-search-result-difficulty.medium {
    background: #fef3c7;
    color: #d97706;
  }
  
  .desktop-search-result-difficulty.hard {
    background: #fecaca;
    color: #dc2626;
  }
  
  .desktop-search-section-header {
    padding: calc(12px * var(--desktop-scale)) calc(16px * var(--desktop-scale)) calc(8px * var(--desktop-scale)) calc(16px * var(--desktop-scale));
    margin: 0 calc(-8px * var(--desktop-scale));
    background: #f6f8fa;
    border-top: 1px solid #e1e5e9;
    border-bottom: 1px solid #e1e5e9;
    font-size: calc(12px * var(--desktop-scale));
    font-weight: 600;
    color: #656d76;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .desktop-search-section-header:first-child {
    border-top: none;
  }
  
  /* Desktop Settings Modal Specific */
  .desktop-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(16px * var(--desktop-scale)) 0;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .desktop-setting-item:last-child {
    border-bottom: none;
  }
  
  .desktop-setting-item label {
    font-weight: 500;
    color: #374151;
  }
  
  .desktop-setting-item select {
    padding: calc(8px * var(--desktop-scale)) calc(12px * var(--desktop-scale));
    border: 2px solid #e5e7eb;
    border-radius: calc(6px * var(--desktop-scale));
    background: white;
    cursor: pointer;
    min-width: calc(120px * var(--desktop-scale));
  }
  
  .desktop-setting-item select:focus {
    outline: none;
    border-color: #667eea;
  }
  
  /* Desktop Feedback Modal Specific */
  .desktop-feedback-field {
    margin-bottom: calc(20px * var(--desktop-scale));
  }
  
  .desktop-feedback-field label {
    display: block;
    margin-bottom: calc(8px * var(--desktop-scale));
    font-weight: 600;
    color: #24292f;
    font-size: calc(14px * var(--desktop-scale));
  }
  
  .desktop-feedback-field input[type="text"],
  .desktop-feedback-field select,
  .desktop-feedback-field textarea {
    width: 100%;
    padding: calc(12px * var(--desktop-scale));
    border: 2px solid #d1d5db;
    border-radius: calc(8px * var(--desktop-scale));
    font-size: calc(14px * var(--desktop-scale));
    color: #24292f;
    background: #ffffff;
    transition: border-color 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
  }
  
  .desktop-feedback-field input[type="text"]:focus,
  .desktop-feedback-field select:focus,
  .desktop-feedback-field textarea:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
  }
  
  .desktop-feedback-field textarea {
    resize: vertical;
    min-height: calc(120px * var(--desktop-scale));
  }
  
  .desktop-feedback-actions {
    display: flex;
    gap: calc(12px * var(--desktop-scale));
    justify-content: flex-end;
    margin-top: calc(24px * var(--desktop-scale));
  }
  
  .desktop-feedback-btn-cancel,
  .desktop-feedback-btn-submit {
    padding: calc(10px * var(--desktop-scale)) calc(20px * var(--desktop-scale));
    border: none;
    border-radius: calc(6px * var(--desktop-scale));
    font-size: calc(14px * var(--desktop-scale));
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: calc(100px * var(--desktop-scale));
  }
  
  .desktop-feedback-btn-cancel {
    background: #f6f8fa;
    color: #24292f;
    border: 1px solid #d1d5db;
  }
  
  .desktop-feedback-btn-cancel:hover {
    background: #f3f4f6;
    border-color: #afb8c1;
  }
  
  .desktop-feedback-btn-submit {
    background: #0969da;
    color: #ffffff;
  }
  
  .desktop-feedback-btn-submit:hover {
    background: #0550ae;
  }
  
  .desktop-feedback-btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
  }
  
  /* Desktop Sidebar Base Styling */
  .desktop-sidebar {
    background: #e5e7eb;
    border-right: 1px solid #d1d5db;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  
  /* Lists Sidebar - Resizable Width */
  #desktop-lists-sidebar {
    width: var(--lists-width);
    min-width: var(--min-lists-width);
    max-width: var(--max-lists-width);
    position: relative;
    transition: width 0.2s ease;
  }
  
  /* Problems Sidebar - Resizable Width */
  #desktop-problems-sidebar {
    width: var(--problems-width);
    min-width: var(--min-problems-width);
    max-width: var(--max-problems-width);
    position: relative;
    transition: width 0.2s ease;
  }
  
  /* Resize Handles */
  .column-resize-handle {
    position: absolute;
    top: 0;
    height: 100%;
    width: var(--resize-handle-width);
    background: transparent;
    cursor: col-resize;
    z-index: 1000;
    user-select: none;
    transition: background-color 0.2s ease;
  }
  
  .column-resize-handle:hover {
    background-color: rgba(102, 126, 234, 0.3);
  }
  
  .column-resize-handle:active {
    background-color: rgba(102, 126, 234, 0.5);
  }
  
  /* Lists-Problems resize handle */
  .lists-problems-resize {
    right: calc(var(--resize-handle-width) / -2);
  }
  
  /* Problems-Content resize handle */  
  .problems-content-resize {
    right: calc(var(--resize-handle-width) / -2);
  }
  
  /* Disable transitions during resize */
  .desktop-container.resizing #desktop-lists-sidebar,
  .desktop-container.resizing #desktop-problems-sidebar {
    transition: none;
  }
  
  /* Main Content Area */
  #desktop-content {
    flex: 1;
    background: #e5e7eb;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(16px * var(--desktop-scale));
    display: flex;
    flex-direction: column;
  }
  
  /* Desktop Content Inner */
  .desktop-content-inner {
    background: #ffffff;
    border-radius: calc(12px * var(--desktop-scale));
    padding: calc(32px * var(--desktop-scale));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #d1d5db;
    max-width: none;
    line-height: 1.6;
    margin: 0;
    flex: 1; /* Take up remaining space */
    min-height: fit-content; /* Allow content to determine height */
    width: 100%;
  }
  
  /* Desktop Lists and File Lists */
  #desktop-lists-list,
  #desktop-file-list {
    list-style: none;
    padding: calc(16px * var(--desktop-scale));
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--desktop-scale));
  }
  
  /* Desktop List Items - Mobile-Inspired Cards */
  #desktop-lists-list li {
    margin: 0;
    border-radius: calc(12px * var(--desktop-scale));
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #d1d5db;
    overflow: visible;
    transition: all 0.3s ease;
  }
  
  /* Individual list items (not category containers) can have overflow hidden if needed */
  #desktop-lists-list li:not(.category-content):not(.desktop-category-content):not(.desktop-category-header) {
    overflow: hidden;
  }

  #desktop-lists-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }
  
  #desktop-lists-list a {
    display: block;
    padding: 0;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s ease;
  }
  
  #desktop-lists-list a:hover {
    background: #f9fafb;
  }
  
  /* Desktop Problem Items - Mobile-Inspired Design */
  #desktop-file-list li {
    margin: 0;
    border-radius: calc(12px * var(--desktop-scale));
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #d1d5db;
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: calc(60px * var(--desktop-scale));
  }
  
  #desktop-file-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }
  
  #desktop-file-list a {
    display: flex;
    align-items: center;
    padding: calc(16px * var(--desktop-scale)) calc(18px * var(--desktop-scale));
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s ease;
    gap: calc(12px * var(--desktop-scale));
  }
  
  #desktop-file-list a:hover {
    background: #f8fafc;
  }
  
  /* Active states for desktop navigation */
  /* Active selection - Enhanced styling */
  #desktop-lists-list li.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 5px solid #2563eb;
    border-color: #3b82f6;
    border-radius: calc(12px * var(--desktop-scale));
    box-shadow: 
      0 2px 8px rgba(37, 99, 235, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  
  #desktop-lists-list li.active a {
    background: transparent;
    font-weight: 600;
    color: #1d4ed8;
  }
  
  #desktop-file-list li.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 5px solid #2563eb;
    border-color: #3b82f6;
    border-radius: calc(12px * var(--desktop-scale));
    box-shadow: 
      0 2px 8px rgba(37, 99, 235, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  
  #desktop-file-list li.active a {
    background: transparent;
    font-weight: 600;
    color: #1d4ed8;
  }
  
  /* Enhanced problem number styling in active state */
  #desktop-file-list li.active .desktop-problem-number {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  }
  
  /* Desktop List Header Styling (like mobile cards) */
  .desktop-list-header {
    padding: calc(16px * var(--desktop-scale)) calc(18px * var(--desktop-scale));
    overflow: visible;
    display: flex;
    align-items: flex-start;
    min-height: auto;
  }
  
  .desktop-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: calc(6px * var(--desktop-scale));
    min-width: 0;
    width: 100%;
    overflow: visible;
  }
  
  .desktop-list-title {
    font-size: calc(16px * var(--desktop-scale));
    font-weight: 600;
    line-height: 1.3;
    color: #1e293b;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    overflow: visible;
    max-width: none;
    width: auto;
  }
  
  .desktop-list-count {
    font-size: calc(13px * var(--desktop-scale));
    font-weight: 500;
    color: #64748b;
    opacity: 0.9;
    margin-top: calc(4px * var(--desktop-scale));
  }
  
  .desktop-list-description {
    font-size: calc(12px * var(--desktop-scale));
    line-height: 1.3;
    color: #64748b;
    margin-top: calc(4px * var(--desktop-scale));
  }
  
  /* Desktop List Icon */
  .desktop-list-icon {
    font-size: calc(18px * var(--desktop-scale));
    min-width: calc(24px * var(--desktop-scale));
    height: calc(24px * var(--desktop-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: calc(6px * var(--desktop-scale));
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
    margin-right: calc(12px * var(--desktop-scale));
  }
  
  /* Desktop Problem Styling */
  .desktop-problem-number {
    font-size: calc(13px * var(--desktop-scale));
    color: #475569;
    font-weight: 600;
    min-width: calc(45px * var(--desktop-scale));
    padding: calc(4px * var(--desktop-scale)) calc(8px * var(--desktop-scale));
    background: #f1f5f9;
    border-radius: calc(6px * var(--desktop-scale));
    text-align: center;
    border: 1px solid #e2e8f0;
  }
  
  .desktop-problem-title {
    flex: 1;
    font-size: calc(15px * var(--desktop-scale));
    font-weight: 500;
    line-height: 1.4;
    color: #1e293b;
  }
  
  .desktop-problem-difficulty {
    font-size: calc(11px * var(--desktop-scale));
    font-weight: 700;
    padding: calc(5px * var(--desktop-scale)) calc(10px * var(--desktop-scale));
    border-radius: calc(8px * var(--desktop-scale));
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .desktop-problem-difficulty.easy {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    border: 1px solid rgba(21, 128, 61, 0.2);
  }
  
  .desktop-problem-difficulty.medium {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.2);
  }
  
  .desktop-problem-difficulty.hard {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
  }
  
  /* Desktop problem difficulty dots (matching mobile design) */
  .desktop-problem-difficulty-dot {
    width: calc(12px * var(--desktop-scale));
    height: calc(12px * var(--desktop-scale));
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .desktop-problem-difficulty-dot.easy {
    background: #15803d;
  }
  
  .desktop-problem-difficulty-dot.medium {
    background: #ca8a04;
  }
  
  .desktop-problem-difficulty-dot.hard {
    background: #dc2626;
  }
  
  /* Typography adjustments for desktop */
  .desktop-content-inner {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  
  .desktop-content-inner h1 {
    font-size: calc(28px * var(--desktop-scale));
    font-weight: 700;
    margin-bottom: calc(20px * var(--desktop-scale));
    color: #24292f;
    line-height: 1.3;
  }
  
  .desktop-content-inner h2 {
    font-size: calc(24px * var(--desktop-scale));
    font-weight: 600;
    margin: calc(32px * var(--desktop-scale)) 0 calc(16px * var(--desktop-scale)) 0;
    color: #24292f;
    line-height: 1.3;
  }
  
  .desktop-content-inner h3 {
    font-size: calc(22px * var(--desktop-scale));
    font-weight: 600;
    margin: calc(24px * var(--desktop-scale)) 0 calc(12px * var(--desktop-scale)) 0;
    color: #2364b5;
    line-height: 1.3;
  }
  
  .desktop-content-inner p {
    margin-bottom: calc(16px * var(--desktop-scale));
    color: #24292f;
    font-size: calc(16px * var(--desktop-scale));
    line-height: 1.6;
  }
  
  .desktop-content-inner code {
    background: #f6f8fa;
    padding: calc(3px * var(--desktop-scale)) calc(6px * var(--desktop-scale));
    border-radius: calc(4px * var(--desktop-scale));
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: calc(14px * var(--desktop-scale));
    color: #24292f;
  }
  
  .desktop-content-inner pre {
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: calc(8px * var(--desktop-scale));
    padding: calc(20px * var(--desktop-scale));
    overflow-x: auto;
    margin: calc(20px * var(--desktop-scale)) 0;
    font-size: calc(14px * var(--desktop-scale));
    line-height: 1.5;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  }
  
  .desktop-content-inner ul,
  .desktop-content-inner ol {
    padding-left: calc(24px * var(--desktop-scale));
    margin-bottom: calc(16px * var(--desktop-scale));
  }
  
  .desktop-content-inner li {
    margin-bottom: calc(8px * var(--desktop-scale));
    color: #24292f;
    font-size: calc(16px * var(--desktop-scale));
    line-height: 1.6;
  }

  /* Ensure all text elements have consistent styling */
  .desktop-content-inner *:not(button):not(.tag-button):not(a):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(code):not(.hljs):not(.heart) {
    color: inherit;
    font-family: inherit;
  }

  .desktop-content-inner * {
    font-family: inherit;
  }

  .desktop-content-inner strong,
  .desktop-content-inner b {
    font-weight: 600;
    color: #24292f;
  }

  .desktop-content-inner em,
  .desktop-content-inner i {
    font-style: italic;
    color: #24292f;
  }
  
  .desktop-content-inner blockquote {
    border-left: calc(4px * var(--desktop-scale)) solid #d0d7de;
    padding: 0 calc(16px * var(--desktop-scale));
    margin: calc(16px * var(--desktop-scale)) 0;
    color: #656d76;
  }
  
  .desktop-content-inner a {
    color: #0969da;
    text-decoration: none;
  }
  
  .desktop-content-inner a:hover {
    text-decoration: underline;
  }
  
  /* Desktop-specific content wrapper with background - High Elevation Tile Design */
  .desktop-content-with-background {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 30%, #ffffff 100%);
    border-radius: calc(16px * var(--desktop-scale));
    border: 1px solid rgba(209, 213, 219, 0.6);
    box-shadow: 
      0 4px 8px rgba(0, 0, 0, 0.12),
      0 8px 16px rgba(0, 0, 0, 0.08),
      0 16px 32px rgba(0, 0, 0, 0.06),
      0 24px 48px rgba(0, 0, 0, 0.04),
      inset 0 2px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    padding: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    isolation: isolate;
  }
  
  /* .desktop-content-with-background:hover {
    box-shadow: 
      0 8px 16px rgba(0, 0, 0, 0.15),
      0 16px 32px rgba(0, 0, 0, 0.12),
      0 24px 48px rgba(0, 0, 0, 0.08),
      0 32px 64px rgba(0, 0, 0, 0.06),
      inset 0 2px 0 rgba(255, 255, 255, 1);
    border-color: rgba(209, 213, 219, 0.4);
  } */

  /* Desktop action buttons styling within background */
  .desktop-content-with-background .desktop-action-buttons {
    border-bottom: 1px solid #e1e4e8;
    border-radius: calc(12px * var(--desktop-scale)) calc(12px * var(--desktop-scale)) 0 0;
  }
  
  /* Desktop Author Footnote */
  .desktop-content-inner .mobile-author-footnote {
    text-align: center;
    margin-top: 0;
    padding: calc(20px * var(--desktop-scale));
    border-top: 2px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    font-size: calc(14px * var(--desktop-scale));
    font-weight: 400;
  }
}

/* ========================================
   RESPONSIVE DESKTOP SCALING - BEST PRACTICES
   ======================================== */

/* Large Desktop (1440px+): Slightly larger for better readability */
@media (min-width: 1440px) {
  :root {
    --desktop-scale: 0.95;
    /* Allow larger columns on larger screens */
    --max-lists-width: 450px;
    --max-problems-width: 550px;
  }
}

/* Extra Large Desktop (1680px+): Near full size */
@media (min-width: 1680px) {
  :root {
    --desktop-scale: 1.0;
    /* Even larger columns for ultra-wide screens */
    --max-lists-width: 500px;
    --max-problems-width: 600px;
  }
}

/* Ultra-wide Desktop (1920px+): Full size with content width limits */
@media (min-width: 1920px) {
  :root {
    --desktop-scale: 1.0;
  }
  
  /* Don't limit the content area itself - let gray background span full width */
  /* Only limit the inner content for better readability */
  .desktop-content-inner {
    max-width: 900px;
    margin: 0 auto;
  }
}

/* 4K+ Desktop (2560px+): Maintain readability */
@media (min-width: 2560px) {
  :root {
    --desktop-scale: 1.1;
  }
  
  .desktop-content-inner {
    max-width: 1000px;
    margin: 0 auto;
  }
}

/* High DPI / Retina Displays: Slightly smaller for clarity */
@media (min-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
  :root {
    --desktop-scale: 0.85;
  }
}

/* Compact Desktop Preference (respects macOS compact mode) */
@media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
  :root {
    --desktop-scale: 0.9; /* Maintain compact feel for smooth interactions */
  }
}

/* User prefers reduced data - smaller assets and tighter spacing */
@media (min-width: 1024px) and (prefers-reduced-data: reduce) {
  :root {
    --desktop-scale: 0.85;
  }
}

/* Print Styles - Clean document layout matching desktop version */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Base document styling - clean and professional */
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    height: auto !important;
    overflow: visible !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', Arial, sans-serif !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    width: 100% !important;
    max-width: none !important;
  }
  
  /* Force mobile layout to show in print regardless of screen size */
  .mobile-layout {
    display: block !important;
  }
  
  .desktop-layout {
    display: none !important;
  }
  
  /* Hide all mobile UI elements completely */
  #mobile-ribbon,
  .mobile-breadcrumb-nav,
  #mobile-lists-sidebar,
  #mobile-sidebar,
  .mobile-action-buttons,
  .mobile-share-fab,
  .mobile-feedback-fab,
  #mobile-print-btn,
  #mobile-random-btn,
  .mobile-nav-btn,
  .mobile-action-btn,
  .mobile-back-button {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide only the code resize controls, not the code itself */
  .code-control-inline,
  button[onclick*="adjustCodeSize"],
  .btn[onclick*="adjustCodeSize"] {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide loading animations and spinners completely */
  [style*="animation: spin"],
  [style*="animation:spin"],
  .loading,
  .spinner {
    display: none !important;
    visibility: hidden !important;
    animation: none !important;
  }
  
  /* Hide loading containers and content specifically */
  div[style*="padding: 3rem 1rem; color: #656d76"],
  div[style*="padding: 2rem 1rem; color: #656d76"],
  div[style*="padding:3rem 1rem;color:#656d76"],
  div[style*="padding:2rem 1rem;color:#656d76"],
  div:has(div[style*="⏳"]),
  div[style*="⏳"],
  span[style*="⏳"] {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Disable all animations and transitions in print */
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  
  /* Clean container structure - completely flatten all layers */
  #mobile-container {
    display: block !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }
  
  .mobile-content,
  #mobile-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    overflow: visible !important;
    height: auto !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }
  
  /* Flatten all view containers */
  .mobile-view,
  #mobile-content-view,
  #mobile-problems-view,
  #mobile-lists-view {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex: none !important;
    overflow: visible !important;
    height: auto !important;
    width: 100% !important;
    max-width: none !important;
  }
  
  /* Main content container - clean document style */
  .mobile-content-inner {
    background: white !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 25px !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    animation: none !important;
    overflow: visible !important;
    height: auto !important;
    display: block !important;
    position: static !important;
    transform: none !important;
    flex: none !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Ensure content is always visible */
  .mobile-content-inner * {
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .mobile-content-inner h1,
  .mobile-content-inner h2, 
  .mobile-content-inner h3,
  .mobile-content-inner h4,
  .mobile-content-inner h5,
  .mobile-content-inner h6,
  .mobile-content-inner p,
  .mobile-content-inner ul,
  .mobile-content-inner ol,
  .mobile-content-inner pre {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .mobile-content-inner li {
    display: list-item !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .mobile-content-inner code {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Remove ALL decorative elements from every element */
  * {
    box-shadow: none !important;
    border-radius: 0 !important;
    text-shadow: none !important;
    background-image: none !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    max-width: none !important;
  }
  
  /* Force full width on all elements that might be constraining width */
  body, html, #mobile-container, .mobile-content, #mobile-content, 
  .mobile-view, .mobile-content-inner, #mobile-content-view {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* Typography - matching desktop clean style */
  .mobile-content-inner h1 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #24292f !important;
    margin: 1em 0 0.5em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .mobile-content-inner h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .mobile-content-inner h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2364b5 !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .mobile-content-inner h4,
  .mobile-content-inner h5,
  .mobile-content-inner h6 {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.6em 0 0.3em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .mobile-content-inner p {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.4em 0 !important;
    orphans: 3;
    widows: 3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  /* List items - uniform with paragraphs */
  .mobile-content-inner ul,
  .mobile-content-inner ol {
    margin: 0.4em 0 !important;
    padding-left: 20px !important;
  }
  
  .mobile-content-inner li {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.2em 0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  /* Code styling - preserve syntax highlighting like desktop */
  .mobile-content-inner code {
    background: #f6f8fa !important;
    color: #24292f !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 12px !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .mobile-content-inner pre {
    background: #f6f8fa !important;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    padding: 14px !important;
    overflow: visible !important;
    margin: 1em 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    page-break-inside: avoid;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: none !important;
  }
  
  .mobile-content-inner pre code {
    background: none !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    border-radius: 0 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  }
  
  /* Syntax highlighting - GitHub style for print */
  .hljs {
    background: #f6f8fa !important;
    color: #24292f !important;
  }
  
  .hljs-keyword {
    color: #cf222e !important;
    font-weight: 600 !important;
  }
  
  .hljs-title.function_ {
    color: #8250df !important;
    font-weight: 600 !important;
  }
  
  .hljs-params {
    color: #953800 !important;
  }
  
  .hljs-number {
    color: #0550ae !important;
    font-weight: 500 !important;
  }
  
  .hljs-comment {
    color: #656d76 !important;
    font-style: italic !important;
  }
  
  .hljs-built_in {
    color: #0550ae !important;
    font-weight: 500 !important;
  }
  
  .hljs-string {
    color: #0a3069 !important;
  }
  
  .hljs-operator {
    color: #cf222e !important;
  }
  
  .hljs-punctuation {
    color: #24292f !important;
  }
  
  .hljs-attr,
  .hljs-attribute {
    color: #8250df !important;
  }
  
  .hljs-class .hljs-title {
    color: #8250df !important;
    font-weight: 600 !important;
  }
  
  .hljs-variable,
  .hljs-name {
    color: #953800 !important;
  }
  
  /* Lists and blockquotes */
  .mobile-content-inner ul,
  .mobile-content-inner ol {
    padding-left: 2em !important;
    margin: 0.5em 0 !important;
  }
  
  .mobile-content-inner li {
    margin: 0.2em 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .mobile-content-inner blockquote {
    border-left: 4px solid #d1d9e0 !important;
    padding-left: 1em !important;
    margin: 0.8em 0 !important;
    color: #656d76 !important;
    font-style: italic !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  /* Links */
  .mobile-content-inner a {
    color: #0969da !important;
    text-decoration: underline !important;
    background: none !important;
    box-shadow: none !important;
  }
  
  /* Difficulty badges - clean print style with colored backgrounds */
  .difficulty-badge,
  .mobile-problem-difficulty {
    display: inline-block !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
  }
  
  .difficulty-badge.easy,
  .mobile-problem-difficulty.easy {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
  }
  
  .difficulty-badge.medium,
  .mobile-problem-difficulty.medium {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
  }
  
  .difficulty-badge.hard,
  .mobile-problem-difficulty.hard {
    background: #fecaca !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5 !important;
  }
  
  /* Difficulty dots - converted to text badges for print */
  .mobile-difficulty-dot,
  .markdown-difficulty-dot,
  .difficulty-dot-inline {
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    border-radius: 4px !important;
    margin-right: 8px !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    vertical-align: middle !important;
  }
  
  .mobile-difficulty-dot.easy,
  .markdown-difficulty-dot.easy,
  .difficulty-dot-inline.easy {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
  }
  
  .mobile-difficulty-dot.easy::after,
  .markdown-difficulty-dot.easy::after,
  .difficulty-dot-inline.easy::after {
    content: "EASY" !important;
  }
  
  .mobile-difficulty-dot.medium,
  .markdown-difficulty-dot.medium,
  .difficulty-dot-inline.medium {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
  }
  
  .mobile-difficulty-dot.medium::after,
  .markdown-difficulty-dot.medium::after,
  .difficulty-dot-inline.medium::after {
    content: "MEDIUM" !important;
  }
  
  .mobile-difficulty-dot.hard,
  .markdown-difficulty-dot.hard,
  .difficulty-dot-inline.hard {
    background: #fecaca !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5 !important;
  }
  
  .mobile-difficulty-dot.hard::after,
  .markdown-difficulty-dot.hard::after,
  .difficulty-dot-inline.hard::after {
    content: "HARD" !important;
  }
  
  /* Sections - add proper spacing like desktop */
  section,
  .section,
  .problem-section,
  .markdown-section {
    margin: 0.8em 0 !important;
  }
  
  /* Hide practice links completely */
  a[href*="leetcode.com/problems"],
  .practice-link {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Page break optimization */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  
  blockquote, table, pre, img {
    page-break-inside: avoid;
  }
  
  /* Author footnote - clean style */
  .mobile-author-footnote {
    text-align: center !important;
    margin-top: 2em !important;
    padding-top: 1em !important;
    border-top: 1px solid #d1d9e0 !important;
    color: #656d76 !important;
    font-size: 11px !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
  }
  
  .heart {
    color: #cf222e !important;
    text-shadow: none !important;
  }
  
  /* Legacy Desktop print styles - hide legacy UI elements */
  #ribbon,
  #lists-sidebar,
  #sidebar,
  .modal,
  .modal-content,
  .modal-header,
  .close-btn,
  .search-filters,
  .action-buttons,
  .setting-item,
  #search-modal,
  #settings-modal,
  #search-btn,
  #settings-btn,
  #home-btn,
  #container {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Show only content area for legacy print */
  #content {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
    animation: none !important;
    transform: none !important;
    flex: none !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Legacy content-inner print styles */
  .content-inner {
    display: block !important;
    position: static !important;
    padding: 25px !important;
    margin: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
    animation: none !important;
    transform: none !important;
    flex: none !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .content-inner h1 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #24292f !important;
    margin: 1em 0 0.5em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2364b5 !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner h4,
  .content-inner h5,
  .content-inner h6 {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.6em 0 0.3em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner p {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.4em 0 !important;
    orphans: 3;
    widows: 3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  /* List items - uniform with paragraphs */
  .content-inner ul,
  .content-inner ol {
    margin: 0.4em 0 !important;
    padding-left: 20px !important;
  }
  
  .content-inner li {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.2em 0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner p {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.4em 0 !important;
    orphans: 3;
    widows: 3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner code {
    background: #f6f8fa !important;
    color: #24292f !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 12px !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .content-inner pre {
    background: #f6f8fa !important;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    padding: 14px !important;
    overflow: visible !important;
    margin: 1em 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    page-break-inside: avoid;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: none !important;
  }
  
  .content-inner pre code {
    background: none !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    border-radius: 0 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  }
  
  .content-inner ul,
  .content-inner ol {
    padding-left: 2em !important;
    margin: 0.5em 0 !important;
  }
  
  .content-inner li {
    margin: 0.2em 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner blockquote {
    border-left: 4px solid #d1d9e0 !important;
    padding-left: 1em !important;
    margin: 0.8em 0 !important;
    color: #656d76 !important;
    font-style: italic !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .content-inner a {
    color: #0969da !important;
    text-decoration: underline !important;
    background: none !important;
    box-shadow: none !important;
  }
  
  /* Legacy desktop author footnote */
  .content-inner .author-footnote {
    text-align: center !important;
    margin-top: 2em !important;
    padding-top: 1em !important;
    border-top: 1px solid #d1d9e0 !important;
    color: #656d76 !important;
    font-size: 11px !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
  }

  /* Desktop-specific print styles - hide desktop UI elements and show content properly */
  #desktop-ribbon,
  .desktop-nav-btn,
  #desktop-search-btn,
  #desktop-settings-btn,
  #desktop-search-modal,
  #desktop-settings-modal,
  .btn-text,
  .btn-icon,
  #desktop-lists-sidebar,
  #desktop-problems-sidebar,
  .desktop-action-buttons,
  #desktop-random-btn,
  #desktop-print-btn,
  .desktop-close-btn,
  .desktop-search-filters,
  .desktop-modal,
  .desktop-modal-content,
  .desktop-modal-header {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Show desktop container and main content area for print */
  #desktop-container,
  #desktop-content,
  .desktop-main {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
    animation: none !important;
    transform: none !important;
    flex: none !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Show only desktop content inner for print */
  .desktop-content-inner {
    display: block !important;
    position: static !important;
    padding: 25px !important;
    margin: 0 !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
    animation: none !important;
    transform: none !important;
    flex: none !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Apply mobile print styles to desktop content */
  .desktop-content-inner h1 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #24292f !important;
    margin: 1em 0 0.5em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2364b5 !important;
    margin: 0.8em 0 0.4em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner h4,
  .desktop-content-inner h5,
  .desktop-content-inner h6 {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #24292f !important;
    margin: 0.6em 0 0.3em 0 !important;
    page-break-after: avoid;
    line-height: 1.3 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner p {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.4em 0 !important;
    orphans: 3;
    widows: 3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  /* List items - uniform with paragraphs */
  .desktop-content-inner ul,
  .desktop-content-inner ol {
    margin: 0.4em 0 !important;
    padding-left: 20px !important;
  }
  
  .desktop-content-inner li {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.2em 0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner p {
    color: #24292f !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0.4em 0 !important;
    orphans: 3;
    widows: 3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner code {
    background: #f6f8fa !important;
    color: #24292f !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 12px !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .desktop-content-inner pre {
    background: #f6f8fa !important;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    padding: 14px !important;
    overflow: visible !important;
    margin: 1em 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    page-break-inside: avoid;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: none !important;
  }
  
  .desktop-content-inner pre code {
    background: none !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    border-radius: 0 !important;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  }
  
  .desktop-content-inner ul,
  .desktop-content-inner ol {
    padding-left: 2em !important;
    margin: 0.5em 0 !important;
  }
  
  .desktop-content-inner li {
    margin: 0.2em 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner blockquote {
    border-left: 4px solid #d1d9e0 !important;
    padding-left: 1em !important;
    margin: 0.8em 0 !important;
    color: #656d76 !important;
    font-style: italic !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  }
  
  .desktop-content-inner a {
    color: #0969da !important;
    text-decoration: underline !important;
    background: none !important;
    box-shadow: none !important;
  }
  
  /* Desktop author footnote - clean style */
  .desktop-author-footnote,
  .author-footnote {
    text-align: center !important;
    margin-top: 2em !important;
    padding-top: 1em !important;
    border-top: 1px solid #d1d9e0 !important;
    color: #656d76 !important;
    font-size: 11px !important;
    page-break-inside: avoid;
    background: none !important;
    box-shadow: none !important;
  }
  
  /* Hide tags and similar problems sections from print */
  .tag-container, 
  .similar-problems-container {
    display: none !important;
  }
  
  /* Hide the last two h3 headings (likely Tags and Similar Problems) */
  h3:nth-last-of-type(1),
  h3:nth-last-of-type(2) {
    display: none !important;
  }
}

/* ===== DARK THEME SUPPORT ===== */
/* Smooth transitions for theme switching */
/* Removed global transition - causes conflicts with inline button styles */

body.dark-theme {
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 50%, #1a1a1a 100%) !important;
  color: #ffffff !important;
}

body.dark-theme .mobile-header {
  background: rgba(26, 26, 26, 0.95) !important;
  border-bottom-color: #404040 !important;
  backdrop-filter: blur(12px) !important;
}

body.dark-theme .desktop-header {
  background: rgba(26, 26, 26, 0.95) !important;
  border-bottom-color: #404040 !important;
  backdrop-filter: blur(12px) !important;
}

body.dark-theme .mobile-content-inner,
body.dark-theme .desktop-content-inner {
  background: #1f1f1f !important;
  color: #ffffff !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .mobile-content-inner h1,
body.dark-theme .mobile-content-inner h2,
body.dark-theme .desktop-content-inner h1,
body.dark-theme .desktop-content-inner h2 {
  color: #ffffff !important;
  text-shadow: none !important;
}

body.dark-theme .mobile-content-inner h3,
body.dark-theme .desktop-content-inner h3 {
  color: #66b3ff !important;
  text-shadow: none !important;
  font-weight: 600 !important;
}

/* Make H3 styling more specific to override catch-all rules */
body.dark-theme h3,
body.dark-theme .mobile-content-inner h3,
body.dark-theme .desktop-content-inner h3,
body.dark-theme div h3 {
  color: #66b3ff !important;
  text-shadow: none !important;
  font-weight: 600 !important;
}

body.dark-theme .mobile-content-inner a:not([style*="background:"]):not(.similar-problem-button):not(.tag-button),
body.dark-theme .desktop-content-inner a:not([style*="background:"]):not(.similar-problem-button):not(.tag-button) {
  color: #66b3ff !important;
  transition: color 0.2s ease !important;
}

body.dark-theme .mobile-content-inner a:not([style*="background:"]):not(.similar-problem-button):not(.tag-button):hover,
body.dark-theme .desktop-content-inner a:not([style*="background:"]):not(.similar-problem-button):not(.tag-button):hover {
  color: #4da6ff !important;
}

body.dark-theme .mobile-content-inner p,
body.dark-theme .desktop-content-inner p,
body.dark-theme .mobile-content-inner li,
body.dark-theme .desktop-content-inner li,
body.dark-theme .mobile-content-inner span,
body.dark-theme .desktop-content-inner span,
body.dark-theme .mobile-content-inner div,
body.dark-theme .desktop-content-inner div {
  color: #ffffff !important;
}

/* Dark theme italic text - keep italic style, just change color */
body.dark-theme .mobile-content-inner em,
body.dark-theme .desktop-content-inner em {
  color: #ffffff !important;
  font-style: italic !important;
}

/* Dark theme bold text - change color and ensure bold weight */
body.dark-theme .mobile-content-inner strong,
body.dark-theme .desktop-content-inner strong {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Ensure all text elements have proper contrast in dark mode - exclude syntax highlighting and heart */
body.dark-theme .mobile-content-inner *:not(a):not(code):not(.tag-button):not(h3):not(.hljs):not(.hljs-keyword):not(.hljs-string):not(.hljs-comment):not(.hljs-number):not(.hljs-built_in):not(.hljs-title):not(.hljs-function_):not(.hljs-params):not(.hljs-operator):not(.hljs-punctuation):not(.hljs-attr):not(.hljs-attribute):not(.hljs-variable):not(.hljs-name):not(.hljs-literal):not(.hljs-class):not(.heart),
body.dark-theme .desktop-content-inner *:not(a):not(code):not(.tag-button):not(h3):not(.hljs):not(.hljs-keyword):not(.hljs-string):not(.hljs-comment):not(.hljs-number):not(.hljs-built_in):not(.hljs-title):not(.hljs-function_):not(.hljs-params):not(.hljs-operator):not(.hljs-punctuation):not(.hljs-attr):not(.hljs-attribute):not(.hljs-variable):not(.hljs-name):not(.hljs-literal):not(.hljs-class):not(.heart) {
  color: #ffffff !important;
}

body.dark-theme .mobile-modal-content,
body.dark-theme .desktop-modal-content {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .mobile-modal-header,
body.dark-theme .desktop-modal-header {
  border-bottom-color: #404040 !important;
  background: rgba(42, 42, 42, 0.9) !important;
  color: #ffffff !important;
}

/* Dark theme code styling - only for inline code, not syntax highlighted blocks */
body.dark-theme code:not(.hljs):not([class*="language-"]) {
  background: #333333 !important;
  color: #ffcc66 !important;
  border: 1px solid #555555 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme pre:not(.hljs):not([class*="language-"]) {
  background: #2a2a2a !important;
  border-color: #404040 !important;
  color: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme blockquote {
  border-left-color: #66b3ff !important;
  background: rgba(102, 179, 255, 0.1) !important;
  color: #ffffff !important;
  backdrop-filter: blur(4px) !important;
}

/* Navigation Buttons Dark Theme */
body.dark-theme .mobile-nav-btn {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .mobile-nav-btn::before {
  background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%) !important;
}

body.dark-theme .mobile-nav-btn:hover {
  background: #404040 !important;
  border-color: #666666 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .mobile-nav-btn:active {
  background: #4a4a4a !important;
  transform: translateY(0) scale(0.98) !important;
}

@media (min-width: 1024px) {
  body.dark-theme .desktop-nav-btn {
    background: #333333 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4) !important;
  }

  body.dark-theme .desktop-nav-btn::before {
    background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%) !important;
  }

  body.dark-theme .desktop-nav-btn:hover {
    background: #404040 !important;
    border-color: #666666 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
  }

  body.dark-theme .desktop-nav-btn:active {
    background: #4a4a4a !important;
    transform: translateY(-1px) scale(0.98) !important;
  }
}

/* Form Elements Dark Theme */
body.dark-theme .mobile-modal-body input[type="text"],
body.dark-theme input[type="text"],
body.dark-theme input[type="search"],
body.dark-theme #desktop-search-input {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme .mobile-modal-body input[type="text"]:focus,
body.dark-theme input[type="text"]:focus,
body.dark-theme input[type="search"]:focus,
body.dark-theme #desktop-search-input:focus {
  border-color: #66b3ff !important;
  box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  outline: none !important;
}

body.dark-theme .mobile-setting-item select,
body.dark-theme .desktop-setting-item select,
body.dark-theme select {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .mobile-setting-item select:focus,
body.dark-theme .desktop-setting-item select:focus,
body.dark-theme select:focus {
  border-color: #66b3ff !important;
  box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.2) !important;
  outline: none !important;
}

body.dark-theme .desktop-search-filters input[type="checkbox"] {
  accent-color: #66b3ff !important;
}

/* Breadcrumb Navigation Dark Theme */
body.dark-theme .mobile-breadcrumb-nav {
  background: rgba(26, 26, 26, 0.95) !important;
  border-bottom: 1px solid #404040 !important;
  backdrop-filter: blur(12px) !important;
}

body.dark-theme .mobile-breadcrumb-link {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .mobile-breadcrumb-link:hover {
  background: #404040 !important;
  color: #ffffff !important;
  border-color: #666666 !important;
}

body.dark-theme .mobile-breadcrumb-arrow {
  color: #cccccc !important;
}

/* Mobile Search Dark Theme */
body.dark-theme #mobile-search-results {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
}

body.dark-theme .mobile-search-result-item {
  border-bottom: 1px solid #404040 !important;
  color: #ffffff !important;
}

body.dark-theme .mobile-search-result-item:hover {
  background: #2a2a2a !important;
}

body.dark-theme .mobile-search-result-title {
  color: #ffffff !important;
}

body.dark-theme .mobile-search-result-meta {
  color: #cccccc !important;
}

/* Mobile Search Results Difficulty Dark Theme - Match Desktop */
body.dark-theme .mobile-search-result-difficulty.easy {
  background: #28a745 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

body.dark-theme .mobile-search-result-difficulty.medium {
  background: #ffa500 !important;
  color: #000000 !important;
  font-weight: 600 !important;
}

body.dark-theme .mobile-search-result-difficulty.hard {
  background: #dc3545 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Mobile Problem Title Dark Theme */
body.dark-theme .mobile-problem-title {
  color: #ffffff !important;
}

/* Mobile List Actions Dark Theme */
body.dark-theme .mobile-list-actions {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Mobile Action Buttons Dark Theme */
body.dark-theme .mobile-action-button {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .mobile-action-button:hover {
  background: #404040 !important;
  border-color: #666666 !important;
}

/* Preserve specific button colors in dark theme */
body.dark-theme .mobile-start-button {
  background: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #10b981 !important;
}

body.dark-theme .mobile-start-button:hover {
  background: #059669 !important;
  border-color: #059669 !important;
}

body.dark-theme .mobile-random-button {
  background: #f59e0b !important;
  color: #ffffff !important;
  border: 1px solid #f59e0b !important;
}

body.dark-theme .mobile-random-button:hover {
  background: #d97706 !important;
  border-color: #d97706 !important;
}

body.dark-theme .mobile-back-button {
  background: #0969da !important;
  color: #ffffff !important;
  border: 1px solid #0969da !important;
}

body.dark-theme .mobile-back-button:hover {
  background: #0860ca !important;
  border-color: #0860ca !important;
}

/* List Styles Dark Theme */
body.dark-theme #mobile-lists-sidebar,
body.dark-theme #mobile-file-list {
  background: #1a1a1a !important;
  border-right: 1px solid #404040 !important;
}

/* Fix mobile sidebar background and borders */
body.dark-theme #mobile-sidebar {
  background: #1a1a1a !important;
  border-right: 1px solid #404040 !important;
}

/* Fix mobile content background */
body.dark-theme #mobile-content {
  background: #1a1a1a !important;
}

/* Fix mobile lists container background */
body.dark-theme #mobile-lists-list {
  background: #1a1a1a !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Mobile Lists - Force dark theme override with higher specificity (exclude category items) */
body.dark-theme #mobile-lists-list li:not(.category-header):not(.category-content),
body.dark-theme #mobile-file-list li {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme #mobile-lists-list li:not(.category-header):not(.category-content):hover,
body.dark-theme #mobile-file-list li:hover {
  background: #2a2a2a !important;
  border-color: #555555 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(calc(-2px * var(--mobile-scale))) !important;
}

body.dark-theme #mobile-lists-list a,
body.dark-theme #mobile-file-list a {
  color: #ffffff !important;
}

/* Fix mobile breadcrumb text color in dark theme */
body.dark-theme .mobile-breadcrumb-text {
    color: #ffffff !important;
}

body.dark-theme #mobile-breadcrumb-list {
    color: #ffffff !important;
}

/* Fix mobile action buttons container in dark theme */
body.dark-theme .mobile-action-buttons {
    background: #1f1f1f !important;
    border: 1px solid #404040 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Fix welcome message text color in dark theme */
body.dark-theme .mobile-list-actions div {
    color: #ffffff !important;
}

body.dark-theme .mobile-welcome-message div {
    color: #ffffff !important;
}

/* Fix mobile list title color in dark theme */
body.dark-theme .mobile-list-title {
    color: #ffffff !important;
}

/* Fix mobile home view dark theme */
body.dark-theme #mobile-home-content div[style*="background: white"] {
    background: #1f1f1f !important;
    border: 1px solid #404040 !important;
}

body.dark-theme #mobile-home-content h3[style*="color: #374151"] {
    color: #66b3ff !important;
}

body.dark-theme #mobile-home-content p[style*="color: #6b7280"] {
    color: #cccccc !important;
}

body.dark-theme #mobile-version-info {
    background: #1f1f1f !important;
    border-top: 1px solid #404040 !important;
    color: #cccccc !important;
}

/* Preserve button colors - prevent inheritance override */
.mobile-content-inner button,
.desktop-content-inner button {
    color: white !important;
}

/* Specific button color preservation */
.mobile-content-inner button[style*="background: #6f42c1"],
.desktop-content-inner button[style*="background: #6f42c1"] {
    background: #6f42c1 !important;
    color: white !important;
}

.mobile-content-inner button[style*="background: #f59e0b"],
.desktop-content-inner button[style*="background: #f59e0b"] {
    background: #f59e0b !important;
    color: white !important;
}

.mobile-content-inner button[style*="background: #0969da"],
.desktop-content-inner button[style*="background: #0969da"] {
    background: #0969da !important;
    color: white !important;
}

/* Fix individual button inline styles with maximum specificity */
html body.dark-theme .mobile-action-buttons button[disabled] {
    background: #333333 !important;
    color: #666666 !important;
    border: 1px solid #555555 !important;
    cursor: not-allowed !important;
}

html body.dark-theme .mobile-action-buttons button#mobile-next-btn {
    background: #6f42c1 !important;
    color: white !important;
    border: none !important;
}

html body.dark-theme .mobile-action-buttons button#mobile-random-btn {
    background: #f59e0b !important;
    color: white !important;
    border: none !important;
}

html body.dark-theme .mobile-action-buttons button#mobile-print-btn {
    background: #6b7280 !important;
    color: #9ca3af !important;
    border: 1px solid #4b5563 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Fix button hover states with maximum specificity */
html body.dark-theme .mobile-action-buttons button#mobile-next-btn:hover {
    background: #5a2d8f !important;
}

html body.dark-theme .mobile-action-buttons button#mobile-random-btn:hover {
    background: #d97706 !important;
}

html body.dark-theme .mobile-action-buttons button#mobile-print-btn:hover {
    background: #6b7280 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
}

body.dark-theme #mobile-lists-list a:hover,
body.dark-theme #mobile-file-list a:hover {
  background: transparent !important;
  color: #ffffff !important;
}

/* Extra specificity for mobile lists dark theme (exclude category items) */
html body.dark-theme #mobile-lists-list li:not(.category-header):not(.category-content):hover,
html body.dark-theme #mobile-file-list li:hover {
  background: #2a2a2a !important;
}

html body.dark-theme #mobile-lists-list a:hover,
html body.dark-theme #mobile-file-list a:hover {
  background: transparent !important;
}

/* Additional mobile element overrides */
body.dark-theme .mobile-list-icon-and-title {
  color: #ffffff !important;
}

body.dark-theme .mobile-difficulty-badge {
  border-color: #555555 !important;
  color: #ffffff !important;
}

/* Override media query dark mode styles with manual dark theme */
body.dark-theme #mobile-lists-list a:hover,
body.dark-theme #mobile-file-list a:hover {
  background: transparent !important;
  color: #ffffff !important;
}

/* Difficulty Badges and Indicators Dark Theme */
body.dark-theme .difficulty-badge {
  border: 1px solid #555555 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .difficulty-badge.easy {
  background: #28a745 !important;
  color: #ffffff !important;
  border-color: #34ce57 !important;
  font-weight: 600 !important;
}

body.dark-theme .difficulty-badge.medium {
  background: #ffa500 !important;
  color: #000000 !important;
  border-color: #ffb733 !important;
  font-weight: 600 !important;
}

body.dark-theme .difficulty-badge.hard {
  background: #dc3545 !important;
  color: #ffffff !important;
  border-color: #e74c3c !important;
  font-weight: 600 !important;
}

/* Difficulty Dots Dark Theme */
body.dark-theme .mobile-difficulty-dot.easy,
body.dark-theme .difficulty-dot-inline.easy,
body.dark-theme .markdown-difficulty-dot.easy {
  background: #28a745 !important;
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.6) !important;
}

body.dark-theme .mobile-difficulty-dot.medium,
body.dark-theme .difficulty-dot-inline.medium,
body.dark-theme .markdown-difficulty-dot.medium {
  background: #ffa500 !important;
  box-shadow: 0 0 8px rgba(255, 165, 0, 0.6) !important;
}

body.dark-theme .mobile-difficulty-dot.hard,
body.dark-theme .difficulty-dot-inline.hard,
body.dark-theme .markdown-difficulty-dot.hard {
  background: #dc3545 !important;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.6) !important;
}

/* Desktop Search Results Difficulty Dark Theme */
@media (min-width: 1024px) {
  body.dark-theme .desktop-search-result-difficulty.easy {
    background: #28a745 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }

  body.dark-theme .desktop-search-result-difficulty.medium {
    background: #ffa500 !important;
    color: #000000 !important;
    font-weight: 600 !important;
  }

  body.dark-theme .desktop-search-result-difficulty.hard {
    background: #dc3545 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }

  body.dark-theme .desktop-problem-difficulty.easy {
    background: #28a745 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }

  body.dark-theme .desktop-problem-difficulty.medium {
    background: #ffa500 !important;
    color: #000000 !important;
    font-weight: 600 !important;
  }

  body.dark-theme .desktop-problem-difficulty.hard {
    background: #dc3545 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }
}

/* Floating Action Buttons Dark Theme */
body.dark-theme .mobile-feedback-fab {
  background: #6f42c1 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 8px 25px rgba(111, 66, 193, 0.4) !important;
  backdrop-filter: blur(8px) !important;
}

body.dark-theme .mobile-share-fab {
  background: #0969da !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 8px 25px rgba(9, 105, 218, 0.4) !important;
  backdrop-filter: blur(8px) !important;
}

body.dark-theme .mobile-feedback-fab:hover {
  background: #5a2d91 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 12px 30px rgba(90, 45, 145, 0.5) !important;
  transform: translateY(-2px) scale(1.05) !important;
}

body.dark-theme .mobile-share-fab:hover {
  background: #0550ae !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 12px 30px rgba(5, 80, 174, 0.5) !important;
  transform: translateY(-2px) scale(1.05) !important;
}

body.dark-theme .mobile-feedback-fab:active {
  transform: translateY(-1px) scale(0.98) !important;
  background: #4a2574 !important;
}

body.dark-theme .mobile-share-fab:active {
  transform: translateY(-1px) scale(0.98) !important;
  background: #044289 !important;
}

/* Action Buttons Dark Theme */
body.dark-theme .mobile-action-btn {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .mobile-action-btn:hover {
  background: #404040 !important;
  color: #ffffff !important;
  border-color: #666666 !important;
}

body.dark-theme .mobile-action-btn:disabled {
  background: #1a1a1a !important;
  color: #666666 !important;
  border-color: #333333 !important;
}

/* Close Buttons Dark Theme */
body.dark-theme .mobile-close-btn {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .mobile-close-btn:hover {
  background: #dc3545 !important;
  color: #ffffff !important;
  border-color: #e74c3c !important;
}

@media (min-width: 1024px) {
  body.dark-theme .desktop-close-btn {
    background: #333333 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
  }

  body.dark-theme .desktop-close-btn:hover {
    background: #dc3545 !important;
    color: #ffffff !important;
    border-color: #e74c3c !important;
  }
}

/* Desktop Layout Dark Theme */
body.dark-theme #desktop-content {
  background: #0a0a0a !important;
}

/* Desktop Sidebars Dark Theme - Match Column 3 styling */
body.dark-theme #desktop-lists-sidebar,
body.dark-theme #desktop-problems-sidebar {
  background: #0a0a0a !important;
  border-right: 1px solid #404040 !important;
}

/* Desktop Lists and File Lists Dark Theme */
body.dark-theme #desktop-lists-list,
body.dark-theme #desktop-file-list {
  background: transparent !important;
}

/* Desktop List Items Dark Theme - Match content area styling (exclude category items) */
body.dark-theme #desktop-lists-list li:not(.category-header):not(.category-content):not(.desktop-category-header):not(.desktop-category-content),
body.dark-theme #desktop-file-list li {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme #desktop-lists-list li:not(.category-header):not(.category-content):not(.desktop-category-header):not(.desktop-category-content):hover,
body.dark-theme #desktop-file-list li:hover {
  background: #2a2a2a !important;
  border-color: #555555 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5) !important;
}

/* Desktop List Links Dark Theme */
body.dark-theme #desktop-lists-list a,
body.dark-theme #desktop-file-list a {
  color: #ffffff !important;
}

body.dark-theme #desktop-lists-list a:hover,
body.dark-theme #desktop-file-list a:hover {
  background: transparent !important;
  color: #ffffff !important;
}

/* Active states for desktop lists (exclude category items) */
/* Dark theme - Enhanced styling to match light theme */
body.dark-theme #desktop-lists-list li.active:not(.category-header):not(.category-content):not(.desktop-category-header):not(.desktop-category-content),
body.dark-theme #desktop-file-list li.active {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  border-left: 5px solid #60a5fa !important;
  border-color: #475569 !important;
  border-radius: calc(12px * var(--desktop-scale)) !important;
  box-shadow: 
    0 2px 8px rgba(96, 165, 250, 0.15) !important,
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme #desktop-lists-list li.active:not(.category-header):not(.category-content):not(.desktop-category-header):not(.desktop-category-content) a,
body.dark-theme #desktop-file-list li.active a {
  background: transparent !important;
  color: #e2e8f0 !important;
  font-weight: 600 !important;
}

/* Dark theme - Enhanced problem number styling in active state */
body.dark-theme #desktop-file-list li.active .desktop-problem-number {
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  padding: 2px 8px !important;
  border-radius: 6px !important;
  font-size: 0.85em !important;
  text-shadow: none !important;
  box-shadow: 0 1px 3px rgba(96, 165, 250, 0.4) !important;
}

/* Desktop List Text Elements Dark Theme */
body.dark-theme .desktop-list-title {
  color: #ffffff !important;
}

body.dark-theme .desktop-list-count,
body.dark-theme .desktop-list-description {
  color: #cccccc !important;
}

body.dark-theme .desktop-problem-number {
  color: #ffffff !important;
  background: #2d3748 !important;
  border-color: #4a5568 !important;
  font-weight: 700 !important;
}

body.dark-theme .mobile-problem-number {
  color: #ffffff !important;
  background: #2d3748 !important;
  border-color: #4a5568 !important;
  font-weight: 700 !important;
}

body.dark-theme .desktop-problem-title {
  color: #ffffff !important;
}

body.dark-theme .desktop-problem-meta {
  color: #cccccc !important;
}

/* Desktop List Icons Dark Theme */
body.dark-theme .desktop-list-icon {
  background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%) !important;
  color: #ffffff !important;
}

/* Desktop Difficulty Indicators Dark Theme */
body.dark-theme .desktop-difficulty-indicator {
  background: rgba(42, 42, 42, 0.8) !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .desktop-difficulty-indicator.easy {
  background: rgba(40, 167, 69, 0.2) !important;
  border-color: #28a745 !important;
}

body.dark-theme .desktop-difficulty-indicator.medium {
  background: rgba(255, 165, 0, 0.2) !important;
  border-color: #ffa500 !important;
}

body.dark-theme .desktop-difficulty-indicator.hard {
  background: rgba(220, 53, 69, 0.2) !important;
  border-color: #dc3545 !important;
}

/* Desktop sidebar scrollbars - hidden by default like light mode */

/* Desktop Search Modal Dark Theme */
body.dark-theme #desktop-search-modal {
  background: rgba(0, 0, 0, 0.8) !important;
}

body.dark-theme .desktop-search-modal-content {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
  color: #ffffff !important;
}

body.dark-theme .desktop-search-filters {
  background: #2a2a2a !important;
  border: 1px solid #404040 !important;
}

body.dark-theme .desktop-search-filters label {
  color: #ffffff !important;
}

body.dark-theme #desktop-search-results {
  background: #1f1f1f !important;
  border: 1px solid #404040 !important;
}

body.dark-theme .desktop-search-result-item {
  border-bottom: 1px solid #404040 !important;
  color: #ffffff !important;
}

body.dark-theme .desktop-search-result-item:hover {
  background: #2a2a2a !important;
}

body.dark-theme .desktop-search-result-title {
  color: #ffffff !important;
}

body.dark-theme .desktop-search-result-meta {
  color: #cccccc !important;
}

/* Desktop Container Dark Theme */
body.dark-theme #desktop-container {
  background: #0a0a0a !important;
}

/* Desktop Content Background Wrapper - High Elevation Tile Design */
body.dark-theme .desktop-content-with-background {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 30%, #2a2a2a 100%) !important;
  border: 1px solid rgba(64, 64, 64, 0.6) !important;
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.4) !important,
    0 12px 24px rgba(0, 0, 0, 0.3) !important,
    0 20px 40px rgba(0, 0, 0, 0.25) !important,
    0 30px 60px rgba(0, 0, 0, 0.2) !important,
    inset 0 2px 0 rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(12px) !important;
}

body.dark-theme .desktop-content-with-background:hover {
  box-shadow: 
    0 12px 24px rgba(0, 0, 0, 0.5) !important,
    0 20px 40px rgba(0, 0, 0, 0.4) !important,
    0 32px 64px rgba(0, 0, 0, 0.3) !important,
    0 48px 96px rgba(0, 0, 0, 0.25) !important,
    inset 0 2px 0 rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(64, 64, 64, 0.4) !important;
}

/* Desktop Header (if exists) */
body.dark-theme .desktop-header {
  background: #1a1a1a !important;
  border-bottom: 1px solid #404040 !important;
  color: #ffffff !important;
}

/* Desktop sidebar headers and dividers */
body.dark-theme .desktop-sidebar-header {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border-bottom: 1px solid #404040 !important;
}

/* Desktop list dividers */
body.dark-theme .desktop-list-divider {
  border-top: 1px solid #404040 !important;
}

/* Desktop problem navigation */
body.dark-theme .desktop-problem-nav {
  background: #2a2a2a !important;
  border: 1px solid #404040 !important;
}

body.dark-theme .desktop-problem-nav a {
  color: #66b3ff !important;
}

body.dark-theme .desktop-problem-nav a:hover {
  color: #4da6ff !important;
}

/* Additional desktop elements */
body.dark-theme .desktop-content-with-background {
  background: transparent !important;
}

body.dark-theme .desktop-action-buttons {
  background: rgba(26, 26, 26, 0.9) !important;
  border-bottom: 1px solid #404040 !important;
}

/* Desktop action buttons styling */
body.dark-theme .desktop-action-buttons button:not([style*="background:"]) {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

body.dark-theme .desktop-action-buttons button:not([style*="background:"]):hover {
  background: #404040 !important;
  border-color: #666666 !important;
}

body.dark-theme .desktop-action-buttons button:disabled {
  background: #1a1a1a !important;
  color: #666666 !important;
  border-color: #333333 !important;
}

/* Fix inline button styles in dark theme - maximum specificity */
html body.dark-theme button[style*="background: #6f42c1"],
html body.dark-theme .desktop-content-inner button[style*="background: #6f42c1"],
html body.dark-theme .mobile-content-inner button[style*="background: #6f42c1"] {
  background: #6f42c1 !important;
  color: white !important;
}

html body.dark-theme button[style*="background: #f59e0b"],
html body.dark-theme .desktop-content-inner button[style*="background: #f59e0b"],
html body.dark-theme .mobile-content-inner button[style*="background: #f59e0b"] {
  background: #f59e0b !important;
  color: white !important;
}

html body.dark-theme button[style*="background: #0969da"],
html body.dark-theme .desktop-content-inner button[style*="background: #0969da"],
html body.dark-theme .mobile-content-inner button[style*="background: #0969da"] {
  background: #0969da !important;
  color: white !important;
}

/* Hover states for colored buttons in dark theme */
html body.dark-theme button[style*="background: #6f42c1"]:hover,
html body.dark-theme .desktop-content-inner button[style*="background: #6f42c1"]:hover,
html body.dark-theme .mobile-content-inner button[style*="background: #6f42c1"]:hover {
  background: #5a2d8f !important;
  color: white !important;
}

html body.dark-theme button[style*="background: #f59e0b"]:hover,
html body.dark-theme .desktop-content-inner button[style*="background: #f59e0b"]:hover,
html body.dark-theme .mobile-content-inner button[style*="background: #f59e0b"]:hover {
  background: #d97706 !important;
  color: white !important;
}

html body.dark-theme button[style*="background: #0969da"]:hover,
html body.dark-theme .desktop-content-inner button[style*="background: #0969da"]:hover,
html body.dark-theme .mobile-content-inner button[style*="background: #0969da"]:hover {
  background: #0860ca !important;
  color: white !important;
}

/* Fix inline link styles in dark theme - maximum specificity */
html body.dark-theme a[style*="background: #0969da"],
html body.dark-theme .desktop-content-inner a[style*="background: #0969da"],
html body.dark-theme .mobile-content-inner a[style*="background: #0969da"] {
  background: #0969da !important;
  color: white !important;
}

html body.dark-theme a[style*="background: #6f42c1"],
html body.dark-theme .desktop-content-inner a[style*="background: #6f42c1"],
html body.dark-theme .mobile-content-inner a[style*="background: #6f42c1"] {
  background: #6f42c1 !important;
  color: white !important;
}

html body.dark-theme a[style*="background: #f59e0b"],
html body.dark-theme .desktop-content-inner a[style*="background: #f59e0b"],
html body.dark-theme .mobile-content-inner a[style*="background: #f59e0b"] {
  background: #f59e0b !important;
  color: white !important;
}

/* Hover states for colored links in dark theme */
html body.dark-theme a[style*="background: #0969da"]:hover,
html body.dark-theme .desktop-content-inner a[style*="background: #0969da"]:hover,
html body.dark-theme .mobile-content-inner a[style*="background: #0969da"]:hover {
  background: #0550ae !important;
  color: white !important;
}

html body.dark-theme a[style*="background: #6f42c1"]:hover,
html body.dark-theme .desktop-content-inner a[style*="background: #6f42c1"]:hover,
html body.dark-theme .mobile-content-inner a[style*="background: #6f42c1"]:hover {
  background: #5a2d8f !important;
  color: white !important;
}

html body.dark-theme a[style*="background: #f59e0b"]:hover,
html body.dark-theme .desktop-content-inner a[style*="background: #f59e0b"]:hover,
html body.dark-theme .mobile-content-inner a[style*="background: #f59e0b"]:hover {
  background: #d97706 !important;
  color: white !important;
}

/* ====================================
   TAGS AND SIMILAR PROBLEMS STYLING
   ==================================== */

/* Base container styling for tags and similar problems sections */
.tag-container, .similar-problems-container {
  margin-top: calc(12px * var(--mobile-scale));
  margin-bottom: calc(20px * var(--mobile-scale));
  line-height: 1.5;
}

/* Tag button styling */
.tag-button {
  display: inline-block;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #3730a3;
  text-decoration: none;
  padding: calc(2px * var(--mobile-scale)) calc(6px * var(--mobile-scale));
  margin: calc(1px * var(--mobile-scale)) calc(3px * var(--mobile-scale)) calc(1px * var(--mobile-scale)) 0;
  border-radius: calc(8px * var(--mobile-scale));
  font-size: calc(11px * var(--mobile-scale));
  font-weight: 500;
  border: 1px solid rgba(55, 48, 163, 0.2);
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tag-button:hover {
  background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(55, 48, 163, 0.15);
  text-decoration: none;
  color: #312e81;
}

.tag-button:active {
  transform: scale(0.95);
}

/* Similar problem button styling with difficulty colors */
.similar-problem-button {
  display: inline-block;
  text-decoration: none;
  padding: calc(2px * var(--mobile-scale)) calc(6px * var(--mobile-scale));
  margin: calc(1px * var(--mobile-scale)) calc(3px * var(--mobile-scale)) calc(1px * var(--mobile-scale)) 0;
  border-radius: calc(8px * var(--mobile-scale));
  font-size: calc(11px * var(--mobile-scale));
  font-weight: 500;
  border: 1px solid;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  line-height: 1.2;
}

.similar-problem-button:hover {
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.similar-problem-button:active {
  transform: scale(0.95);
}

/* Difficulty-specific styling for similar problems */
.similar-problem-button.easy {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.2);
}

.similar-problem-button.easy:hover {
  background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.2);
  color: #14532d;
}

.similar-problem-button.medium {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.2);
}

.similar-problem-button.medium:hover {
  background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
  color: #92400e;
}

.similar-problem-button.hard {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.2);
}

.similar-problem-button.hard:hover {
  background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
  color: #991b1b;
}

/* Desktop responsive adjustments */
@media (min-width: 768px) {
  .tag-container, .similar-problems-container {
    margin-top: calc(12px * var(--desktop-scale));
    margin-bottom: calc(20px * var(--desktop-scale));
  }

  .tag-button {
    padding: calc(3px * var(--desktop-scale)) calc(8px * var(--desktop-scale));
    margin: calc(2px * var(--desktop-scale)) calc(4px * var(--desktop-scale)) calc(2px * var(--desktop-scale)) 0;
    border-radius: calc(10px * var(--desktop-scale));
    font-size: calc(12px * var(--desktop-scale));
  }

  .similar-problem-button {
    padding: calc(3px * var(--desktop-scale)) calc(8px * var(--desktop-scale));
    margin: calc(2px * var(--desktop-scale)) calc(4px * var(--desktop-scale)) calc(2px * var(--desktop-scale)) 0;
    border-radius: calc(10px * var(--desktop-scale));
    font-size: calc(12px * var(--desktop-scale));
  }
}

/* Dark theme support */
body.dark-theme .tag-button {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%) !important;
  color: #ffffff !important;
  border-color: #5ba0f2 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3) !important;
}

body.dark-theme .tag-button:hover {
  background: linear-gradient(135deg, #357abd 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 8px rgba(74, 144, 226, 0.5) !important;
  transform: translateY(-1px);
  border-color: #3b82f6 !important;
}

body.dark-theme .tag-button:active {
  transform: scale(0.95) !important;
  box-shadow: 0 1px 3px rgba(74, 144, 226, 0.4) !important;
}

body.dark-theme .similar-problem-button.easy {
  background: #28a745 !important;
  color: #ffffff !important;
  border-color: #34ce57 !important;
  font-weight: 600 !important;
}

body.dark-theme .similar-problem-button.easy:hover {
  background: #218838 !important;
  color: #ffffff !important;
}

body.dark-theme .similar-problem-button.medium {
  background: #ffa500 !important;
  color: #000000 !important;
  border-color: #ffb733 !important;
  font-weight: 600 !important;
}

body.dark-theme .similar-problem-button.medium:hover {
  background: #e69500 !important;
  color: #000000 !important;
}

body.dark-theme .similar-problem-button.hard {
  background: #dc3545 !important;
  color: #ffffff !important;
  border-color: #e74c3c !important;
  font-weight: 600 !important;
}

body.dark-theme .similar-problem-button.hard:hover {
  background: #c82333 !important;
  color: #ffffff !important;
}

/* Stats Grid Dark Theme - Fix invisible white text */
body.dark-theme .stats-grid-4 > div {
  background: #2a2a2a !important;
  border: 1px solid #404040 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .stats-grid-4 > div > div:nth-child(2),
body.dark-theme .stats-grid-4 > div > div:nth-child(3) {
  color: #ffffff !important;
}

/* Override inline styles for tiles and cards */
body.dark-theme div[style*="background: white"],
body.dark-theme div[style*="background:white"],
body.dark-theme div[style*="background:#ffffff"],
body.dark-theme div[style*="background: #ffffff"] {
  background: #2a2a2a !important;
  border: 1px solid #404040 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Fix text colors in tiles */
body.dark-theme div[style*="background: white"] h3,
body.dark-theme div[style*="background:white"] h3,
body.dark-theme div[style*="background:#ffffff"] h3, 
body.dark-theme div[style*="background: #ffffff"] h3 {
  color: #66b3ff !important;
}

body.dark-theme div[style*="background: white"] p,
body.dark-theme div[style*="background:white"] p,
body.dark-theme div[style*="background:#ffffff"] p,
body.dark-theme div[style*="background: #ffffff"] p {
  color: #ffffff !important;
}

/* Override any inline text color styles that make text invisible */
body.dark-theme h3[style*="color: #374151"],
body.dark-theme h3[style*="color:#374151"] {
  color: #66b3ff !important;
}

body.dark-theme p[style*="color: #6b7280"],
body.dark-theme p[style*="color:#6b7280"] {
  color: #ffffff !important;
}

/* HLJS Dark Theme - Remove horizontal lines and improve styling */
body.dark-theme .hljs {
  background: transparent !important;
  color: #d4d4d4 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Enhanced specificity for desktop content HLJS elements */
html body.dark-theme .desktop-content-inner .hljs,
html body.dark-theme .mobile-content-inner .hljs {
  background: transparent !important;
  color: #d4d4d4 !important;
  border: none !important;
  box-shadow: none !important;
}

html body.dark-theme .desktop-content-inner code.hljs,
html body.dark-theme .mobile-content-inner code.hljs {
  background: transparent !important;
  color: #d4d4d4 !important;
  border: none !important;
  box-shadow: none !important;
  padding: calc(3px * var(--desktop-scale)) calc(6px * var(--desktop-scale)) !important;
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;  
}

html body.dark-theme .desktop-content-inner pre.hljs,
html body.dark-theme .mobile-content-inner pre.hljs {
  background: #2a2a2a !important;
  border: 1px solid #404040 !important;
  color: #d4d4d4 !important;
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
}

body.dark-theme .hljs-keyword {
  color: #569cd6 !important;
  font-weight: 600 !important;
}

body.dark-theme .hljs-title.function_ {
  color: #dcdcaa !important;
  font-weight: 600 !important;
}

body.dark-theme .hljs-params {
  color: #9cdcfe !important;
}

body.dark-theme .hljs-number {
  color: #b5cea8 !important;
  font-weight: 500 !important;
}

/* Enhanced specificity syntax highlighting for desktop/mobile content */
html body.dark-theme .desktop-content-inner .hljs-keyword,
html body.dark-theme .mobile-content-inner .hljs-keyword {
  color: #569cd6 !important;
  font-weight: 600 !important;
}

html body.dark-theme .desktop-content-inner .hljs-title.function_,
html body.dark-theme .mobile-content-inner .hljs-title.function_ {
  color: #dcdcaa !important;
  font-weight: 600 !important;
}

html body.dark-theme .desktop-content-inner .hljs-params,
html body.dark-theme .mobile-content-inner .hljs-params {
  color: #9cdcfe !important;
}

html body.dark-theme .desktop-content-inner .hljs-number,
html body.dark-theme .mobile-content-inner .hljs-number {
  color: #b5cea8 !important;
  font-weight: 500 !important;
}

html body.dark-theme .desktop-content-inner .hljs-comment,
html body.dark-theme .mobile-content-inner .hljs-comment {
  color: #6a9955 !important;
  font-style: italic !important;
}

html body.dark-theme .desktop-content-inner .hljs-built_in,
html body.dark-theme .mobile-content-inner .hljs-built_in {
  color: #4ec9b0 !important;
}

body.dark-theme .hljs-comment {
  color: #6a9955 !important;
  font-style: italic !important;
}

body.dark-theme .hljs-built_in {
  color: #4ec9b0 !important;
  font-weight: 500 !important;
}

body.dark-theme .hljs-string {
  color: #ce9178 !important;
}

body.dark-theme .hljs-operator {
  color: #d4d4d4 !important;
}

body.dark-theme .hljs-punctuation {
  color: #d4d4d4 !important;
}

body.dark-theme .hljs-attr,
body.dark-theme .hljs-attribute {
  color: #9cdcfe !important;
}

body.dark-theme .hljs-class .hljs-title {
  color: #4ec9b0 !important;
  font-weight: 600 !important;
}

body.dark-theme .hljs-variable,
body.dark-theme .hljs-name {
  color: #9cdcfe !important;
}

body.dark-theme .hljs-literal {
  color: #569cd6 !important;
}

/* Enhanced specificity for additional syntax highlighting classes */
html body.dark-theme .desktop-content-inner .hljs-string,
html body.dark-theme .mobile-content-inner .hljs-string {
  color: #ce9178 !important;
}

html body.dark-theme .desktop-content-inner .hljs-operator,
html body.dark-theme .mobile-content-inner .hljs-operator {
  color: #d4d4d4 !important;
}

html body.dark-theme .desktop-content-inner .hljs-punctuation,
html body.dark-theme .mobile-content-inner .hljs-punctuation {
  color: #d4d4d4 !important;
}

html body.dark-theme .desktop-content-inner .hljs-attr,
html body.dark-theme .mobile-content-inner .hljs-attr,
html body.dark-theme .desktop-content-inner .hljs-attribute,
html body.dark-theme .mobile-content-inner .hljs-attribute {
  color: #9cdcfe !important;
}

html body.dark-theme .desktop-content-inner .hljs-class .hljs-title,
html body.dark-theme .mobile-content-inner .hljs-class .hljs-title {
  color: #4ec9b0 !important;
  font-weight: 600 !important;
}

html body.dark-theme .desktop-content-inner .hljs-variable,
html body.dark-theme .mobile-content-inner .hljs-variable,
html body.dark-theme .desktop-content-inner .hljs-name,
html body.dark-theme .mobile-content-inner .hljs-name {
  color: #9cdcfe !important;
}

html body.dark-theme .desktop-content-inner .hljs-literal,
html body.dark-theme .mobile-content-inner .hljs-literal {
  color: #569cd6 !important;
}

/* Dark theme footer styling - matching content background */
html body.dark-theme .mobile-author-footnote,
html body.dark-theme .desktop-content-inner .mobile-author-footnote,
html body.dark-theme .mobile-content-inner .mobile-author-footnote {
  background: #1f1f1f !important;
  border-top: 2px solid #404040 !important;
  color: #d1d5db !important;
}

html body.dark-theme .mobile-author-footnote p,
html body.dark-theme .desktop-content-inner .mobile-author-footnote p,
html body.dark-theme .mobile-content-inner .mobile-author-footnote p {
  color: #d1d5db !important;
}

html body.dark-theme .heart,
html body.dark-theme .mobile-author-footnote .heart,
html body.dark-theme .desktop-content-inner .heart,
html body.dark-theme .mobile-content-inner .heart {
  color: #f87171 !important;
  text-shadow: 0 1px 2px rgba(248, 113, 113, 0.4) !important;
}

/* Action buttons styling - Practice, Prev, Next, Random, Print */
/* Remove all transitions from buttons to prevent CSS conflicts */
button, 
button[data-action], 
a[href*="leetcode.com"], 
a[rel="noopener noreferrer"] {
  transition: none !important;
}

/* Force white color for Practice buttons */
.desktop-content-inner a[href*="leetcode.com"], 
.mobile-content-inner a[href*="leetcode.com"],
a[href*="leetcode.com"] {
  color: white !important;
}

.desktop-content-inner a[href*="leetcode.com"]:hover, 
.mobile-content-inner a[href*="leetcode.com"]:hover,
a[href*="leetcode.com"]:hover {
  color: white !important;
}

/* Force white color for tag buttons in dark mode only */
body.dark-theme .desktop-content-inner .tag-button,
body.dark-theme .mobile-content-inner .tag-button {
  color: white !important;
}

/* Fix MD page navigation buttons - override inline styles with maximum specificity */
html body.dark-theme .desktop-content-inner button[data-action="prev"]:not([style*="background:"]),
html body.dark-theme .mobile-content-inner button[data-action="prev"]:not([style*="background:"]),
html body.dark-theme .desktop-content-inner button[data-action="next"]:not([style*="background:"]),
html body.dark-theme .mobile-content-inner button[data-action="next"]:not([style*="background:"]),
html body.dark-theme .desktop-content-inner button[data-action="random"]:not([style*="background:"]),
html body.dark-theme .mobile-content-inner button[data-action="random"]:not([style*="background:"]), 
/* Print buttons in dark theme - disabled appearance */
html body.dark-theme .desktop-content-inner button[data-action="print"]:not([style*="background:"]),
html body.dark-theme .mobile-content-inner button[data-action="print"]:not([style*="background:"]),
body.dark-theme button[data-action="print"]:not([style*="background:"]),
html body.dark-theme button#desktop-print-btn[data-action="print"],
html body.dark-theme .desktop-content-inner button#desktop-print-btn[data-action="print"] {
  background: #6b7280 !important;
  color: #9ca3af !important;
  border: 1px solid #4b5563 !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* Other action buttons in dark theme - normal appearance */
body.dark-theme button[data-action="prev"]:not([style*="background:"]),
body.dark-theme button[data-action="next"]:not([style*="background:"]),
body.dark-theme button[data-action="random"]:not([style*="background:"]) {
  background: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #555555 !important;
}

html body.dark-theme .desktop-content-inner button[data-action="prev"]:not([style*="background:"]):hover,
html body.dark-theme .mobile-content-inner button[data-action="prev"]:not([style*="background:"]):hover,
html body.dark-theme .desktop-content-inner button[data-action="next"]:not([style*="background:"]):hover,
html body.dark-theme .mobile-content-inner button[data-action="next"]:not([style*="background:"]):hover,
html body.dark-theme .desktop-content-inner button[data-action="random"]:not([style*="background:"]):hover,
html body.dark-theme .mobile-content-inner button[data-action="random"]:not([style*="background:"]):hover,
/* Print buttons hover in dark theme - keep disabled appearance */
html body.dark-theme .desktop-content-inner button[data-action="print"]:not([style*="background:"]):hover,
html body.dark-theme .mobile-content-inner button[data-action="print"]:not([style*="background:"]):hover,
body.dark-theme button[data-action="print"]:not([style*="background:"]):hover,
html body.dark-theme button#desktop-print-btn[data-action="print"]:hover,
html body.dark-theme .desktop-content-inner button#desktop-print-btn[data-action="print"]:hover {
  background: #6b7280 !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
}

/* Other action buttons hover in dark theme - normal appearance */
body.dark-theme button[data-action="prev"]:not([style*="background:"]):hover,
body.dark-theme button[data-action="next"]:not([style*="background:"]):hover,
body.dark-theme button[data-action="random"]:not([style*="background:"]):hover {
  background: #404040 !important;
  border-color: #666666 !important;
}

/* Fix disabled MD page navigation buttons with maximum specificity */
html body.dark-theme .desktop-content-inner button[disabled],
html body.dark-theme .mobile-content-inner button[disabled],
body.dark-theme button[disabled] {
  background: #1a1a1a !important;
  color: #666666 !important;
  border: 1px solid #333333 !important;
}

/* Also fix light theme disabled buttons to match layout */
html .mobile-content-inner button[disabled],
html .desktop-content-inner button[disabled],
.mobile-content-inner button[disabled],
.desktop-content-inner button[disabled] {
  background: #f1f3f4 !important;
  color: #8c959f !important;
  border: 1px solid #d1d5db !important;
}

/* Ensure disabled buttons stay properly styled */
button[disabled] {
  transition: none !important;
  background-color: #f6f8fa !important;
  color: #8c959f !important;
}

button[disabled]:hover {
  background-color: #f6f8fa !important;
  color: #8c959f !important;
  transform: none !important;
}

/* =============================================
   CATEGORY STYLES - Mobile and Desktop
   ============================================= */

/* Base Category Header Styles */
.category-header {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.category-title {
  margin: calc(1rem * var(--mobile-scale, 1)) 0 calc(0.5rem * var(--mobile-scale, 1)) 0;
}

.category-toggle {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--mobile-scale, 1));
  padding: calc(6px * var(--mobile-scale, 1)) calc(4px * var(--mobile-scale, 1));
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: none;
  user-select: none;
  margin-bottom: calc(6px * var(--mobile-scale, 1));
  margin-top: calc(8px * var(--mobile-scale, 1));
  box-shadow: none;
  position: relative;
}

/* Remove hover effects for mobile category toggles */
@media (max-width: 1023px) {
  .category-toggle:hover {
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
  }
}

.category-icon {
  font-size: calc(1.6rem * var(--mobile-scale, 1));
  filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
  animation: pulse 2s infinite;
}

.category-name {
  font-weight: 900;
  font-size: calc(1.1rem * var(--mobile-scale, 1));
  color: #1e1b4b;
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  text-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.category-arrow {
  font-size: calc(1.1rem * var(--mobile-scale, 1));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
  transform: scale(1);
  text-align: center;
  line-height: 1;
  /* Ensure perfect centering for all arrow characters */
  position: relative;
}

.category-arrow.collapsed {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  transform: scale(1) rotate(90deg);
}

/* Description styling removed for cleaner category headers */
.category-description {
  display: none;
}

/* Creative pulse animation for category icons */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
  }
}

/* Category Content Animation */
.category-content {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateY(0);
  max-height: none; /* No height limit - fully flexible */
}

/* Mobile-specific category collapse with smooth animations */
@media (max-width: 1023px) {
  .category-content {
    display: block;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
    max-height: none; /* No height limit - fully flexible */
  }
  
  .category-content.collapsed {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Override collapsed state during animation to keep content visible */
  .category-content.animating {
    display: block !important;
    overflow: hidden;
  }
}

/* Desktop-specific category collapse with animations */
@media (min-width: 1024px) {
  .category-content.collapsed {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Mobile-only category lists styling */
@media (max-width: 1023px) {
  .category-lists {
    padding: 0 calc(6px * var(--mobile-scale, 1)) calc(10px * var(--mobile-scale, 1)) calc(6px * var(--mobile-scale, 1));
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--mobile-scale, 1));
    width: 100%;
    box-sizing: border-box;
  }
}


/* Desktop-specific Category Styles */
@media (min-width: 1024px) {
  .desktop-category-header .category-title {
    margin: calc(1rem * var(--desktop-scale, 1)) 0 calc(0.5rem * var(--desktop-scale, 1)) 0;
  }

  .desktop-category-toggle {
    padding: calc(4px * var(--desktop-scale, 1)) calc(4px * var(--desktop-scale, 1));
    border-radius: 0;
    gap: calc(5px * var(--desktop-scale, 1));
    margin-bottom: calc(5px * var(--desktop-scale, 1));
    margin-top: calc(6px * var(--desktop-scale, 1));
  }

  .desktop-category-toggle .category-icon {
    font-size: calc(1.4rem * var(--desktop-scale, 1));
  }

  .desktop-category-toggle .category-name {
    font-size: calc(0.95rem * var(--desktop-scale, 1));
    font-weight: 900;
    letter-spacing: 1.5px;
  }

  .desktop-category-toggle .category-arrow {
    font-size: calc(1rem * var(--desktop-scale, 1));
  }

  .desktop-category-description {
    font-size: calc(0.75rem * var(--desktop-scale, 1));
    margin-top: calc(5px * var(--desktop-scale, 1));
    padding-left: calc(14px * var(--desktop-scale, 1));
    padding-right: calc(14px * var(--desktop-scale, 1));
  }

  .desktop-category-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Override the general desktop list styling for category headers */
  #desktop-lists-list li.category-header,
  #desktop-lists-list li.desktop-category-header {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* Override the general desktop list hover for category headers and content */
  #desktop-lists-list li.category-header:hover,
  #desktop-lists-list li.desktop-category-header:hover,
  #desktop-lists-list li.category-content:hover,
  #desktop-lists-list li.desktop-category-content:hover {
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .desktop-category-content {
    max-height: none !important;
  }

  .desktop-category-content.collapsed {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transform: translateY(-10px) !important;
  }

  .desktop-category-lists {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  .desktop-category-list-item {
    margin-bottom: calc(6px * var(--desktop-scale, 1));
  }
}

/* Dark Theme Support for Categories */
body.dark-theme .category-toggle {
  background: transparent;
  box-shadow: none;
}

body.dark-theme .category-name {
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 12px rgba(129, 140, 248, 0.4);
}

body.dark-theme .category-icon {
  filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.6));
}

body.dark-theme .category-arrow {
  color: #818cf8;
  filter: drop-shadow(0 0 4px rgba(129, 140, 248, 0.6));
}

/* Category description hidden in new design */

body.dark-theme .category-arrow {
  color: #9ca3af;
}

/* Ensure categories integrate well with existing list styles */
@media (max-width: 1023px) {
  .category-content .mobile-list-header {
    border-radius: calc(6px * var(--mobile-scale, 1));
  }
}

@media (min-width: 1024px) {
  .desktop-category-content .desktop-list-header {
    border-radius: calc(4px * var(--desktop-scale, 1));
  }
}

/* =============================================
   CATEGORY LIST ITEM STYLING - DESKTOP
   ============================================= */

/* Apply original desktop list styling to category list items */
.desktop-category-list-item {
  margin: 0;
  border-radius: calc(12px * var(--desktop-scale));
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  overflow: visible;
  transition: all 0.3s ease;
  margin-bottom: calc(6px * var(--desktop-scale, 1));
}

.desktop-category-list-item:hover:not(.active) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.desktop-category-list-item a {
  display: block;
  padding: 0;
  text-decoration: none;
  color: #1e293b;
  transition: all 0.2s ease;
}

.desktop-category-list-item:not(.active) a:hover {
  background: rgba(249, 250, 251, 0.8);
  border-radius: calc(12px * var(--desktop-scale));
}

/* Active state for desktop category list items */
.desktop-category-list-item.active {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-left: 5px solid #2563eb;
  border-color: #3b82f6;
  border-radius: calc(12px * var(--desktop-scale));
  box-shadow: 
    0 2px 8px rgba(37, 99, 235, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: none !important;
}

.desktop-category-list-item.active:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  transform: none !important;
  box-shadow: 
    0 2px 8px rgba(37, 99, 235, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.desktop-category-list-item.active a {
  background: transparent !important;
  font-weight: 600;
  color: #1d4ed8;
}

.desktop-category-list-item.active a:hover {
  background: transparent !important;
  color: #1d4ed8 !important;
}

/* Desktop List Header styling within categories */
.desktop-category-list-item .desktop-list-header {
  padding: calc(16px * var(--desktop-scale)) calc(18px * var(--desktop-scale));
}

/* =============================================
   CATEGORY LIST ITEM STYLING - MOBILE
   ============================================= */

/* Mobile category list item styling - MOBILE ONLY */
@media (max-width: 1023px) {
  .category-list-item a {
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
  }

  /* Dark theme support for mobile category list items - using original main branch styling */
  body.dark-theme .category-list-item {
    background: #1f1f1f !important;
    border: 1px solid #404040 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  }

  body.dark-theme .category-list-item:hover {
    background: #2a2a2a !important;
    border-color: #555555 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5) !important;
    transform: translateY(calc(-2px * var(--mobile-scale))) !important;
  }

  body.dark-theme .category-list-item a {
    color: #ffffff !important;
  }
}

/* Dark theme support for category list items */
body.dark-theme .desktop-category-list-item {
  background: #1f2937;
  border: 1px solid #374151;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-theme .desktop-category-list-item:hover:not(.active) {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  background: #374151;
}

body.dark-theme .desktop-category-list-item a {
  color: #f9fafb;
}

body.dark-theme .desktop-category-list-item:not(.active) a:hover {
  background: rgba(55, 65, 81, 0.3);
  border-radius: calc(12px * var(--desktop-scale));
}

/* Mobile feedback modal responsive improvements */
@media (max-height: 600px) {
  .mobile-modal-content {
    margin: 2vh auto;
    max-height: 75vh;
  }
}

@media (max-height: 500px) {
  .mobile-modal-content {
    margin: 1vh auto;
    max-height: 80vh;
  }
  
  .mobile-modal-body {
    padding: calc(15px * var(--mobile-scale));
  }
  
  .feedback-field {
    margin-bottom: calc(15px * var(--mobile-scale));
  }
  
  .feedback-field textarea {
    min-height: calc(80px * var(--mobile-scale));
  }
}

/* Handle keyboard appearance on mobile */
@media (max-height: 400px) {
  .mobile-modal-content {
    margin: 0 auto;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .mobile-modal-header {
    border-radius: 0;
  }
  
  .feedback-actions {
    border-radius: 0;
  }
}

body.dark-theme .desktop-category-list-item.active {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-left: 5px solid #3b82f6;
  border-color: #60a5fa;
  box-shadow: 
    0 2px 8px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-theme .desktop-category-list-item.active a {
  color: #dbeafe;
  font-weight: 600;
}
