:root {
  --bg: #140b1d;
  --panel: #23102d;
  --wall: #2c1724;
  --wall-accent: #4f2f3c;
  --path: #1f1730;
  --start: #7a3d1f;
  --exit: #ff8c42;
  --exit-outline: #ffd166;
  --player: #f3f0e8;
  --player-shadow: #c8c2b7;
  --text: #f7ebda;
  --vines: #4e7c3b;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  background: radial-gradient(circle at top, #3d2051 0%, #140b1d 45%, #08050d 100%);
  color: var(--text);
}

.game-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.header-copy {
  flex: 1;
}

header h1 {
  margin-bottom: 0.25rem;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 140, 66, 0.35);
}

header p {
  margin-top: 0;
  color: #f2c67d;
}

.game-area {
  margin: 1.25rem 0 0.75rem;
  padding: 1rem;
  background: linear-gradient(145deg, rgba(35, 16, 45, 0.95), rgba(67, 39, 79, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.25);
}

.board-wrapper {
  position: relative;
  width: min(94vw, 465px);
  padding: 0.4rem;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(31, 23, 48, 0.95), rgba(68, 41, 87, 0.95));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px rgba(0, 0, 0, 0.35);
}

.maze-board {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  grid-template-rows: repeat(var(--grid-rows), 1fr);
  gap: 1px;
  width: 100%;
  aspect-ratio: var(--grid-cols) / var(--grid-rows);
  background: rgba(8, 6, 11, 0.85);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}

.fog-layer {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: multiply;
}

.cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--path);
  transition: background 0.15s ease, transform 0.15s ease;
  position: relative;
  overflow: visible;
}

.cell.wall {
  background: linear-gradient(135deg, var(--wall), var(--wall-accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.cell.wall::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.12) 50%, transparent 100%);
  border-radius: 2px;
  pointer-events: none;
}

.cell.wall::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 20%;
  width: 60%;
  height: 60%;
  transform: translateX(-50%) rotate(-10deg);
  border-radius: 100% 0 100% 0;
  border: 2px solid rgba(79, 123, 59, 0.55);
  border-left-color: transparent;
  border-bottom-color: transparent;
  opacity: 0.75;
}

.cell.start {
  background: radial-gradient(circle at 30% 30%, #ffcf8c 0%, var(--start) 45%, #5a2410 100%);
}

.cell.exit {
  background: radial-gradient(circle at center, #fff2c2 0%, var(--exit) 45%, #a43f1b 100%);
  border: 2px solid var(--exit-outline);
  box-sizing: border-box;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.25), 0 0 12px rgba(255, 140, 66, 0.85), inset 0 0 10px rgba(255, 255, 255, 0.6);
}

.cell.player {
  background: var(--player);
  border-radius: 50% 50% 40% 40%;
  position: relative;
  box-shadow: inset 0 -2px 0 var(--player-shadow), 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.cell.player::before,
.cell.player::after {
  content: "";
  position: absolute;
  top: 20%;
  width: 25%;
  height: 25%;
  background: #0f172a;
  border-radius: 50%;
}

.cell.player::before {
  left: 22%;
}

.cell.player::after {
  right: 22%;
}


.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 11, 29, 0.82);
  color: white;
  border-radius: 8px;
  letter-spacing: 0.02em;
  z-index: 5;
}

.overlay-content {
  text-align: center;
  max-width: 280px;
  padding: 1.25rem;
  border: 2px solid rgba(183, 243, 106, 0.3);
  border-radius: 16px;
  background: rgba(10, 8, 17, 0.85);
  box-shadow: 0 0 24px rgba(76, 175, 80, 0.2);
}

.overlay-title {
  margin: 0 0 0.4rem;
  font-family: "Trebuchet MS", "Segoe UI", "Arial", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: #b7f36a;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 10px rgba(183, 243, 106, 0.2);
}

.overlay-message {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #dce8b2;
  font-family: "Trebuchet MS", "Segoe UI", "Arial", sans-serif;
}

.overlay-button {
  padding: 0.8rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #4caf50, #2f7d32);
  color: #f6ffe8;
  cursor: pointer;
  font-family: "Trebuchet MS", "Segoe UI", "Arial", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(47, 125, 50, 0.25);
}

.overlay-button:hover {
  filter: brightness(1.05);
}

.overlay[hidden] {
  display: none !important;
}

.game-status {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: #f8d296;
}

.difficulty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0 0;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.16), rgba(47, 125, 50, 0.24));
  border: 1px solid rgba(183, 243, 106, 0.28);
  box-shadow: 0 0 14px rgba(76, 175, 80, 0.16);
  color: #f8d296;
  font-family: "Trebuchet MS", "Segoe UI", "Arial", sans-serif;
  flex-shrink: 0;
}

.difficulty-controls label {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.difficulty-controls select {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: #f6ffe8;
  color: #2f2a1c;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.game-controls button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.25);
}

.game-controls button:hover {
  filter: brightness(1.05);
}
