body {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  color: #e0e7ff;
}
.cell, .cell-visited, .cell-solution {
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
header h1 {
  letter-spacing: 0.04em;
  text-shadow: 0 2px 24px #38bdf8, 0 1px 0 #1e293b;
}
.maze {
  display: grid;
  gap: 2px;
  justify-content: center;
  align-content: center;
}
.cell {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 5px #00000090;
}
.cell-wall {
  background: linear-gradient(135deg, #1f2937, #111827);
  box-shadow: inset 0 0 8px #0f172a, 0 2px 8px #000000cc;
  border: 1px solid #374151;
}
.cell-path {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  box-shadow: 0 0 4px #60a5faaa;
}
.cell-rat {
  background: url('./rat.jpg') no-repeat center center;
  background-size: contain !important;
  border-radius: 0.5rem;
  border: none;
  box-shadow: none;
  cursor: default;
  /* Optional: keep a subtle glow effect */
  filter: drop-shadow(0 0 6px rgba(34, 213, 94, 0.8));
  user-select: none;
}
.cell-cheese {
  background: url('./cheese.webp') no-repeat center center;
  background-size: contain;
  border-radius: 0.5rem;
  border: none;
  box-shadow: none;
  cursor: default;
  filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.8));
  user-select: none;
}
.cell-visited {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 0 8px #3b82f6cc;
}
.cell-solution:not(.cell-rat) {
  background: radial-gradient(circle at center, #f87171, #ef4444);
  box-shadow: 0 0 15px #f87171cc;
}
#maze-container {
  padding: 16px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgb(30 41 59 / 0.4);
  user-select: none;
}
.cell-path:hover {
  filter: brightness(1.15);
  cursor: pointer;
}
.cell-rat:hover, .cell-cheese:hover {
  filter: brightness(1.25);
  cursor: pointer;
}
@keyframes blinkCursor {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0; }
}
.loader-cursor {
  display: inline-block;
  width: 1ch;
  background: transparent;
  color: #22d3ee;
  animation: blinkCursor 1s steps(1) infinite;
}
.glassy {
  background: linear-gradient(120deg, rgba(30,41,59,0.96) 75%, rgba(30,58,138,0.72) 100%);
  box-shadow: 0 4px 32px #164e6366, 0 1.5px 2.5px #0ea5e944;
  border: 1.5px solid #273859cc;
  backdrop-filter: blur(7px);
}
/* Terminal window style */
.terminal-bar {
  background: #181c24;
  border-radius: 1em 1em 0 0;
  border-bottom: 2px #253059 solid;
  padding: 0.7em 1.4em;
  font-family: 'Fira Mono', monospace;
  font-size: 1em;
  letter-spacing: 0.05em;
  color: #8AEDFC;
  box-shadow: 0 6px 20px 0 #213c4e44;
  display: flex;
  align-items: center;
  gap: 1em;
}
.window-dot {
  width: 15px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.window-dot.red { background: #f43f5e; }
.window-dot.yellow { background: #eab308; }
.window-dot.green { background: #22c55e; }
/* Main 'terminal' container */
.main-terminal {
  background: #161922fb;
  border-radius: 0 0 1.4em 1.4em;
  box-shadow: 0 8px 32px #164e635c;
  border: 1.7px solid #273859cc;
  padding: 2.3em 2em 1.2em 2em;
  max-width: 1050px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  overflow: hidden; /* nothing can spill outside */
}
/* gradient text effect for title */
.gradient-title {
  background-image: linear-gradient(90deg,#7df49e 40%,#34d399 60%,#22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-size: 2.7em;
  display: inline-block;
}
/* Accent bar under heading */
.accent-bar {
  height: 5px;
  width: 52px;
  background: linear-gradient(90deg,#34d399 30%,#22d3ee 100%);
  border-radius: 6px;
  margin: 1.1em auto 0.7em auto;
  opacity: 0.4;
}
/* Footer bar */
.footer-bar {
  text-align: center;
  margin-top: 2.5em;
  padding-bottom: 1.1em;
  width: 100%;
  font-size: 1em;
  color: #d1d5db;
}
.footer-link {
  color: #22d3ee;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  margin: 0 0.3em;
  transition: color 0.2s;
}
.footer-link:hover {
  color: #34d399;
  text-decoration: underline;
}
.footer-heart {
  color: #f43f5e;
  display: inline;
  margin: 0 0.2em;
}
/* Add this to your CSS */
.animated-accent-bar {
  /* width: 100%; */
  max-width: 500px;    /* Set desired max width */
  height: 8px;         /* Set desired thickness */
  margin: 0 auto;
  border-radius: 6px;
  background: linear-gradient(90deg, #22d3ee, #34d399, #22d3ee);
  background-size: 200% 100%;
  animation: accentBarAnim 2.5s linear infinite;
  box-shadow: 0 0 18px 0 #22d3ee88, 0 2px 16px #34d39955;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

.gradient-title {
  font-size: clamp(1.35rem, 5.5vw, 2.7rem);
  line-height: 1.15;
  text-align: center;
}

.terminal-bar,
.main-terminal {
  width: min(96vw, 1480px);
}

.main-terminal {
  max-width: 1480px;
  padding: clamp(0.9rem, 2.1vw, 2.3rem);
}

#maze-container {
  width: fit-content;     /* remove extra inner empty area */
  max-width: 100%;        /* still safe on small screens */
  margin: 0 auto;
  overflow: hidden;
  padding: clamp(8px, 1vw, 14px);
}

.maze {
  width: fit-content;
  margin: 0 auto;
  justify-content: center;
  align-content: center;
}

.cell {
  width: 100%;
  height: 100%;
}

#algo-details {
  width: 100%;
}

@media (max-width: 1024px) {
  .terminal-bar {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }

  .main-terminal {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }
}

@media (max-width: 768px) {
  .terminal-bar {
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    gap: 0.6rem;
  }

  .window-dot {
    width: 11px;
    height: 8px;
  }

  .main-terminal {
    border-radius: 1rem;
  }

  #maze-container {
    border-radius: 12px;
  }
}

@media (max-width: 640px) {
  #algorithm,
  #generate,
  #solve {
    width: 100%;
    max-width: 100%;
    font-size: 0.98rem;
    padding: 0.65rem 0.9rem;
  }

  .footer-bar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    line-height: 1.5;
  }
}

/* FINAL responsive overrides (keep at file end) */
#maze-container.maze {
  display: grid;
  width: max-content !important;   /* shrink to grid content */
  max-width: 100% !important;
  margin-left: auto;
  margin-right: auto;
  overflow: auto;
  justify-content: start;          /* no fake centering gap inside itself */
  align-content: start;
}

/* Ensure wrapper does not force visual extra inner space */
.main-terminal {
  overflow-x: hidden;
}
