:root {
  /* Color system */
  --gray-900: #0a0a0a;
  --gray-800: #1a1a1a;
  --gray-700: #2a2a2a;
  --gray-600: #3a3a3a;
  --gray-500: #666;
  --gray-400: #888;
  --gray-300: #bbb;
  --gray-200: #ddd;
  --gray-100: #e0e0e0;

  --cyan: #00ffff;
  --cyan-10: rgba(0, 255, 255, 0.1);
  --cyan-15: rgba(0, 255, 255, 0.15);
  --cyan-30: rgba(0, 255, 255, 0.3);
  --cyan-50: rgba(0, 255, 255, 0.5);

  --magenta: #ff00ff;
  --magenta-10: rgba(255, 0, 255, 0.1);
  --magenta-30: rgba(255, 0, 255, 0.3);

  /* Spacing (8px grid) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;

  /* Sidebar width */
  --sidebar-width: 340px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--gray-900);
  color: var(--gray-100);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--cyan);
  color: var(--gray-900);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 16px;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--gray-800) 0%, #0f0f0f 100%);
  border-right: 1px solid var(--cyan-15);
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop sidebar collapsed state */
@media (min-width: 769px) {
  .sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
}

/* Desktop sidebar toggle button */
.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: var(--space-3);
  left: calc(var(--sidebar-width) + var(--space-3));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cyan-10);
  border: 1px solid var(--cyan-30);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--cyan);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 150;
}

.sidebar-toggle-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 255, 255, 0.3);
  transform: scale(1.05);
}

.sidebar-toggle-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

@media (min-width: 769px) {
  .sidebar-toggle-btn {
    display: flex;
  }

  .sidebar-toggle-btn.collapsed {
    left: var(--space-3);
  }
}

.sidebar-header {
  padding: 32px 24px 24px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #00ffff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.sidebar-header p {
  font-size: 13px;
  color: #888;
  font-weight: 300;
  line-height: 1.5;
}

.sidebar-content {
  padding: 24px;
}

.control-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #666;
  margin-bottom: 16px;
}

/* Collapsible sections */
.control-section.collapsible {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.section-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.section-title-text {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-400);
}

.collapse-icon {
  transition: transform 0.2s;
  color: var(--gray-500);
}

.section-header[aria-expanded="false"] .collapse-icon {
  transform: rotate(-90deg);
}

.section-content {
  padding: 16px;
  display: block;
}

.section-header[aria-expanded="false"] + .section-content {
  display: none;
}

/* Select with color preview */
.select-with-preview label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-300);
  margin-bottom: 8px;
}

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

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.select-row select {
  flex: 1;
}


.control-group {
  margin-bottom: 20px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #bbb;
}

.control-value {
  color: #00ffff;
  font-weight: 600;
  font-size: 13px;
}

select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2300ffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 255, 255, 0.3);
}

select:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.1);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #00ffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 255, 255, 0.4);
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #00ffff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 255, 255, 0.4);
}

/* Style info display */
.style-info {
  background: rgba(255, 0, 255, 0.05);
  border: 1px solid rgba(255, 0, 255, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.4;
}

.style-info .style-name {
  color: var(--magenta);
  font-weight: 600;
}

.style-info .style-desc {
  color: var(--gray-400);
}

button {
  width: 100%;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  color: #00ffff;
  padding: 14px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 10px;
}

button:hover {
  background: rgba(0, 255, 255, 0.15);
  border-color: rgba(0, 255, 255, 0.5);
  box-shadow: 0 4px 16px rgba(0, 255, 255, 0.2);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #bbb;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
}

/* ================================
   COLLAPSIBLE ADVANCED SECTION
   ================================ */
.advanced-section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 24px;
}

