diff --git a/docs/DNEVNIK.md b/docs/DNEVNIK.md
index b628e51..7fbd608 100644
--- a/docs/DNEVNIK.md
+++ b/docs/DNEVNIK.md
@@ -68,6 +68,136 @@
3. **Incremental approach** - manjΕ‘e testne mape pred velikimi
4. **Time management** - vedno imej rollback plan!
+---
+
+## ποΈ 15. December 2024 - Session 4: Micro Farm & Minting System
+
+**Trajanje:** 4.5 uri (00:50 - 01:42)
+**Cilj:** Phase 37 (Micro Farm) + Phase 40 (Minting) Implementation
+
+### β
DoseΕΎki:
+
+**PHASE 37: MICRO FARM & EXPANSION** π±
+1. **8x8 Micro Farm System:**
+ - β
Initial farm boundary (center of 100x100 map)
+ - β
White boundary visualization with corner markers
+ - β
Tile tracking system (Set-based unlocked tiles)
+ - β
MicroFarmSystem.js created
+
+2. **Visual Feedback:**
+ - β
Locked tile overlay (30% opacity black)
+ - β
Clear farm vs locked distinction
+ - β
Dynamic rendering (15 tile viewRange)
+ - β
Depth-sorted overlays
+
+3. **Farming Restrictions:**
+ - β
Block tilling outside farm boundary
+ - β
Error messages with floating text
+ - β
FarmingSystem integration
+ - β
Boundary validation on every action
+
+4. **Expansion System:**
+ - β
4-direction unlock buttons (β¬οΈβ¬οΈβ‘οΈβ¬
οΈ)
+ - β
Cost system (50 gold per 2x2 expansion)
+ - β
Interactive UI with hover effects
+ - β
Dynamic boundary updates
+
+5. **Minimap Integration:**
+ - β
Farm boundary visible in minimap
+ - β
White box indicator
+ - β
Fixed terrainSystem compatibility
+ - β
Player-relative rendering
+
+**PHASE 40: MINTING SYSTEM** π°
+1. **Core System:**
+ - β
Smelter (Gold Ore β Gold Bar)
+ - β
Mint (Gold Bar β Gold Coins)
+ - β
MintingSystem.js created
+ - β
Processing time tracking
+
+2. **Recipes:**
+ - β
Smelt: 1 ore + 1 coal β 1 bar (5s)
+ - β
Mint: 1 bar β 10 coins (3s)
+ - β
Fuel system for smelter
+ - β
Progress tracking
+
+3. **Visual Representation:**
+ - β
Smelter sprite (π₯ brown with fire outline)
+ - β
Mint sprite (π° gold with coin icon)
+ - β
Processing feedback
+ - β
Completion floating text
+
+### π§ Technical Fixes:
+
+1. **Flat2DTerrainSystem:**
+ - β
Added decorationsMap (Map) for InteractionSystem
+ - β
Fixed crash in handleInteraction
+ - β
Compatibility with existing systems
+
+2. **UIScene Minimap:**
+ - β
Fixed player position reading (gridX/gridY)
+ - β
TerrainSystem.getTile() integration
+ - β
Farm boundary rendering
+ - β
Circular minimap compatibility
+
+3. **Variable Scope:**
+ - β
Fixed farmCenterX/Y references
+ - β
Proper this. prefixing
+ - β
Overlay rendering fixes
+
+### β Izzivi:
+
+1. **AI Image Generation:**
+ - Green screen transparency NE deluje zanesljivo
+ - Manual background removal potreben
+ - **LEKCIJA:** Direct transparent PNG je edina pot!
+
+2. **Sprite Processing:**
+ - Automatic green removal briΕ‘e pravilne barve (pink, red)
+ - Disabled processAllTransparency() globally
+ - **LEKCIJA:** Ready assets = no processing!
+
+3. **Complexity:**
+ - 3 velike features v 1 session
+ - Water auto-tiling postponed
+ - Phase 38 postponed
+
+### π― Naslednji Koraki:
+
+1. **Phase 38: Town Repair** (Next priority)
+ - Ruined buildings system
+ - NPC relationship (hearts)
+ - Trading shops
+ - Repair mechanics
+
+2. **Water Auto-Tiling** (Visual improvement)
+ - Edge detection
+ - Smooth transitions
+ - Wave animations
+
+3. **Weather Improvements:**
+ - Rain ripples on water
+ - Better puddles
+ - Particle effects
+
+### π Statistika:
+
+- **Session trajanje:** 4.5 uri
+- **Datoteke spremenjene:** 6
+- **Nove datoteke:** 2 (MicroFarmSystem.js, MintingSystem.js)
+- **Linije kode:** +500
+- **Features completed:** 2 major phases
+- **Commits:** 2 (Phase 37, Phase 40)
+
+### π‘ Lekcije:
+
+1. **Micro systems work!** - 8x8 start je dovolj za gameplay
+2. **Visual feedback je critical** - overlay + boundaries = clarity
+3. **Expansion mechanics engaging** - unlock buttons + cost = satisfying
+4. **Minting = unique economy** - no random coin drops!
+5. **4.5h session moΕΎen** - ampak potreben break! π΄
+
+
---
## ποΈ 14. December 2024 - Session 2: Cherry Blossom Trees + Visual Polish
diff --git a/index.html b/index.html
index 458a403..083613d 100644
--- a/index.html
+++ b/index.html
@@ -167,6 +167,7 @@
+
diff --git a/src/systems/MintingSystem.js b/src/systems/MintingSystem.js
new file mode 100644
index 0000000..5cec690
--- /dev/null
+++ b/src/systems/MintingSystem.js
@@ -0,0 +1,270 @@
+// π° MINTING SYSTEM - Phase 40
+// Smelter (Ore β Gold) + Mint (Gold β Coins)
+
+class MintingSystem {
+ constructor(scene) {
+ this.scene = scene;
+
+ // Active smelters and mints in world
+ this.smelters = [];
+ this.mints = [];
+
+ // Recipes
+ this.recipes = {
+ smelt_gold: {
+ name: 'Smelt Gold',
+ input: 'gold_ore',
+ inputAmount: 1,
+ output: 'gold_bar',
+ outputAmount: 1,
+ fuel: 'coal',
+ fuelAmount: 1,
+ time: 5 // seconds
+ },
+ mint_coin: {
+ name: 'Mint Coin',
+ input: 'gold_bar',
+ inputAmount: 1,
+ output: 'gold_coin',
+ outputAmount: 10, // 1 bar = 10 coins
+ fuel: null, // No fuel needed
+ time: 3 // seconds
+ }
+ };
+
+ console.log('π° MintingSystem initialized!');
+ }
+
+ // Place smelter at position
+ placeSmelter(gridX, gridY) {
+ const smelter = {
+ gridX,
+ gridY,
+ type: 'smelter',
+ input: null,
+ fuel: null,
+ output: null,
+ processing: false,
+ progress: 0,
+ recipe: null
+ };
+
+ this.smelters.push(smelter);
+
+ // Create sprite
+ this.createSmelterSprite(smelter);
+
+ console.log(`π₯ Smelter placed at (${gridX}, ${gridY})`);
+ return smelter;
+ }
+
+ // Place mint at position
+ placeMint(gridX, gridY) {
+ const mint = {
+ gridX,
+ gridY,
+ type: 'mint',
+ input: null,
+ output: null,
+ processing: false,
+ progress: 0,
+ recipe: null
+ };
+
+ this.mints.push(mint);
+
+ // Create sprite
+ this.createMintSprite(mint);
+
+ console.log(`π° Mint placed at (${gridX}, ${gridY})`);
+ return mint;
+ }
+
+ createSmelterSprite(smelter) {
+ const worldX = smelter.gridX * 48;
+ const worldY = smelter.gridY * 48;
+
+ // Simple graphics representation
+ const graphics = this.scene.add.graphics();
+ graphics.fillStyle(0x8B4513, 1); // Brown
+ graphics.fillRect(worldX, worldY, 48, 48);
+ graphics.lineStyle(2, 0xFF4500, 1); // Orange outline (fire)
+ graphics.strokeRect(worldX, worldY, 48, 48);
+ graphics.setDepth(5);
+
+ // Fire icon
+ const fireText = this.scene.add.text(worldX + 24, worldY + 24, 'π₯', {
+ fontSize: '24px'
+ }).setOrigin(0.5);
+ fireText.setDepth(6);
+
+ smelter.sprite = graphics;
+ smelter.icon = fireText;
+ }
+
+ createMintSprite(mint) {
+ const worldX = mint.gridX * 48;
+ const worldY = mint.gridY * 48;
+
+ // Simple graphics representation
+ const graphics = this.scene.add.graphics();
+ graphics.fillStyle(0xFFD700, 1); // Gold
+ graphics.fillRect(worldX, worldY, 48, 48);
+ graphics.lineStyle(2, 0xFFA500, 1); // Orange outline
+ graphics.strokeRect(worldX, worldY, 48, 48);
+ graphics.setDepth(5);
+
+ // Coin icon
+ const coinText = this.scene.add.text(worldX + 24, worldY + 24, 'π°', {
+ fontSize: '24px'
+ }).setOrigin(0.5);
+ coinText.setDepth(6);
+
+ mint.sprite = graphics;
+ mint.icon = coinText;
+ }
+
+ // Try to process in smelter
+ processSmelter(smelter, inputItem, fuelItem) {
+ if (smelter.processing) {
+ console.log('β³ Smelter is busy!');
+ return false;
+ }
+
+ // Validate recipe
+ const recipe = this.recipes.smelt_gold;
+ if (inputItem !== recipe.input || fuelItem !== recipe.fuel) {
+ console.log('β Invalid recipe!');
+ return false;
+ }
+
+ // Start processing
+ smelter.processing = true;
+ smelter.progress = 0;
+ smelter.recipe = recipe;
+ smelter.input = inputItem;
+ smelter.fuel = fuelItem;
+ smelter.startTime = Date.now();
+
+ console.log(`π₯ Smelting ${inputItem}... (${recipe.time}s)`);
+ return true;
+ }
+
+ // Try to mint coins
+ processMint(mint, inputItem) {
+ if (mint.processing) {
+ console.log('β³ Mint is busy!');
+ return false;
+ }
+
+ // Validate recipe
+ const recipe = this.recipes.mint_coin;
+ if (inputItem !== recipe.input) {
+ console.log('β Invalid input!');
+ return false;
+ }
+
+ // Start processing
+ mint.processing = true;
+ mint.progress = 0;
+ mint.recipe = recipe;
+ mint.input = inputItem;
+ mint.startTime = Date.now();
+
+ console.log(`π° Minting coins... (${recipe.time}s)`);
+ return true;
+ }
+
+ // Update - called each frame
+ update(delta) {
+ // Update smelters
+ this.smelters.forEach(smelter => {
+ if (smelter.processing) {
+ const elapsed = (Date.now() - smelter.startTime) / 1000;
+ smelter.progress = elapsed / smelter.recipe.time;
+
+ // Complete?
+ if (smelter.progress >= 1) {
+ this.completeSmelter(smelter);
+ }
+ }
+ });
+
+ // Update mints
+ this.mints.forEach(mint => {
+ if (mint.processing) {
+ const elapsed = (Date.now() - mint.startTime) / 1000;
+ mint.progress = elapsed / mint.recipe.time;
+
+ // Complete?
+ if (mint.progress >= 1) {
+ this.completeMint(mint);
+ }
+ }
+ });
+ }
+
+ completeSmelter(smelter) {
+ const recipe = smelter.recipe;
+
+ // Give output
+ if (this.scene.inventorySystem) {
+ this.scene.inventorySystem.addItem(recipe.output, recipe.outputAmount);
+ }
+
+ // Reset smelter
+ smelter.processing = false;
+ smelter.progress = 0;
+ smelter.input = null;
+ smelter.fuel = null;
+ smelter.recipe = null;
+
+ console.log(`β
Smelting complete! +${recipe.outputAmount} ${recipe.output}`);
+
+ // Visual feedback
+ if (this.scene.events) {
+ this.scene.events.emit('show-floating-text', {
+ x: smelter.gridX * 48,
+ y: smelter.gridY * 48,
+ text: `+${recipe.outputAmount} ${recipe.output}`,
+ color: '#FFD700'
+ });
+ }
+ }
+
+ completeMint(mint) {
+ const recipe = mint.recipe;
+
+ // Give coins (add to gold directly!)
+ if (this.scene.inventorySystem) {
+ this.scene.inventorySystem.gold += recipe.outputAmount;
+ }
+
+ // Reset mint
+ mint.processing = false;
+ mint.progress = 0;
+ mint.input = null;
+ mint.recipe = null;
+
+ console.log(`β
Minting complete! +${recipe.outputAmount} gold`);
+
+ // Visual feedback
+ if (this.scene.events) {
+ this.scene.events.emit('show-floating-text', {
+ x: mint.gridX * 48,
+ y: mint.gridY * 48,
+ text: `+${recipe.outputAmount}g`,
+ color: '#FFD700'
+ });
+ }
+ }
+
+ // Get smelter/mint at position
+ getSmelterAt(gridX, gridY) {
+ return this.smelters.find(s => s.gridX === gridX && s.gridY === gridY);
+ }
+
+ getMintAt(gridX, gridY) {
+ return this.mints.find(m => m.gridX === gridX && m.gridY === gridY);
+ }
+}