/* ============================================
   SACRED VERSES - MODAL SYSTEM (REDESIGNED)
   Typography, Themes, and Shortcuts Interface
   ============================================ */

/* ===========================================
   MODAL BASE STYLES
   =========================================== */

.shortcuts-help {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-index-modal, 30);
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.shortcuts-help.active {
  opacity: 1;
  visibility: visible;
}

.shortcuts-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.shortcuts-content {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-large, 1rem);
  
  padding: 2rem;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  
  box-shadow: 
    0 20px 40px var(--shadow-color),
    0 0 0 1px var(--accent-glow);
  
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.shortcuts-help.active .shortcuts-content {
  transform: scale(1);
}

.shortcuts-content.dragging {
  cursor: grabbing !important;
  transition: none !important;
  z-index: 9999;
  box-shadow: 
    0 25px 50px var(--shadow-color),
    0 0 0 1px var(--accent-glow),
    0 0 30px var(--accent-glow);
}

.shortcuts-content.snapping {
  cursor: move;
}

/* ===========================================
   MODAL HEADER SECTION
   =========================================== */

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-large, 1rem);;
  padding: 15px;
}

.shortcuts-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-xl, 1.25rem);
  font-weight: var(--font-weight-semibold, 600);
  text-align: center;
  width: 100%;
}

/* ===========================================
   CLOSE BUTTON STYLING
   =========================================== */

.shortcuts-close {
  /* Reset and positioning */
  background: none;
  border: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
  outline: none;
  
  /* Layout and sizing */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  
  /* Visual styling */
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  
  /* Subtle elevation */
  box-shadow: 
    0 2px 8px var(--shadow-color),
    0 0 0 1px var(--accent-glow);
  
  /* Smooth transitions */
  transition: all var(--transition-fast, 0.2s ease);
  
  /* Performance optimization */
  will-change: transform, background-color, box-shadow;
  transform: translateZ(0);
  backface-visibility: hidden;
  
  /* Positioning for elegant placement */
  position: relative;
  z-index: 10;
}

.shortcuts-close svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  display: block;
  transition: all var(--transition-fast, 0.2s ease);
  shape-rendering: geometricPrecision;
}

/* Close button interactive states */
.shortcuts-close:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 
    0 4px 16px var(--accent-glow),
    0 0 0 4px var(--accent-glow);
}

.shortcuts-close:hover svg {
  transform: scale(1.1) rotate(90deg);
  stroke-width: 2.5;
}

.shortcuts-close:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 2px 8px var(--accent-glow),
    0 0 0 2px var(--accent-glow);
}

.shortcuts-close:focus-visible {
  outline: none;
  box-shadow: 
    0 4px 16px var(--accent-glow),
    0 0 0 3px var(--accent-primary),
    0 0 0 6px var(--accent-glow);
}

/* Close button entrance animation */
.shortcuts-help.active .shortcuts-close {
  animation: closeButtonFadeIn 0.4s ease-out backwards;
}

@keyframes closeButtonFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(-90deg);
  }
  60% {
    transform: scale(1.05) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Close button ripple effect */
.shortcuts-close::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--accent-glow);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.shortcuts-close:active::before {
  width: 3rem;
  height: 3rem;
  opacity: 0.3;
  transition: none;
}

/* ===========================================
   MODAL BODY LAYOUT
   =========================================== */

.shortcuts-body {
  display: grid;
  gap: 2rem;
}

.shortcuts-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shortcuts-section h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-medium, 500);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* ===========================================
   TYPOGRAPHY SECTION - FONT CARDS
   =========================================== */

.typography-section {
  order: 1;
}

.font-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.font-card {
  padding: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-large, 1rem);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.font-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-color);
  border-color: var(--accent-primary);
}

.font-card.active {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.font-card.active::after {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.font-card-name {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.font-card-preview {
  font-size: var(--font-size-xl, 1.25rem);
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: var(--font-weight-normal, 400);
}

/* Font-specific styling */
.font-card[data-font="source-sans"] .font-card-name,
.font-card[data-font="source-sans"] .font-card-preview {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.font-card[data-font="source-serif"] .font-card-name,
.font-card[data-font="source-serif"] .font-card-preview {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

/* ===========================================
   BACKGROUND TEXTURE SECTION
   =========================================== */

.texture-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
}

.texture-card {
  cursor: pointer;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius, 0.75rem);
  overflow: hidden;
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
}

.texture-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
  border-color: var(--accent-primary);
}

.texture-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.texture-card.active::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.texture-mode-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  padding: 1px 6px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  line-height: 1.5;
  pointer-events: none;
}

.texture-mode-badge.texture-mode-light {
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
}

.texture-mode-badge.texture-mode-dark {
  background: rgba(0, 0, 0, 0.65);
  color: #f5f5f5;
}

.texture-mode-badge.texture-mode-both {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.texture-preview {
  width: 100%;
  height: 60px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-primary);
}

/* Checkerboard swatch for the "None" option */
.texture-card[data-texture-id="none"] .texture-preview {
  background-image:
    linear-gradient(45deg, var(--border-color) 25%, transparent 25%),
    linear-gradient(-45deg, var(--border-color) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--border-color) 75%),
    linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
  opacity: 0.5;
}