.advanced-section > summary {
  padding: 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.advanced-section > summary::-webkit-details-marker {
  display: none;
}

.advanced-section > summary::after {
  content: '▸';
  font-size: 14px;
  color: var(--gray-500);
  transition: transform 0.2s;
}

.advanced-section[open] > summary::after {
  transform: rotate(90deg);
}

.advanced-section > summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.advanced-section > summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.advanced-section .section-title.collapsible {
  margin-bottom: 0;
}

.subsection {
  padding: 0 16px 16px;
}

.subsection:first-of-type {
  padding-top: 4px;
}

.subsection-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ================================
   PLAYBACK SECTION
   ================================ */
.playback-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.playback-controls button {
  margin-bottom: 0;
}

.utility-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.utility-controls button {
  margin-bottom: 0;
  padding: 12px 14px;
  font-size: 13px;
}

/* Hint section smaller spacing */
.hint-section {
  margin-bottom: 16px;
}

/* Canvas */
#canvas {
  position: fixed;
  left: var(--sidebar-width);
  top: 0;
  width: calc(100vw - var(--sidebar-width));
  height: 100vh;
  cursor: grab;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#canvas:active { cursor: grabbing; }

/* Canvas expanded when sidebar collapsed (desktop) */
@media (min-width: 769px) {
  #canvas.expanded {
    left: 0;
    width: 100vw;
  }
}

/* ================================
   UNIFIED FLOATING CONTROLS (bottom left)
   ================================ */
