/* Minefelt */
.minefield-wrap {
  width: min(100%, 480px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.memory-status {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}
.memory-bar {
  width: 100%;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  overflow: hidden;
}
.memory-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width linear;
}
.memory-start {
  padding: 32px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.memory-start p { margin: 0; font-size: 1.05rem; }

.grid.minefield {
  --n: 5;
  position: relative;
  border: 3px solid var(--line);
  background: var(--surface);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.grid.minefield .cell {
  position: relative;
  font-size: calc(min(100vw, 480px) / var(--n) * 0.45);
  cursor: pointer;
  border-width: 0 1px 1px 0;
  border-color: #ddd;
  transition: background 0.15s;
}
.grid.minefield .cell.start { background: #e0f2fe; }
.grid.minefield .cell.goal { background: #fef08a; }
.grid.minefield .cell.mine-visible { background: #fee2e2; }
.grid.minefield .cell.mine-hit { background: #ef4444; color: #fff; animation: shake 0.3s; }
.grid.minefield .cell.path { background: #bbf7d0; }
.grid.minefield .cell.path-head { box-shadow: inset 0 0 0 3px var(--good); }

.minefield-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.minefield-trail polyline {
  fill: none;
  stroke: var(--good);
  stroke-width: 0.18;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