.texture-name {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================================
   TEXT ANIMATION SECTION
   =========================================== */

.animation-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 4px 6px 0;

  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

.animation-carousel::-webkit-scrollbar {
  width: 6px;
}

.animation-carousel::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 3px;
}

.animation-card {
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius, 0.75rem);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.animation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
  border-color: var(--accent-primary);
}

.animation-card.active {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===========================================
   THEME SECTION - ENHANCED CAROUSEL
   =========================================== */

.theme-section {
  order: 2;
}

/* Enhanced carousel wrapper with elegant shadows */
.theme-carousel-wrapper {
  position: relative;
  border-radius: 1rem;
  padding: 0.125rem;
  background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
  
  /* Elegant outer shadow matching navigation buttons */
  box-shadow: 
    0 4px 12px var(--shadow-color),
    0 0 0 1px var(--border-color);
  
  transition: all var(--transition-normal, 0.4s ease);
}

.theme-carousel-wrapper:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 8px 20px var(--shadow-color),
    0 0 0 1px var(--border-color),
    0 0 24px var(--accent-glow);
}

/* Enhanced carousel container */
.theme-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  
  /* Enhanced styling */
  background: var(--bg-primary);
  border-radius: calc(1rem - 0.125rem);

  
  /* Enhanced scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
  scroll-behavior: smooth;
  
  /* Performance optimizations */
  contain: layout paint;
  will-change: scroll-position;
  transform: translateZ(0);
  backface-visibility: hidden;
  
  /* Z-index lower than shadow so entire container appears below */
  position: relative;
  z-index: 1;
}

/* Simple shadow overlay (appears above cards when JS is fixed) */
.theme-carousel-shadow {
  position: absolute;
  inset: 0.125rem;
  pointer-events: none;
  border-radius: calc(1rem - 0.125rem);
  z-index: 2;
  
  /* Subtle gradient overlay for visual depth */
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 20%,
    transparent 80%,
    rgba(0, 0, 0, 0.02) 100%
  );
  
  /* Very subtle inner glow */
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 1px 3px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px var(--border-color);
  
  transition: all var(--transition-normal, 0.4s ease);
  opacity: 0.8;
}

.theme-carousel-wrapper:hover .theme-carousel-shadow {
  opacity: 1;
}

/* Enhanced webkit scrollbar styling */
.theme-carousel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.theme-carousel::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
  margin: 4px;
}

.theme-carousel::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
  border: 1px solid var(--bg-primary);
  transition: all var(--transition-fast, 0.2s ease);
}

.theme-carousel::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
  transform: scaleY(1.1);
}

/* Theme cards remain unchanged */
.theme-card {
  width: 100%;
  height: 110px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.theme-card:active {
  transform: translateY(0);
}

.theme-card.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.theme-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.theme-preview {
  width: 100%;
  height: 65px;
  border-radius: 10px 10px 0 0;
  position: relative;
  overflow: hidden;
}

.theme-text-sample {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}

.theme-info {
  padding: 8px 12px;
  height: 45px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.theme-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-tags {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================================
   SHORTCUTS SECTION - 3-COLUMN GRID
   =========================================== */

.shortcuts-section {
  order: 3;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1.5rem;
  align-items: start;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-secondary);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  font-family: var(--font-mono, monospace);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-medium, 500);
  line-height: 1;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius, 0.5rem);
  box-shadow: inset 0 -1px 0 var(--border-color);
  min-width: 1.5rem;
  text-align: center;
}

/* ===========================================
   LOADING STATES
   =========================================== */

.theme-carousel.loading {
  opacity: 0.6;
  pointer-events: none;
}

.theme-carousel.loading .theme-carousel-wrapper {
  animation: carouselLoading 2s ease-in-out infinite;
}

@keyframes carouselLoading {
  0%, 100% {
    box-shadow: 
      0 4px 12px var(--shadow-color),
      0 0 0 1px var(--border-color);
  }
  50% {
    box-shadow: 
      0 4px 12px var(--shadow-color),
      0 0 0 1px var(--border-color),
      0 0 16px var(--accent-glow);
  }
}

.theme-card.loading {
  opacity: 0.5;
}

.theme-card.loading .theme-preview {
  background: var(--bg-secondary) !important;
}