.floating-controls {
  position: fixed;
  bottom: 24px;
  left: calc(var(--sidebar-width) + 24px);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  padding: 8px 12px;
  z-index: 60;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When sidebar is collapsed, move controls to edge */
.sidebar.collapsed ~ .floating-controls {
  left: 24px;
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.15s;
  padding: 0;
  margin: 0;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.ctrl-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* Play/Pause button - slightly larger */
.ctrl-btn.play-pause {
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.9);
}

.ctrl-btn.play-pause svg {
  width: 24px;
  height: 24px;
}

.ctrl-btn.play-pause:hover {
  color: #fff;
}

/* Show/hide play vs pause icons based on state */
.ctrl-btn.play-pause .play-icon {
  display: none;
}
.ctrl-btn.play-pause .pause-icon {
  display: block;
}
.ctrl-btn.play-pause.paused .play-icon {
  display: block;
}
.ctrl-btn.play-pause.paused .pause-icon {
  display: none;
}

/* Speed indicator */
.speed-indicator {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Divider between playback and actions */
.ctrl-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 8px;
}


/* Stats */
.stats {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.8;
  backdrop-filter: blur(10px);
  z-index: 50;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #888;
  font-weight: 400;
}

.stats-row span {
  color: #00ffff;
  font-weight: 600;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active { display: flex; }

.modal-content {
  background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 16px;
  padding: 40px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-content h2 {
  color: #00ffff;
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 600;
}

.modal-content h3 {
  color: #00ffff;
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 600;
}

.modal-content p {
  color: #bbb;
  line-height: 1.7;
  margin-bottom: 16px;
  font-size: 14px;
}

.modal-content a {
  color: #ff00ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 0, 255, 0.3);
  transition: all 0.2s;
}

.modal-content a:hover {
  color: #00ffff;
  border-bottom-color: #00ffff;
}

/* Dataset info badge */
.dataset-info {
  background: rgba(0, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #888;
  line-height: 1.6;
}

.dataset-info strong {
  color: #00ffff;
  font-weight: 600;
}

/* Data Mapping Display */
.mapping-display {
  background: rgba(255, 0, 255, 0.05);
  border: 1px solid rgba(255, 0, 255, 0.15);
  border-radius: 8px;
  padding: 0;
  margin-top: 8px;
  font-size: 12px;
  overflow: hidden;
}

.mapping-toggle {
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ff00ff;
  font-weight: 500;
  user-select: none;
  transition: background 0.2s;
}

.mapping-toggle::-webkit-details-marker {
  display: none;
}

.mapping-toggle:hover {
  background: rgba(255, 0, 255, 0.08);
}

.mapping-icon {
  font-size: 14px;
  transition: transform 0.2s;
}

.mapping-display[open] .mapping-icon {
  transform: rotate(90deg);
}

.mapping-content {
  padding: 0 12px 12px;
}

.mapping-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  animation: mappingFadeIn 0.3s ease-out;
}

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

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

.mapping-source {
  flex: 1;
  color: #bbb;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapping-arrow {
  color: #ff00ff;
  font-size: 14px;
  flex-shrink: 0;
  animation: mappingPulse 2s ease-in-out infinite;
}

@keyframes mappingPulse {
  0%, 100% {
    opacity: 0.5;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(3px);
  }
}

.mapping-target {
  flex: 1;
  color: #00ffff;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapping-value {
  color: #00ffff;
  font-weight: 700;
  font-size: 12px;
}

/* Mobile adjustments for mapping */
@media (max-width: 768px) {
  .mapping-display {
    font-size: 11px;
  }

  .mapping-item {
    flex-wrap: wrap;
    gap: 4px;
  }

  .mapping-source,
  .mapping-target {
    font-size: 10px;
  }
}

/* Toggle switches */
.toggle-group {
  margin-bottom: 12px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-label input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #888;
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-label input[type="checkbox"]:checked {
  background: rgba(0, 255, 255, 0.3);
}

.toggle-label input[type="checkbox"]:checked::before {
  left: 23px;
  background: #00ffff;
  box-shadow: 0 2px 8px rgba(0, 255, 255, 0.4);
}

.toggle-label input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.toggle-text {
  font-size: 13px;
  font-weight: 500;
  color: #bbb;
}

/* Hamburger menu button */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  color: #00ffff;
  transition: all 0.2s;
  z-index: 150;
}

.hamburger-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 255, 255, 0.3);
}

/* Close button in sidebar */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  color: #bbb;
  transition: all 0.2s;
  z-index: 10;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Mobile styles */
@media (max-width: 768px) {
  /* Show hamburger button */
  .hamburger-btn {
    display: flex;
  }

  /* Sidebar - hidden by default, overlay when open */
  .sidebar {
    width: 85vw;
    max-width: 340px;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.7);
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* Canvas - full width */
  #canvas {
    left: 0;
    width: 100vw;
  }

  /* Stats panel - bottom left, more compact */
  .stats {
    left: 16px;
    right: auto;
    bottom: 16px;
    padding: 12px 16px;
    font-size: 12px;
    line-height: 1.6;
  }

  .stats-row {
    gap: 12px;
  }

  /* Floating controls - mobile (sidebar overlays, so controls at edge) */
  .floating-controls {
    bottom: 16px;
    left: 16px;
    padding: 6px 10px;
    gap: 4px;
  }

  .ctrl-btn {
    width: 36px;
    height: 36px;
  }

  .ctrl-btn svg {
    width: 18px;
    height: 18px;
  }

  .ctrl-btn.play-pause {
    width: 42px;
    height: 42px;
  }

  .ctrl-btn.play-pause svg {
    width: 22px;
    height: 22px;
  }

  .speed-indicator {
    font-size: 12px;
    min-width: 36px;
  }

  .ctrl-divider {
    height: 20px;
    margin: 0 6px;
  }

  /* Modal - full width with less padding */
  .modal-content {
    max-width: 95vw;
    padding: 24px;
    max-height: 85vh;
  }

  .modal-content h2 {
    font-size: 24px;
  }

  .modal-content h3 {
    font-size: 16px;
  }

  .modal-content p {
    font-size: 13px;
  }

  /* Color categories - 3 columns for better touch targets */
  .color-category {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .color-option {
    height: 52px;
  }

  .mood-filter {
    gap: 8px;
  }

  .mood-btn {
    font-size: 14px;
    padding: 10px 12px;
  }

  /* Ensure touch-friendly controls */
  input[type="range"] {
    height: 8px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }

  select {
    padding: 14px 16px;
    font-size: 15px;
  }

  button {
    padding: 16px 20px;
    font-size: 15px;
  }

  /* Mobile Advanced Section */
  .advanced-section > summary {
    padding: 14px;
  }

  .subsection {
    padding: 0 14px 14px;
  }

  /* Mobile Playback */
  .utility-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .utility-controls button {
    padding: 14px;
  }
}

@media (max-width: 480px) {
  /* Smaller devices - even more compact */
  .sidebar {
    width: 90vw;
  }

  .sidebar-header {
    padding: 24px 20px 20px;
  }

  .sidebar-header h1 {
    font-size: 18px;
  }

  .sidebar-header p {
    font-size: 12px;
  }

  .sidebar-content {
    padding: 20px;
  }

  .control-section {
    margin-bottom: 24px;
  }

  .stats {
    left: auto;
    right: 12px;
    bottom: 12px;
    padding: 10px 14px;
    font-size: 11px;
  }

  /* Floating controls - compact but still usable */
  .floating-controls {
    bottom: 12px;
    left: 12px;
    padding: 5px 8px;
    gap: 3px;
  }

  .ctrl-btn {
    width: 32px;
    height: 32px;
  }

  .ctrl-btn svg {
    width: 16px;
    height: 16px;
  }

  .ctrl-btn.play-pause {
    width: 38px;
    height: 38px;
  }

  .ctrl-btn.play-pause svg {
    width: 20px;
    height: 20px;
  }

  .speed-indicator {
    font-size: 11px;
    min-width: 32px;
  }

  .ctrl-divider {
    height: 18px;
    margin: 0 4px;
  }

  .hamburger-btn {
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .modal-content {
    padding: 20px;
  }

  .modal-content h2 {
    font-size: 20px;
  }

  .modal-content h3 {
    font-size: 15px;
  }
}

/* ================================
   ACCESSIBILITY
   ================================ */
/* Focus visible for keyboard navigation */
button:focus-visible,
select:focus-visible,
.color-option:focus-visible,
.hamburger-btn:focus-visible,
.sidebar-close-btn:focus-visible,
.ctrl-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Color options keyboard focus */
.color-option:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-30);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  #canvas,
  .sidebar-toggle-btn,
  button,
  .color-option,
  select,
  .modal,
  input[type="range"]::-webkit-slider-thumb,
  input[type="range"]::-moz-range-thumb {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .sidebar {
    border-right-color: var(--cyan-50);
  }

  select,
  button,
  .color-option {
    border-width: 2px;
  }

  .control-value {
    font-weight: 700;
  }
}

/* ================================
   PARAMETER TOOLTIPS
   ================================ */
.param-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.15);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s;
}

