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

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #333;
  color: white;
  padding: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

button,
select {
  padding: 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:hover,
select:hover {
  opacity: 0.9;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#grid-container {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  grid-template-rows: repeat(20, 1fr);
  width: calc(100vw - 20px);
  height: calc(100vh - 70px);
}

.cell {
  border: 1px solid #ccc;
  width: 100%;
  height: 100%;
  transition: background-color 0.3s;
}

.cell.start {
  background: green;
}

.cell.end {
  background: red;
}

.cell.obstacle {
  background: black;
}

.cell.visited {
  background: #add8e6; /* Light blue */
}

.cell.path {
  background: rgba(200, 206, 17, 0.8) !important;
}

/* Terrain styling */
.cell[data-terrain="grass"] {
  background: #7cfc00;
}

.cell[data-terrain="water"] {
  background: #87cefa;
}

.cell[data-terrain="mountain"] {
  background: #a9a9a9;
}

/* ✅ Override terrain colors when part of path */
.cell.path[data-terrain="grass"],
.cell.path[data-terrain="water"],
.cell.path[data-terrain="mountain"] {
  background: rgba(200, 206, 17, 0.8) !important;
}