.theme-card.loading .theme-text-sample {
  color: var(--text-muted) !important;
}

.font-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===========================================
   THEME-SPECIFIC ADAPTATIONS
   =========================================== */

/* Light themes - enhanced definition */
[data-theme="classic"] .theme-carousel-wrapper,
[data-theme="rosepine-dawn"] .theme-carousel-wrapper,
[data-theme="briar-rose-light"] .theme-carousel-wrapper {
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.08),
    0 0 0 1px var(--border-color),
    0 0 20px var(--accent-glow);
}

[data-theme="classic"] .theme-carousel,
[data-theme="rosepine-dawn"] .theme-carousel,
[data-theme="briar-rose-light"] .theme-carousel {
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.06),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Dark themes - subtle glow */
[data-theme*="dark"] .theme-carousel-wrapper,
[data-theme*="mocha"] .theme-carousel-wrapper,
[data-theme*="macchiato"] .theme-carousel-wrapper,
[data-theme*="frappe"] .theme-carousel-wrapper,
[data-theme="rosepine"] .theme-carousel-wrapper,
[data-theme="rosepine-moon"] .theme-carousel-wrapper {
  background: linear-gradient(145deg, var(--bg-primary), var(--bg-secondary));
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 0 1px var(--border-color),
    0 0 16px var(--accent-glow);
}

[data-theme*="dark"] .theme-carousel,
[data-theme*="mocha"] .theme-carousel,
[data-theme*="macchiato"] .theme-carousel,
[data-theme*="frappe"] .theme-carousel,
[data-theme="rosepine"] .theme-carousel,
[data-theme="rosepine-moon"] .theme-carousel {
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme*="dark"] .theme-carousel-shadow,
[data-theme*="mocha"] .theme-carousel-shadow,
[data-theme*="macchiato"] .theme-carousel-shadow,
[data-theme*="frappe"] .theme-carousel-shadow,
[data-theme="rosepine"] .theme-carousel-shadow,
[data-theme="rosepine-moon"] .theme-carousel-shadow {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0%,
    transparent 20%,
    transparent 80%,
    rgba(0, 0, 0, 0.1) 100%
  );
}

/* Close button theme adaptations */
[data-theme="classic"] .shortcuts-close:hover {
  box-shadow: 
    0 4px 16px rgba(184, 134, 11, 0.3),
    0 0 0 4px rgba(184, 134, 11, 0.15);
}

[data-theme*="dark"] .shortcuts-close,
[data-theme*="mocha"] .shortcuts-close,
[data-theme*="macchiato"] .shortcuts-close,
[data-theme*="frappe"] .shortcuts-close,
[data-theme="rosepine"] .shortcuts-close,
[data-theme="rosepine-moon"] .shortcuts-close {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme*="dark"] .shortcuts-close:hover,
[data-theme*="mocha"] .shortcuts-close:hover,
[data-theme*="macchiato"] .shortcuts-close:hover,
[data-theme*="frappe"] .shortcuts-close:hover,
[data-theme="rosepine"] .shortcuts-close:hover,
[data-theme="rosepine-moon"] .shortcuts-close:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

[data-theme="classic"] .shortcuts-close,
[data-theme="rosepine-dawn"] .shortcuts-close,
[data-theme="briar-rose-light"] .shortcuts-close {
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 1px var(--accent-glow);
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
  .shortcuts-content {
    max-width: 95vw;
    padding: 1.25rem;
    margin: 1rem;
  }
  
  .font-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .font-card {
    padding: 1.25rem;
  }
  
  .font-card-name {
    font-size: var(--font-size-base, 1rem);
  }
  
  .font-card-preview {
    font-size: var(--font-size-lg, 1.125rem);
  }
  
  .shortcuts-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .theme-carousel-wrapper {
    border-radius: 0.75rem;
    padding: 0.1rem;
  }
  
  .theme-carousel {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    max-height: 300px;
    border-radius: calc(0.75rem - 0.1rem);
    padding: 1rem;
  }
  
  .theme-carousel-shadow {
    border-radius: calc(0.75rem - 0.1rem);
  }
  
  .theme-card {
    height: 90px;
  }
  
  .theme-preview {
    height: 55px;
  }
  
  .theme-info {
    height: 35px;
    padding: 6px 8px;
  }
  
  .theme-text-sample {
    font-size: 11px;
  }
  
  .shortcuts-close {
    width: 2.75rem;
    height: 2.75rem;
  }
  
  .shortcuts-close svg {
    width: 1.375rem;
    height: 1.375rem;
  }
}

