enum BlockColor: String, Codable, Hashable, CaseIterable {
    // Primary (can merge)
    case red
    case blue
    case yellow

    // Secondary (result of merges)
    case purple
    case orange
    case green

    var isPrimary: Bool {
        switch self {
        case .red, .blue, .yellow: return true
        case .purple, .orange, .green: return false
        }
    }

    var displayHex: String {
        switch self {
        case .red:    return "#E63946"
        case .blue:   return "#457B9D"
        case .yellow: return "#F4D35E"
        case .purple: return "#7B2D8B"
        case .orange: return "#E76F51"
        case .green:  return "#2A9D8F"
        }
    }
}

struct Block: Hashable, Equatable {
    let id: Int          // stable index within original level; survives undo
    let position: GridPosition
    let color: BlockColor
}