.param-info:hover {
  background: rgba(0, 255, 255, 0.25);
}

.param-info::before {
  content: 'ⓘ';
}

/* Tooltip */
.param-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  border: 1px solid var(--cyan-30);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--gray-200);
  white-space: normal;
  width: 220px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.param-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--cyan-30);
}

.param-info:hover .param-tooltip,
.param-info:focus .param-tooltip {
  opacity: 1;
  pointer-events: auto;
}

.param-info:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Attractor description */
.attractor-description {
  background: rgba(255, 0, 255, 0.05);
  border: 1px solid rgba(255, 0, 255, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.6;
}

/* ================================
   ONBOARDING TOOLTIPS
   ================================ */
/* Tooltip container */
.onboarding-tooltip {
  position: fixed;
  background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
  border: 2px solid var(--cyan);
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 255, 255, 0.3), 0 0 0 9999px rgba(0, 0, 0, 0.75);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.onboarding-tooltip.active {
  opacity: 1;
  transform: translateY(0);
}

.onboarding-tooltip h3 {
  color: var(--cyan);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.onboarding-tooltip p {
  color: var(--gray-200);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.onboarding-tooltip-buttons {
  display: flex;
  gap: 8px;
}

.onboarding-tooltip button {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0;
}

.onboarding-tooltip .btn-primary {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.25) 0%, rgba(255, 0, 255, 0.2) 100%);
  border: 1px solid var(--cyan);
  color: #fff;
}

.onboarding-tooltip .btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.35) 0%, rgba(255, 0, 255, 0.3) 100%);
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.3);
}

.onboarding-tooltip .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--gray-300);
}

.onboarding-tooltip .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--gray-100);
}

/* Spotlight effect for highlighted elements */
.onboarding-highlight {
  position: relative;
  z-index: 1000;
  box-shadow: 0 0 0 4px rgba(0, 255, 255, 0.5), 0 0 32px rgba(0, 255, 255, 0.4);
  border-radius: 8px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(0, 255, 255, 0.5), 0 0 32px rgba(0, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 255, 255, 0.7), 0 0 48px rgba(0, 255, 255, 0.6);
  }
}

/* Progress indicator */
.onboarding-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: center;
}

.onboarding-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
}

.onboarding-progress-dot.active {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.onboarding-progress-dot.completed {
  background: var(--magenta);
}
