html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #111;
  }
  canvas {
    display: block;
    background-color: #222;
    cursor: grab;
  }  #controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 30, 0, 0.8));
    color: white;
    padding: 0;
    border-radius: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 0, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 380px;
    transition: all 0.3s ease;
  }

  #controls:hover {
    border-color: rgba(0, 255, 0, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  }

  .controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
  }

  .controls-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f0;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  }

  .controls-section {
    padding: 16px 20px;
  }

  .controls-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(0, 255, 0, 0.1);
  }

  .button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }

  .button-group .btn:nth-child(5) {
    grid-column: 1 / -1;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .btn-primary {
    background: linear-gradient(135deg, #0f0, #0a0);
    color: #000;
    border-color: #0f0;
  }

  .btn-primary:hover {
    background: linear-gradient(135deg, #1f1, #0f0);
    box-shadow: 0 4px 16px rgba(0, 255, 0, 0.4);
  }

  .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #ddd;
  }

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

  .btn-danger {
    background: linear-gradient(135deg, #f44, #d33);
    color: #fff;
    border-color: #f44;
  }

  .btn-danger:hover {
    background: linear-gradient(135deg, #f55, #f44);
    box-shadow: 0 4px 16px rgba(255, 68, 68, 0.4);
  }

  .btn-info {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: #fff;
    border-color: #4a90e2;
  }

  .btn-info:hover {
    background: linear-gradient(135deg, #5ba0f2, #4a90e2);
    box-shadow: 0 4px 16px rgba(74, 144, 226, 0.4);
  }

  .speed-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .speed-label {
    font-size: 13px;
    font-weight: 500;
    color: #0f0;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .speed-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .speed-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
  }

  .speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #0f0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 255, 0, 0.3);
  }

  .speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0f0;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 255, 0, 0.3);
  }

  .speed-display {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 0, 0.2);
  }

  .speed-input {
    width: 50px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 12px;
    text-align: center;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
  }

  /* Custom styling for number input spinner arrows */
  .speed-input::-webkit-outer-spin-button,
  .speed-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .speed-unit {
    font-size: 11px;
    color: #0f0;
    font-weight: 500;
  }
  .info-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    color: #0f0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .info-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
  }

  .home-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    color: #0f0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
  }

  .home-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
  }

  .help-text {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
    font-style: italic;
  }
  .help-text i {
    color: #0f0;
  }

  /* Subtle animations for personality */
  @keyframes glow {
    0%, 100% { text-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
    50% { text-shadow: 0 0 20px rgba(0, 255, 0, 0.6); }
  }

  .controls-title {
    animation: glow 3s ease-in-out infinite;
  }

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

  .btn-primary:not(:hover) {
    animation: pulse 2s ease-in-out infinite;
  }

  .speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    transition: transform 0.2s ease;
  }

  .speed-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    transition: transform 0.2s ease;
  }

  /* Responsive design for controls */
  @media (max-width: 768px) {
    #controls {
      top: 10px;
      left: 10px;
      right: 10px;
      min-width: auto;
      max-width: none;
    }

    .controls-title {
      font-size: 16px;
    }

    .button-group {
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }

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

    .speed-inputs {
      flex-direction: column;
      gap: 8px;
    }

    .help-text {
      font-size: 11px;
      text-align: center;
    }
  }

  @media (max-width: 480px) {
    #controls {
      position: relative;
      top: 0;
      left: 0;
      right: 0;
      margin: 10px;
      border-radius: 12px;
    }

    .button-group {
      grid-template-columns: 1fr;
      gap: 6px;
    }

    .button-group .btn:nth-child(5) {
      grid-column: 1;
    }

    .btn {
      justify-content: center;
    }
  }

  /* Modal Styles */
  .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
  }

  .modal.show {
    display: block;
  }

  .modal-content {
    background-color: #2a2a2a;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }

  .patterns-modal .modal-content {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(45, 45, 45, 0.9));
    margin: 2% auto;
    padding: 30px;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
  }

  .close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s;
  }

  .close:hover,
  .close:focus {
    color: #fff;
  }

  .tab-container {
    padding: 20px;
  }

  .tab-buttons {
    display: flex;
    border-bottom: 2px solid #444;
    margin-bottom: 20px;
  }

  .tab-button {
    background: none;
    border: none;
    color: #aaa;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    font-family: inherit;
  }

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

  .tab-button.active {
    color: #0f0;
    border-bottom-color: #0f0;
  }

  .tab-content {
    min-height: 300px;
  }

  .tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
  }

  .tab-panel.active {
    display: block;
  }

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

  .tab-panel h2 {
    color: #0f0;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
  }

  .tab-panel p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #ddd;
  }

  .tab-panel ul,
  .tab-panel ol {
    padding-left: 25px;
    color: #ddd;
  }

  .tab-panel li {
    margin-bottom: 8px;
    line-height: 1.5;
  }

  .tab-panel strong {
    color: #0f0;
  }

  .social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
  }

  .social-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ddd;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
    font-size: 14px;
  }

  .social-icon:hover {
    color: #0f0;
    background-color: rgba(0, 255, 0, 0.1);
    transform: translateY(-2px);
  }
  .social-icon i {
    font-size: 16px;
  }

  /* Inline links styling */
  .repo-link,
  .portfolio-link {
    color: #0f0;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border-bottom: 1px solid transparent;
  }

  .repo-link:hover,
  .portfolio-link:hover {
    color: #00ff00;
    border-bottom-color: #0f0;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
  }

  /* Video link styling */
  .video-link {
    color: #0f0;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border-bottom: 1px solid transparent;
  }

  .video-link:hover {
    color: #00ff00;
    border-bottom-color: #0f0;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
  }

  /* Patterns modal and list styling */
  .patterns-modal {
    display: none !important;
  }

  .patterns-modal.show {
    display: block !important;
  }

  .patterns-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
  }

  .pattern-item {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.8), rgba(50, 50, 50, 0.6));
    border: 1px solid rgba(200, 200, 200, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
  }

  .pattern-item:hover {
    border-color: rgba(100, 150, 255, 0.5);
    box-shadow: 0 8px 20px rgba(100, 150, 255, 0.1);
    transform: translateY(-2px);
  }

  .pattern-item h3 {
    color: #0f0;
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
  }

  .pattern-item p {
    color: #ddd;
    margin: 0 0 15px 0;
    line-height: 1.5;
    font-size: 14px;
  }

  .pattern-item button {
    background: linear-gradient(45deg, #0f0, #00cc00);
    border: none;
    color: #000;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .pattern-item button:hover {
    background: linear-gradient(45deg, #00ff00, #00dd00);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
  }

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

  /* Pattern preview styling */
  .pattern-preview-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
  }

  .pattern-preview {
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 6px;
    background: #222;
    transition: all 0.3s ease;
  }

  .pattern-preview:hover {
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.2);
  }