@media (max-width: 480px) {
  .shortcuts-content {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .font-card {
    padding: 1rem;
  }
  
  .theme-carousel-wrapper {
    border-radius: 0.5rem;
  }
  
  .theme-carousel {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    border-radius: calc(0.5rem - 0.1rem);
    padding: 0.75rem;
  }
  
  .theme-carousel-shadow {
    border-radius: calc(0.5rem - 0.1rem);
  }
  
  .theme-card {
    height: 80px;
  }
  
  .theme-preview {
    height: 50px;
  }
  
  .theme-info {
    height: 30px;
    padding: 4px 6px;
  }
  
  .theme-name {
    font-size: 11px;
  }
  
  .theme-tags {
    font-size: 9px;
  }
  
  .shortcuts-close {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .shortcuts-close svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* ===========================================
   ACCESSIBILITY SUPPORT
   =========================================== */

@media (prefers-reduced-motion: reduce) {
  .shortcuts-help {
    transition: opacity 0.2s ease;
  }
  
  .shortcuts-content {
    transition: none;
    transform: scale(1);
  }
  
  .shortcuts-help.active .shortcuts-content {
    transform: scale(1);
  }
  
  .theme-card,
  .font-card,
  .texture-card,
  .animation-card {
    transition: none;
  }

  .theme-carousel,
  .animation-carousel {
    scroll-behavior: auto;
  }
  
  .shortcuts-content {
    cursor: default !important;
  }
  
  .theme-carousel-wrapper,
  .theme-carousel,
  .theme-carousel-shadow {
    transition: none !important;
    animation: none !important;
  }
  
  .theme-carousel-wrapper:hover {
    transform: none !important;
  }
  
  .shortcuts-close,
  .shortcuts-close svg {
    transition: none !important;
  }
  
  .shortcuts-close:hover {
    transform: none !important;
  }
  
  .shortcuts-close:hover svg {
    transform: none !important;
  }
}

@media (prefers-contrast: high) {
  .shortcuts-content {
    border-width: 2px;
  }
  
  .theme-card,
  .font-card,
  .texture-card,
  .animation-card {
    border-width: 3px;
  }

  .theme-card.selected,
  .font-card.active,
  .texture-card.active,
  .animation-card.active {
    border-width: 4px;
  }
  
  kbd {
    border-width: 2px;
    font-weight: bold;
  }
  
  .theme-carousel-wrapper {
    border: 2px solid var(--text-primary);
    box-shadow: none;
  }
  
  .theme-carousel {
    border: 1px solid var(--border-color);
    box-shadow: none;
  }
  
  .theme-carousel-shadow {
    display: none;
  }
  
  .shortcuts-close {
    border-width: 2px;
    font-weight: bold;
  }
  
  .shortcuts-close svg {
    stroke-width: 3;
  }
  
  .shortcuts-close:focus-visible {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .theme-card:hover,
  .font-card:hover,
  .texture-card:hover,
  .animation-card:hover {
    transform: none;
    box-shadow: none;
  }

  .theme-card:active,
  .font-card:active,
  .texture-card:active,
  .animation-card:active {
    background: var(--bg-secondary);
    transform: scale(0.98);
  }

  .shortcuts-content {
    cursor: default;
  }
  
  .shortcuts-content.dragging {
    cursor: default;
  }
  
  .shortcuts-close:hover {
    transform: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: 
      0 2px 8px var(--shadow-color),
      0 0 0 1px var(--accent-glow);
  }
  
  .shortcuts-close:hover svg {
    transform: none;
    stroke-width: 2;
  }
  
  .shortcuts-close:active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
    transform: scale(0.95);
  }
}

/* ===========================================
   SCROLLBAR STYLING
   =========================================== */

.shortcuts-content {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

.shortcuts-content::-webkit-scrollbar {
  width: 8px;
}

.shortcuts-content::-webkit-scrollbar-track {
  background: transparent;
}

.shortcuts-content::-webkit-scrollbar-thumb {
  background-color: var(--accent-primary);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.shortcuts-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent-secondary);
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
  .shortcuts-help {
    display: none !important;
  }
  
  .theme-carousel-wrapper {
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
  
  .theme-carousel-shadow {
    display: none;
  }
  
  .shortcuts-close {
    display: none !important;
  }
}

/* CRITICAL: Mobile scrolling fixes */
@media (hover: none) and (pointer: coarse) {
  .shortcuts-content {
    touch-action: auto !important;
  }
  
  .theme-carousel {
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    overflow-y: auto !important;
  }
  
  .shortcuts-header {
    touch-action: none;
    cursor: move;
    padding: 1rem 0.5rem; /* Larger touch target */
  }
}

/* Phone-specific: Disable dragging completely */
@media (hover: none) and (pointer: coarse) and (max-width: 767px) {
  .shortcuts-content,
  .shortcuts-header {
    touch-action: auto !important;
    cursor: default !important;
  }
}