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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #101828;
  min-height: 100vh;
  color: #e2e8f0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: #f8fafc;
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.author-attribution {
  text-align: center;
  margin-top: 20px;
  padding: 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
}

.author-attribution p {
  color: #cbd5e1;
  font-size: 1.1rem;
  margin: 0;
}

.author-attribution a {
  color: #a78bfa;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.author-attribution a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

/* Algorithm Descriptions Styles */
.algorithm-descriptions {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
}

.algorithm-descriptions h2 {
  color: #f1f5f9;
  font-size: 1.8rem;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

.algorithm-section {
  margin-bottom: 10px;
}

.algorithm-section h3 {
  color: #667eea;
  font-size: 1.3rem;
  margin-bottom: 5px;
  font-weight: 600;
}

.algorithm-section p {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.95rem;
}

.algorithm-section strong {
  color: #a78bfa;
  font-weight: 600;
}

.controls {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group label {
  font-weight: 600;
  color: #e2e8f0;
}

select,
input[type="range"] {
  padding: 8px 12px;
  border: 2px solid #475569;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
  background: #334155;
  color: #e2e8f0;
}

select:focus,
input[type="range"]:focus {
  border-color: #667eea;
}

.control-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#start-btn {
  background: linear-gradient(45deg, #4caf50, #45a049);
  color: white;
}

#start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

#start-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#clear-btn {
  background: linear-gradient(45deg, #f44336, #d32f2f);
  color: white;
}

#clear-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

#clear-path-btn {
  background: linear-gradient(45deg, #ff9800, #f57c00);
  color: white;
}

#clear-path-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

#generate-maze-btn {
  background: linear-gradient(45deg, #9c27b0, #7b1fa2);
  color: white;
}

#generate-maze-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

.status {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 15px 20px;
  border-radius: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  text-align: center;
}

#status-text {
  font-size: 18px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 10px;
}

#stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

#stats span {
  font-weight: 600;
  color: #cbd5e1;
}

.maze-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

#maze-canvas {
  border: 3px solid #475569;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: crosshair;
}

.legend {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 150px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #475569;
}

.legend-color.start {
  background-color: #4caf50;
}

.legend-color.end {
  background-color: #f44336;
}

.legend-color.wall {
  background-color: #333;
}

.legend-color.visited {
  background-color: #2196f3;
}

.legend-color.path {
  background-color: #ffd700;
}

#speed-value {
  min-width: 40px;
  font-weight: 600;
  color: #a78bfa;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 2rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-buttons {
    justify-content: center;
  }

  .maze-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  #maze-canvas {
    width: 100%;
    height: auto;
    max-width: 500px;
  }

  .legend {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    min-width: auto;
  }

  #stats {
    flex-direction: column;
    gap: 10px;
  }
}
