:root {
  --bg: #0b0f14;
  --card: #111821;
  --text: #e6edf3;
  --muted: #9fb0c0;
  --accent: #57a6ff;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --red: #e74c3c;
  --wall: #2b3440;
  --visited: #284f7a;
  --frontier: #2d6cdf;
  --path: #f59e0b;
  --start: #22c55e;
  --goal: #ff5d8f;
  --grid: #1b2531;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, #0f1621 0%, var(--bg) 60%);
  color: var(--text);
}

header {
  max-width: 1100px;
  margin: 20px auto 8px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid #1f2a36;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}
.tag {
  margin-left: 8px;
  font-size: 12px;
  padding: 3px 8px;
  background: #1b2531;
  border: 1px solid #263244;
  border-radius: 999px;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
button {
  background: #182231;
  color: var(--text);
  border: 1px solid #273448;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
}
button:hover { background: #1b283a; border-color: #30435c; }
button:active { transform: translateY(1px); }
button.active { outline: 2px solid var(--accent); }

.speed { color: var(--muted); margin-left: 8px; display: inline-flex; align-items: center; gap: 8px; }
#fpsLabel { min-width: 54px; display: inline-block; color: var(--text); }

.hint { color: var(--muted); margin-left: 8px; }

main {
  max-width: 1100px;
  margin: 0 auto 18px;
  padding: 0 16px;
}

#grid {
  display: block;
  width: 100%;
  max-width: 1000px;
  height: auto;
  background: #0f1621;
  border: 1px solid #1f2a36;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px #121a24;
  image-rendering: pixelated;
}

footer {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.metrics {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.metrics strong { color: var(--text); font-weight: 700; }
label select {
  background: #182231; color: var(--text); border: 1px solid #273448;
  padding: 6px 10px; border-radius: 10px; margin-left: 6px;
}
.controls label { display: inline-flex; align-items: center; gap: 6px; }
